void
dmz::MBRAPluginFaultTreeAutoLayout::_set_component_hide_state (
      const Handle Obj,
      const Boolean Value,
      ObjectModule &objMod) {

   objMod.store_flag (Obj, _hideAttrHandle, Value);

   HandleContainer list;

   if (objMod.lookup_sub_links (Obj, _linkAttrHandle, list)) {

      Handle child = list.get_first ();

      while (child) {

         _set_component_hide_state (child, Value, objMod);
         child = list.get_next ();
      }
   }

   if (objMod.lookup_sub_links (Obj, _logicAttrHandle, list)) {

      Handle child = list.get_first ();

      while (child) {

         objMod.store_flag (child, _hideAttrHandle, Value);
         child = list.get_next ();
      }
   }
}
   virtual Boolean add_plugins (PluginContainer &container) {

      Boolean result (True);

      HandleContainer pluginList;

      container.get_plugin_list (pluginList);

      Handle plugin = pluginList.get_first ();

      while (plugin) {

         PluginInfo *infoPtr = container.lookup_plugin_info (plugin);
         Plugin *pluginPtr = container.lookup_plugin (plugin);

         if (container.release_plugin (plugin)) {

            if (!add_plugin (infoPtr, pluginPtr)) { 

               result = False;

               if (container.add_plugin (infoPtr, pluginPtr)) {

                  container.remove_plugin (plugin);
               }
            }
         }

         plugin = pluginList.get_next ();
      }

      return result;
   }
