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 
25 #include <MemoryX/interface/components/LongtermMemoryInterface.h>
26 
28 
29 namespace memoryx
30 {
31 
32  using SnapshotMap = std::map<Ice::Identity, WorkingMemorySnapshotInterfacePtr>;
33 
35 
37 
39  virtual public WorkingMemorySnapshotListSegmentBase
40  {
41  public:
42  WorkingMemorySnapshotListSegment(const DatabaseInterfacePrx& databasePrx, const CollectionInterfacePrx& collection, Ice::CommunicatorPtr ic);
44 
45  WorkingMemorySnapshotInterfacePrx createSnapshot(const ::std::string& name, const AbstractWorkingMemoryInterfacePrx& workingMemory,
46  const ::Ice::Current& = Ice::emptyCurrent) override;
47  WorkingMemorySnapshotInterfacePrx createSubsetSnapshot(const ::std::string& name, const AbstractWorkingMemoryInterfacePrx& workingMemory, const Ice::StringSeq& entityIdList,
48  const ::Ice::Current& c = Ice::emptyCurrent) override;
49  WorkingMemorySnapshotInterfacePrx openSnapshot(const ::std::string& name, const ::Ice::Current& = Ice::emptyCurrent) override;
50  void closeSnapshot(const WorkingMemorySnapshotInterfacePrx& snapshot, const ::Ice::Current& = Ice::emptyCurrent) override;
51  void loadSnapshot(const ::std::string& name, const AbstractWorkingMemoryInterfacePrx& workingMemory,
52  const ::Ice::Current& = Ice::emptyCurrent) override;
53  bool removeSnapshot(const ::std::string& name, const ::Ice::Current& = Ice::emptyCurrent) override;
54  NameList getSnapshotNames(const ::Ice::Current& = Ice::emptyCurrent) const override;
55 
56  Ice::Int size(const ::Ice::Current& = Ice::emptyCurrent) const override;
57  void clear(const ::Ice::Current& = Ice::emptyCurrent) override;
58  void print(const ::Ice::Current& = Ice::emptyCurrent) const override;
59 
60  protected:
61  // set segment name
62  void setSegmentName(const std::string& segmentName, const ::Ice::Current& = Ice::emptyCurrent) override
63  {
64  this->segmentName = segmentName;
65  }
66 
67  void setParentMemory(const MemoryInterfacePtr& memory, const Ice::Current&) override
68  {
69  this->parentMemory = memory;
70  }
71 
72 
73 
74  private:
75  MemoryInterfacePtr parentMemory;
76  DatabaseInterfacePrx databasePrx;
77  CollectionInterfacePrx snapshotListCollection;
78  SnapshotMap openedSnapshots;
79  MongoSerializerPtr dbSerializer;
80 
82 
83  WorkingMemorySnapshotInterfacePrx createSnapshotProxy(const WorkingMemorySnapshotPtr& snapshot, const Ice::Current& c);
84  WorkingMemorySnapshotPtr findSnapshot(const std::string& name);
85  std::string segmentName;
86 
87  // AbstractMemorySegment interface
88  public:
89  Ice::Identity getIceId(const Ice::Current&) const override;
90  };
91 
93 
94 }
95 
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:67
memoryx::WorkingMemorySnapshotListSegment::setSegmentName
void setSegmentName(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.h:62
memoryx::WorkingMemorySnapshotListSegment::setParentMemory
void setParentMemory(const MemoryInterfacePtr &memory, const Ice::Current &) override
Definition: WorkingMemorySnapshotListSegment.h:67
MongoSerializer.h
memoryx::WorkingMemorySnapshotListSegment::clear
void clear(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:183
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
memoryx::WorkingMemorySnapshotListSegment::print
void print(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: WorkingMemorySnapshotListSegment.cpp:193
memoryx::WorkingMemorySnapshotListSegment::WorkingMemorySnapshotListSegment
WorkingMemorySnapshotListSegment(const DatabaseInterfacePrx &databasePrx, const CollectionInterfacePrx &collection, Ice::CommunicatorPtr ic)
Definition: WorkingMemorySnapshotListSegment.cpp:39
memoryx::WorkingMemorySnapshotListSegment::createSnapshot
WorkingMemorySnapshotInterfacePrx createSnapshot(const ::std::string &name, const AbstractWorkingMemoryInterfacePrx &workingMemory, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:53
memoryx::SnapshotMap
std::map< Ice::Identity, WorkingMemorySnapshotInterfacePtr > SnapshotMap
Definition: WorkingMemorySnapshotListSegment.h:32
memoryx::WorkingMemorySnapshotListSegment::openSnapshot
WorkingMemorySnapshotInterfacePrx openSnapshot(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:80
IceInternal::Handle< ::Ice::Communicator >
memoryx::WorkingMemorySnapshotListSegment
Definition: WorkingMemorySnapshotListSegment.h:38
memoryx::WorkingMemorySnapshotListSegment::loadSnapshot
void loadSnapshot(const ::std::string &name, const AbstractWorkingMemoryInterfacePrx &workingMemory, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:103
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:523
memoryx::WorkingMemorySnapshot
The WorkingMemorySnapshot class handles snapshot IO methods.
Definition: WorkingMemorySnapshot.h:42
memoryx::WorkingMemorySnapshotListSegment::getIceId
Ice::Identity getIceId(const Ice::Current &) const override
Definition: WorkingMemorySnapshotListSegment.cpp:171
memoryx::WorkingMemorySnapshotListSegment::size
Ice::Int size(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: WorkingMemorySnapshotListSegment.cpp:178
memoryx::WorkingMemorySnapshotListSegment::~WorkingMemorySnapshotListSegment
~WorkingMemorySnapshotListSegment() override
Definition: WorkingMemorySnapshotListSegment.cpp:49
memoryx::WorkingMemorySnapshotListSegment::getSnapshotNames
NameList getSnapshotNames(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: WorkingMemorySnapshotListSegment.cpp:142
memoryx::WorkingMemorySnapshotListSegment::removeSnapshot
bool removeSnapshot(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:126
memoryx::WorkingMemorySnapshotListSegment::closeSnapshot
void closeSnapshot(const WorkingMemorySnapshotInterfacePrx &snapshot, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: WorkingMemorySnapshotListSegment.cpp:93
IceUtil::Handle
Definition: forward_declarations.h:29
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:916