Example #1
0
void copyObject(Alembic::Abc::IObject & iIn,
    Alembic::Abc::OObject & iOut)
{
    std::size_t numChildren = iIn.getNumChildren();

    Alembic::Abc::ICompoundProperty inProps = iIn.getProperties();
    Alembic::Abc::OCompoundProperty outProps = iOut.getProperties();
    copyProps(inProps, outProps);

    for (std::size_t i = 0; i < numChildren; ++i)
    {
        Alembic::Abc::IObject childIn(iIn.getChild(i));
        Alembic::Abc::OObject childOut(iOut, childIn.getName(),
                                       childIn.getMetaData());
        copyObject(childIn, childOut);
    }
}
Example #2
0
int main( int argc, char **argv )
{
   if( 4 <= argc )
   {
      unsigned long maxBytes = strtoul(argv[1], 0, 0);
      if( 0 == maxBytes ){
         fprintf( stderr, "Invalid byte count %s\n", argv[1] );
         return -1 ;
      }
      processWrap_t child( argv[3], argv+3 );
      if( 0 <= child.pid() ){
         char outFileName[512];
         snprintf( outFileName, sizeof(outFileName), "%s.%d", argv[2], child.pid() );
         int fdOut = open( outFileName, O_RDWR|O_CREAT );
         if( 0 <= fdOut ){
            pollHandlerSet_t handlers ;
            myHandler_t childOut( child.child_stdout(), 'o', handlers, fdOut, maxBytes );
            myHandler_t childErr( child.child_stderr(), 'e', handlers, fdOut, maxBytes );
   
            signal( SIGINT, ctrlcHandler );
   
            while( childOut.isOpen() && !die ){
               if( !handlers.poll(500) ){
               }
            }
   
            if( childOut.isOpen() ){
               child.shutdown();
            }
   
         }
         else {
            perror( outFileName );
         }

         child.wait();
      }
   }
   else
      fprintf( stderr, "Usage: %s maxBytes outFile command arguments\n", argv[0] );

   return 0 ;
}