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 <shared_mutex>
27
28#include <Ice/ObjectAdapter.h>
29
30#include <MemoryX/interface/core/MemoryInterface.h>
31
32namespace memoryx
33{
34
36 {
37 AbstractMemorySegmentPrx proxy;
38 AbstractMemorySegmentPtr pointer;
39 };
40
41 using MemorySegmentMap = std::map<std::string, MemorySegmentEntry>;
42
43 /*!
44 * \brief The SegmentedMemory class provides an interface for organizing memories with segmented data structures.
45 */
46 class SegmentedMemory : virtual public MemoryInterface
47 {
48 protected:
49 ~SegmentedMemory() override;
50
51 public:
53
54
55 AbstractMemorySegmentPrx addSegment(const std::string& segmentName,
56 const AbstractMemorySegmentPtr& segment,
57 const ::Ice::Current& = Ice::emptyCurrent) override;
58 bool hasSegment(const std::string& segmentName,
59 const ::Ice::Current& = Ice::emptyCurrent) const override;
60 AbstractMemorySegmentPrx
61 getSegment(const std::string& segmentName,
62 const ::Ice::Current& = Ice::emptyCurrent) const override;
63 void removeSegment(const std::string& segmentName,
64 const ::Ice::Current& = Ice::emptyCurrent) override;
65 NameList getSegmentNames(const ::Ice::Current& = Ice::emptyCurrent) const override;
66
67 EntityBasePtr findEntityById(const std::string& entityId,
68 const Ice::Current& c = Ice::emptyCurrent) override;
69 EntityRefBasePtr findEntityRefById(const std::string& entityId,
70 const Ice::Current& c = Ice::emptyCurrent) override;
71
72 AbstractMemorySegmentPtr getSegmentPtr(const std::string& segmentName);
73
75
76 protected:
78 mutable std::shared_mutex segmentsMutex;
79 };
80
82
83} // namespace memoryx
constexpr T c
AbstractMemorySegmentPrx addSegment(const std::string &segmentName, const AbstractMemorySegmentPtr &segment, const ::Ice::Current &=Ice::emptyCurrent) override
virtual Ice::ObjectAdapterPtr getObjectAdapter() const =0
NameList getSegmentNames(const ::Ice::Current &=Ice::emptyCurrent) const override
MemorySegmentMap segments
EntityRefBasePtr findEntityRefById(const std::string &entityId, const Ice::Current &c=Ice::emptyCurrent) override
AbstractMemorySegmentPtr getSegmentPtr(const std::string &segmentName)
void removeSegment(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
EntityBasePtr findEntityById(const std::string &entityId, const Ice::Current &c=Ice::emptyCurrent) override
AbstractMemorySegmentPrx getSegment(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) const override
std::shared_mutex segmentsMutex
bool hasSegment(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) const override
::IceInternal::Handle<::Ice::ObjectAdapter > ObjectAdapterPtr
Definition IceManager.h:52
VirtualRobot headers.
IceInternal::Handle< SegmentedMemory > SegmentedMemoryPtr
std::map< std::string, MemorySegmentEntry > MemorySegmentMap
AbstractMemorySegmentPrx proxy
AbstractMemorySegmentPtr pointer