HardwareConfig.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4
6
8{
9 class DeviceConfig;
10
11 /**
12 * @brief Root of the config structure.
13 */
15 {
16
17 public:
19
20 DeviceConfig& getDeviceConfig(std::string name);
21
22 /**
23 * @brief Print a representation of the entire structure
24 * @param stream
25 * @param rhs the HardwareConfig structure to be printed
26 * @return
27 */
28 friend std::ostream&
29 operator<<(std::ostream& stream, const HardwareConfig& rhs)
30 {
31 std::stringstream s;
32 for (auto& dev : rhs.deviceConfigs)
33 {
34 dev.second->print(s, 0);
35 }
36 stream << s.str();
37 return stream;
38 }
39
40 /**
41 * @brief This method is called when the config is completely read form the HardwareConfig file.
42 * It starts the tracking of which item is read from this Config object.
43 */
44 void onParsingFinished();
45
46 /**
47 * @brief Add a DeviceConfig
48 * @param name the DeviceConfig name
49 * @param config the DeviceConfig object
50 */
51 void addDeviceConfig(const std::string name, std::shared_ptr<DeviceConfig> config);
52
53 /**
54 * @brief This method is called when the config is completely read form the HardwareConfig file.
55 * It starts the tracking of which item is read from this Config object.
56 */
57 bool checkAllItemsRead(std::vector<std::string>& errors) const;
58
59 std::map<std::string, std::shared_ptr<DeviceConfig>> deviceConfigs;
60 };
61} // namespace armarx::control::hardware_config
friend std::ostream & operator<<(std::ostream &stream, const HardwareConfig &rhs)
Print a representation of the entire structure.
void addDeviceConfig(const std::string name, std::shared_ptr< DeviceConfig > config)
Add a DeviceConfig.
void onParsingFinished()
This method is called when the config is completely read form the HardwareConfig file.
bool checkAllItemsRead(std::vector< std::string > &errors) const
This method is called when the config is completely read form the HardwareConfig file.
DeviceConfig & getDeviceConfig(std::string name)
std::map< std::string, std::shared_ptr< DeviceConfig > > deviceConfigs