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 
27 #include <MemoryX/interface/workingmemory/AbstractWorkingMemoryInterface.h>
30 #include <Ice/Handle.h>
31 
32 namespace memoryx
33 {
34  class WorkingMemoryUpdater;
36 
38  {
41  {
42  }
43  };
44 
45  /**
46  * @class WorkingMemoryUpdater
47  * @brief Base class for all working memory updater processes
48  * @ingroup WorkingMemory
49  *
50  * WorkingMemoryUpdater can be registered to a memoryx::WorkingMemory. They have access to all WorkingMemorySegments and can thus read and manipulate data
51  * within these segments without the use of Ice communication. Further, they can have an Ice interface, which can be retrieved via the getUpdater method
52  * form the WorkingMemory.
53  */
55  virtual public armarx::Component,
56  virtual public WorkingMemoryUpdaterBase
57  {
58  friend class AbstractWorkingMemory;
59 
60  public:
61  /**
62  * Constructs a new working memory updater method
63  *
64  * @param name of the fusion method
65  */
67  ~WorkingMemoryUpdater() override { }
68 
70  {
71  return armarx::PropertyDefinitionsPtr(new WorkingMemoryUpdaterProperties(getConfigIdentifier()));
72  }
73 
74  protected:
75  void onInitComponent() override {}
76  void onConnectComponent() override {}
77  void onDisconnectComponent() override {}
78  void onExitComponent() override {}
79 
80  template<class T>
81  IceInternal::Handle<T> getSegment(std::string segmentName)
82  {
83  AbstractMemorySegmentPtr segment = workingMemory->getSegmentPtr(segmentName);
85  }
86 
88  {
89  return workingMemory;
90  }
91 
92  private:
93  // only accessible from friend WorkingMemory
94  void setWorkingMemory(AbstractWorkingMemoryPtr workingMemory)
95  {
96  this->workingMemory = workingMemory;
97  }
98 
99  AbstractWorkingMemoryPtr workingMemory;
100  };
101 }
102 
memoryx::WorkingMemoryUpdater::getWorkingMemory
AbstractWorkingMemoryPtr getWorkingMemory()
Definition: WorkingMemoryUpdater.h:87
memoryx::WorkingMemoryUpdater::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: WorkingMemoryUpdater.h:76
memoryx::WorkingMemoryUpdater::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: WorkingMemoryUpdater.h:69
memoryx::WorkingMemoryUpdaterProperties::WorkingMemoryUpdaterProperties
WorkingMemoryUpdaterProperties(std::string prefix)
Definition: WorkingMemoryUpdater.h:39
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
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:54
memoryx::WorkingMemoryUpdater::WorkingMemoryUpdater
WorkingMemoryUpdater()
Constructs a new working memory updater method.
Definition: WorkingMemoryUpdater.h:66
memoryx::AbstractWorkingMemoryPtr
IceUtil::Handle< AbstractWorkingMemory > AbstractWorkingMemoryPtr
Definition: AbstractWorkingMemory.h:154
WorkingMemoryEntitySegment.h
Component.h
armarx::Component
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition: Component.h:95
armarx::ComponentPropertyDefinitions
Default component property definition container.
Definition: Component.h:70
AbstractWorkingMemory.h
memoryx::WorkingMemoryUpdater::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: WorkingMemoryUpdater.h:78
IceUtil::Handle< class PropertyDefinitionContainer >
memoryx::WorkingMemoryUpdater::getSegment
IceInternal::Handle< T > getSegment(std::string segmentName)
Definition: WorkingMemoryUpdater.h:81
armarx::ComponentPropertyDefinitions::ComponentPropertyDefinitions
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Definition: Component.cpp:37
ImportExport.h
memoryx::AbstractWorkingMemory
Definition: AbstractWorkingMemory.h:73
memoryx::WorkingMemoryUpdater::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: WorkingMemoryUpdater.h:75
memoryx::WorkingMemoryUpdater::~WorkingMemoryUpdater
~WorkingMemoryUpdater() override
Definition: WorkingMemoryUpdater.h:67
memoryx::WorkingMemoryUpdater::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: WorkingMemoryUpdater.h:77
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:34
memoryx::WorkingMemoryUpdaterProperties
Definition: WorkingMemoryUpdater.h:37
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28