Exemplo n.º 1
0
   State &operator= (const State &Value) {

      cache = 0;

      if (Value.context && (Value.context != context)) {

         if (context) { context->unref (); context = 0; }

         context = Value.context;

         if (context) { context->ref (); }
      }

      dataTable.empty ();
      dataTable.copy (Value.dataTable);

      if (Value.stringTable) {

         if (!stringTable) { stringTable = new stringStruct; }
         if (stringTable) { *stringTable = *(Value.stringTable); }
      }
      else if (stringTable) { delete stringTable; stringTable = 0; }

      return *this;
   };
Exemplo n.º 2
0
   State (PluginInfo &theInfo, Log *theLog) :
         Plugin (theInfo),
         RuntimeModule (theInfo),
         info (theInfo),
         discovered (False),
         started (False),
         levelsHead (0),
         levelsTail (0),
         maxLevel (1),
         log (theLog) {

      externTable.store (get_plugin_handle (), this);
   }
Exemplo n.º 3
0
   dataStruct *get_data (const Handle AttrHandle, const attrStruct *AttrPtr = 0) {

      dataStruct *ds (0);

      if (cache && (cache->AttrHandle == AttrHandle)) { ds = cache; }

      if (!ds) {

         ds = dataTable.lookup (AttrHandle);

         if (!ds && AttrPtr && AttrHandle) {

            ds = new dataStruct (AttrHandle, *AttrPtr);

            if (!dataTable.store (AttrHandle, ds)) { delete ds; ds = 0; }
         }

         if (ds) { cache = ds; }
      }

      return ds;
   }
   void remove_all_plugins (Plugin *pluginPtr) {

      if (pluginPtr) {

         HashTableHandleIterator it;

         for (
               PluginStruct *current = interfaceTable.get_last (it);
               current;
               current = interfaceTable.get_prev (it)) {

            pluginPtr->discover_plugin (PluginDiscoverRemove, current->plugin);
         }

         for (
               const Plugin *ExPtr = externTable.get_last (it);
               ExPtr;
               ExPtr = externTable.get_prev (it)) {

            pluginPtr->discover_plugin (PluginDiscoverRemove, ExPtr);
         }
      }
   }
   void discover_all_plugins (Plugin *pluginPtr) {

      if (pluginPtr) {

         HashTableHandleIterator it;

         for (
               PluginStruct *current = interfaceTable.get_first (it);
               current;
               current = interfaceTable.get_next (it)) {

            pluginPtr->discover_plugin (PluginDiscoverAdd, current->plugin);
         }

         for (
               const Plugin *ExPtr = externTable.get_first (it);
               ExPtr;
               ExPtr = externTable.get_next (it)) {

            pluginPtr->discover_plugin (PluginDiscoverAdd, ExPtr);
         }
      }
   }
Exemplo n.º 6
0
void
dmz::JsExtV8Input::_do_all_callbacks (
      const int Argc,
      V8Value argv[],
      HashTableHandleTemplate<CallbackTable> &table) {

   HandleContainer called;
   HandleContainerIterator it;
   Handle channel (0);

   while (_active.get_next (it, channel)) {

      CallbackTable *ct = table.lookup (channel);

      if (ct) { _do_callback (Argc, argv, *ct, called); }
   }
}
Exemplo n.º 7
0
   void delete_plugins () {

      discovered = False;
      started = False;
      interfaceTable.clear ();

      HashTableHandleIterator it;
      PluginStruct *ps (0);
      while (pluginTable.get_prev (it, ps)) { ps->delete_plugin (); }

      it.reset ();
      ps = 0;
      while (pluginTable.get_prev (it, ps)) { ps->unload_plugin (); }

      pluginTable.empty ();
      externTable.clear ();
      if (levelsHead) { delete levelsHead; levelsHead = 0; }
      levelsTail = 0;
      maxLevel = 1;
   }
   State (PluginInfo &theInfo, Log *theLog) :
         Plugin (theInfo),
         RuntimeModule (theInfo),
         MessageObserver (theInfo),
         observerContext (0),
         convert (theInfo),
         info (theInfo),
         discovered (False),
         started (False),
         levelsHead (0),
         levelsTail (0),
         maxLevel (1),
         log (theLog) {

      externTable.store (get_plugin_handle (), this);

      RuntimeContext *rt = info.get_context ();

      if (rt) {

         observerContext = rt->get_plugin_observer_context ();

         Definitions defs (rt);

         Message msg;

         defs.create_message (PluginObserverActivateMessageName, msg);

         subscribe_to_message (msg);
      }

      if (observerContext) {

         observerContext->ref ();
         observerContext->moduleTable.store (info.get_handle (), this);
      }
   }
Exemplo n.º 9
0
   ~MessageObserverState () {

      if (context) { context->unref (); context = 0; }
      if (handlePtr) { delete handlePtr; handlePtr = 0; }
      msgTable.empty ();
   }
Exemplo n.º 10
0
   State &operator= (const State &Value) {

      table.copy (Value.table);
      return *this;
   }
Exemplo n.º 11
0
 ~State () { table.empty (); }
Exemplo n.º 12
0
   ~MessageObserverState () {

      if (dispatch) { dispatch->unref (); dispatch = 0; }
      if (handlePtr) { delete handlePtr; handlePtr = 0; }
      msgTable.empty ();
   }
Exemplo n.º 13
0
dmz::Boolean
dmz::JsExtV8Archive::_register_callback (
      const Handle Instance,
      const String &Name,
      const Handle Archive,
      V8Object self,
      V8Function func,
      HashTableHandleTemplate<CallbackTable> &table) {

   Boolean result (False);

   if (Instance && Archive && (func.IsEmpty () == false)) {

      InstanceStruct *is = _instanceTable.lookup (Instance);

      if (!is) {

         is = new InstanceStruct (Instance, Name);

         if (!_instanceTable.store (Instance, is)) { delete is; is = 0; }
      }

      if (is) {

         CallbackTable *ct = table.lookup (Archive);

         if (!ct) {

            ct = new CallbackTable (Archive);

            if (!table.store (Archive, ct)) { delete ct; ct = 0; }
         }

         if (ct) {

            CallbackStruct *cs = ct->table.lookup (Instance);

            if (!cs) {

               cs = new CallbackStruct (*is, *ct);

               if (ct->table.store (Instance, cs)) {

                  cs->next = is->list;
                  is->list = cs;
               }
               else if (cs) { delete cs; cs = 0; }
            }

            if (cs) {

               result = True;

               cs->self.Dispose (); cs->self.Clear ();
               cs->func.Dispose (); cs->func.Clear ();

               cs->self = V8ObjectPersist::New (self);
               cs->func = V8FunctionPersist::New (func);

               if (!is_active_archive_handle (Archive)) {

                  activate_archive (Archive);
               }
            }
         }
      }
   }

   return result;
}
Exemplo n.º 14
0
   void empty () {

      cache = 0;
      dataTable.empty ();
      if (stringTable) { delete stringTable; stringTable = 0; }
   }