SegmentedMemory.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 ALexey Kozlov ( kozlov at kit dot edu)
18 * @date 2013
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
25 // Ice
26 #include <Ice/ObjectAdapter.h>
27 
28 #include <MemoryX/interface/core/MemoryInterface.h>
29 
30 #include <shared_mutex>
31 
32 namespace memoryx
33 {
34 
36  {
37  AbstractMemorySegmentPrx proxy;
38  AbstractMemorySegmentPtr pointer;
39  };
40  using MemorySegmentMap = std::map<std::string, MemorySegmentEntry>;
41 
42  /*!
43  * \brief The SegmentedMemory class provides an interface for organizing memories with segmented data structures.
44  */
46  virtual public MemoryInterface
47  {
48  protected:
49  ~SegmentedMemory() override;
50  public:
52 
53 
54  AbstractMemorySegmentPrx addSegment(const std::string& segmentName, const AbstractMemorySegmentPtr& segment, const ::Ice::Current& = Ice::emptyCurrent) override;
55  bool hasSegment(const std::string& segmentName, const ::Ice::Current& = Ice::emptyCurrent) const override;
56  AbstractMemorySegmentPrx getSegment(const std::string& segmentName, const ::Ice::Current& = Ice::emptyCurrent) const override;
57  void removeSegment(const std::string& segmentName, const ::Ice::Current& = Ice::emptyCurrent) override;
58  NameList getSegmentNames(const ::Ice::Current& = Ice::emptyCurrent) const override;
59 
60  EntityBasePtr findEntityById(const std::string& entityId, const Ice::Current& c = Ice::emptyCurrent) override;
61  EntityRefBasePtr findEntityRefById(const std::string& entityId, const Ice::Current& c = Ice::emptyCurrent) override;
62 
63  AbstractMemorySegmentPtr getSegmentPtr(const std::string& segmentName);
64 
65  virtual Ice::ObjectAdapterPtr getObjectAdapter() const = 0;
66 
67  protected:
69  mutable std::shared_mutex segmentsMutex;
70 
71  };
72 
73 
75 
76 }
77 
memoryx::SegmentedMemory::segments
MemorySegmentMap segments
Definition: SegmentedMemory.h:68
memoryx::SegmentedMemory::SegmentedMemory
SegmentedMemory()
Definition: SegmentedMemory.cpp:32
memoryx::SegmentedMemory::getSegmentPtr
AbstractMemorySegmentPtr getSegmentPtr(const std::string &segmentName)
Definition: SegmentedMemory.cpp:124
memoryx::SegmentedMemory::addSegment
AbstractMemorySegmentPrx addSegment(const std::string &segmentName, const AbstractMemorySegmentPtr &segment, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: SegmentedMemory.cpp:40
memoryx::SegmentedMemory::segmentsMutex
std::shared_mutex segmentsMutex
Definition: SegmentedMemory.h:69
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
memoryx::SegmentedMemory::getObjectAdapter
virtual Ice::ObjectAdapterPtr getObjectAdapter() const =0
memoryx::MemorySegmentMap
std::map< std::string, MemorySegmentEntry > MemorySegmentMap
Definition: SegmentedMemory.h:40
memoryx::SegmentedMemory::hasSegment
bool hasSegment(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: SegmentedMemory.cpp:69
memoryx::SegmentedMemory
The SegmentedMemory class provides an interface for organizing memories with segmented data structure...
Definition: SegmentedMemory.h:45
IceInternal::Handle< ::Ice::ObjectAdapter >
memoryx::MemorySegmentEntry::proxy
AbstractMemorySegmentPrx proxy
Definition: SegmentedMemory.h:37
memoryx::SegmentedMemory::findEntityRefById
EntityRefBasePtr findEntityRefById(const std::string &entityId, const Ice::Current &c=Ice::emptyCurrent) override
Definition: SegmentedMemory.cpp:166
memoryx::MemorySegmentEntry
Definition: SegmentedMemory.h:35
memoryx::SegmentedMemory::findEntityById
EntityBasePtr findEntityById(const std::string &entityId, const Ice::Current &c=Ice::emptyCurrent) override
Definition: SegmentedMemory.cpp:141
memoryx::MemorySegmentEntry::pointer
AbstractMemorySegmentPtr pointer
Definition: SegmentedMemory.h:38
memoryx::SegmentedMemory::removeSegment
void removeSegment(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: SegmentedMemory.cpp:91
memoryx::SegmentedMemory::getSegment
AbstractMemorySegmentPrx getSegment(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: SegmentedMemory.cpp:75
memoryx::SegmentedMemory::~SegmentedMemory
~SegmentedMemory() override
Definition: SegmentedMemory.cpp:36
memoryx::SegmentedMemory::getSegmentNames
NameList getSegmentNames(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: SegmentedMemory.cpp:110