public void SaveToXML(string filePathName, GQHSM hsm) { FileStream fs = new FileStream(filePathName, FileMode.Create); if (fs == null) { Logger.Warn("Unable to create {0}", filePathName); return; } SaveToXML(fs, hsm); fs.Close(); }
public override void PreInit(GQHSM parentHSM) { base.PreInit(parentHSM); if (IsMultiPort) { _port = (IQPort)_parentHSM.CreateMultiPort(Name); } else { _port = _parentHSM.CreatePort(Name); } _fullName = parentHSM.GetName() + "." + Name; parentHSM.RegisterPort(this); }
public void UnregisterHsm(GQHSM hsm) { m_LifeCycleManager.UnregisterHsm((ILQHsm)hsm); List<GQHSM> HSMs = m_NameToHSM[hsm.GetName()]; List<GQHSM> newHSMS = new List<GQHSM>(); foreach (GQHSM remHSM in HSMs) { if (remHSM.HandlerClass != hsm.HandlerClass) { newHSMS.Add(remHSM); } } HSMs = newHSMS; }
public override void PreInit(GQHSM parentHSM) { base.PreInit(parentHSM); if (Component == null) { Component = new GQHSMComponentLink[2]; Component[0] = new GQHSMComponentLink(); Component[0].Id = new Guid(); Component[0].Name = FromPortName; Component[1] = new GQHSMComponentLink(); Component[1].Id = new Guid(); Component[1].Name = ToPortName; } GQHSMManager.Instance.RegisterPortLink(this); }
public override void PreInit(GQHSM parentHSM) { base.PreInit(parentHSM); _fullName = _parentHSM.RegisterState(this); if (ChildStates != null) { foreach (GQHSMState gs in ChildStates) { gs.PreInit(parentHSM); if (gs.IsStartState) { _childStartState = gs; } } } _stateHandler = new QState(this, StateHandler, Name); }
public void SaveToXML(Stream fs, GQHSM hsm) { XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("",""); // specifies the type of object to be deserialized. XmlSerializer serializer = new XmlSerializer(typeof(GQHSMStateMachine)); // If the XML document has been altered with unknown // nodes or attributes, handles them with the // UnknownNode and UnknownAttribute events. serializer.UnknownNode += new XmlNodeEventHandler(serializer_UnknownNode); serializer.UnknownAttribute += new XmlAttributeEventHandler(serializer_UnknownAttribute); serializer.Serialize(fs, hsm.HSMData, ns); }
public GQHSM LoadFromXML(string fileName, string sXML) { GQHSM theHSM; // Creates an instance of the XmlSerializer class; // specifies the type of object to be deserialized. XmlSerializer serializer = new XmlSerializer(typeof(GQHSMStateMachine)); // If the XML document has been altered with unknown // nodes or attributes, handles them with the // UnknownNode and UnknownAttribute events. serializer.UnknownNode += new XmlNodeEventHandler(serializer_UnknownNode); serializer.UnknownAttribute += new XmlAttributeEventHandler(serializer_UnknownAttribute); StringReader srXML = new StringReader(sXML); theHSM = new GQHSM(fileName); theHSM.HSMData = (GQHSMStateMachine)serializer.Deserialize(srXML); theHSM.PreInit(); return theHSM; }
public GQHSMAction(GQHSM parent, string actionStr) { _parentHSM = parent; string[] NameAndParams = actionStr.Split(new char[] { '(', ')' }, StringSplitOptions.RemoveEmptyEntries); if (NameAndParams.Length > 1) { _params = new GQHSMParameters(NameAndParams[1]); } else if (NameAndParams.Length == 1) { _params = new GQHSMParameters(); } _name = NameAndParams[0]; _globals = GQHSMManager.Instance.Globals; if (!_name.StartsWith("^")) { _actionHandler = _parentHSM.GetMethod(_name, _params); } }
public void Init(GQHSM parentHSM, string[] actionStrings) { _parentHSM = parentHSM; if (actionStrings.Length > 0) { _actions = new GQHSMAction[actionStrings.Length]; int paramIndex = 0; foreach (string actionStr in actionStrings) { if (actionStr.Length > 0) { _actions[paramIndex++] = new GQHSMAction(parentHSM, actionStr); } else { throw new Exception("Invalid zero length action string detected!, Discarding"); } } } }
public GQHSMActions(GQHSM parentHSM, string actionsStr) { string[] actionStrings = actionsStr.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); Init(parentHSM, actionStrings); }
public GQHSMActions(GQHSM parentHSM, string[] actionsStr) { Init(parentHSM, actionsStr); }
public override void PreInit(GQHSM parentHSM) { base.PreInit(parentHSM); _parentHSM.RegisterTransition(this); }
public virtual void PreInit(GQHSM parentHSM) { _parentHSM = parentHSM; }
public void RegisterHsm(GQHSM hsm) { m_NameToHSM.Add(hsm.GetName(), hsm); m_LifeCycleManager.RegisterHsm((ILQHsm)hsm); }