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

Represents some kind of system that contains multiple device chains. Part of the Facade pattern example. More...

Inheritance diagram for Facade_ComplicatedSubSystem:
Inheritance graph
Collaboration diagram for Facade_ComplicatedSubSystem:
Collaboration graph

Static Public Member Functions

static IDeviceNetworkLowLevel CreateInstance ()
 Class factory for the sub-system class.
 

Properties

int IDeviceNetworkHighLevel. NumChains [get]
 The number of device chains available from the sub-system.
 
- Properties inherited from IDeviceNetworkHighLevel
int NumChains [get]
 The number of device chains available from the sub-system.
 

Private Member Functions

 Facade_ComplicatedSubSystem ()
 (private) Constructor. Sets up the device chains.
 
int IDeviceNetworkLowLevel. GetNumChains ()
 Retrieve the number of device chains.
 
bool IDeviceNetworkLowLevel. LockDeviceChain (int chainIndex)
 Lock the specified device chain to indicate exclusive access is desired.
 
bool IDeviceNetworkLowLevel. UnlockDeviceChain (int chainIndex)
 Unlock the specified device chain to indicate exclusive access is no longer desired.
 
void IDeviceNetworkLowLevel. ResetDeviceChain (int chainIndex)
 Reset the visibility of all devices on the given device chain so that all devices except the first are not visible.
 
void IDeviceNetworkLowLevel. EnableDevicesInDeviceChain (int chainIndex, uint deviceselectMask)
 Select one or more devices in the given device chain so those devices are visible.
 
void IDeviceNetworkLowLevel. DisableDevicesInDeviceChain (int chainIndex, uint deviceselectMask)
 Deselect one or more devices in the given device chain so those devices are no longer visible.
 
uint[] IDeviceNetworkLowLevel. GetIdcodes (int chainIndex)
 Retrieve a list of idcodes for each device in the given device chain that is visible.
 
uint[] IDeviceNetworkHighLevel. GetIdcodes (int chainIndex)
 Returns a list of all idcodes from all selected devices in the given device chain.
 
void IDeviceNetworkHighLevel. EnableDevicesInDeviceChain (int chainIndex, uint selectMask)
 Make visible certain devices in the given device chain. The selectMask value has a bit set for each device device to make visible.
 
void IDeviceNetworkHighLevel. DisableDevicesInDeviceChain (int chainIndex)
 Resets the given device chain so that all devices except the device controller is no longer visible.
 

Private Attributes

DeviceChain[] _deviceChains = { new DeviceChain("CHAIN0"), new DeviceChain("CHAIN1") }
 The list of device chains. In this case, there are two.
 

Additional Inherited Members

int GetNumChains ()
 Retrieve the number of device chains available in the network.
 
bool LockDeviceChain (int chainIndex)
 Lock the specified device chain for exclusive access.
 
bool UnlockDeviceChain (int chainIndex)
 Unlock the specified device chain to release exclusive access.
 
void ResetDeviceChain (int chainIndex)
 Reset the visibility of all devices on the specified device chain.
 
void EnableDevicesInDeviceChain (int chainIndex, uint devicesSelectMask)
 Make visible the specified devices on the specified device chain.
 
void DisableDevicesInDeviceChain (int chainIndex, uint devicesSelectMask)
 Make invisible 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.
 
uint[] GetIdcodes (int chainIndex)
 Returns a list of all idcodes from all selected devices in the given device chain.
 
void EnableDevicesInDeviceChain (int chainIndex, uint selectMask)
 Make visible certain devices in the given device chain. The selectMask value has a bit set for each TAP device to make visible.
 
void DisableDevicesInDeviceChain (int chainIndex)
 Resets the given device chain so that all devices except the TAP controller is no longer visible.
 

Detailed Description

Represents some kind of system that contains multiple device chains. Part of the Facade pattern example.

The following operations are available:

Definition at line 253 of file Facade_ComplicatedSubSystem.cs.

Constructor & Destructor Documentation

◆ Facade_ComplicatedSubSystem()

Facade_ComplicatedSubSystem ( )
inlineprivate

(private) Constructor. Sets up the device chains.

Definition at line 272 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem._deviceChains, and DeviceChain.AddNode().

Referenced by Facade_ComplicatedSubSystem.CreateInstance().

Member Function Documentation

◆ CreateInstance()

static IDeviceNetworkLowLevel CreateInstance ( )
inlinestatic

Class factory for the sub-system class.

Returns
Returns a new instance of the class.

Definition at line 264 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem.Facade_ComplicatedSubSystem().

Referenced by Facade_ComplicatedSubSystemFactory.CreateHighLevelInstance(), and Facade_ComplicatedSubSystemFactory.CreateLowLevelInstance().

◆ DisableDevicesInDeviceChain() [1/2]

void IDeviceNetworkHighLevel. DisableDevicesInDeviceChain ( int  chainIndex)
inlineprivate

Resets the given device chain so that all devices except the device controller is no longer visible.

Parameters
chainIndexIndex of the device chain to access (0..NumChains-1).

Implements IDeviceNetworkHighLevel.

Definition at line 468 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem.LockDeviceChain().

◆ DisableDevicesInDeviceChain() [2/2]

void IDeviceNetworkLowLevel. DisableDevicesInDeviceChain ( int  chainIndex,
uint  deviceselectMask 
)
inlineprivate

