TimedVariant.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-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 Lesser General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
10 *
11 * ArmarX is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @package ArmarX::
20 * @author Mirko Waechter ( mirko.waechter at kit dot edu)
21 * @date 2015
22 * @copyright http://www.gnu.org/licenses/gpl.txt
23 * GNU General Public License
24 */
25 
26 #include "TimedVariant.h"
27 
28 template class ::IceInternal::Handle<::armarx::TimedVariant>;
29 
30 namespace armarx
31 {
32  TimedVariant::TimedVariant()
33  {
34 
35  }
36 
37  TimedVariant::TimedVariant(const TimedVariant& source) :
38  IceUtil::Shared(source),
39  Ice::Object(source),
40  VariantBase(source),
41  Variant(dynamic_cast<const Variant&>(source)),
42  TimedVariantBase(source)
43  {
44 
45  }
46 
47  TimedVariant::TimedVariant(const Variant& variant, const IceUtil::Time& time) :
48  IceUtil::Shared(variant),
49  Ice::Object(variant),
50  VariantBase(variant),
51  Variant(variant),
52  TimedVariantBase()
53 
54  {
55  timestamp = time.toMicroSeconds();
56  initialized = variant.getInitialized(Ice::emptyCurrent);
57  }
58 
60  {
61  data = variant->data;
62  Ice::Current c;
63  typeId = variant->getType(c);
64  timestamp = time.toMicroSeconds();
65  initialized = variant->getInitialized(c);
66  }
67 
69  {
70 
71  }
72 
74  {
75  return IceUtil::Time::microSeconds(timestamp);
76  }
77 
78  Ice::Long TimedVariant::getTimestamp(const Ice::Current& c) const
79  {
80  return timestamp;
81  }
82 
84  {
85  return new TimedVariant(*this);
86  }
87 
89  {
90  return Variant::getOutputValueOnly() + " \nTime: " + IceUtil::Time::microSeconds(timestamp).toDateTime();
91  }
92 }
armarx::TimedVariant::~TimedVariant
~TimedVariant() override
Definition: TimedVariant.cpp:68
armarx::Variant
The Variant class is described here: Variants.
Definition: Variant.h:224
armarx::Variant::getInitialized
bool getInitialized(const Ice::Current &c=Ice::emptyCurrent) const override
Tells if the Variant is properly initialized.
Definition: Variant.cpp:591
armarx::TimedVariant::getTimestamp
Ice::Long getTimestamp(const Ice::Current &c=Ice::emptyCurrent) const override
Timestamp in micro seconds.
Definition: TimedVariant.cpp:78
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
IceUtil
Definition: Instance.h:21
IceInternal::Handle< Variant >
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
armarx::TimedVariant::TimedVariant
TimedVariant()
Definition: TimedVariant.cpp:32
armarx::TimedVariant::getOutputValueOnly
std::string getOutputValueOnly() const override
Returns the formatted content of the Variant as a string.
Definition: TimedVariant.cpp:88
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:917
armarx::Variant::getOutputValueOnly
virtual std::string getOutputValueOnly() const
Returns the formatted content of the Variant as a string.
Definition: Variant.cpp:504
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:681
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::Variant::initialized
bool initialized
Definition: Variant.h:726
TimedVariant.h
armarx::TimedVariant::getTime
IceUtil::Time getTime() const
Definition: TimedVariant.cpp:73
Ice
Definition: DBTypes.cpp:64
armarx::TimedVariant::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: TimedVariant.cpp:83
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::TimedVariant
Definition: TimedVariant.h:40