9#include "helpers/formatstring.h"
28 for (uint32_t idcode : idcodes)
32 std::cout <<
"]" << std::endl;
60 std::cout << std::endl;
61 std::cout <<
"Facade Exercise" << std::endl;
64 int numChains = deviceChainFacade->
NumChains();
66 <<
" Showing idcodes of devices after a device reset (expect one device on each chain)..."
68 for (
int chainIndex = 0; chainIndex < numChains; ++chainIndex)
71 std::vector<uint32_t> idcodes = deviceChainFacade->
GetIdcodes(chainIndex);
75 std::cout <<
" Showing idcodes of devices after selecting all devices..."
77 for (
int chainIndex = 0; chainIndex < numChains; ++chainIndex)
80 std::vector<uint32_t> idcodes = deviceChainFacade->
GetIdcodes(chainIndex);
84 std::cout <<
" Done." << std::endl;
static void _Facade_ShowIdCodes(int chainIndex, UIntArray *idcodes)
Helper function to present a formatted list of idcodes for a particular device chain....
Declaration of the IDeviceNetworkLowLevel interface representing the complicated sub-system used in t...
Declaration of the Facade_Exercise() function as used in the Facade Pattern.
Declaration of the IDeviceNetworkHighLevel interface representing the high-level system used in the F...
The namespace containing all Design Pattern Examples implemented in C++.
IDeviceNetworkHighLevel * CreateHighLevelInstance()
Class factory for a singleton instance of the IDeviceNetworkHighLevel interface. Part of the Facade P...
void Facade_Exercise()
Example of using the Facade design pattern.
std::string formatstring(const char *fmt,...)
Use the given string and arguments to return a buffer containing the formatted string....
Represents a high level view of a complex network of device chains. A device chain can be thought of ...
virtual void EnableDevicesInDeviceChain(int chainIndex, uint32_t selectMask)=0
Make visible certain devices in the given device chain. The selectMask value has a bit set for each T...
virtual void DisableDevicesInDeviceChain(int chainIndex)=0
Resets the given device chain so that all devices except the TAP controller is no longer visible.
virtual std::vector< uint32_t > GetIdcodes(int chainIndex)=0
Returns a list of all idcodes from all selected devices in the given device chain.
virtual int NumChains()=0
The number of device chains available from the sub-system.