WorkingMemorySnapshotListSegment.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::LongtermMemory
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
26#include <MemoryX/interface/components/LongtermMemoryInterface.h>
27
28namespace memoryx
29{
30
31 using SnapshotMap = std::map<Ice::Identity, WorkingMemorySnapshotInterfacePtr>;
32
34
36
37 class WorkingMemorySnapshotListSegment : virtual public WorkingMemorySnapshotListSegmentBase
38 {
39 public:
40 WorkingMemorySnapshotListSegment(const DatabaseInterfacePrx& databasePrx,
41 const CollectionInterfacePrx& collection,
44
45 WorkingMemorySnapshotInterfacePrx
46 createSnapshot(const ::std::string& name,
47 const AbstractWorkingMemoryInterfacePrx& workingMemory,
48 const ::Ice::Current& = Ice::emptyCurrent) override;
49 WorkingMemorySnapshotInterfacePrx
50 createSubsetSnapshot(const ::std::string& name,
51 const AbstractWorkingMemoryInterfacePrx& workingMemory,
52 const Ice::StringSeq& entityIdList,
53 const ::Ice::Current& c = Ice::emptyCurrent) override;
54 WorkingMemorySnapshotInterfacePrx
55 openSnapshot(const ::std::string& name, const ::Ice::Current& = Ice::emptyCurrent) override;
56 void closeSnapshot(const WorkingMemorySnapshotInterfacePrx& snapshot,
57 const ::Ice::Current& = Ice::emptyCurrent) override;
58 void loadSnapshot(const ::std::string& name,
59 const AbstractWorkingMemoryInterfacePrx& workingMemory,
60 const ::Ice::Current& = Ice::emptyCurrent) override;
61 bool removeSnapshot(const ::std::string& name,
62 const ::Ice::Current& = Ice::emptyCurrent) override;
63 NameList getSnapshotNames(const ::Ice::Current& = Ice::emptyCurrent) const override;
64
65 Ice::Int size(const ::Ice::Current& = Ice::emptyCurrent) const override;
66 void clear(const ::Ice::Current& = Ice::emptyCurrent) override;
67 void print(const ::Ice::Current& = Ice::emptyCurrent) const override;
68
69 protected:
70 // set segment name
71 void
72 setSegmentName(const std::string& segmentName,
73 const ::Ice::Current& = Ice::emptyCurrent) override
74 {
75 this->segmentName = segmentName;
76 }
77
78 void
79 setParentMemory(const MemoryInterfacePtr& memory, const Ice::Current&) override
80 {
81 this->parentMemory = memory;
82 }
83
84
85 private:
86 MemoryInterfacePtr parentMemory;
87 DatabaseInterfacePrx databasePrx;
88 CollectionInterfacePrx snapshotListCollection;
89 SnapshotMap openedSnapshots;
90 MongoSerializerPtr dbSerializer;
91
93
94 WorkingMemorySnapshotInterfacePrx
95 createSnapshotProxy(const WorkingMemorySnapshotPtr& snapshot, const Ice::Current& c);
96 WorkingMemorySnapshotPtr findSnapshot(const std::string& name);
97 std::string segmentName;
98
99 // AbstractMemorySegment interface
100 public:
101 Ice::Identity getIceId(const Ice::Current&) const override;
102 };
103
105
106} // namespace memoryx
constexpr T c
void setSegmentName(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
void setParentMemory(const MemoryInterfacePtr &memory, const Ice::Current &) override
bool removeSnapshot(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
NameList getSnapshotNames(const ::Ice::Current &=Ice::emptyCurrent) const override
void clear(const ::Ice::Current &=Ice::emptyCurrent) override
void print(const ::Ice::Current &=Ice::emptyCurrent) const override
void loadSnapshot(const ::std::string &name, const AbstractWorkingMemoryInterfacePrx &workingMemory, const ::Ice::Current &=Ice::emptyCurrent) override
WorkingMemorySnapshotInterfacePrx createSnapshot(const ::std::string &name, const AbstractWorkingMemoryInterfacePrx &workingMemory, const ::Ice::Current &=Ice::emptyCurrent) override
void closeSnapshot(const WorkingMemorySnapshotInterfacePrx &snapshot, const ::Ice::Current &=Ice::emptyCurrent) override
WorkingMemorySnapshotListSegment(const DatabaseInterfacePrx &databasePrx, const CollectionInterfacePrx &collection, Ice::CommunicatorPtr ic)
Ice::Identity getIceId(const Ice::Current &) const override
WorkingMemorySnapshotInterfacePrx openSnapshot(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
Ice::Int size(const ::Ice::Current &=Ice::emptyCurrent) const override
WorkingMemorySnapshotInterfacePrx createSubsetSnapshot(const ::std::string &name, const AbstractWorkingMemoryInterfacePrx &workingMemory, const Ice::StringSeq &entityIdList, const ::Ice::Current &c=Ice::emptyCurrent) override
The WorkingMemorySnapshot class handles snapshot IO methods.
::IceInternal::Handle<::Ice::Communicator > CommunicatorPtr
Definition IceManager.h:49
VirtualRobot headers.
IceUtil::Handle< WorkingMemorySnapshot > WorkingMemorySnapshotPtr
std::map< Ice::Identity, WorkingMemorySnapshotInterfacePtr > SnapshotMap
IceUtil::Handle< WorkingMemorySnapshotListSegment > WorkingMemorySnapshotListSegmentPtr
IceUtil::Handle< MongoSerializer > MongoSerializerPtr
Definition EntityRef.h:41