Example #3
0
// ArchiveObserver Interface.
void
dmz::ArchivePluginObject::create_archive (
      const Handle ArchiveHandle,
      const Int32 Version,
      Config &local,
      Config &global) {

   ObjectModule *objMod (get_object_module ());

   if (objMod) {

      _currentFilterList = _filterTable.lookup (ArchiveHandle);

      HandleContainer container;

      objMod->get_object_handles (container);

      Handle object = container.get_first ();

      while (object) {

         Config objArchive = _archive_object (object);

         if (!objArchive.is_empty ()) {

            local.add_config (objArchive);
         }

         object = container.get_next ();
      }

      _currentFilterList = 0;
   }
}
void
dmz::MBRAPluginFaultTreeAutoLayout::_update_tree (
      const Handle SuperHandle,
      const Handle SubHandle,
      const Int32 Column,
      Int32 &count) {

   ObjectModule *objMod (get_object_module ());

   if (objMod && SuperHandle && SubHandle) {

      Vector rootPos (0.0, 0.0, 0.0);

      Vector superPos;
      objMod->lookup_position (SuperHandle, _defaultAttrHandle, superPos);

      Vector offset ((Column * _hOffset), 0.0, (count * _vOffset));
      Vector topPos (rootPos + offset);

      HandleContainer children;
      objMod->lookup_sub_links (SubHandle, _linkAttrHandle, children);

      if (children.get_count ()) {

         Int32 startCount (count);

         Handle current (children.get_first ());

         while (current) {

            _update_tree (SubHandle, current, Column + 1, count);

            current = children.get_next ();
         }

         Int32 endCount (count);

         offset.set_xyz (0.0, 0.0, ((endCount - startCount - 1) * 0.5f * _vOffset));
         objMod->store_position (SubHandle, _defaultAttrHandle, topPos + offset);

         _update_logic (SubHandle);

         _update_path (SubHandle);
      }
      else {

         offset.set_xyz ((Column * _hOffset), 0.0, (count * _vOffset));
         objMod->store_position (SubHandle, _defaultAttrHandle, rootPos + offset);

         count++;
      }
   }
}
void
dmz::InputPluginMouseEventToMessage::_send (
      const Message &Msg,
      HandleContainer &targets) {

   if (Msg) {

      Handle target (targets.get_first ());

      while (target) {

         Msg.send (target, 0, 0);
         target = targets.get_next ();
      }
   }
}
Example #6
0
dmz::Handle
dmz::EventModuleCommonBasic::_get_source (const Handle ObjectHandle) {

   Handle result (0);

   if (_objMod) {

      HandleContainer links;

      if (_objMod->lookup_super_links (ObjectHandle, _sourceHandle, links)) {

         result = links.get_first ();
      }
   }

   return result;
}
void
dmz::MBRAPluginFaultTreeAutoLayout::_update_path (const Handle Object) {

   ObjectModule *objMod (get_object_module ());

   if (objMod && Object) {

      Vector rootPos;
      objMod->lookup_position (Object, _defaultAttrHandle, rootPos);
      const QPointF RootPoint (rootPos.get_x (), rootPos.get_z ());

      Vector logicPos (
         rootPos.get_x () + (0.5f * _hOffset),
         rootPos.get_y (),
         rootPos.get_z ());

      const QPointF LogicPoint (logicPos.get_x (), logicPos.get_z ());

      _path.moveTo (RootPoint);
      _path.lineTo (LogicPoint);

      HandleContainer children;
      objMod->lookup_sub_links (Object, _linkAttrHandle, children);

      if (children.get_count ()) {

         Vector pos;
         Handle current (children.get_first ());

         while (current) {

            Vector pos;
            objMod->lookup_position (current, _defaultAttrHandle, pos);
            QPointF end (pos.get_x (), pos.get_z ());

            _path.moveTo (LogicPoint);
            _path.lineTo (LogicPoint.x (), end.y ());
            _path.lineTo (end);

            current = children.get_next ();
         }
      }
   }
}
void
dmz::MBRAPluginFaultTreeAutoLayout::_update_tree () {

   ObjectModule *objMod (get_object_module ());

   if (objMod && _root) {

      HandleContainer children;

      objMod->lookup_sub_links (_root, _linkAttrHandle, children);

      _path = QPainterPath ();

      Int32 count (0);

      Handle current (children.get_first ());

      while (current) {

         _update_tree (_root, current, 1, count);

         current = children.get_next ();
      }

      Vector offset (0.0, 0.0, 0.0);

      if (count) {

         offset.set_z ((count - 1) * 0.5f * _vOffset);
      }

      objMod->store_position (_root, _defaultAttrHandle, offset);

      _update_logic (_root);

      if (children.get_count ()) {

         _update_path (_root);
      }

      if (_pathItem) { _pathItem->setPath (_path); }
   }
}
void
dmz::MBRAPluginFaultTreeAutoLayout::_update_logic (const Handle Parent) {

   ObjectModule *objMod (get_object_module ());

   if (objMod) {

      HandleContainer logic;
      objMod->lookup_sub_links (Parent, _logicAttrHandle, logic);

      if (logic.get_count ()) {

         Vector pos;
         objMod->lookup_position (Parent, _defaultAttrHandle, pos);

         pos.set_x (pos.get_x () + (_hOffset * 0.5f));
         objMod->store_position (logic.get_first (), _defaultAttrHandle, pos);
      }
   }
}
Example #10
0
/*!

\brief Sends the message to multiple targets.
\param[in] Targets HandleContainer of unique handles of message observers to send message.
\param[in] InData Pointer to the data object that is sent along with the message. May
be NULL if no data is to be sent.
\param[out] outData Pointer to Data object that will be used by the target
message observer to return results. This parameter may be NULL if no data is to be
returned.
\return Returns an id associated with the sent message. This id is not a unique
runtime handle but is instead a running counter that will roll over when max unsigned
integer messages have been sent.

*/
dmz::UInt32
dmz::Message::send (
      const HandleContainer &Targets,
      const Data *InData,
      Data *outData) const {

   UInt32 result (0);
   
   if (_context && _context->context) {

      Handle target (Targets.get_first ());

      while (target) {

         result = _context->context->send (*this, target, InData, outData);

         target = Targets.get_next ();
      }
   }

   return result;
}
Example #11
0
/*!

\brief Sends the message to multiple targets.
\param[in] Targets HandleContainer of unique handles of message observers to send message.
\param[in] InData Pointer to the data object that is sent along with the message. May
be NULL if no data is to be sent.
\param[out] outData Pointer to Data object that will be used by the target
message observer to return results. This parameter may be NULL if no data is to be
returned.
\return Returns an id associated with the sent message. This id is not a unique
runtime handle but is instead a running counter that will roll over when max unsigned
integer messages have been sent.
\note If the Message is a monostate, Targets will be ignored.

*/
dmz::UInt32
dmz::Message::send (
      const HandleContainer &Targets,
      const Data *InData,
      Data *outData) const {

   UInt32 result (0);

   if (_context && _context->dispatch) {

      if (_context->monostate) {

         _context->dispatch->send_monostate_warning (*this);

         send (0, InData, outData);
      }
      else {

         Handle target (Targets.get_first ());

         while (target) {

            result = _context->dispatch->send (
               (result == 0 ? True : False),
               *this,
               target,
               InData,
               outData);

            target = Targets.get_next ();
         }
      }
   }

   return result;
}