本文整理汇总了C#中NodeIdDictionary类的典型用法代码示例。如果您正苦于以下问题:C# NodeIdDictionary类的具体用法?C# NodeIdDictionary怎么用?C# NodeIdDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeIdDictionary类属于命名空间,在下文中一共展示了NodeIdDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TypeTable
/// <summary>
/// Initializes the object with default values.
/// </summary>
/// <param name="namespaceUris">The namespace URIs.</param>
public TypeTable(NamespaceTable namespaceUris)
{
m_namespaceUris = namespaceUris;
m_referenceTypes = new SortedDictionary<QualifiedName,TypeInfo>();
m_nodes = new NodeIdDictionary<TypeInfo>();
m_encodings = new NodeIdDictionary<TypeInfo>();
}
示例2: FileSystemNodeManager
/// <summary>
/// Initializes the node manager.
/// </summary>
public FileSystemNodeManager(Opc.Ua.Server.IServerInternal server, string systemRoot)
:
base(server)
{
List<string> namespaceUris = new List<string>();
namespaceUris.Add(Namespaces.FileSystem);
namespaceUris.Add(Namespaces.FileSystem + "/Instance");
NamespaceUris = namespaceUris;
m_cache = new NodeIdDictionary<NodeState>();
// create the directory.
string absolutePath = Utils.GetAbsoluteDirectoryPath(systemRoot, true, false, true);
// create the system.
m_system = new FileSystemMonitor(
SystemContext,
absolutePath,
server.NamespaceUris.GetIndexOrAppend(namespaceUris[1]),
Lock);
// update the default context.
SystemContext.SystemHandle = m_system;
}
示例3: TestBase
/// <summary>
/// Initializes the test with session, configuration and logger.
/// </summary>
public TestBase(
string name,
Session session,
ServerTestConfiguration configuration,
ReportMessageEventHandler reportMessage,
ReportProgressEventHandler reportProgress,
TestBase template)
{
m_name = name;
m_session = session;
m_configuration = configuration;
m_reportMessage = reportMessage;
m_reportProgress = reportProgress;
if (template != null && Object.ReferenceEquals(session, template.m_session))
{
m_blockSize = template.BlockSize;
m_availableNodes = template.m_availableNodes;
m_writeableVariables = template.m_writeableVariables;
}
else
{
m_blockSize = 1000;
m_availableNodes = new NodeIdDictionary<Node>();
m_writeableVariables = new List<VariableNode>();
}
}
示例4: LoadTypes
/// <summary>
/// Fetches the event type information from the AE server.
/// </summary>
public void LoadTypes(Opc.Ua.Client.Session client, IServerInternal server, NamespaceMapper mapper)
{
TypeNodes = new NodeIdDictionary<ReferenceDescription>();
LoadTypes(client, server, mapper, Opc.Ua.ObjectTypeIds.BaseObjectType);
LoadTypes(client, server, mapper, Opc.Ua.VariableTypeIds.BaseVariableType);
LoadTypes(client, server, mapper, Opc.Ua.DataTypeIds.BaseDataType);
LoadTypes(client, server, mapper, Opc.Ua.ReferenceTypeIds.References);
}
示例5: SetPhaseLock
/// <summary>
/// Sets the lock for the phase.
/// </summary>
public void SetPhaseLock(NodeId phaseId, NodeId lockId)
{
if (m_mapping == null)
{
m_mapping = new NodeIdDictionary<NodeId>();
}
m_mapping[phaseId] = lockId;
}
示例6: CustomNodeManager2
/// <summary>
/// Initializes the node manager.
/// </summary>
public CustomNodeManager2(IServerInternal server)
{
// save a reference to the server that owns the node manager.
m_server = server;
// create the default context.
m_systemContext = m_server.DefaultSystemContext.Copy();
m_systemContext.SystemHandle = null;
m_systemContext.NodeIdFactory = this;
// create the table of nodes.
m_predefinedNodes = new NodeIdDictionary<NodeState>();
m_rootNotifiers = new List<NodeState>();
m_sampledItems = new List<DataChangeMonitoredItem>();
m_minimumSamplingInterval = 100;
}
示例7: DsatsDemoNodeManager
/// <summary>
/// Initializes the node manager.
/// </summary>
public DsatsDemoNodeManager(IServerInternal server, ApplicationConfiguration configuration)
:
base(server, DsatsDemo.Namespaces.DsatsDemo, DsatsDemo.Namespaces.DsatsDemo +"/Instance")
{
SystemContext.NodeIdFactory = this;
// get the configuration for the node manager.
m_configuration = configuration.ParseExtension<DsatsDemoServerConfiguration>();
// use suitable defaults if no configuration exists.
if (m_configuration == null)
{
m_configuration = new DsatsDemoServerConfiguration();
}
m_source = new DataSourceClient(configuration);
m_sessionLocks = new NodeIdDictionary<List<NodeId>>();
}
示例8: Group
/// <summary>
/// Initializes the object with the default values.
/// </summary>
public Group(
Server server,
object serverLock,
string name,
int serverHandle,
int clientHandle,
int updateRate,
bool active,
float deadband,
int lcid,
int timebias,
Subscription subscription,
NodeIdDictionary<CachedValue> cache)
{
// register interface for a group object as a connection point.
RegisterInterface(typeof(OpcRcw.Da.IOPCDataCallback).GUID);
// all the groups use the same lock as the server object.
// this is necessary because the session/subscription objects are not thread safe.
m_lock = serverLock;
// set default values.
m_server = server;
m_subscription = subscription;
m_session = subscription.Session;
m_name = name;
m_serverHandle = serverHandle;
m_clientHandle = clientHandle;
m_updateRate = updateRate;
m_active = false;
m_deadband = deadband;
m_lcid = lcid;
m_timebias = timebias;
m_enabled = true;
m_advised = false;
m_cache = cache;
m_defaultKeepAliveCount = subscription.KeepAliveCount;
this.PublishStateChanged(active, null);
}
示例9: ComAe2Subscription
/// <summary>
/// Initializes a new instance of the <see cref="ComHdaBrowser"/> class.
/// </summary>
public ComAe2Subscription(
ComAe2Proxy server,
ComAe2ProxyConfiguration configuration,
ComAeNamespaceMapper mapper,
ComAe2Browser browser,
AeConditionManager conditionManager)
{
m_server = server;
m_configuration = configuration;
m_mapper = mapper;
m_browser = browser;
m_conditionManager = conditionManager;
m_filter = new AeEventFilter(m_mapper);
m_queue = new Queue<AeEvent>();
m_notifiers = new NodeIdDictionary<MonitoredItem>();
m_sourceNodes = new List<NodeId>();
// set a default filters.
m_filter.SetFilter(Constants.ALL_EVENTS, 0, UInt16.MaxValue, null, null);
UpdateAreaFilter(null);
UpdateSourceFilter(null);
}
示例10: Initialize
/// <summary>
/// Initializes the mapper.
/// </summary>
public void Initialize(Session session, ComAe2ProxyConfiguration configuration)
{
base.Initialize(session, configuration);
m_session = session;
// discard the table.
m_eventTypes = new NodeIdDictionary<AeEventCategory>();
m_categories = new Dictionary<uint, AeEventCategory>();
m_attributes = new Dictionary<uint, AeEventAttribute>();
// load the well known types from an embedded resource.
IndexWellKnownTypes();
// browse the server for additional types.
if (!configuration.UseOnlyBuiltInTypes)
{
IndexTypesFromServer(Opc.Ua.ObjectTypeIds.BaseEventType, OpcRcw.Ae.Constants.SIMPLE_EVENT);
}
// check for existing category mapping.
NodeIdMappingSet mappingSet = configuration.GetMappingSet("EventCategories");
// update mappings.
UpdateEventTypeMappings(mappingSet);
// update configuration.
configuration.ReplaceMappingSet(mappingSet);
// check for existing attribute mapping.
mappingSet = configuration.GetMappingSet("EventAttributes");
// update mappings.
UpdateEventAttributeMappings(mappingSet);
// update configuration.
configuration.ReplaceMappingSet(mappingSet);
}
示例11: SubscribeToEvents
/// <summary>
/// Subscribes or unsubscribes to events produced by the specified source.
/// </summary>
/// <remarks>
/// This method is called when a event subscription is created or deletes. The node manager
/// must start/stop reporting events for the specified object and all objects below it in
/// the notifier hierarchy.
/// </remarks>
public virtual ServiceResult SubscribeToEvents(
OperationContext context,
object sourceId,
uint subscriptionId,
IEventMonitoredItem monitoredItem,
bool unsubscribe)
{
ServerSystemContext systemContext = m_systemContext.Copy(context);
IDictionary<NodeId,NodeState> operationCache = new NodeIdDictionary<NodeState>();
lock (Lock)
{
// check for valid handle.
NodeState source = IsHandleInNamespace(sourceId);
if (source == null)
{
return StatusCodes.BadNodeIdInvalid;
}
// check if the object supports subscritions.
BaseObjectState instance = sourceId as BaseObjectState;
if (instance == null || instance.EventNotifier != EventNotifiers.SubscribeToEvents)
{
return StatusCodes.BadNotSupported;
}
MonitoredNode monitoredNode = instance.Handle as MonitoredNode;
// handle unsubscribe.
if (unsubscribe)
{
if (monitoredNode != null)
{
monitoredNode.UnsubscribeToEvents(systemContext, monitoredItem);
// do any post processing.
OnUnsubscribeToEvents(systemContext, monitoredNode, monitoredItem);
}
return ServiceResult.Good;
}
// subscribe to events.
if (monitoredNode == null)
{
instance.Handle = monitoredNode = new MonitoredNode(m_server, this, source);
}
monitoredNode.SubscribeToEvents(systemContext, monitoredItem);
// do any post processing.
OnSubscribeToEvents(systemContext, monitoredNode, monitoredItem);
return ServiceResult.Good;
}
}
示例12: Call
/// <summary>
/// Calls a method on the specified nodes.
/// </summary>
public virtual void Call(
OperationContext context,
IList<CallMethodRequest> methodsToCall,
IList<CallMethodResult> results,
IList<ServiceResult> errors)
{
ServerSystemContext systemContext = m_systemContext.Copy(context);
IDictionary<NodeId,NodeState> operationCache = new NodeIdDictionary<NodeState>();
List<CallOperationState> nodesToValidate = new List<CallOperationState>();
lock (Lock)
{
for (int ii = 0; ii < methodsToCall.Count; ii++)
{
CallMethodRequest methodToCall = methodsToCall[ii];
// skip items that have already been processed.
if (methodToCall.Processed)
{
continue;
}
// check for valid handle.
NodeState source = GetManagerHandle(systemContext, methodToCall.ObjectId, operationCache) as NodeState;
if (source == null)
{
continue;
}
// owned by this node manager.
methodToCall.Processed = true;
// check for valid method.
MethodState method = GetManagerHandle(systemContext, methodToCall.MethodId, operationCache) as MethodState;
if (method == null)
{
errors[ii] = StatusCodes.BadMethodInvalid;
continue;
}
// check if method belongs to the object.
if (!Object.ReferenceEquals(method.Parent, source))
{
errors[ii] = StatusCodes.BadMethodInvalid;
continue;
}
CallMethodResult result = results[ii] = new CallMethodResult();
// check if the node is ready for reading.
if (source.ValidationRequired)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;
// must validate node in a seperate operation.
CallOperationState operation = new CallOperationState();
operation.Source = source;
operation.Method = method;
operation.Index = ii;
nodesToValidate.Add(operation);
continue;
}
// call the method.
errors[ii] = Call(
systemContext,
methodToCall,
source,
method,
result);
}
// check for nothing to do.
if (nodesToValidate.Count == 0)
{
return;
}
// validates the nodes (reads values from the underlying data source if required).
for (int ii = 0; ii < nodesToValidate.Count; ii++)
{
CallOperationState operation = nodesToValidate[ii];
// validate the object.
if (!ValidateNode(systemContext, operation.Source))
{
continue;
}
// call the method.
CallMethodResult result = results[operation.Index];
//.........这里部分代码省略.........
示例13: HistoryUpdate
/// <summary>
/// Updates the history for the specified nodes.
/// </summary>
public virtual void HistoryUpdate(
OperationContext context,
Type detailsType,
IList<HistoryUpdateDetails> nodesToUpdate,
IList<HistoryUpdateResult> results,
IList<ServiceResult> errors)
{
ServerSystemContext systemContext = m_systemContext.Copy(context);
IDictionary<NodeId,NodeState> operationCache = new NodeIdDictionary<NodeState>();
List<ReadWriteOperationState> nodesToValidate = new List<ReadWriteOperationState>();
lock (Lock)
{
for (int ii = 0; ii < nodesToUpdate.Count; ii++)
{
HistoryUpdateDetails nodeToUpdate = nodesToUpdate[ii];
// skip items that have already been processed.
if (nodeToUpdate.Processed)
{
continue;
}
// check for valid handle.
NodeState source = GetManagerHandle(systemContext, nodeToUpdate.NodeId, operationCache) as NodeState;
if (source == null)
{
continue;
}
// owned by this node manager.
nodeToUpdate.Processed = true;
// check if the node is ready for reading.
if (source.ValidationRequired)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;
// must validate node in a seperate operation.
ReadWriteOperationState operation = new ReadWriteOperationState();
operation.Source = source;
operation.Index = ii;
nodesToValidate.Add(operation);
continue;
}
// historical data not available.
errors[ii] = StatusCodes.BadHistoryOperationUnsupported;
}
// check for nothing to do.
if (nodesToValidate.Count == 0)
{
return;
}
// validates the nodes (reads values from the underlying data source if required).
for (int ii = 0; ii < nodesToValidate.Count; ii++)
{
ReadWriteOperationState operation = nodesToValidate[ii];
if (!ValidateNode(systemContext, operation.Source))
{
continue;
}
// historical data not available.
errors[ii] = StatusCodes.BadHistoryOperationUnsupported;
}
}
}
示例14: Write
/// <summary>
/// Writes the value for the specified attributes.
/// </summary>
public virtual void Write(
OperationContext context,
IList<WriteValue> nodesToWrite,
IList<ServiceResult> errors)
{
ServerSystemContext systemContext = m_systemContext.Copy(context);
IDictionary<NodeId,NodeState> operationCache = new NodeIdDictionary<NodeState>();
List<ReadWriteOperationState> nodesToValidate = new List<ReadWriteOperationState>();
lock (Lock)
{
for (int ii = 0; ii < nodesToWrite.Count; ii++)
{
WriteValue nodeToWrite = nodesToWrite[ii];
// skip items that have already been processed.
if (nodeToWrite.Processed)
{
continue;
}
// check for valid handle.
NodeState source = GetManagerHandle(systemContext, nodeToWrite.NodeId, operationCache) as NodeState;
if (source == null)
{
continue;
}
// owned by this node manager.
nodeToWrite.Processed = true;
// index range is not supported.
if (!String.IsNullOrEmpty(nodeToWrite.IndexRange))
{
errors[ii] = StatusCodes.BadIndexRangeInvalid;
continue;
}
// check if the node is ready for reading.
if (source.ValidationRequired)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;
// must validate node in a seperate operation.
ReadWriteOperationState operation = new ReadWriteOperationState();
operation.Source = source;
operation.Index = ii;
nodesToValidate.Add(operation);
continue;
}
// write the attribute value.
errors[ii] = source.WriteAttribute(
systemContext,
nodeToWrite.AttributeId,
nodeToWrite.ParsedIndexRange,
nodeToWrite.Value);
// updates to source finished - report changes to monitored items.
source.ClearChangeMasks(systemContext, false);
}
// check for nothing to do.
if (nodesToValidate.Count == 0)
{
return;
}
// validates the nodes (reads values from the underlying data source if required).
for (int ii = 0; ii < nodesToValidate.Count; ii++)
{
ReadWriteOperationState operation = nodesToValidate[ii];
if (!ValidateNode(systemContext, operation.Source))
{
continue;
}
WriteValue nodeToWrite = nodesToWrite[operation.Index];
// write the attribute value.
errors[operation.Index] = operation.Source.WriteAttribute(
systemContext,
nodeToWrite.AttributeId,
nodeToWrite.ParsedIndexRange,
nodeToWrite.Value);
// updates to source finished - report changes to monitored items.
operation.Source.ClearChangeMasks(systemContext, false);
}
}
}
示例15: Call
/// <summary>
/// Calls a method on the specified nodes.
/// </summary>
public virtual void Call(
OperationContext context,
IList<CallMethodRequest> methodsToCall,
IList<CallMethodResult> results,
IList<ServiceResult> errors)
{
ServerSystemContext systemContext = SystemContext.Copy(context);
IDictionary<NodeId, NodeState> operationCache = new NodeIdDictionary<NodeState>();
for (int ii = 0; ii < methodsToCall.Count; ii++)
{
CallMethodRequest methodToCall = methodsToCall[ii];
// skip items that have already been processed.
if (methodToCall.Processed)
{
continue;
}
MethodState method = null;
lock (Lock)
{
// check for valid handle.
NodeHandle handle = GetManagerHandle(systemContext, methodToCall.ObjectId, operationCache);
if (handle == null)
{
continue;
}
// owned by this node manager.
methodToCall.Processed = true;
// validate the source node.
NodeState source = ValidateNode(systemContext, handle, operationCache);
if (source == null)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;
continue;
}
// find the method.
method = source.FindMethod(systemContext, methodToCall.MethodId);
if (method == null)
{
// check for loose coupling.
if (source.ReferenceExists(ReferenceTypeIds.HasComponent, false, methodToCall.MethodId))
{
method = (MethodState)FindPredefinedNode(methodToCall.MethodId, typeof(MethodState));
}
if (method == null)
{
errors[ii] = StatusCodes.BadMethodInvalid;
continue;
}
}
}
// call the method.
CallMethodResult result = results[ii] = new CallMethodResult();
errors[ii] = Call(
systemContext,
methodToCall,
method,
result);
}
}