Deselect one or more devices in the given device chain so those devices are no longer visible.

Parameters
chainIndexThe index of the device chain to access (0..n-1).
deviceselectMaskA bit mask indicating which devices to make invisible, with bit 0 corresponding to the first device, bit 1 corresponding to the second device, etc. Bit 0 is ignored as the first device is always visible.

Implements IDeviceNetworkLowLevel.

Definition at line 382 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem._deviceChains, and DeviceChain.DeselectNodes().

◆ EnableDevicesInDeviceChain() [1/2]

void IDeviceNetworkLowLevel. EnableDevicesInDeviceChain ( int  chainIndex,
uint  deviceselectMask 
)
inlineprivate

Select one or more devices in the given device chain so those devices are visible.

Parameters
chainIndexThe index of the device chain to access (0..n-1).
deviceselectMaskA bit mask indicating which devices to make visible, with bit 0 corresponding to the first device, bit 1 corresponding to the second device, etc. Bit 0 is ignored as the first device is always visible.

Implements IDeviceNetworkLowLevel.

Definition at line 365 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem._deviceChains, and DeviceChain.SelectNodes().

◆ EnableDevicesInDeviceChain() [2/2]

void IDeviceNetworkHighLevel. EnableDevicesInDeviceChain ( int  chainIndex,
uint  selectMask 
)
inlineprivate

Make visible certain devices in the given device chain. The selectMask value has a bit set for each device device to make visible.

Parameters
chainIndexIndex of the device chain to access (0..NumChains-1).
selectMaskA bit mask where each bit corresponds to a device, up to the number of devices in the given device chain. Bit 0 is ignored as the first device is always visible.

Implements IDeviceNetworkLowLevel.

Definition at line 454 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem.LockDeviceChain().

◆ GetIdcodes() [1/2]

uint[] IDeviceNetworkLowLevel. GetIdcodes ( int  chainIndex)
inlineprivate

Retrieve a list of idcodes for each device in the given device chain that is visible.

Parameters
chainIndexThe index of the device chain to access (0..n-1).
Returns
An array of uints holding the idcodes for each device, with the first idcode corresponding to the first visible device. Can be empty if the chainIndex parameter is out of bounds.

Implements IDeviceNetworkLowLevel.

Definition at line 398 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem._deviceChains, and DeviceChain.GetIdCodesForVisibleNodes().

◆ GetIdcodes() [2/2]

uint[] IDeviceNetworkHighLevel. GetIdcodes ( int  chainIndex)
inlineprivate

Returns a list of all idcodes from all selected devices in the given device chain.

Parameters
chainIndexIndex of the device chain to access (0..NumChains-1).
Returns
An array holding the idcodes of all visible devices in the given chain. Can be empty if the chainIndex parameter is out of bounds.

Implements IDeviceNetworkLowLevel.

Definition at line 434 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem.LockDeviceChain().

◆ GetNumChains()

int IDeviceNetworkLowLevel. GetNumChains ( )
inlineprivate

Retrieve the number of device chains.

Returns
Returns the number of device chains

Implements IDeviceNetworkLowLevel.

Definition at line 292 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem._deviceChains.

◆ LockDeviceChain()

bool IDeviceNetworkLowLevel. LockDeviceChain ( int  chainIndex)
inlineprivate

Lock the specified device chain to indicate exclusive access is desired.

Parameters
chainIndexThe index of the device chain to access (0..n-1).
Returns
Returns true if the device chain was successfully locked; otherwise, returns false (chain index out of range or the device chain is already locked)

Implements IDeviceNetworkLowLevel.

Definition at line 304 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem._deviceChains, and DeviceChain.IsLocked.

Referenced by Facade_ComplicatedSubSystem.DisableDevicesInDeviceChain(), Facade_ComplicatedSubSystem.EnableDevicesInDeviceChain(), and Facade_ComplicatedSubSystem.GetIdcodes().

◆ ResetDeviceChain()

void IDeviceNetworkLowLevel. ResetDeviceChain ( int  chainIndex)
inlineprivate

Reset the visibility of all devices on the given device chain so that all devices except the first are not visible.

Parameters
chainIndexThe index of the device chain to access (0..n-1).

Implements IDeviceNetworkLowLevel.

Definition at line 348 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem._deviceChains, and DeviceChain.ResetVisibility().

◆ UnlockDeviceChain()

bool IDeviceNetworkLowLevel. UnlockDeviceChain ( int  chainIndex)
inlineprivate

Unlock the specified device chain to indicate exclusive access is no longer desired.

Parameters
chainIndexThe index of the device chain to access (0..n-1).
Returns
Returns true if the device chain was successfully unlocked; otherwise, returns false (chain index out of range or the device chain is already unlocked)

Implements IDeviceNetworkLowLevel.

Definition at line 327 of file Facade_ComplicatedSubSystem.cs.

References Facade_ComplicatedSubSystem._deviceChains, and DeviceChain.IsLocked.

Member Data Documentation

◆ _deviceChains

Property Documentation

◆ NumChains

int IDeviceNetworkHighLevel. NumChains
getprivate

The number of device chains available from the sub-system.

Implements IDeviceNetworkHighLevel.

Definition at line 419 of file Facade_ComplicatedSubSystem.cs.


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