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

Public Member Functions

 Facade_ComplicatedSubSystem ()
 (private) Constructor. Sets up the device chains.
 
- Public Member Functions inherited from IDeviceNetworkLowLevel
virtual ~IDeviceNetworkLowLevel ()
 
virtual int GetNumChains ()=0
 Retrieve the number of device chains available in the network.
 
virtual bool LockDeviceChain (int chainIndex)=0
 Lock the specified device chain for exclusive access.
 
virtual bool UnlockDeviceChain (int chainIndex)=0
 Unlock the specified device chain to release exclusive access.
 
virtual void ResetDeviceChain (int chainIndex)=0
 Reset the visibility of all devices on the specified device chain.
 
virtual void EnableDevicesInDeviceChain (int chainIndex, uint32_t devicesSelectMask)=0
 Make visible the specified devices on the specified device chain.
 
virtual void DisableDevicesInDeviceChain (int chainIndex, uint32_t devicesSelectMask)=0
 Make invisible the specified devices on the specified device chain.
 
virtual std::vector< uint32_t > GetIdcodes (int chainIndex)=0
 Retrieve a list of idcodes of all visible devices in the given device chain.
 

Public Attributes

std::vector< DeviceChain_deviceChains { DeviceChain("CHAIN0"), DeviceChain("CHAIN1") }
 The list of device chains. In this case, there are two.
 

Private Member Functions

int GetNumChains ()
 Retrieve the number of device chains.
 
bool LockDeviceChain (int chainIndex) override
 Lock the specified device chain to indicate exclusive access is desired.
 
bool UnlockDeviceChain (int chainIndex) override
 Unlock the specified device chain to indicate exclusive access is no longer desired.
 
void ResetDeviceChain (int chainIndex) override
 Reset the visibility of all devices on the given device chain so that all devices except the first are not visible.
 
void EnableDevicesInDeviceChain (int chainIndex, uint32_t deviceselectMask) override
 Select one or more devices in the given device chain so those devices are visible.
 
void DisableDevicesInDeviceChain (int chainIndex, uint32_t deviceselectMask) override
 Deselect one or more devices in the given device chain so those devices are no longer visible.
 
std::vector< uint32_t > GetIdcodes (int chainIndex) override
 Retrieve a list of idcodes for each device in the given device chain that is 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 233 of file Facade_ComplicatedSubSystem.cpp.

Constructor & Destructor Documentation

◆ Facade_ComplicatedSubSystem()

Member Function Documentation

◆ DisableDevicesInDeviceChain()

void DisableDevicesInDeviceChain ( int  chainIndex,
uint32_t  deviceselectMask 
)
inlineoverrideprivatevirtual

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 353 of file Facade_ComplicatedSubSystem.cpp.

References Facade_ComplicatedSubSystem::_deviceChains.

◆ EnableDevicesInDeviceChain()

void EnableDevicesInDeviceChain ( int  chainIndex,
uint32_t  deviceselectMask 
)
inlineoverrideprivatevirtual

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 336 of file Facade_ComplicatedSubSystem.cpp.

References Facade_ComplicatedSubSystem::_deviceChains.

◆ GetIdcodes()

std::vector< uint32_t > GetIdcodes ( int  chainIndex)
inlineoverrideprivatevirtual

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.

Implements IDeviceNetworkLowLevel.

Definition at line 368 of file Facade_ComplicatedSubSystem.cpp.

References Facade_ComplicatedSubSystem::_deviceChains.

◆ GetNumChains()

int GetNumChains ( )
inlineprivatevirtual

Retrieve the number of device chains.

Returns
Returns the number of device chains

Implements IDeviceNetworkLowLevel.

Definition at line 263 of file Facade_ComplicatedSubSystem.cpp.

References Facade_ComplicatedSubSystem::_deviceChains.

◆ LockDeviceChain()

bool LockDeviceChain ( int  chainIndex)
inlineoverrideprivatevirtual

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 275 of file Facade_ComplicatedSubSystem.cpp.

References Facade_ComplicatedSubSystem::_deviceChains.

◆ ResetDeviceChain()

void ResetDeviceChain ( int  chainIndex)
inlineoverrideprivatevirtual

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 319 of file Facade_ComplicatedSubSystem.cpp.

References Facade_ComplicatedSubSystem::_deviceChains.

◆ UnlockDeviceChain()

bool UnlockDeviceChain ( int  chainIndex)
inlineoverrideprivatevirtual

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 298 of file Facade_ComplicatedSubSystem.cpp.

References Facade_ComplicatedSubSystem::_deviceChains.

Member Data Documentation

◆ _deviceChains


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