コード例 #1
0
   PluginStruct *release_plugin (Handle PluginHandle) {

      PluginStruct *ps (pluginTable.lookup (PluginHandle));

      if (ps) { update_obs (PluginDiscoverRemove, PluginHandle); }

      ps = (pluginTable.remove (PluginHandle));

      if (ps && ps->info && ps->plugin) {

         if (started) {

            LevelStruct *ls (levelsHead);

            while (ls) {

               if (ps->info->uses_level (ls->Level)) {

                  ps->plugin->update_plugin_state (PluginStateStop, ls->Level);
               }

               ls = ls->next;
            }

            ls = levelsHead;

            while (ls) {

               if (ps->info->uses_level (ls->Level)) {

                  ps->plugin->update_plugin_state (PluginStateShutdown, ls->Level);
               }

               ls = ls->next;
            }
         }

         if (discovered) {

            remove_all_plugins (ps->plugin);

            if (ps->HasInterface) {

               remove_plugin (ps->plugin);
               interfaceTable.remove (PluginHandle);
            }
         }
      }

      LevelStruct *ls = levelsHead;

      while (ls) { ls->table.remove (PluginHandle); ls = ls->next; }

      return ps;
   }
コード例 #2
0
   void discover_plugin (const Plugin *PluginPtr) {

      HashTableHandleIterator it;

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

         if (current->plugin) {

            current->plugin->discover_plugin (PluginDiscoverAdd, PluginPtr);
         }
      }
   }
コード例 #3
0
   void remove_plugin (const Plugin *PluginPtr) {

      HashTableHandleIterator it;

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

         if (current->plugin) {

            current->plugin->discover_plugin (PluginDiscoverRemove, PluginPtr);
         }
      }
   }
コード例 #4
0
   void dump (const Handle Target, const PluginDiscoverEnum Mode) {

      PluginObserver *obs (
         observerContext ? observerContext->obsTable.lookup (Target) : 0);

      if (obs) {

         const Handle Source (info.get_handle ());

         HashTableHandleIterator it;
         PluginStruct *ps (0);

         while (pluginTable.get_next (it, ps)) {

            if (ps->info) {

               obs->update_runtime_plugin (Mode, Source, ps->info->get_handle ());
            }
         }

         if (observerContext) {

            observerContext->obsActiveTable.store (Target, obs);
         }
      }
   }
コード例 #5
0
   virtual const PluginInfo *lookup_plugin_info (const Handle PluginHandle) {

      PluginInfo *result (0);

      PluginStruct *ps (pluginTable.lookup (PluginHandle));

      if (ps) { result = ps->info; }

      return result;
   }
コード例 #6
0
   // RuntimeModule Interface
   virtual void get_plugin_list (HandleContainer &container) {

      HashTableHandleIterator it;
      PluginStruct *ps (0);
   
      while (pluginTable.get_next (it, ps)) {

         container.add (it.get_hash_key ());
      }
   }
コード例 #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;
   }
コード例 #8
0
   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);
         }
      }
   }
コード例 #9
0
   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);
         }
      }
   }
コード例 #10
0
   virtual Boolean add_plugin (PluginInfo *info, Plugin *plugin) {

      Boolean result (False);

      if (info && plugin) {

         PluginStruct *ps (new PluginStruct (info, plugin, log));

         if (ps && ps->info) {

            update_levels (*ps);

            if (pluginTable.store (ps->info->get_handle (), ps)) {

               if (ps->info && ps->HasInterface) {

                  interfaceTable.store (ps->info->get_handle (), ps);
               }

               result = True;
            }
            else { delete ps; ps = 0; }

            if (discovered) {

               discover_all_plugins (plugin);

               if (ps->HasInterface) { discover_plugin (plugin); }
            }

            if (started) {

                LevelStruct *ls (levelsTail);

                while (ls) {

                   if (info->uses_level (ls->Level)) {

                      plugin->update_plugin_state (PluginStateInit, ls->Level);
                   }

                   ls = ls->prev;
                }

                ls = levelsTail;

                while (ls) {

                   if (info->uses_level (ls->Level)) {

                      plugin->update_plugin_state (PluginStateStart, ls->Level);
                   }

                   ls = ls->prev;
               }
            }
         }

         update_obs (PluginDiscoverAdd, ps->info->get_handle ());

         result = True;
      }

      return result;
   }