/// <summary> /// Initializes the node manager. /// </summary> public PerfTestNodeManager(IServerInternal server, ApplicationConfiguration configuration) : base(server, configuration, Namespaces.PerfTest) { SystemContext.NodeIdFactory = this; SystemContext.SystemHandle = m_system = new UnderlyingSystem(); // get the configuration for the node manager. m_configuration = configuration.ParseExtension <PerfTestServerConfiguration>(); // use suitable defaults if no configuration exists. if (m_configuration == null) { m_configuration = new PerfTestServerConfiguration(); } }
/// <summary> /// Initializes the node manager. /// </summary> public PerfTestNodeManager(IServerInternal server, ApplicationConfiguration configuration) : base(server, configuration, Namespaces.PerfTest) { SystemContext.NodeIdFactory = this; SystemContext.SystemHandle = m_system = new UnderlyingSystem(); // get the configuration for the node manager. m_configuration = configuration.ParseExtension<PerfTestServerConfiguration>(); // use suitable defaults if no configuration exists. if (m_configuration == null) { m_configuration = new PerfTestServerConfiguration(); } }
/// <summary> /// Returns the next reference. /// </summary> /// <returns>The next reference that meets the browse criteria.</returns> public override IReference Next() { UnderlyingSystem system = (UnderlyingSystem)this.SystemContext.SystemHandle; lock (DataLock) { IReference reference = null; // enumerate pre-defined references. // always call first to ensure any pushed-back references are returned first. reference = base.Next(); if (reference != null) { return(reference); } if (m_stage == Stage.Begin) { m_stage = Stage.Tags; m_position = 0; } // don't start browsing huge number of references when only internal references are requested. if (InternalOnly) { return(null); } // enumerate tags. if (m_stage == Stage.Tags) { if (IsRequired(ReferenceTypeIds.Organizes, false)) { reference = NextChild(); if (reference != null) { return(reference); } } } // all done. return(null); } }
/// <summary> /// Returns the next child. /// </summary> private IReference NextChild() { UnderlyingSystem system = (UnderlyingSystem)this.SystemContext.SystemHandle; NodeId targetId = null; // check if a specific browse name is requested. if (!QualifiedName.IsNull(base.BrowseName)) { // browse name must be qualified by the correct namespace. if (m_parent.BrowseName.NamespaceIndex != base.BrowseName.NamespaceIndex) { return(null); } // parse the browse name. int index = 0; for (int ii = 0; ii < base.BrowseName.Name.Length; ii++) { char ch = base.BrowseName.Name[ii]; if (!Char.IsDigit(ch)) { return(null); } index *= 10; index += Convert.ToInt32(ch - '0'); } // check for valid browse name. if (index < 0 || index > m_parent.Register.Size) { return(null); } // return target. targetId = ModelUtils.GetRegisterVariableId(m_parent.Register, index, m_parent.NodeId.NamespaceIndex); } // return the child at the next position. else { // look for next segment. if (m_position >= m_parent.Register.Size) { return(null); } // return target. targetId = ModelUtils.GetRegisterVariableId(m_parent.Register, m_position, m_parent.NodeId.NamespaceIndex); m_position++; } // create reference. if (targetId != null) { return(new NodeStateReference(ReferenceTypeIds.Organizes, false, targetId)); } return(null); }