WorkingMemoryUpdater.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 MemoryX::Core
17 * @author Kai Welke <welke@kit.edu>
18 * @copyright 2012 Kai Welke
19 * @license http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
25 #include <Ice/Handle.h>
26 
29 
30 #include <MemoryX/interface/workingmemory/AbstractWorkingMemoryInterface.h>
33 
34 namespace memoryx
35 {
36  class WorkingMemoryUpdater;
38 
40  {
43  {
44  }
45  };
46 
47  /**
48  * @class WorkingMemoryUpdater
49  * @brief Base class for all working memory updater processes
50  * @ingroup WorkingMemory
51  *
52  * WorkingMemoryUpdater can be registered to a memoryx::WorkingMemory. They have access to all WorkingMemorySegments and can thus read and manipulate data
53  * within these segments without the use of Ice communication. Further, they can have an Ice interface, which can be retrieved via the getUpdater method
54  * form the WorkingMemory.
55  */
57  virtual public armarx::Component,
58  virtual public WorkingMemoryUpdaterBase
59  {
60  friend class AbstractWorkingMemory;
61 
62  public:
63  /**
64  * Constructs a new working memory updater method
65  *
66  * @param name of the fusion method
67  */
69  {
70  }
71 
73  {
74  }
75 
78  {
80  new WorkingMemoryUpdaterProperties(getConfigIdentifier()));
81  }
82 
83  protected:
84  void
85  onInitComponent() override
86  {
87  }
88 
89  void
90  onConnectComponent() override
91  {
92  }
93 
94  void
96  {
97  }
98 
99  void
100  onExitComponent() override
101  {
102  }
103 
104  template <class T>
106  getSegment(std::string segmentName)
107  {
108  AbstractMemorySegmentPtr segment = workingMemory->getSegmentPtr(segmentName);
109  return IceInternal::Handle<T>::dynamicCast(segment);
110  }
111 
114  {
115  return workingMemory;
116  }
117 
118  private:
119  // only accessible from friend WorkingMemory
120  void
121  setWorkingMemory(AbstractWorkingMemoryPtr workingMemory)
122  {
123  this->workingMemory = workingMemory;
124  }
125 
126  AbstractWorkingMemoryPtr workingMemory;
127  };
128 } // namespace memoryx
memoryx::WorkingMemoryUpdater::getWorkingMemory
AbstractWorkingMemoryPtr getWorkingMemory()
Definition: WorkingMemoryUpdater.h:113
memoryx::WorkingMemoryUpdater::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: WorkingMemoryUpdater.h:90
memoryx::WorkingMemoryUpdater::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: WorkingMemoryUpdater.h:77
memoryx::WorkingMemoryUpdaterProperties::WorkingMemoryUpdaterProperties
WorkingMemoryUpdaterProperties(std::string prefix)
Definition: WorkingMemoryUpdater.h:41
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
IceInternal::Handle
Definition: forward_declarations.h:8
memoryx::WorkingMemoryUpdater
Base class for all working memory updater processes.
Definition: WorkingMemoryUpdater.h:56
memoryx::WorkingMemoryUpdater::WorkingMemoryUpdater
WorkingMemoryUpdater()
Constructs a new working memory updater method.
Definition: WorkingMemoryUpdater.h:68
memoryx::AbstractWorkingMemoryPtr
IceUtil::Handle< AbstractWorkingMemory > AbstractWorkingMemoryPtr
Definition: AbstractWorkingMemory.h:175
WorkingMemoryEntitySegment.h
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:91
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:69
AbstractWorkingMemory.h
memoryx::WorkingMemoryUpdater::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: WorkingMemoryUpdater.h:100
IceUtil::Handle< class PropertyDefinitionContainer >
memoryx::WorkingMemoryUpdater::getSegment
IceInternal::Handle< T > getSegment(std::string segmentName)
Definition: WorkingMemoryUpdater.h:106
armarx::ComponentPropertyDefinitions::ComponentPropertyDefinitions
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition: Component.cpp:35
ImportExport.h
memoryx::AbstractWorkingMemory
Definition: AbstractWorkingMemory.h:82
memoryx::WorkingMemoryUpdater::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: WorkingMemoryUpdater.h:85
memoryx::WorkingMemoryUpdater::~WorkingMemoryUpdater
~WorkingMemoryUpdater() override
Definition: WorkingMemoryUpdater.h:72
memoryx::WorkingMemoryUpdater::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: WorkingMemoryUpdater.h:95
ARMARXCORE_IMPORT_EXPORT
#define ARMARXCORE_IMPORT_EXPORT
Definition: ImportExport.h:38
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
memoryx::WorkingMemoryUpdaterProperties
Definition: WorkingMemoryUpdater.h:39
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27