Beispiel #1
0
/*!

\brief Looks up named handle.
\param[in] Name String containing name of Handle.
\return Returns the named handle if it exists. Returns zero if the named handle
does not exists.

*/
dmz::Handle
dmz::Definitions::lookup_named_handle (const String &Name) const {

   Handle result (0);

   if (_state.defs) {

      RuntimeHandle *handle (_state.defs->namedHandleTable.lookup (Name));

      if (handle) { result = handle->get_runtime_handle (); }
   }

   return result;
}
Beispiel #2
0
/*!

\brief Creates a named handle.
\param[in] Name String containing name of Handle.
\return Returns the named handle. Returns zero if the named handle could not be
created.

*/
dmz::Handle
dmz::Definitions::create_named_handle (const String &Name) {

   Handle result (0);

   if (Name && _state.context && _state.defs) {

      RuntimeHandle *handle (_state.defs->namedHandleTable.lookup (Name));

      if (!handle) {

         handle = new RuntimeHandle (Name + ".NamedHandle", _state.context);

         if (handle) {

            if (_state.defs->namedHandleTable.store (Name, handle)) {

               String *ptr (new String (Name));

               if (ptr) {

                  if (_state.defs->namedHandleNameTable.store (
                        handle->get_runtime_handle (),
                        ptr)) {

                     _state.defs->define_named_handle (
                        handle->get_runtime_handle (),
                        Name);
                  }
                  else { delete ptr; ptr = 0; }
               }

            }
            else {

               delete handle; handle = 0;
               handle = _state.defs->namedHandleTable.lookup (Name);
            }
         }
      }

      if (handle) { result = handle->get_runtime_handle (); }
   }

   return result;
}
Beispiel #3
0
 State (
       const String &TheName,
       const PluginDeleteModeEnum TheDeleteMode,
       RuntimeContext *theContext) :
       _handlePtr (TheName ? 0 : new RuntimeHandle ("Plugin", theContext)),
       Name (TheName),
       PluginHandle (_handlePtr ?
          _handlePtr->get_runtime_handle () :
          Definitions (theContext).create_named_handle (TheName)),
       deleteMode (TheDeleteMode),
       context (0),
       lib (0) {;}
   State (const Handle TheObsHandle, const String &ObsName, RuntimeContext *context) :
         handlePtr (
            TheObsHandle == 0 ?
               new RuntimeHandle (ObsName + ".ResourcesObserver", context) :
               0),
         ObsHandle (handlePtr ? handlePtr->get_runtime_handle () : TheObsHandle),
         log (ObsName + "ResourcesObserver", context),
         rc (context ? context->get_resources_context () : 0),
         mask (0),
         warnMask (0) {

      if (rc) { rc->ref (); }
   }
Beispiel #5
0
   State (const Handle TheHandle, RuntimeContext *theContext) :
         handle (TheHandle),
         handlePtr (0),
         context (0) {

      if (theContext) { context = theContext->get_undo_context (); }
      if (context) { context->ref (); }

      if (!handle) {

         handlePtr = new RuntimeHandle ("UndoObserver", theContext);
         handle = handlePtr ? handlePtr->get_runtime_handle () : 0;
      }
   }
   State (
         const String &TheName,
         const String &TheClassName,
         const String &TheFactoryName,
         const String &TheScopeName,
         const PluginDeleteModeEnum TheDeleteMode,
         RuntimeContext *theContext,
         DynamicLibrary *theLib) :
         _handlePtr (TheName ? 0 : new RuntimeHandle ("Plugin", theContext)),
         Name (TheName ? TheName : "Unnamed Component"),
         ClassName (TheClassName),
         FactoryName (TheFactoryName),
         ScopeName (TheScopeName),
         PluginHandle (_handlePtr ?
            _handlePtr->get_runtime_handle () :
            Definitions (theContext).create_named_handle (TheName)),
         deleteMode (TheDeleteMode),
         context (theContext),
         lib (theLib) {

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