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 
28 namespace 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
memoryx::WorkingMemorySnapshotListSegment::createSubsetSnapshot
WorkingMemorySnapshotInterfacePrx createSubsetSnapshot(const ::std::string &name, const AbstractWorkingMemoryInterfacePrx &workingMemory, const Ice::StringSeq &entityIdList, const ::Ice::Current &c=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:72
memoryx::WorkingMemorySnapshotListSegment::setSegmentName
void setSegmentName(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.h:72
memoryx::WorkingMemorySnapshotListSegment::setParentMemory
void setParentMemory(const MemoryInterfacePtr &memory, const Ice::Current &) override
Definition: WorkingMemorySnapshotListSegment.h:79
MongoSerializer.h
memoryx::WorkingMemorySnapshotListSegment::clear
void clear(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:209
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
memoryx::WorkingMemorySnapshotListSegment::print
void print(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: WorkingMemorySnapshotListSegment.cpp:220
memoryx::WorkingMemorySnapshotListSegment::WorkingMemorySnapshotListSegment
WorkingMemorySnapshotListSegment(const DatabaseInterfacePrx &databasePrx, const CollectionInterfacePrx &collection, Ice::CommunicatorPtr ic)
Definition: WorkingMemorySnapshotListSegment.cpp:40
memoryx::WorkingMemorySnapshotListSegment::createSnapshot
WorkingMemorySnapshotInterfacePrx createSnapshot(const ::std::string &name, const AbstractWorkingMemoryInterfacePrx &workingMemory, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:55
memoryx::SnapshotMap
std::map< Ice::Identity, WorkingMemorySnapshotInterfacePtr > SnapshotMap
Definition: WorkingMemorySnapshotListSegment.h:31
memoryx::WorkingMemorySnapshotListSegment::openSnapshot
WorkingMemorySnapshotInterfacePrx openSnapshot(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:90
IceInternal::Handle<::Ice::Communicator >
memoryx::WorkingMemorySnapshotListSegment
Definition: WorkingMemorySnapshotListSegment.h:37
memoryx::WorkingMemorySnapshotListSegment::loadSnapshot
void loadSnapshot(const ::std::string &name, const AbstractWorkingMemoryInterfacePrx &workingMemory, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:119
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:570
memoryx::WorkingMemorySnapshot
The WorkingMemorySnapshot class handles snapshot IO methods.
Definition: WorkingMemorySnapshot.h:41
memoryx::WorkingMemorySnapshotListSegment::getIceId
Ice::Identity getIceId(const Ice::Current &) const override
Definition: WorkingMemorySnapshotListSegment.cpp:195
memoryx::WorkingMemorySnapshotListSegment::size
Ice::Int size(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: WorkingMemorySnapshotListSegment.cpp:203
memoryx::WorkingMemorySnapshotListSegment::~WorkingMemorySnapshotListSegment
~WorkingMemorySnapshotListSegment() override
Definition: WorkingMemorySnapshotListSegment.cpp:50
memoryx::WorkingMemorySnapshotListSegment::getSnapshotNames
NameList getSnapshotNames(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: WorkingMemorySnapshotListSegment.cpp:161
memoryx::WorkingMemorySnapshotListSegment::removeSnapshot
bool removeSnapshot(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:144
memoryx::WorkingMemorySnapshotListSegment::closeSnapshot
void closeSnapshot(const WorkingMemorySnapshotInterfacePrx &snapshot, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:106
IceUtil::Handle
Definition: forward_declarations.h:30
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:917