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
armarx::control::hardware_config::HardwareConfig::onParsingFinished
void onParsingFinished()
This method is called when the config is completely read form the HardwareConfig file.
Definition: HardwareConfig.cpp:22
armarx::control::hardware_config::HardwareConfig::HardwareConfig
HardwareConfig()
Definition: HardwareConfig.cpp:5
armarx::control::hardware_config
Definition: Config.cpp:3
armarx::control::hardware_config::HardwareConfig::addDeviceConfig
void addDeviceConfig(const std::string name, std::shared_ptr< DeviceConfig > config)
Add a DeviceConfig.
Definition: HardwareConfig.cpp:31
armarx::control::hardware_config::HardwareConfig::checkAllItemsRead
bool checkAllItemsRead(std::vector< std::string > &errors) const
This method is called when the config is completely read form the HardwareConfig file.
Definition: HardwareConfig.cpp:42
armarx::control::hardware_config::DeviceConfig
Definition: DeviceConfig.h:42
armarx::control::hardware_config::HardwareConfig::operator<<
friend std::ostream & operator<<(std::ostream &stream, const HardwareConfig &rhs)
Print a representation of the entire structure.
Definition: HardwareConfig.h:29
DeviceConfig.h
armarx::control::hardware_config::HardwareConfig::deviceConfigs
std::map< std::string, std::shared_ptr< DeviceConfig > > deviceConfigs
Definition: HardwareConfig.h:59
armarx::control::hardware_config::HardwareConfig::getDeviceConfig
DeviceConfig & getDeviceConfig(std::string name)
Definition: HardwareConfig.cpp:10
armarx::control::hardware_config::HardwareConfig
Root of the config structure.
Definition: HardwareConfig.h:14
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33