DemoStateManager.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package ArmarXGui::DemoStateManager
17  * @author Leonie Leven
18  * @date 2024
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #include "DemoStateManager.h"
24 
25 namespace armarx
26 {
27  void
29  {
30 
31  this->defaultStartUp = getProperty<std::string>("DefaultStateStartUp").getValue();
32  this->defaultStateValues = getProperty<std::string>("DefaultStates").getValue();
33  std::size_t pos = defaultStartUp.find(":");
34  std::string message = "";
35  int i = 0;
36  if (pos != std::string::npos)
37  {
38  message = defaultStartUp.substr(0, pos);
39  i = std::stoi(defaultStartUp.substr(pos + 1));
40  }
41  this->currentSeverity = static_cast<severity::SeverityEnum>(i);
42  this->currentState = message;
43  }
44 
45  void
47  {
48  }
49 
50  void
52  {
53  }
54 
55  void
57  {
58  }
59 
62  {
64  new ::armarx::ComponentPropertyDefinitions(getConfigIdentifier());
65  def->required(properties.defaultStates, "DefaultStates", "");
66  def->required(properties.defaultStateStartUp, "DefaultStateStartUp", "");
67  return def;
68  }
69 
70  void
71  DemoStateManager::setState(const std::string& state,
72  armarx::severity::SeverityEnum severity,
73  const Ice::Current&)
74  {
75  this->currentSeverity = severity;
76  this->currentState = state;
77  }
78 
79  void
80  DemoStateManager::clear(const Ice::Current&)
81  {
82  this->currentSeverity = severity::SeverityEnum::normal;
83  this->currentState = clearMessage;
84  }
85 
86  StateAndSeverity
88  {
89  return {this->currentState, this->currentSeverity};
90  }
91 
92  std::string
93  DemoStateManager::getDefaultStates(const ::Ice::Current&)
94  {
95  return this->defaultStateValues;
96  }
97 
98 } // namespace armarx
armarx::DemoStateManager::onExitComponent
void onExitComponent() override
Definition: DemoStateManager.cpp:56
armarx::DemoStateManager::onConnectComponent
void onConnectComponent() override
Definition: DemoStateManager.cpp:46
DemoStateManager.h
message
message(STATUS "Boost-Library-Dir: " "${Boost_LIBRARY_DIRS}") message(STATUS "Boost-LIBRARIES
Definition: CMakeLists.txt:8
armarx::DemoStateManager::onDisconnectComponent
void onDisconnectComponent() override
Definition: DemoStateManager.cpp:51
armarx::DemoStateManager::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: DemoStateManager.cpp:61
armarx::DemoStateManager::onInitComponent
void onInitComponent() override
Definition: DemoStateManager.cpp:28
armarx::DemoStateManager::setState
void setState(const std::string &state, armarx::severity::SeverityEnum severity, const Ice::Current &=::Ice::Current()) override
Definition: DemoStateManager.cpp:71
armarx::DemoStateManager::clearMessage
const std::string clearMessage
Definition: DemoStateManager.h:38
armarx::DemoStateManager::clear
void clear(const ::Ice::Current &=::Ice::Current()) override
Definition: DemoStateManager.cpp:80
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:79
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::DemoStateManager::getStateAndSeverity
StateAndSeverity getStateAndSeverity(const ::Ice::Current &=::Ice::Current()) override
Definition: DemoStateManager.cpp:87
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::DemoStateManager::getDefaultStates
std::string getDefaultStates(const ::Ice::Current &=::Ice::Current()) override
Definition: DemoStateManager.cpp:93