コード例 #1
0
ファイル: dmzArchiveObserverUtil.cpp プロジェクト: ashok/dmz
/*!

\brief Attaches observer to specified archive groups.
\details The \a Init Config should contain a list of Config objects named
"archive". These objects should also contain an attribute called "name" which
contains the name of the archive group. If the name attribute is not set, the default
archive group name is used.
\code
<dmz>
<dmzFooPluginArchive>
   <archive/> <!-- attaches to default archive group -->
   <archive name="Extra Archive Group"/>
   <archive name="Some Other Archive Group"/>
</dmzFooPluginArchive>
</dmz>
\endcode
\param[in] Init Config containing a list of the archive groups.
\param[in] log Pointer to a Log used for logging.

*/
void
dmz::ArchiveObserverUtil::init_archive (const Config &Init, Log *log) {

   Config list;

   if (Init.lookup_all_config ("archive", list)) {

      ConfigIterator it;
      Config archive;

      while (list.get_next_config (it, archive)) {

         activate_archive (config_to_string ("name", archive, ArchiveDefaultName));
      }
   }
   else { activate_default_archive (); }
}
コード例 #2
0
ファイル: dmzArchiveObserverUtil.cpp プロジェクト: ashok/dmz
/*!

\brief Joins default archive group.
\return Returns the Handle of the default archive group.

*/
dmz::Handle
dmz::ArchiveObserverUtil::activate_default_archive () {

   return activate_archive (ArchiveDefaultName);
}
コード例 #3
0
ファイル: dmzJsExtV8Archive.cpp プロジェクト: ben-sangster/js
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;
}