本文整理汇总了C#中NodeIdDictionary类的典型用法代码示例。如果您正苦于以下问题:C# NodeIdDictionary类的具体用法?C# NodeIdDictionary怎么用?C# NodeIdDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NodeIdDictionary类属于命名空间,在下文中一共展示了NodeIdDictionary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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>();
}
开发者ID:OPCFoundation,项目名称:UA-.NETStandardLibrary,代码行数:11,代码来源:TypeTable.cs
示例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;
}
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:29,代码来源:FileSystemNodeManager.cs
示例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>();
}
}
开发者ID:zryska,项目名称:UA-.NET,代码行数:30,代码来源:TestBase.cs
示例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);
}
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:11,代码来源:AggregatedTypeCache.cs
示例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;
}
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:12,代码来源:ToolState.cs
示例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;
}
开发者ID:yuriik83,项目名称:UA-.UWP-Universal-Windows-Platform,代码行数:20,代码来源:CustomNodeManager.cs
示例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>>();
}
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:21,代码来源:DsatsDemoNodeManager.cs
示例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);
}
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:43,代码来源:Com.Da.Group.cs
示例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);
}
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:25,代码来源:ComAeSubscription.cs
示例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);
}
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:41,代码来源:ComAeNamespaceMapper.cs
示例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;
}
}
开发者ID:yuriik83,项目名称:UA-.UWP-Universal-Windows-Platform,代码行数:66,代码来源:CustomNodeManager.cs
示例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];
//.........这里部分代码省略.........
开发者ID:yuriik83,项目名称:UA-.UWP-Universal-Windows-Platform,代码行数:101,代码来源:CustomNodeManager.cs
示例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;
}
}
}
开发者ID:yuriik83,项目名称:UA-.UWP-Universal-Windows-Platform,代码行数:78,代码来源:CustomNodeManager.cs
示例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);
}
}
}
开发者ID:yuriik83,项目名称:UA-.UWP-Universal-Windows-Platform,代码行数:99,代码来源:CustomNodeManager.cs
示例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);
}
}
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:75,代码来源:QuickstartNodeManager.cs
示例16: UpdateAreaFilter
/// <summary>
/// Updates the list of area filters.
/// </summary>
private void UpdateAreaFilter(List<NodeId> areas)
{
// check if monitoring all events.
if (areas == null || areas.Count == 0)
{
MonitoredItem monitoredItem = null;
if (!m_notifiers.TryGetValue(Opc.Ua.ObjectIds.Server, out monitoredItem))
{
monitoredItem = CreateMonitoredItem(Opc.Ua.ObjectIds.Server);
}
m_notifiers.Clear();
m_notifiers[Opc.Ua.ObjectIds.Server] = monitoredItem;
return;
}
// build table of areas to monitor.
NodeIdDictionary<MonitoredItem> notifiers = new NodeIdDictionary<MonitoredItem>();
// map all of the area search strings onto NodeIds for notifiers.
for (int ii = 0; ii < areas.Count; ii++)
{
NodeId areaId = areas[ii];
// check for existing item.
MonitoredItem monitoredItem = null;
if (m_notifiers.TryGetValue(areaId, out monitoredItem))
{
notifiers[areaId] = monitoredItem;
continue;
}
// check for new item.
if (!notifiers.ContainsKey(areaId))
{
notifiers[areaId] = CreateMonitoredItem(areaId);
}
}
// mark unused items for deletion.
foreach (MonitoredItem monitoredItem in m_notifiers.Values)
{
if (!notifiers.ContainsKey(monitoredItem.StartNodeId))
{
m_subscription.RemoveItem(monitoredItem);
}
}
m_notifiers = notifiers;
}
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:55,代码来源:ComAeSubscription.cs
示例17: Write
/// <summary>
/// Writes the value for the specified attributes.
/// </summary>
public override void Write(
OperationContext context,
IList<WriteValue> nodesToWrite,
IList<ServiceResult> errors)
{
ServerSystemContext systemContext = SystemContext.Copy(context);
IDictionary<NodeId, NodeState> operationCache = new NodeIdDictionary<NodeState>();
List<DataSourceClient.WriteRequest> writeRequests = new List<DataSourceClient.WriteRequest>();
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.
NodeHandle handle = GetManagerHandle(systemContext, nodeToWrite.NodeId, operationCache);
if (handle == null)
{
continue;
}
// owned by this node manager.
nodeToWrite.Processed = true;
// index range is not supported.
if (nodeToWrite.AttributeId != Attributes.Value)
{
if (!String.IsNullOrEmpty(nodeToWrite.IndexRange))
{
errors[ii] = StatusCodes.BadWriteNotSupported;
continue;
}
}
// check if the node is a area in memory.
if (handle.Node == null)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;
continue;
}
// check if the request if for a remote node.
RemoteNode remoteNode = null;
if (m_remoteNodes.TryGetValue(handle.NodeId, out remoteNode))
{
// check for theorectical access.
BaseVariableState variable = handle.Node as BaseVariableState;
if (variable == null || nodeToWrite.AttributeId != Attributes.Value || (variable.AccessLevel & AccessLevels.CurrentWrite) == 0)
{
errors[ii] = StatusCodes.BadNotWritable;
continue;
}
// check for access based on current user credentials.
if (!CheckWriteAccess(systemContext, remoteNode))
{
errors[ii] = StatusCodes.BadUserAccessDenied;
continue;
}
DataSourceClient.WriteRequest request = new DataSourceClient.WriteRequest();
request.RemoteId = remoteNode.RemoteId;
request.WriteValue = nodeToWrite;
request.Index = ii;
writeRequests.Add(request);
errors[ii] = StatusCodes.BadNoCommunication;
continue;
}
// write the attribute value.
errors[ii] = handle.Node.WriteAttribute(
systemContext,
nodeToWrite.AttributeId,
nodeToWrite.ParsedIndexRange,
nodeToWrite.Value);
// updates to source finished - report changes to monitored items.
handle.Node.ClearChangeMasks(systemContext, false);
}
// check for nothing to do.
if (writeRequests.Count == 0)
{
return;
}
}
//.........这里部分代码省略.........
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:101,代码来源:DsatsDemoNodeManager.cs
示例18: UpdateCache
/// <summary>
/// Updates the event types in cache with the most recent info fetched from the AE server.
/// </summary>
public void UpdateCache(ServerSystemContext context, ushort namespaceIndex)
{
// clear the existing nodes.
EventTypeNodes = new NodeIdDictionary<BaseObjectTypeState>();
Attributes = new Dictionary<int,int[]>();
TypeTable typeTable = context.TypeTable as TypeTable;
// rebuild from the recently fetched list.
for (int ii = 0; ii < EventTypes.Count; ii++)
{
// save the attributes for use when creating filters.
if (EventTypes[ii].EventTypeMapping != EventTypeMapping.ConditionClassType && !Attributes.ContainsKey(EventTypes[ii].CategoryId))
{
EventType eventType = EventTypes[ii];
int[] attributeIds = new int[eventType.Attributes.Count];
for (int jj = 0; jj < attributeIds.Length; jj++)
{
attributeIds[jj] = eventType.Attributes[jj].Id;
}
Attributes.Add(EventTypes[ii].CategoryId, attributeIds);
}
AeEventTypeState node = new AeEventTypeState(EventTypes[ii], namespaceIndex);
BaseObjectTypeState mappingNode = null;
if (!EventTypeNodes.TryGetValue(node.SuperTypeId, out mappingNode))
{
mappingNode = new AeEventTypeMappingState(node.EventType.EventTypeMapping, namespaceIndex);
EventTypeNodes.Add(mappingNode.NodeId, mappingNode);
// ensure the mapping node is in the type table.
if (typeTable != null)
{
if (!typeTable.IsKnown(mappingNode.NodeId))
{
typeTable.AddSubtype(mappingNode.NodeId, mappingNode.SuperTypeId);
}
}
}
EventTypeNodes.Add(node.NodeId, node);
// ensure the type node is in the type table.
if (typeTable != null)
{
if (!typeTable.IsKnown(node.NodeId))
{
typeTable.AddSubtype(node.NodeId, mappingNode.NodeId);
}
}
}
}
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:59,代码来源:AeTypeCache.cs
示例19: 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<NodeHandle> nodesToValidate = new List<NodeHandle>();
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.
NodeHandle handle = GetManagerHandle(systemContext, nodeToWrite.NodeId, operationCache);
if (handle == null)
{
continue;
}
// owned by this node manager.
nodeToWrite.Processed = true;
// index range is not supported.
if (nodeToWrite.AttributeId != Attributes.Value)
{
if (!String.IsNullOrEmpty(nodeToWrite.IndexRange))
{
errors[ii] = StatusCodes.BadWriteNotSupported;
continue;
}
}
// check if the node is a area in memory.
if (handle.Node == null)
{
errors[ii] = StatusCodes.BadNodeIdUnknown;
// must validate node in a seperate operation.
handle.Index = ii;
nodesToValidate.Add(handle);
continue;
}
// Utils.Trace("WRITE: Value={0} Range={1}", nodeToWrite.Value.WrappedValue, nodeToWrite.IndexRange);
// write the attribute value.
errors[ii] = handle.Node.WriteAttribute(
systemContext,
nodeToWrite.AttributeId,
nodeToWrite.ParsedIndexRange,
nodeToWrite.Value);
// updates to source finished - report changes to monitored items.
handle.Node.ClearChangeMasks(systemContext, false);
}
// check for nothing to do.
if (nodesToValidate.Count == 0)
{
return;
}
}
// validates the nodes and writes t
|
请发表评论