PredictionEntity.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package MemoryX::Core::MemoryTypes
19  * @author Manfred Kroehnert (Manfred dot Kroehnert at kit dot edu)
20  * @date 2015
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
28 #include <MemoryX/interface/memorytypes/PredictionEntities.h>
29 
30 namespace memoryx
31 {
32  class PredictionEntity;
34 
36  virtual public memoryx::PredictionEntityBase,
37  virtual public memoryx::Entity
38  {
39  public:
41  PredictionEntity(const EntityRefBasePtr& memorySnapshotRef,
42  const EntityRefBasePtr& sourceMemorySnapshotRef,
43  const EntityRefBasePtr& predictedMemorySnapshotRef,
44  const EntityRefBaseList& predictedMemorySnapshotRefList,
45  const std::string& predictionMethodName,
46  Ice::Int taskCount,
47  Ice::Float predictionScore);
49  ~PredictionEntity() override;
50 
51  void initializeAttributes();
52 
53 
54  // cloning
55  Ice::ObjectPtr ice_clone() const override;
56  PredictionEntityPtr clone(const Ice::Current& c = Ice::emptyCurrent) const;
57 
58  // PredictionEntityBase interface
59  /**
60  * @brief getProfilerMemorySnapshotRef situation (memory snapshot) that actually occured (may differ from pediction)
61  */
62  EntityRefBasePtr
63  getProfilerMemorySnapshotRef(const Ice::Current& c = Ice::emptyCurrent) const override;
64  void setProfilerMemorySnapshotRef(const EntityRefBasePtr& memorySnapshotRef,
65  const Ice::Current& c = Ice::emptyCurrent) override;
66 
67  /**
68  * @brief getSourceProfilerMemorySnapshotRef situation (memory snapshot) before the prediction
69  */
70  EntityRefBasePtr getSourceProfilerMemorySnapshotRef(
71  const Ice::Current& c = Ice::emptyCurrent) const override;
72  void setSourceProfilerMemorySnapshotRef(const EntityRefBasePtr& sourceMemorySnapshotRef,
73  const Ice::Current& c = Ice::emptyCurrent) override;
74 
75  /**
76  * @brief getPredictedProfilerMemorySnapshotRef situation (memory snapshot) which was predicted on the basis of getSourceProfilerMemorySnapshotRef()
77  */
79  const Ice::Current& c = Ice::emptyCurrent) const override;
80  void
81  setPredictedProfilerMemorySnapshotRef(const EntityRefBasePtr& predictedMemorySnapshotRef,
82  const Ice::Current& c = Ice::emptyCurrent) override;
83 
85  const Ice::Current& c = Ice::emptyCurrent) const override;
87  const EntityRefBaseList& predictedMemorySnapshotRefList,
88  const Ice::Current& c = Ice::emptyCurrent) override;
89 
90  std::string
91  getPredictionMethodName(const Ice::Current& c = Ice::emptyCurrent) const override;
92  void setPredictionMethodName(const std::string& predictionMethodName,
93  const Ice::Current& c = Ice::emptyCurrent) override;
94 
95  Ice::Int getTaskCount(const Ice::Current& c = Ice::emptyCurrent) const override;
96  void setTaskCount(Ice::Int taskCount, const Ice::Current& c = Ice::emptyCurrent) override;
97 
98  Ice::Float getPredictionScore(const Ice::Current& c = Ice::emptyCurrent) const override;
99  void setPredictionScore(Ice::Float predictionScore,
100  const Ice::Current& c = Ice::emptyCurrent) override;
101 
102  // streaming operator
103  friend std::ostream&
104  operator<<(std::ostream& stream, const PredictionEntity& rhs)
105  {
106  rhs.output(stream);
107  return stream;
108  }
109 
110  friend std::ostream&
111  operator<<(std::ostream& stream, const PredictionEntityPtr& rhs)
112  {
113  rhs->output(stream);
114  return stream;
115  }
116 
117  friend std::ostream&
118  operator<<(std::ostream& stream, const PredictionEntityBasePtr& rhs)
119  {
120  stream << PredictionEntityPtr::dynamicCast(rhs);
121  return stream;
122  }
123 
124  private:
125  void output(std::ostream& stream) const;
126 
127  static const std::string SNAPSHOT_ATTRIBUTE;
128  static const std::string SOURCE_SNAPSHOT_ATTRIBUTE;
129  static const std::string PREDICTION_ATTRIBUTE;
130  static const std::string PREDICTION_LIST_ATTRIBUTE;
131  static const std::string PREDICTION_METHOD_NAME_ATTRIBUTE;
132  static const std::string TASK_COUNT_ATTRIBUTE;
133  static const std::string PREDICTION_SCORE_ATTRIBUTE;
134  };
135 
136 } // namespace memoryx
memoryx::PredictionEntity::getPredictionMethodName
std::string getPredictionMethodName(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: PredictionEntity.cpp:183
memoryx::PredictionEntity
Definition: PredictionEntity.h:35
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:919
memoryx::PredictionEntity::initializeAttributes
void initializeAttributes()
Definition: PredictionEntity.cpp:77
memoryx::PredictionEntity::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: PredictionEntity.cpp:95
memoryx::PredictionEntity::setProfilerMemorySnapshotRef
void setProfilerMemorySnapshotRef(const EntityRefBasePtr &memorySnapshotRef, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PredictionEntity.cpp:116
memoryx::PredictionEntity::setSourceProfilerMemorySnapshotRef
void setSourceProfilerMemorySnapshotRef(const EntityRefBasePtr &sourceMemorySnapshotRef, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PredictionEntity.cpp:130
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
memoryx::PredictionEntity::operator<<
friend std::ostream & operator<<(std::ostream &stream, const PredictionEntity &rhs)
Definition: PredictionEntity.h:104
memoryx::PredictionEntity::getPredictedProfilerMemorySnapshotRefList
EntityRefBaseList getPredictedProfilerMemorySnapshotRefList(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: PredictionEntity.cpp:154
memoryx::PredictionEntity::clone
PredictionEntityPtr clone(const Ice::Current &c=Ice::emptyCurrent) const
Definition: PredictionEntity.cpp:101
IceInternal::Handle
Definition: forward_declarations.h:8
memoryx::PredictionEntity::~PredictionEntity
~PredictionEntity() override
Definition: PredictionEntity.cpp:72
memoryx::PredictionEntity::getTaskCount
Ice::Int getTaskCount(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: PredictionEntity.cpp:199
memoryx::PredictionEntity::getSourceProfilerMemorySnapshotRef
EntityRefBasePtr getSourceProfilerMemorySnapshotRef(const Ice::Current &c=Ice::emptyCurrent) const override
getSourceProfilerMemorySnapshotRef situation (memory snapshot) before the prediction
Definition: PredictionEntity.cpp:124
memoryx::PredictionEntity::PredictionEntity
PredictionEntity()
Definition: PredictionEntity.cpp:39
memoryx::PredictionEntity::setPredictedProfilerMemorySnapshotRefList
void setPredictedProfilerMemorySnapshotRefList(const EntityRefBaseList &predictedMemorySnapshotRefList, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PredictionEntity.cpp:169
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:661
memoryx::PredictionEntity::setTaskCount
void setTaskCount(Ice::Int taskCount, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PredictionEntity.cpp:205
memoryx::PredictionEntity::getProfilerMemorySnapshotRef
EntityRefBasePtr getProfilerMemorySnapshotRef(const Ice::Current &c=Ice::emptyCurrent) const override
getProfilerMemorySnapshotRef situation (memory snapshot) that actually occured (may differ from pedic...
Definition: PredictionEntity.cpp:110
memoryx::PredictionEntity::getPredictionScore
Ice::Float getPredictionScore(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: PredictionEntity.cpp:212
Entity.h
memoryx::PredictionEntity::setPredictionScore
void setPredictionScore(Ice::Float predictionScore, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PredictionEntity.cpp:218
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:917
memoryx::PredictionEntity::getPredictedProfilerMemorySnapshotRef
EntityRefBasePtr getPredictedProfilerMemorySnapshotRef(const Ice::Current &c=Ice::emptyCurrent) const override
getPredictedProfilerMemorySnapshotRef situation (memory snapshot) which was predicted on the basis of...
Definition: PredictionEntity.cpp:139
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
memoryx::PredictionEntity::setPredictionMethodName
void setPredictionMethodName(const std::string &predictionMethodName, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PredictionEntity.cpp:191
memoryx::Entity
Definition: Entity.h:245
memoryx::PredictionEntity::setPredictedProfilerMemorySnapshotRef
void setPredictedProfilerMemorySnapshotRef(const EntityRefBasePtr &predictedMemorySnapshotRef, const Ice::Current &c=Ice::emptyCurrent) override
Definition: PredictionEntity.cpp:145