//! \cond
dmz::NetModuleIdentityMapBasic::NetModuleIdentityMapBasic (
      const PluginInfo &Info,
      Config &local) :
      Plugin (Info),
      NetModuleIdentityMap (Info),
      MessageObserver (Info),
      _log (Info),
      _site (0),
      _host (0),
      _netHandles (1001, 1, 0xFFFF),
      _handleConverter (Info.get_context ()) {

   _init (local);

   Definitions defs (Info, &_log);

   if (defs.create_message (ObjectDestroyMessageName, _removeObjMsg)) {

      subscribe_to_message (_removeObjMsg);
   }
}
Ejemplo n.º 2
0
/*!

\brief Creates dmz::Message from dmz::Config.
\details Defined in dmzRuntimeMessaging.h.
This function converts the named attribute to a dmz::Message. It is assumed that the
last part of the \a Name variable specifies the attribute name. If the String
"type.name" is passed in as \a Name, it will try to find a  config context called
"type" and the attribute "name" stored in the "type" config context. If the named
Message does not exist, it is created.
\code
dmz::Message type = dmz::config_create_message ("dmz.type.name", global, "DefaultMessage", get_plugin_runtime_context (), &_log);
\endcode
\param[in] Name String containing name of the attribute in the config context to convert.
\param[in] Source Config containing config context to convert.
\param[in] DefaultValue String containing default name of Message to use if not found
int the Config.
\param[in] context Pointer to the runtime context.
\param[in] log Pointer to the dmz::Log to use for log reporting.
\return Returns dmz::Message containing the message type. Returns an empty
dmz::Message if no message name is specified in either the Config or the
\a DefaultValue.

*/
dmz::Message
dmz::config_create_message (
      const String &Name,
      const Config &Source,
      const String &DefaultValue,
      RuntimeContext *context,
      Log *log) {

   Message result;

   String messageName;

   if (!Source.lookup_attribute (Name, messageName)) { messageName = DefaultValue; }

   if (messageName) {

      Definitions defs (context);
      defs.create_message (messageName, result);
   }

   return result;
}
Ejemplo n.º 3
0
   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);
      }
   }