DUDS
Distributed Update of Data from Something
GenericValueVisitor.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the DUDS project. It is subject to the BSD-style
3  * license terms in the LICENSE file found in the top-level directory of this
4  * distribution and at https://github.com/jjackowski/duds/blob/master/LICENSE.
5  * No part of DUDS, including this file, may be copied, modified, propagated,
6  * or distributed except according to the terms contained in the LICENSE file.
7  *
8  * Copyright (C) 2017 Jeff Jackowski
9  */
12 
13 namespace duds { namespace data {
14 
15 std::string GenericValueStringVisitor::operator() (const int128_w &n) const {
16  std::ostringstream os;
17  os << n;
18  return os.str();
19 }
20 
21 std::string GenericValueStringVisitor::operator() (const double &n) const {
22  std::ostringstream os;
23  os << n;
24  return os.str();
25 }
26 
27 std::string GenericValueStringVisitor::operator() (const boost::uuids::uuid &u) const {
28  return boost::uuids::to_string(u);
29 }
30 
31 std::string GenericValueStringVisitor::operator() (const Quantity &q) const {
32  std::ostringstream os;
34  os << q.value;
35  return os.str();
36 }
37 
39  std::ostringstream os;
40  os << s.count() << "fs";
41  return os.str();
42 }
43 
45  std::ostringstream os;
46  os << s.count() << "ns";
47  return os.str();
48 }
49 
52  std::ostringstream os;
53  os << hf;
54  return os.str();
55 }
56 
59  std::ostringstream os;
60  os << hf;
61  return os.str();
62 }
63 
64 } }
A container for a value and a unit to better describe the value.
Definition: Quantity.hpp:37
Wraps an integer to allow the Boost multiprecision library to provide insertion and extraction operat...
Definition: Int128.hpp:85
std::string operator()(const std::string &s) const
Holds Interstellar Time down to seconds in fields that increase by a power of 100, two decimal digits each, up to a 1e10 seconds field.
Definition: Hectoform.hpp:25
An extention to the C++ std::chrono::time_point template to make time points easier to work with...
std::chrono::duration< int128_t, std::femto > Femtoseconds
Stores a duration in femtoseconds.
double value
Some value; probably something measured.
Definition: Quantity.hpp:41
std::chrono::duration< std::uint64_t, std::nano > Nanoseconds
Stores a duration in nanoseconds.