예제 #1
0
Bool ToolboxesManager_IsInitialised( void* initRegister, char* label ) {
    ToolboxesManager* self = (ToolboxesManager*)initRegister;

    if( Stg_ObjectList_Get( self->initTB, label ) )
        return True;
    else
        return False;
}
void TurnOffGravity( UnderworldContext* context ) {
	BuoyancyForceTerm* buoyancy;
   Stokes_SLE* stokesSLE = (Stokes_SLE* )LiveComponentRegister_Get( context->CF->LCRegister, (Name)"stokesEqn" );

	buoyancy = (BuoyancyForceTerm*) Stg_ObjectList_Get( stokesSLE->fForceVec->forceTermList, (Name)"buoyancyForceTerm" );
	assert( buoyancy );
	buoyancy->gravity = 0.0;
}
Index LiveComponentRegister_Add( LiveComponentRegister *self, Stg_Component *component ) {
   assert( self );
   // check if component is already there. If so don't append to objectList
   if( Stg_ObjectList_Get( self->componentList, component->name ) ) {
      Index id = Stg_ObjectList_GetIndex( self->componentList, component->name );
      // lets just silence this for now
      return id;
   }
   return Stg_ObjectList_Append( self->componentList, component );
}
Index LiveComponentRegister_Add( LiveComponentRegister *self, Stg_Component *component ) {
   assert( self );
   // check if component is already there. If so don't append to objectList
   if( Stg_ObjectList_Get( self->componentList, component->name ) ) {
      Index id = Stg_ObjectList_GetIndex( self->componentList, component->name );
      // lets just silence this for now
      //Journal_Printf( global_error_stream, "### Trying to add component '%s'. But it already exist on the LiveComponentRegister at index %d\n", component->name, id );
      return id;
   }
   return Stg_ObjectList_Append( self->componentList, component );
}
예제 #5
0
Bool _ToolboxesManager_LoadToolbox( void* toolboxesManager, Module* toolbox ) {
    ToolboxesManager* self = (ToolboxesManager*)toolboxesManager;

    /* if not Loaded call the Initialise() and Register() */
    if( !Stg_ObjectList_Get( self->initTB, toolbox->name ) ) {

        ((Toolbox*)toolbox)->Initialise( self, self->argc, self->argv );
        ((Toolbox*)toolbox)->Register( self );

        Stg_ObjectList_Append( self->initTB, toolbox );
    }
    return True;
}
예제 #6
0
Bool _ToolboxesManager_UnloadToolbox( void* toolboxesManager, Module* toolbox ) {
    ToolboxesManager* self = (ToolboxesManager*)toolboxesManager;

    if( Stg_ObjectList_Get( self->initTB, toolbox->name ) ) {
        ((Toolbox*)toolbox)->Finalise( self );

        /* remove the toolbox from the initTB list, but don't actually Delete it's memory */
        Stg_ObjectList_Remove( self->initTB, toolbox->name, KEEP );
    }

    if( self->initTB && self->initTB->count == 0 ) {
        Stg_Class_Delete( self->initTB );
        self->initTB = NULL;
    }

    return True;
}
예제 #7
0
void* _EntryPoint_Copy( void* entryPoint, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
   EntryPoint* self = (EntryPoint*)entryPoint;
   EntryPoint* newEntryPoint;
   PtrMap*     map = ptrMap;
   Bool        ownMap = False;
   
   if( !map ) {
      map = PtrMap_New( 10 );
      ownMap = True;
   }
   
   newEntryPoint = (EntryPoint*)_Stg_Object_Copy( self, dest, deep, nameExt, map );
   
   /* Virtual methods */
   newEntryPoint->_getRun = self->_getRun;
   
   newEntryPoint->castType = self->castType;
   newEntryPoint->run = self->run;
   
   if( deep ) {
      newEntryPoint->hooks = (HookList*)Stg_Class_Copy( self->hooks, NULL, deep, nameExt, map );
      
      if( newEntryPoint->hooks ) {
         if( self->alwaysFirstHook ) {
            if( nameExt ) {
               Name tmpName;
               
               tmpName = Memory_Alloc_Array(
                  char,
                  strlen( Stg_Object_GetName( self->alwaysFirstHook ) ) + strlen( nameExt ) + 1,
                  "tmpName" );

               strcpy( tmpName, Stg_Object_GetName( self->alwaysFirstHook ) );
               strcpy( &tmpName[strlen( Stg_Object_GetName( self->alwaysFirstHook ) )], nameExt );
               
               newEntryPoint->alwaysFirstHook = (Hook*)Stg_ObjectList_Get( newEntryPoint->hooks, tmpName );
               Memory_Free( tmpName );
            }
            else {
               newEntryPoint->alwaysFirstHook = (Hook*)Stg_ObjectList_Get(
                  newEntryPoint->hooks,
                  Stg_Object_GetName( self->alwaysFirstHook ) );
            }
         }
         else {
            self->alwaysFirstHook = NULL;
         }
         
         if( self->alwaysLastHook ) {
            if( nameExt ) {
               Name tmpName;
               
               tmpName = Memory_Alloc_Array(
                  char,
                  strlen( Stg_Object_GetName( self->alwaysLastHook ) ) + strlen( nameExt ) + 1,
                  "tmpName" );

               strcpy( tmpName, Stg_Object_GetName( self->alwaysLastHook ) );
               strcpy( &tmpName[strlen( Stg_Object_GetName( self->alwaysLastHook ) )], nameExt );
               
               newEntryPoint->alwaysLastHook = (Hook*)Stg_ObjectList_Get( newEntryPoint->hooks, tmpName );
               Memory_Free( tmpName );
            }
            else {
               newEntryPoint->alwaysLastHook = (Hook*)Stg_ObjectList_Get(
                  newEntryPoint->hooks,
                  Stg_Object_GetName( self->alwaysLastHook ) );
            }
         }
void LibStGermainSuite_TestXMLLibraryPath( LibStGermainSuiteData* data ) {
   Stg_Object* testDirectory;
   /* Testing entries in xmlDictionary */
   testDirectory = (Stg_Object*)Stg_ObjectList_Get( Project_XMLSearchPaths,"StGermain" );
   pcu_check_true(testDirectory != NULL);
}
Stg_Component *LiveComponentRegister_Get( LiveComponentRegister *self, Name name ) {
   if( self == NULL )
      return NULL;
   
   return ( Stg_Component* ) Stg_ObjectList_Get( self->componentList, name );
}