100 uint32_t bitMask = 0x2;
101 size_t numNodes =
_nodes.size();
104 for (
size_t index = 1; index < numNodes; ++index)
106 if ((bitMask & nodeSelectMask) != 0)
108 _nodes[index].Visible = makeVisible;
163 node.Visible =
false;
200 std::vector<uint32_t> idcodes;
206 idcodes.push_back(node.Idcode);
279 if (chainIndex >= 0 && chainIndex <
static_cast<int>(
_deviceChains.size()))
300 bool unlocked =
false;
302 if (chainIndex >= 0 && chainIndex <
static_cast<int>(
_deviceChains.size()))
321 if (chainIndex >= 0 && chainIndex <
static_cast<int>(
_deviceChains.size()))
338 if (chainIndex >= 0 && chainIndex <
static_cast<int>(
_deviceChains.size()))
355 if (chainIndex >= 0 && chainIndex <
static_cast<int>(
_deviceChains.size()))
370 std::vector<uint32_t> idcodes;
372 if (chainIndex >= 0 && chainIndex <
static_cast<int>(
_deviceChains.size()))
374 idcodes =
_deviceChains[chainIndex].GetIdCodesForVisibleNodes();
389 static std::unique_ptr<Facade_ComplicatedSubSystem>
_instance;
400 _instance = std::make_unique<Facade_ComplicatedSubSystem>();
Declaration of the IDeviceNetworkLowLevel interface representing the complicated sub-system used in t...
Represents a device chain, which is a collection of DeviceNode objects. Part of the Facade Pattern ex...
std::vector< DeviceNode > _nodes
The list of TAPNodes on this device chain.
bool IsLocked
Whether this device chain is locked for access.
DeviceChain(std::string name)
Constructor.
void DeselectNodes(uint32_t nodeSelectMask)
Make invisible one or more devices in the device chain.
std::vector< uint32_t > GetIdCodesForVisibleNodes()
Retrieve a list of idcodes for all devices that are visible in the device chain.
void SelectNodes(uint32_t nodeSelectMask)
Make visible one or more devices in the device chain.
void ResetVisibility()
Resets the device chain so that all devices that are not CLdevices are no longer visible in the devic...
std::string Name
The Name of this device chain.
void _ShowHideNodes(uint32_t nodeSelectMask, bool makeVisible)
Helper method to show or hide devices on the device chain.
void AddNode(DeviceNode node)
Helper method to add a DeviceNode to the device chain. DeviceNode objects that are of DeviceTypes::DE...
Represents some kind of system that contains multiple device chains. Part of the Facade Pattern examp...
bool UnlockDeviceChain(int chainIndex) override
Unlock the specified device chain to indicate exclusive access is no longer desired.
void EnableDevicesInDeviceChain(int chainIndex, uint32_t deviceselectMask) override
Select one or more devices in the given device chain so those devices are visible.
void ResetDeviceChain(int chainIndex) override
Reset the visibility of all devices on the given device chain so that all devices except the first ar...
std::vector< uint32_t > GetIdcodes(int chainIndex) override
Retrieve a list of idcodes for each device in the given device chain that is visible.
std::vector< DeviceChain > _deviceChains
The list of device chains. In this case, there are two.
Facade_ComplicatedSubSystem()
(private) Constructor. Sets up the device chains.
int GetNumChains()
Retrieve the number of device chains.
bool LockDeviceChain(int chainIndex) override
Lock the specified device chain to indicate exclusive access is desired.
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.
Declaration of the IDeviceNetworkHighLevel interface representing the high-level system used in the F...
The namespace containing all Design Pattern Examples implemented in C++.
IDeviceNetworkLowLevel * CreateLowLevelInstance()
Class factory for a singleton instance of the sub-system class. Part of the Facade Pattern example.
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.
static std::unique_ptr< Facade_ComplicatedSubSystem > _instance
A singleton instance of the sub-system. Part of the Facade Pattern example.
Represents a single device. Part of the Facade Pattern example.
DeviceTypes DeviceType
A value from the DeviceTypes enumeration identifying the type of the device.
DeviceNode(std::string name, uint32_t idcode, DeviceTypes tapType, bool initiallyVisible)
Constructor.
bool Visible
Whether the device is visible in the device chain.
std::string Name
Name of this device.
uint32_t Idcode
The idcode for this device.
Represents a network of device chains and the low level access to that network. In general,...