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
28template class ::IceInternal::Handle<::armarx::TimedVariant>;
29
30namespace armarx
31{
35
37 IceUtil::Shared(source),
38 Ice::Object(source),
39 VariantBase(source),
40 Variant(dynamic_cast<const Variant&>(source)),
41 TimedVariantBase(source)
42 {
43 }
44
45 TimedVariant::TimedVariant(const Variant& variant, const IceUtil::Time& time) :
46 IceUtil::Shared(variant),
47 Ice::Object(variant),
48 VariantBase(variant),
49 Variant(variant),
50 TimedVariantBase()
51
52 {
53 timestamp = time.toMicroSeconds();
54 initialized = variant.getInitialized(Ice::emptyCurrent);
55 }
56
57 TimedVariant::TimedVariant(const VariantPtr& variant, const IceUtil::Time& time)
58 {
59 data = variant->data;
60 Ice::Current c;
61 typeId = variant->getType(c);
62 timestamp = time.toMicroSeconds();
63 initialized = variant->getInitialized(c);
64 }
65
69
70 IceUtil::Time
72 {
73 return IceUtil::Time::microSeconds(timestamp);
74 }
75
76 Ice::Long
77 TimedVariant::getTimestamp(const Ice::Current& c) const
78 {
79 return timestamp;
80 }
81
82 Ice::ObjectPtr
84 {
85 return new TimedVariant(*this);
86 }
87
88 std::string
90 {
92 " \nTime: " + IceUtil::Time::microSeconds(timestamp).toDateTime();
93 }
94} // namespace armarx
std::string timestamp()
constexpr T c
Ice::Long getTimestamp(const Ice::Current &c=Ice::emptyCurrent) const override
Timestamp in micro seconds.
std::string getOutputValueOnly() const override
Returns the formatted content of the Variant as a string.
Ice::ObjectPtr ice_clone() const override
IceUtil::Time getTime() const
bool getInitialized(const Ice::Current &c=Ice::emptyCurrent) const override
Tells if the Variant is properly initialized.
Definition Variant.cpp:698
virtual std::string getOutputValueOnly() const
Returns the formatted content of the Variant as a string.
Definition Variant.cpp:608
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< Variant > VariantPtr
Definition Variant.h:41