ExampleMemory.h
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 RobotAPI::ArmarXObjects::ExampleMemory
17  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2020
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 
27 
28 #include <ArmarXCore/interface/observers/ObserverInterface.h>
30 
33 
34 
35 namespace armarx
36 {
37  /**
38  * @defgroup Component-ExampleMemory ExampleMemory
39  * @ingroup RobotAPI-Components
40  * A description of the component ExampleMemory.
41  *
42  * @class ExampleMemory
43  * @ingroup Component-ExampleMemory
44  * @brief Brief description of class ExampleMemory.
45  *
46  * Detailed description of class ExampleMemory.
47  */
48  class ExampleMemory :
49  virtual public armarx::Component
50  , virtual public armem::server::ReadWritePluginUser
52  {
53  public:
54 
55  /// @see armarx::ManagedIceObject::getDefaultName()
56  std::string getDefaultName() const override;
57 
58 
59  // WritingInterface interface
60  public:
61  armem::data::AddSegmentsResult addSegments(const armem::data::AddSegmentsInput& input, const Ice::Current&) override;
62  armem::data::CommitResult commit(const armem::data::Commit& commit, const Ice::Current& = Ice::emptyCurrent) override;
63 
64 
65  // LightweightRemoteGuiComponentPluginUser interface
66  public:
67  void createRemoteGuiTab();
68  void RemoteGui_update() override;
69 
70  // ActionsInterface interface
71  public:
72  armem::actions::GetActionsOutputSeq getActions(const armem::actions::GetActionsInputSeq& input) override;
73  armem::actions::ExecuteActionOutputSeq executeActions(const armem::actions::ExecuteActionInputSeq& input) override;
74 
75 
76  protected:
77 
79 
80  void onInitComponent() override;
81  void onConnectComponent() override;
82  void onDisconnectComponent() override;
83  void onExitComponent() override;
84 
85 
86  private:
87 
88  armem::PredictionResult predictLatest(const armem::PredictionRequest& request);
89 
91 
92  struct Properties
93  {
94  struct CoreSegments
95  {
96  std::vector<std::string> defaultCoreSegments = { "ExampleModality", "ExampleConcept" };
97  std::string _defaultSegmentsStr;
98  bool addOnUsage = false;
99  };
100 
101  CoreSegments core;
102 
103  bool enableRemoteGui = false;
104  };
105  Properties p;
106 
107 
108  struct RemoteGuiTab : RemoteGui::Client::Tab
109  {
110  std::atomic_bool rebuild = false;
111 
112  RemoteGui::Client::GroupBox memoryGroup;
113  };
114  RemoteGuiTab tab;
115 
116  };
117 }
armarx::armem::PredictionRequest
Definition: Prediction.h:49
armarx::ExampleMemory::Properties::CoreSegments::defaultCoreSegments
std::vector< std::string > defaultCoreSegments
Definition: ExampleMemory.h:96
armarx::ExampleMemory::RemoteGui_update
void RemoteGui_update() override
Definition: ExampleMemory.cpp:278
ReadWritePluginUser.h
Prediction.h
armarx::RemoteGui::Client::Tab
Definition: Tab.h:15
armarx::armem::PredictionResult
Definition: Prediction.h:58
armarx::ExampleMemory::commit
armem::data::CommitResult commit(const armem::data::Commit &commit, const Ice::Current &=Ice::emptyCurrent) override
Definition: ExampleMemory.cpp:123
armarx::ExampleMemory::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: ExampleMemory.cpp:69
armarx::ExampleMemory::Properties::CoreSegments::addOnUsage
bool addOnUsage
Definition: ExampleMemory.h:98
LightweightRemoteGuiComponentPlugin.h
armarx::ExampleMemory::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: ExampleMemory.cpp:102
armarx::ExampleMemory::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: ExampleMemory.cpp:93
armarx::ExampleMemory
Brief description of class ExampleMemory.
Definition: ExampleMemory.h:48
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:19
armarx::ExampleMemory::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ExampleMemory.cpp:41
armarx::armem::server::plugins::ReadWritePluginUser
Base class of memory server components.
Definition: ReadWritePluginUser.h:20
armarx::RemoteGui::Client::GroupBox
Definition: Widgets.h:193
armarx::ExampleMemory::addSegments
armem::data::AddSegmentsResult addSegments(const armem::data::AddSegmentsInput &input, const Ice::Current &) override
Definition: ExampleMemory.cpp:114
armarx::ExampleMemory::createRemoteGuiTab
void createRemoteGuiTab()
Definition: ExampleMemory.cpp:264
armarx::LightweightRemoteGuiComponentPluginUser
Definition: LightweightRemoteGuiComponentPlugin.h:73
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::ExampleMemory::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: ExampleMemory.cpp:106
armarx::ExampleMemory::getActions
armem::actions::GetActionsOutputSeq getActions(const armem::actions::GetActionsInputSeq &input) override
Definition: ExampleMemory.cpp:140
armarx::ExampleMemory::getDefaultName
std::string getDefaultName() const override
Definition: ExampleMemory.cpp:63
IceUtil::Handle< class PropertyDefinitionContainer >
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
armarx::ExampleMemory::Properties::CoreSegments::_defaultSegmentsStr
std::string _defaultSegmentsStr
Definition: ExampleMemory.h:97
armarx::ExampleMemory::executeActions
armem::actions::ExecuteActionOutputSeq executeActions(const armem::actions::ExecuteActionInputSeq &input) override
Definition: ExampleMemory.cpp:165
armarx::ExampleMemory::Properties::CoreSegments
Definition: ExampleMemory.h:94
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28