StatisticMeasures.cpp
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 Lesser 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 Adil Orhan (ubdnw at student dot kit dot edu)
20  * @date 2015
21  * @copyright http://www.gnu.org/licenses/gpl.txt
22  * GNU General Public License
23  */
24 
25 #include "StatisticMeasures.h"
26 
28 
29 namespace memoryx
30 {
31 
33  {
34  mean = 0;
35  standardDeviation = 0;
36  relativeStandardDeviation = 0;
37  }
38 
39  StatisticMeasures::StatisticMeasures(double mean, double standardDeviation, double relativeStandardDeviation)
40  {
41  this->mean = mean;
42  this->standardDeviation = standardDeviation;
43  this->relativeStandardDeviation = relativeStandardDeviation;
44  }
45 
47  {
48  }
49 
51  {
52  return mean;
53  }
54 
56  {
57  return standardDeviation;
58  }
59 
61  {
62  return relativeStandardDeviation;
63  }
64 
66  {
67  return this->clone();
68  }
69 
70  armarx::VariantDataClassPtr StatisticMeasures::clone(const Ice::Current& c) const
71  {
72  return new StatisticMeasures(*this);
73  }
74 
75  std::string StatisticMeasures::output(const Ice::Current&) const
76  {
77  std::stringstream ss;
78  ss << "mean " << mean << " standardDeviation " << standardDeviation << " relativeStandardDeviation " << relativeStandardDeviation;
79  return ss.str();
80  }
81 
83  {
85  }
86 
87  bool StatisticMeasures::validate(const Ice::Current& c)
88  {
89  return true;
90  }
91 
92  void StatisticMeasures::serialize(const armarx::ObjectSerializerBasePtr& serializer, const Ice::Current&) const
93  {
94  armarx::AbstractObjectSerializerPtr obj = armarx::AbstractObjectSerializerPtr::dynamicCast(serializer);
95 
96  obj->setDouble("mean", mean);
97  obj->setDouble("standardDeviation", standardDeviation);
98  obj->setDouble("relativeStandardDeviation", relativeStandardDeviation);
99  }
100 
101  void StatisticMeasures::deserialize(const armarx::ObjectSerializerBasePtr& serializer, const Ice::Current&)
102  {
103  armarx::AbstractObjectSerializerPtr obj = armarx::AbstractObjectSerializerPtr::dynamicCast(serializer);
104 
105  mean = obj->getDouble("mean");
106  standardDeviation = obj->getDouble("standardDeviation");
107  relativeStandardDeviation = obj->getDouble("relativeStandardDeviation");
108  }
109 
110 }
memoryx::StatisticMeasures::deserialize
void deserialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: StatisticMeasures.cpp:101
memoryx::StatisticMeasures::serialize
void serialize(const armarx::ObjectSerializerBasePtr &serializer, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: StatisticMeasures.cpp:92
memoryx::StatisticMeasures::getRelativeStandardDeviation
double getRelativeStandardDeviation()
Definition: StatisticMeasures.cpp:60
AbstractObjectSerializer.h
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
memoryx::StatisticMeasures::~StatisticMeasures
~StatisticMeasures() override
Definition: StatisticMeasures.cpp:46
memoryx::VariantType::StatisticMeasures
const armarx::VariantTypeId StatisticMeasures
Definition: StatisticMeasures.h:32
memoryx::StatisticMeasures::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: StatisticMeasures.cpp:65
memoryx::StatisticMeasures::getMean
double getMean()
Definition: StatisticMeasures.cpp:50
IceInternal::Handle
Definition: forward_declarations.h:8
StatisticMeasures.h
armarx::mean
std::optional< float > mean(const boost::circular_buffer< NameValueMap > &buffer, const std::string &key)
Definition: KinematicUnitGuiPlugin.cpp:1615
memoryx::StatisticMeasures::getStandardDeviation
double getStandardDeviation()
Definition: StatisticMeasures.cpp:55
memoryx::StatisticMeasures::getType
armarx::VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: StatisticMeasures.cpp:82
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:44
memoryx::StatisticMeasures::output
std::string output(const Ice::Current &=Ice::emptyCurrent) const override
Definition: StatisticMeasures.cpp:75
memoryx::StatisticMeasures::validate
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Definition: StatisticMeasures.cpp:87
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
memoryx::StatisticMeasures::StatisticMeasures
StatisticMeasures()
Definition: StatisticMeasures.cpp:32
memoryx::StatisticMeasures::clone
armarx::VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: StatisticMeasures.cpp:70