Design Pattern Examples
Overview of object-oriented design patterns
DeviceChain Class Reference

Represents a device chain, which is a collection of DeviceNode objects. Part of the Facade pattern example. More...

Collaboration diagram for DeviceChain:
Collaboration graph

Public Member Functions

 DeviceChain (string name)
 Constructor.
 
void ResetVisibility ()
 Resets the device chain so that all devices that are not CLdevices are no longer visible in the device chain.
 
void SelectNodes (uint nodeSelectMask)
 Make visible one or more devices in the device chain.
 
void DeselectNodes (uint nodeSelectMask)
 Make invisible 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.
 

Public Attributes

string Name
 The Name of this device chain.
 
bool IsLocked
 Whether this device chain is locked for access.
 

Package Functions

void AddNode (DeviceNode node)
 Helper method to add a DeviceNode to the device chain. DeviceNode objects that are of DeviceTypes.DEVICECONTROLLER are always inserted as the first device in the device chain, with the assumption there is only one DEVICECONTROLLER in a given device chain (this is not actually enforced, though).
 

Private Member Functions

void _ShowHideNodes (uint nodeSelectMask, bool makeVisible)
 Helper method to show or hide devices on the device chain.
 

Private Attributes

List< DeviceNode_nodes = new List<DeviceNode>()
 The list of TAPNodes on this device chain.
 

Detailed Description

Represents a device chain, which is a collection of DeviceNode objects. Part of the Facade pattern example.

Definition at line 96 of file Facade_ComplicatedSubSystem.cs.

Constructor & Destructor Documentation

◆ DeviceChain()

DeviceChain ( string  name)
inline

Constructor.

Parameters
nameName of this device chain.

Definition at line 117 of file Facade_ComplicatedSubSystem.cs.

References DeviceChain.Name.

Member Function Documentation

◆ _ShowHideNodes()

void _ShowHideNodes ( uint  nodeSelectMask,
bool  makeVisible 
)
inlineprivate

Helper method to show or hide devices on the device chain.

Parameters
nodeSelectMaskA bit mask where the position of each bit corresponds to a device in the device chain, with bit 0 being the first device, bit 1 being the second device, and so on.
makeVisibletrue if the device is to be made visible on the device chain; otherwise false, the device cannot be seen on the device chain.

Definition at line 130 of file Facade_ComplicatedSubSystem.cs.

References DeviceChain._nodes.

Referenced by DeviceChain.DeselectNodes(), and DeviceChain.SelectNodes().

◆ AddNode()

void AddNode ( DeviceNode  node)
inlinepackage

Helper method to add a DeviceNode to the device chain. DeviceNode objects that are of DeviceTypes.DEVICECONTROLLER are always inserted as the first device in the device chain, with the assumption there is only one DEVICECONTROLLER in a given device chain (this is not actually enforced, though).

Parameters
nodeA DeviceNode object to add to the device chain.

Definition at line 159 of file Facade_ComplicatedSubSystem.cs.

References DeviceChain._nodes, and DeviceNode.DeviceType.

Referenced by Facade_ComplicatedSubSystem.Facade_ComplicatedSubSystem().

◆ DeselectNodes()

void DeselectNodes ( uint  nodeSelectMask)
inline

Make invisible one or more devices in the device chain.

Parameters
nodeSelectMaska bit mask specifying which device or devices to hide, where bit 0 is the first device, bit 1 is the second, etc. Bit 0 is ignored as the first device is always visible.

Definition at line 205 of file Facade_ComplicatedSubSystem.cs.

References DeviceChain._ShowHideNodes().

Referenced by Facade_ComplicatedSubSystem.DisableDevicesInDeviceChain().

◆ GetIdCodesForVisibleNodes()

uint[] GetIdCodesForVisibleNodes ( )
inline

Retrieve a list of idcodes for all devices that are visible in the device chain.

Returns
Returns an array of uints corresponding to the idcodes of each visible device. The first idcode corresponds to the first visible device.

Definition at line 218 of file Facade_ComplicatedSubSystem.cs.

References DeviceChain._nodes, DeviceNode.Idcode, and DeviceNode.Visible.

Referenced by Facade_ComplicatedSubSystem.GetIdcodes().

◆ ResetVisibility()

void ResetVisibility ( )
inline

Resets the device chain so that all devices that are not CLdevices are no longer visible in the device chain.

Definition at line 177 of file Facade_ComplicatedSubSystem.cs.

References DeviceChain._nodes, and DeviceNode.DeviceType.

Referenced by Facade_ComplicatedSubSystem.ResetDeviceChain().

◆ SelectNodes()

void SelectNodes ( uint  nodeSelectMask)
inline

Make visible one or more devices in the device chain.

Parameters
nodeSelectMaska bit mask specifying which device or devices to make visible, where bit 0 is the first device, bit 1 is the second, etc. Bit 0 is ignored as the first device is always visible.

Definition at line 194 of file Facade_ComplicatedSubSystem.cs.

References DeviceChain._ShowHideNodes().

Referenced by Facade_ComplicatedSubSystem.EnableDevicesInDeviceChain().

Member Data Documentation

◆ _nodes

List<DeviceNode> _nodes = new List<DeviceNode>()
private

The list of TAPNodes on this device chain.

Definition at line 101 of file Facade_ComplicatedSubSystem.cs.

Referenced by DeviceChain._ShowHideNodes(), DeviceChain.AddNode(), DeviceChain.GetIdCodesForVisibleNodes(), and DeviceChain.ResetVisibility().

◆ IsLocked

bool IsLocked

Whether this device chain is locked for access.

Definition at line 111 of file Facade_ComplicatedSubSystem.cs.

Referenced by Facade_ComplicatedSubSystem.LockDeviceChain(), and Facade_ComplicatedSubSystem.UnlockDeviceChain().

◆ Name

string Name

The documentation for this class was generated from the following file: