FREEDM DGI
CDeviceBuilder.hpp
Go to the documentation of this file.
1 
23 #ifndef C_DEVICE_BUILDER_HPP
24 #define C_DEVICE_BUILDER_HPP
25 
26 #include "CDevice.hpp"
27 
28 #include <map>
29 #include <set>
30 #include <string>
31 #include <utility>
32 
33 namespace freedm {
34 namespace broker {
35 namespace device {
36 
48 {
49 public:
52 
54  CDeviceBuilder(std::string filename);
55 
57  DeviceInfo GetDeviceInfo(std::string type);
58 
60  CDevice::Pointer CreateDevice(std::string id, std::string type,
61  IAdapter::Pointer adapter);
62 private:
64  struct BuildVars
65  {
67  std::map<std::pair<std::string, std::string>, std::string> s_conflict;
68 
70  std::set<std::string> s_undefined_type;
71 
73  std::set<std::string> s_uninitialized_type;
74  };
75 
77  void ExpandInfo(std::string target, std::set<std::string> path,
78  BuildVars & vars);
79 
81  std::map<std::string, DeviceInfo> m_type_to_info;
82 };
83 
84 } // namespace device
85 } // namespace broker
86 } // namespace freedm
87 
88 #endif // C_DEVICE_BUILDER_HPP
CDeviceBuilder()
Default constructor.
Definition: CDeviceBuilder.hpp:51
Handles construction of all device objects used by the DGI.
Definition: CDeviceBuilder.hpp:47
Stores the variables required to populate the device information map.
Definition: CDeviceBuilder.hpp:64
Stores the internal structure of a device object.
Definition: CDevice.hpp:40
std::set< std::string > s_uninitialized_type
Stores the device types that have no type information.
Definition: CDeviceBuilder.hpp:73
boost::shared_ptr< CDevice > Pointer
Pointer to physical device interface.
Definition: CDevice.hpp:77
General FREEDM Namespace.
Definition: CBroker.cpp:53
void ExpandInfo(std::string target, std::set< std::string > path, BuildVars &vars)
Recursive function to populate the device information map.
Definition: CDeviceBuilder.cpp:229
CDevice::Pointer CreateDevice(std::string id, std::string type, IAdapter::Pointer adapter)
Builds and returns a shared pointer to a new device object.
Definition: CDeviceBuilder.cpp:319
DeviceInfo GetDeviceInfo(std::string type)
Accessor that returns the device information for a device type.
Definition: CDeviceBuilder.cpp:300
boost::shared_ptr< IAdapter > Pointer
Pointer to a physical adapter.
Definition: IAdapter.hpp:72
std::map< std::string, DeviceInfo > m_type_to_info
Map from device type to its associated device information.
Definition: CDeviceBuilder.hpp:81
std::set< std::string > s_undefined_type
Stores the device types that have not been defined.
Definition: CDeviceBuilder.hpp:70
std::map< std::pair< std::string, std::string >, std::string > s_conflict
Maps a pair of device types to a shared signal name.
Definition: CDeviceBuilder.hpp:67