7using System.Collections.Generic;
101 private List<DeviceNode>
_nodes =
new List<DeviceNode>();
133 int numNodes =
_nodes.Count;
136 for (
int index = 1; index < numNodes; ++index)
138 if ((bitMask & nodeSelectMask) != 0)
140 _nodes[index].Visible = makeVisible;
183 node.Visible =
false;
220 List<uint> idcodes =
new List<uint>();
230 return idcodes.ToArray();
287 #region IDeviceNetworkLowLevel methods
329 bool unlocked =
false;
400 uint[] idcodes =
new uint[0];
414 #region ITAPNetworkHighLevel methods
419 int IDeviceNetworkHighLevel.NumChains
436 uint[] idcodes =
new uint[0];
Represents a device chain, which is a collection of DeviceNode objects. Part of the Facade pattern ex...
void DeselectNodes(uint nodeSelectMask)
Make invisible one or more devices in the device chain.
bool IsLocked
Whether this device chain is locked for access.
DeviceChain(string name)
Constructor.
List< DeviceNode > _nodes
The list of TAPNodes on this device chain.
string Name
The Name of this device chain.
void _ShowHideNodes(uint nodeSelectMask, bool makeVisible)
Helper method to show or hide devices on the device chain.
void ResetVisibility()
Resets the device chain so that all devices that are not CLdevices are no longer visible in the devic...
void SelectNodes(uint nodeSelectMask)
Make visible one or more devices in the device chain.
uint[] GetIdCodesForVisibleNodes()
Retrieve a list of idcodes for all devices that are visible in the device chain.
void AddNode(DeviceNode node)
Helper method to add a DeviceNode to the device chain. DeviceNode objects that are of DeviceTypes....
Represents a single device. Part of the Facade pattern example.
uint Idcode
The idcode for this device.
DeviceTypes DeviceType
A value from the DeviceTypes enumeration identifying the type of the device.
string Name
Name of this device.
bool Visible
Whether the device is visible in the device chain.
DeviceNode(string name, uint idcode, DeviceTypes tapType, bool initiallyVisible)
Constructor.
Class factory for the complicated sub-system class. Part of the Facade pattern example.
static IDeviceNetworkLowLevel CreateLowLevelInstance()
Class factory for a singleton instance of the sub-system class.
static ? IDeviceNetworkLowLevel _instance
A singleton instance of the sub-system.
static IDeviceNetworkHighLevel CreateHighLevelInstance()
Class factory for a singleton instance of the sub-system class.
Represents some kind of system that contains multiple device chains. Part of the Facade pattern examp...
static IDeviceNetworkLowLevel CreateInstance()
Class factory for the sub-system class.
bool IDeviceNetworkLowLevel. LockDeviceChain(int chainIndex)
Lock the specified device chain to indicate exclusive access is desired.
Facade_ComplicatedSubSystem()
(private) Constructor. Sets up the device chains.
DeviceChain[] _deviceChains
The list of device chains. In this case, there are two.
Represents a high level view of a complex network of device chains. A device chain can be thought of ...
void DisableDevicesInDeviceChain(int chainIndex)
Resets the given device chain so that all devices except the TAP controller is no longer visible.
void EnableDevicesInDeviceChain(int chainIndex, uint selectMask)
Make visible certain devices in the given device chain. The selectMask value has a bit set for each T...
uint[] GetIdcodes(int chainIndex)
Returns a list of all idcodes from all selected devices in the given device chain.
Represents a network of device chains and the low level access to that network. In general,...
bool LockDeviceChain(int chainIndex)
Lock the specified device chain for exclusive access.
void ResetDeviceChain(int chainIndex)
Reset the visibility of all devices on the specified device chain.
void DisableDevicesInDeviceChain(int chainIndex, uint devicesSelectMask)
Make invisible the specified devices on the specified device chain.
int GetNumChains()
Retrieve the number of device chains available in the network.
void EnableDevicesInDeviceChain(int chainIndex, uint devicesSelectMask)
Make visible the specified devices on the specified device chain.
uint[] GetIdcodes(int chainIndex)
Retrieve a list of idcodes of all visible devices in the given device chain.
bool UnlockDeviceChain(int chainIndex)
Unlock the specified device chain to release exclusive access.
The namespace containing all Design Pattern Examples implemented in C#.
DeviceTypes
Identifies the type of devices that can appear in a device chain. Part of the Facade pattern example.
@ DEVICECONTROLLER
device controller. This is always visible.