33#include <boost/array.hpp>
34#include <boost/tuple/tuple.hpp>
43#ifdef ROBOTRACONTEUR_USE_SMALL_VECTOR
44#include <boost/container/small_vector.hpp>
47#include <boost/asio/buffer.hpp>
49#include <boost/utility/value_init.hpp>
50#include <boost/container/static_vector.hpp>
51#include <boost/foreach.hpp>
52#include <boost/range/adaptor/map.hpp>
53#include <boost/range/numeric.hpp>
55#include <boost/smart_ptr/intrusive_ref_counter.hpp>
57#include <boost/numeric/conversion/cast.hpp>
59#include <boost/lexical_cast.hpp>
61#include <boost/utility/string_ref.hpp>
63#include <boost/variant.hpp>
65#include <boost/date_time/posix_time/ptime.hpp>
66#include "boost/date_time/posix_time/posix_time_types.hpp"
70namespace RobotRaconteur
141ROBOTRACONTEUR_CORE_API
bool operator==(
const cdouble& c1,
const cdouble& c2);
142ROBOTRACONTEUR_CORE_API
bool operator!=(
const cdouble& c1,
const cdouble& c2);
143ROBOTRACONTEUR_CORE_API
bool operator==(
const cfloat& c1,
const cfloat& c2);
144ROBOTRACONTEUR_CORE_API
bool operator!=(
const cfloat& c1,
const cfloat& c2);
145ROBOTRACONTEUR_CORE_API
bool operator==(
const rr_bool& c1,
const rr_bool& c2);
146ROBOTRACONTEUR_CORE_API
bool operator!=(
const rr_bool& c1,
const rr_bool& c2);
148template <
typename T,
typename U>
152 static RR_SHARED_PTR<T> rr_cast(
const RR_SHARED_PTR<U>& objin)
155 return RR_SHARED_PTR<T>();
157 RR_SHARED_PTR<T> c = RR_DYNAMIC_POINTER_CAST<T>(objin);
166 static RR_INTRUSIVE_PTR<T> rr_cast(
const RR_INTRUSIVE_PTR<U>& objin)
169 return RR_INTRUSIVE_PTR<T>();
171 RR_INTRUSIVE_PTR<T> c = RR_DYNAMIC_POINTER_CAST<T>(objin);
182class rr_cast_support<T, T>
185 static const RR_SHARED_PTR<T>& rr_cast(
const RR_SHARED_PTR<T>& objin) {
return objin; }
187 static const RR_INTRUSIVE_PTR<T>& rr_cast(
const RR_INTRUSIVE_PTR<T>& objin) {
return objin; }
199template <
typename T,
typename U>
200static RR_SHARED_PTR<T>
rr_cast(
const RR_SHARED_PTR<U>& objin)
202 return rr_cast_support<T, U>::rr_cast(objin);
215template <
typename T,
typename U>
216static RR_INTRUSIVE_PTR<T>
rr_cast(
const RR_INTRUSIVE_PTR<U>& objin)
218 return rr_cast_support<T, U>::rr_cast(objin);
228class ROBOTRACONTEUR_CORE_API RRObject : boost::noncopyable
233 virtual ~RRObject() {}
252class ROBOTRACONTEUR_CORE_API RRValue :
public boost::intrusive_ref_counter<RRValue>, boost::noncopyable
257 virtual ~RRValue() {}
259 virtual std::string RRType() = 0;
264class ROBOTRACONTEUR_CORE_API MessageStringData
270class ROBOTRACONTEUR_CORE_API MessageStringData_string_ref
273 boost::string_ref ref;
274 MessageStringData_string_ref(
const boost::string_ref& r) : ref(r) {}
276class ROBOTRACONTEUR_CORE_API MessageStringData_static_string
279 boost::string_ref ref;
280 MessageStringData_static_string(
const boost::string_ref& r) : ref(r) {}
285class ROBOTRACONTEUR_CORE_API MessageStringRef;
287class ROBOTRACONTEUR_CORE_API MessageStringPtr
290 boost::variant<detail::MessageStringData, detail::MessageStringData_static_string> _str_ptr;
293 friend class MessageStringRef;
297 MessageStringPtr(
const std::string& str);
298 MessageStringPtr(boost::string_ref str,
bool is_static =
false);
299 MessageStringPtr(
const MessageStringPtr& str_ptr);
300 MessageStringPtr(
const MessageStringRef& str_ref);
301#ifndef ROBOTRACONTEUR_NO_CXX11
302 MessageStringPtr(std::string&& str);
306 inline MessageStringPtr(
const char (&str)[N])
308 init_literal(str, strlen(str));
311 boost::string_ref str()
const;
314 bool operator==(MessageStringRef b)
const;
315 bool operator!=(MessageStringRef b)
const;
316 bool operator<(MessageStringRef b)
const;
319 void init_literal(
const char* str,
size_t len);
322class ROBOTRACONTEUR_CORE_API MessageStringRef
325 boost::variant<
const detail::MessageStringData*, detail::MessageStringData_static_string,
326 detail::MessageStringData_string_ref>
330 friend class MessageStringPtr;
332 MessageStringRef(
const std::string& str);
333 MessageStringRef(boost::string_ref str,
bool is_static =
false);
334 MessageStringRef(
const MessageStringPtr& str_ptr);
335 MessageStringRef(
const MessageStringRef& str_ref);
339 inline MessageStringRef(
const char (&str)[N])
341 init_literal(str, strlen(str));
344 bool operator==(MessageStringRef b)
const;
345 bool operator!=(MessageStringRef b)
const;
347 boost::string_ref str()
const;
350 void init_literal(
const char* str,
size_t len);
353std::size_t hash_value(
const RobotRaconteur::MessageStringPtr& k);
355ROBOTRACONTEUR_CORE_API std::ostream& operator<<(std::ostream& out,
const MessageStringPtr& str);
356ROBOTRACONTEUR_CORE_API std::ostream& operator<<(std::ostream& out,
const MessageStringRef& str);
359inline boost::iterator_range<boost::string_ref::const_iterator> to_range(
const boost::string_ref& str)
361 return boost::iterator_range<boost::string_ref::const_iterator>(str.cbegin(), str.cend());
364inline std::string operator+(
const char* lhs, boost::string_ref rhs) {
return lhs + rhs.to_string(); }
366inline std::string operator+(
const std::string& lhs, boost::string_ref rhs) {
return lhs + rhs.to_string(); }
368inline std::string operator+(boost::string_ref lhs,
const char* rhs) {
return lhs.to_string() + rhs; }
377 virtual MessageStringPtr GetTypeString() = 0;
412ROBOTRACONTEUR_CORE_API RR_INTRUSIVE_PTR<RRArray<char> >
stringToRRArray(boost::string_ref str);
430 static RR_INTRUSIVE_PTR<T> PrePack(
const T& val) {
return val; }
432 template <
typename U>
433 static T PreUnpack(U& val)
435 return rr_cast<T>(val);
438 virtual ~RRPrimUtil(){};
440 typedef RR_INTRUSIVE_PTR<RRValue> BoxedType;
444class RRPrimUtil<RR_INTRUSIVE_PTR<T> >
448 static MessageStringPtr GetElementTypeString() {
return MessageStringPtr(
""); }
450 static boost::string_ref GetRRElementTypeString() {
return ""; }
452 static RR_INTRUSIVE_PTR<RRValue> PrePack(
const RR_INTRUSIVE_PTR<T>& val) {
return rr_cast<RRValue>(val); }
454 template <
typename U>
455 static RR_INTRUSIVE_PTR<T> PreUnpack(
const U& val)
457 return rr_cast<T>(val);
460 virtual ~RRPrimUtil(){};
462 typedef RR_INTRUSIVE_PTR<T> BoxedType;
466class RRPrimUtil<std::string>
470 static MessageStringPtr GetElementTypeString() {
return MessageStringPtr(
""); }
471 static boost::string_ref GetRRElementTypeString() {
return ""; }
472 static RR_INTRUSIVE_PTR<RRValue> PrePack(boost::string_ref val);
473 static std::string PreUnpack(
const RR_INTRUSIVE_PTR<RRValue>& val);
475 virtual ~RRPrimUtil(){};
477 typedef RR_INTRUSIVE_PTR<RRArray<char> > BoxedType;
480#define RRPrimUtilNumeric(x, code) \
482 class RRPrimUtil<x> \
485 static DataTypes GetTypeID() { return code; } \
486 static MessageStringPtr GetElementTypeString() { return MessageStringPtr(""); } \
487 static boost::string_ref GetRRElementTypeString() { return ""; } \
488 static RR_INTRUSIVE_PTR<RRArray<x> > PrePack(const x& val); \
489 template <typename U> \
490 static x PreUnpack(const U& val) \
492 return RRArrayToScalar(rr_cast<RRArray<x> >(val)); \
494 typedef RR_INTRUSIVE_PTR<RRArray<x> > BoxedType; \
513ROBOTRACONTEUR_CORE_API std::string GetRRDataTypeString(
DataTypes type);
514ROBOTRACONTEUR_CORE_API
bool IsTypeRRArray(
DataTypes type);
515ROBOTRACONTEUR_CORE_API
bool IsTypeNumeric(
DataTypes type);
528 RR_OVIRTUAL MessageStringPtr GetTypeString() RR_OVERRIDE
530 std::string type = GetRRDataTypeString(GetTypeID());
543 RR_OVIRTUAL std::string RRType() RR_OVERRIDE;
581 RR_OVIRTUAL
DataTypes GetTypeID() RR_OVERRIDE {
return RRPrimUtil<T>::GetTypeID(); }
583 RRArray(T*
data,
size_t length,
bool owned) : data_(
data), element_count(length), owned(owned) {}
585 RR_OVIRTUAL ~RRArray() RR_OVERRIDE
593 T* operator->()
const {
return data; }
595 RR_OVIRTUAL
size_t size() RR_OVERRIDE {
return element_count; }
597 RR_OVIRTUAL
size_t ElementSize() RR_OVERRIDE {
return sizeof(T); }
655 BOOST_ASSERT_MSG(i < element_count,
"out of range");
662 BOOST_ASSERT_MSG(i < element_count,
"out of range");
697 const T*
data()
const {
return data_; }
701 T* c_array() {
return data_; }
710 template <
typename T2>
732 void rangecheck(size_type i)
736 std::out_of_range e(
"array<>: index out of range");
737 boost::throw_exception(e);
743 size_t element_count;
749inline RR_INTRUSIVE_PTR<RRValue> RRPrimUtil<std::string>::PrePack(boost::string_ref val)
754inline std::string RRPrimUtil<std::string>::PreUnpack(
const RR_INTRUSIVE_PTR<RRValue>& val)
759#define RRPrimUtilNumericPrePack(x) \
760 inline RR_INTRUSIVE_PTR<RRArray<x> > RRPrimUtil<x>::PrePack(const x& val) { return ScalarToRRArray(val); }
762RRPrimUtilNumericPrePack(
double);
763RRPrimUtilNumericPrePack(
float);
764RRPrimUtilNumericPrePack(int8_t);
765RRPrimUtilNumericPrePack(uint8_t);
766RRPrimUtilNumericPrePack(int16_t);
767RRPrimUtilNumericPrePack(uint16_t);
768RRPrimUtilNumericPrePack(int32_t);
769RRPrimUtilNumericPrePack(uint32_t);
770RRPrimUtilNumericPrePack(int64_t);
771RRPrimUtilNumericPrePack(uint64_t);
772RRPrimUtilNumericPrePack(
char);
773RRPrimUtilNumericPrePack(cdouble);
774RRPrimUtilNumericPrePack(cfloat);
775RRPrimUtilNumericPrePack(rr_bool);
777#undef RRPrimUtilNumericPrePack
783 static boost::string_ref get()
785 BOOST_STATIC_ASSERT_MSG(
sizeof(T) == 0,
"Invalid key type for Robot Raconteur map");
786 throw DataTypeException(
"Unknown data type");
789 static std::string get_map_rrtype()
791 BOOST_STATIC_ASSERT_MSG(
sizeof(T) == 0,
"Invalid key type for Robot Raconteur map");
792 throw DataTypeException(
"Unknown data type");
797class RRMap_keytype<int32_t>
800 static boost::string_ref get() {
return "int32_t"; }
802 static std::string get_map_rrtype() {
return "RobotRaconteur.RRMap<int32_t>"; }
806class RRMap_keytype<std::string>
809 static boost::string_ref get() {
return "string"; }
811 static std::string get_map_rrtype() {
return "RobotRaconteur.RRMap<string>"; }
824template <
typename K,
typename T>
825class RRMap :
public RRValue
828 std::map<K, RR_INTRUSIVE_PTR<T> > map;
833 RRMap(
const std::map<K, RR_INTRUSIVE_PTR<T> >& mapin) : map(mapin) {}
835 RR_OVIRTUAL ~RRMap() RR_OVERRIDE {}
837 RR_OVIRTUAL std::string RRType() RR_OVERRIDE {
return RRMap_keytype<K>::get_map_rrtype(); }
891 bool empty()
const {
return map.empty(); }
908 return map.insert(x);
911 template <
class InputIterator>
912 void insert(InputIterator first, InputIterator last)
914 map.insert(first, last);
951class RRList :
public RRValue
954 std::list<RR_INTRUSIVE_PTR<T> > list;
959 RRList(std::list<RR_INTRUSIVE_PTR<T> > listin) { list = listin; }
961 RR_OVIRTUAL ~RRList() RR_OVERRIDE {}
963 RR_OVIRTUAL std::string RRType() RR_OVERRIDE {
return "RobotRaconteur.RRList"; }
1017 bool empty()
const {
return list.empty(); }
1031 void push_front(
const RR_INTRUSIVE_PTR<T>& x) { list.push_front(x); }
1033 void push_back(
const RR_INTRUSIVE_PTR<T>& x) { list.push_back(x); }
1047 void remove(
const RR_INTRUSIVE_PTR<T>& value) { list.remove(value); }
1088template <
typename T>
1091 return RR_INTRUSIVE_PTR<RRArray<T> >(
new RRArray<T>(
new T[length], length,
true));
1112template <
typename T>
1113static RR_INTRUSIVE_PTR<RRArray<T> >
AttachRRArray(T* data,
size_t length,
bool owned)
1115 return RR_INTRUSIVE_PTR<RRArray<T> >(
new RRArray<T>(data, length, owned));
1130template <
typename T>
1133 RR_INTRUSIVE_PTR<RRArray<T> > ret(
new RRArray<T>(
new T[length], length,
true));
1134 memcpy(ret->void_ptr(), data, length *
sizeof(T));
1171template <
typename T>
1177 memset(
static_cast<void*
>(o->data()), 0, length *
sizeof(T));
1204template <
typename T>
1217template <
typename T>
1225 if (value->size() == 0)
1244template <
typename Y,
typename U>
1249 std::vector<Y> out(in->size());
1250 for (
size_t i = 0; i < in->size(); i++)
1251 out[i] = boost::numeric_cast<Y>((*in)[i]);
1266template <
typename Y,
typename U>
1270 for (
size_t i = 0; i < in.size(); i++)
1271 (*out)[i] = boost::numeric_cast<Y>(in[i]);
1287template <
typename Y, std::
size_t N,
typename U>
1292 if (in->size() != N)
1294 boost::array<Y, N> out = {};
1295 for (
size_t i = 0; i < N; i++)
1296 out[i] = boost::numeric_cast<Y>((*in)[i]);
1311template <
typename Y, std::
size_t N,
typename U>
1316 if (in->size() != N)
1318 for (
size_t i = 0; i < N; i++)
1319 out[i] = boost::numeric_cast<Y>((*in)[i]);
1334template <
typename Y,
typename U, std::
size_t N>
1338 for (
size_t i = 0; i < N; i++)
1339 (*out)[i] = boost::numeric_cast<Y>(in[i]);
1357template <
typename Y, std::
size_t N,
typename U>
1364 boost::container::static_vector<Y, N> out(in->size());
1365 for (
size_t i = 0; i < in->size(); i++)
1366 out[i] = boost::numeric_cast<Y>((*in)[i]);
1384template <
typename Y, std::
size_t N,
typename U>
1391 out.resize(in->size());
1392 for (
size_t i = 0; i < in->size(); i++)
1393 out[i] = boost::numeric_cast<Y>((*in)[i]);
1410template <
typename Y,
typename U, std::
size_t N>
1414 for (
size_t i = 0; i < in.size(); i++)
1415 (*out)[i] = boost::numeric_cast<Y>(in[i]);
1428 const std::vector<std::string>& string_vector);
1452template <
typename T>
1475template <
typename T>
1496template <
typename T>
1519template <
typename T>
1520const RR_INTRUSIVE_PTR<T>&
rr_null_check(
const RR_INTRUSIVE_PTR<T>& ptr,
const char* msg)
1529#define RR_NULL_CHECK rr_null_check
1531template <
typename T>
1532static RR_INTRUSIVE_PTR<RRArray<T> > VerifyRRArrayLength(
const RR_INTRUSIVE_PTR<RRArray<T> >& a,
size_t len,
1536 throw NullValueException(
"Arrays must not be null");
1539 if (varlength && (a->size() > len))
1541 throw DataTypeException(
"Array dimension mismatch");
1543 if (!varlength && (a->size() != len))
1545 throw DataTypeException(
"Array dimension mismatch");
1551template <
typename T>
1552static RR_INTRUSIVE_PTR<RRList<T> > VerifyRRArrayLength(
const RR_INTRUSIVE_PTR<RRList<T> >& a,
size_t len,
1557 BOOST_FOREACH (RR_INTRUSIVE_PTR<T>& aa, (*a))
1559 VerifyRRArrayLength(aa, len, varlength);
1564template <
typename K,
typename T>
1565static RR_INTRUSIVE_PTR<RRMap<K, T> > VerifyRRArrayLength(
const RR_INTRUSIVE_PTR<RRMap<K, T> >& a,
size_t len,
1570 BOOST_FOREACH (
const RR_INTRUSIVE_PTR<T>& aa, *a | boost::adaptors::map_values)
1572 VerifyRRArrayLength(aa, len, varlength);
1589 virtual DataTypes GetElementTypeID() = 0;
1594ROBOTRACONTEUR_CORE_API
class MultiDimArray_CalculateCopyIndicesIter
1597 virtual bool Next(uint32_t& indexa, uint32_t& indexb, uint32_t& len) = 0;
1599 virtual ~MultiDimArray_CalculateCopyIndicesIter();
1603ROBOTRACONTEUR_CORE_API RR_SHARED_PTR<MultiDimArray_CalculateCopyIndicesIter>
1604MultiDimArray_CalculateCopyIndicesBeginIter(
const std::vector<uint32_t>& mema_dims,
1605 const std::vector<uint32_t>& mema_pos,
1606 const std::vector<uint32_t>& memb_dims,
1607 const std::vector<uint32_t>& memb_pos,
const std::vector<uint32_t>& count);
1610ROBOTRACONTEUR_CORE_API
void MultiDimArray_CheckArraySize(
const std::vector<uint32_t>& dims,
size_t array_size);
1633template <
typename T>
1637 RR_INTRUSIVE_PTR<RRArray<uint32_t> > Dims;
1639 RR_INTRUSIVE_PTR<RRArray<T> > Array;
1641 RRMultiDimArray(){};
1646 this->Array = Array;
1649 RR_OVIRTUAL ~RRMultiDimArray() RR_OVERRIDE {}
1651 RR_OVIRTUAL std::string RRType() RR_OVERRIDE {
return "RobotRaconteur.RRMultiDimArray"; }
1653 RR_OVIRTUAL
DataTypes GetElementTypeID() RR_OVERRIDE {
return RRPrimUtil<T>::GetTypeID(); }
1664 const RR_INTRUSIVE_PTR<RRMultiDimArray<T> >& buffer,
1665 const std::vector<uint32_t>& bufferpos,
const std::vector<uint32_t>& count)
1670 detail::MultiDimArray_CheckArraySize(mema_dims, Array->size());
1671 detail::MultiDimArray_CheckArraySize(memb_dims, buffer->Array->size());
1672 RR_SHARED_PTR<detail::MultiDimArray_CalculateCopyIndicesIter> iter =
1673 detail::MultiDimArray_CalculateCopyIndicesBeginIter(mema_dims, memorypos, memb_dims, bufferpos, count);
1676 uint32_t indexa = 0;
1677 uint32_t indexb = 0;
1679 while (iter->Next(indexa, indexb, len))
1681 memcpy((buffer->Array->data() + indexb), (Array->data()) + indexa, len *
sizeof(T));
1694 const RR_INTRUSIVE_PTR<RRMultiDimArray<T> >& buffer,
1695 const std::vector<uint32_t>& bufferpos,
const std::vector<uint32_t>& count)
1700 detail::MultiDimArray_CheckArraySize(mema_dims, Array->size());
1701 detail::MultiDimArray_CheckArraySize(memb_dims, buffer->Array->size());
1702 RR_SHARED_PTR<detail::MultiDimArray_CalculateCopyIndicesIter> iter =
1703 detail::MultiDimArray_CalculateCopyIndicesBeginIter(mema_dims, memorypos, memb_dims, bufferpos, count);
1706 uint32_t indexa = 0;
1707 uint32_t indexb = 0;
1709 while (iter->Next(indexa, indexb, len))
1711 memcpy((Array->data() + indexa), (buffer->Array->data() + indexb), len *
sizeof(T));
1716template <
size_t Ndims,
typename T>
1717static RR_INTRUSIVE_PTR<RRMultiDimArray<T> > VerifyRRMultiDimArrayLength(
const RR_INTRUSIVE_PTR<RRMultiDimArray<T> >& a,
1719 const boost::array<uint32_t, Ndims>& dims)
1722 throw NullValueException(
"Arrays must not be null");
1724 if (a->Dims->size() != Ndims)
1726 throw DataTypeException(
"Array dimension mismatch");
1729 if (a->Array->size() != n_elems)
1731 throw DataTypeException(
"Array dimension mismatch");
1734 for (
size_t i = 0; i < Ndims; i++)
1736 if ((*a->Dims)[i] != dims[i])
1738 throw DataTypeException(
"Array dimension mismatch");
1745template <
size_t Ndims,
typename T>
1746static RR_INTRUSIVE_PTR<RRList<T> > VerifyRRMultiDimArrayLength(
const RR_INTRUSIVE_PTR<RRList<T> >& a,
size_t n_elems,
1747 const boost::array<uint32_t, Ndims>& dims)
1756 BOOST_FOREACH (
const RR_INTRUSIVE_PTR<T>& aa, (*a))
1758 VerifyRRMultiDimArrayLength<Ndims>(aa, n_elems, dims);
1764template <
size_t Ndims,
typename K,
typename T>
1765static RR_INTRUSIVE_PTR<RRMap<K, T> > VerifyRRMultiDimArrayLength(
const RR_INTRUSIVE_PTR<RRMap<K, T> >& a,
1767 const boost::array<uint32_t, Ndims>& dims)
1776 BOOST_FOREACH (
const RR_INTRUSIVE_PTR<T>& aa, *a | boost::adaptors::map_values)
1778 VerifyRRMultiDimArrayLength<Ndims>(aa, n_elems, dims);
1794template <
typename T>
1797 uint32_t n_elems = boost::accumulate(dims, 1, std::multiplies<uint32_t>());
1807template <
typename T>
1810 std::vector<uint32_t> length;
1811 length.push_back(0);
1825template <
typename T>
1838template <
typename T>
1852template <
typename T,
typename U>
1865template <
typename K,
typename T>
1880template <
typename K,
typename T,
typename U>
1907 virtual boost::string_ref RRElementTypeString() = 0;
1924template <
typename T>
1928 typename std::vector<T> pod_array;
1931 RRPodArray(
size_t n) { pod_array.resize(n); }
1933 RRPodArray(
typename std::vector<T>& array_in) : pod_array(array_in) {}
1935 RRPodArray(
const T& value_in) { pod_array.push_back(value_in); }
1937 RR_OVIRTUAL ~RRPodArray() RR_OVERRIDE {}
1939 RR_OVIRTUAL std::string RRType() RR_OVERRIDE {
return "RobotRaconteur.RRPodArray"; }
1941 RR_OVIRTUAL boost::string_ref RRElementTypeString() RR_OVERRIDE {
return RRPrimUtil<T>::GetRRElementTypeString(); }
1991 bool empty()
const {
return pod_array.empty(); }
2013 T*
data() {
return pod_array.data(); }
2015 const T*
data()
const {
return pod_array.data(); }
2027#define RRPrimUtilPod(x, type_string) \
2029 class RRPrimUtil<x> \
2032 static DataTypes GetTypeID() { return DataTypes_pod_t; } \
2033 static MessageStringPtr GetElementTypeString() { return MessageStringPtr(type_string); } \
2034 static boost::string_ref GetRRElementTypeString() { return type_string; } \
2035 static RR_INTRUSIVE_PTR<RRPodArray<x> > PrePack(const x& val) { return ScalarToRRPodArray(val); } \
2036 template <typename U> \
2037 static x PreUnpack(const U& val) \
2039 return RRPodArrayToScalar(rr_cast<RRPodArray<x> >(val)); \
2041 typedef RR_INTRUSIVE_PTR<RRPodArray<x> > BoxedType; \
2054 RR_INTRUSIVE_PTR<RRArray<uint32_t> > Dims;
2055 virtual boost::string_ref RRElementTypeString() = 0;
2077template <
typename T>
2081 typename RR_INTRUSIVE_PTR<RRPodArray<T> > PodArray;
2083 RRPodMultiDimArray() {}
2091 RR_OVIRTUAL ~RRPodMultiDimArray() RR_OVERRIDE {}
2093 RR_OVIRTUAL std::string RRType() RR_OVERRIDE {
return "RobotRaconteur.RRPodMultiDimArray"; }
2095 RR_OVIRTUAL boost::string_ref RRElementTypeString() RR_OVERRIDE {
return RRPrimUtil<T>::GetRRElementTypeString(); }
2106 const RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> >& buffer,
2107 const std::vector<uint32_t>& bufferpos,
const std::vector<uint32_t>& count)
2112 detail::MultiDimArray_CheckArraySize(mema_dims, PodArray->size());
2113 detail::MultiDimArray_CheckArraySize(memb_dims, buffer->PodArray->size());
2114 RR_SHARED_PTR<detail::MultiDimArray_CalculateCopyIndicesIter> iter =
2115 detail::MultiDimArray_CalculateCopyIndicesBeginIter(mema_dims, memorypos, memb_dims, bufferpos, count);
2118 uint32_t indexa = 0;
2119 uint32_t indexb = 0;
2121 while (iter->Next(indexa, indexb, len))
2123 for (
size_t i = 0; i < len; i++)
2125 buffer->PodArray->at(indexb + i) = PodArray->at(indexa + i);
2139 const RR_INTRUSIVE_PTR<RRPodMultiDimArray<T> >& buffer,
2140 const std::vector<uint32_t>& bufferpos,
const std::vector<uint32_t>& count)
2145 detail::MultiDimArray_CheckArraySize(mema_dims, PodArray->size());
2146 detail::MultiDimArray_CheckArraySize(memb_dims, buffer->PodArray->size());
2147 RR_SHARED_PTR<detail::MultiDimArray_CalculateCopyIndicesIter> iter =
2148 detail::MultiDimArray_CalculateCopyIndicesBeginIter(mema_dims, memorypos, memb_dims, bufferpos, count);
2151 uint32_t indexa = 0;
2152 uint32_t indexb = 0;
2154 while (iter->Next(indexa, indexb, len))
2156 for (
size_t i = 0; i < len; i++)
2158 PodArray->at(indexa + i) = buffer->PodArray->at(indexb + i);
2171template <
typename T>
2184template <
typename T>
2192 if (value->size() == 0)
2195 return value->at(0);
2211template <
typename T>
2230template <
typename T>
2233 uint32_t n_elems = boost::accumulate(dims, 1, std::multiplies<uint32_t>());
2247template <
typename T>
2250 std::vector<uint32_t> length;
2251 length.push_back(0);
2255#define RRPrimUtilNamedArray(x, type_string, array_type) \
2257 class RRPrimUtil<x> \
2260 static DataTypes GetTypeID() { return DataTypes_pod_t; } \
2261 static MessageStringPtr GetElementTypeString() { return MessageStringPtr(type_string); } \
2262 static boost::string_ref GetRRElementTypeString() { return type_string; } \
2263 static RR_INTRUSIVE_PTR<RRNamedArray<x> > PrePack(const x& val) { return ScalarToRRNamedArray(val); } \
2264 template <typename U> \
2265 static x PreUnpack(const U& val) \
2267 return RRNamedArrayToScalar(rr_cast<RRNamedArray<x> >(val)); \
2269 typedef RR_INTRUSIVE_PTR<RRNamedArray<x> > BoxedType; \
2270 typedef array_type ElementArrayType; \
2271 static const size_t ElementArrayCount = sizeof(x) / sizeof(array_type); \
2272 static size_t GetElementArrayCount() { return ElementArrayCount; } \
2273 static DataTypes GetElementArrayTypeID() { return RRPrimUtil<array_type>::GetTypeID(); } \
2285 virtual DataTypes ElementArrayType() = 0;
2287 virtual size_t ElementSize() = 0;
2289 virtual size_t ElementArrayCount() = 0;
2291 virtual RR_INTRUSIVE_PTR<RRBaseArray> GetNumericBaseArray() = 0;
2293 virtual boost::string_ref RRElementTypeString() = 0;
2310template <
typename T>
2314 RR_INTRUSIVE_PTR<RRArray<typename RRPrimUtil<T>::ElementArrayType> > rr_array;
2333 this->rr_array = rr_array;
2336 virtual DataTypes GetTypeID() {
return RRPrimUtil<T>::GetTypeID(); }
2338 virtual size_t size()
const {
return rr_array->size() / (RRPrimUtil<T>::ElementArrayCount); }
2340 virtual size_t size() {
return rr_array->size() / (RRPrimUtil<T>::ElementArrayCount); }
2342 virtual void*
void_ptr() {
return rr_array->void_ptr(); }
2350 virtual RR_INTRUSIVE_PTR<RRArray<typename RRPrimUtil<T>::ElementArrayType> >
GetNumericArray() {
return rr_array; }
2354 RR_OVIRTUAL std::string RRType() RR_OVERRIDE {
return "RobotRaconteur.RRNamedArray"; }
2356 RR_OVIRTUAL boost::string_ref RRElementTypeString() RR_OVERRIDE {
return RRPrimUtil<T>::GetRRElementTypeString(); }
2414 BOOST_ASSERT_MSG(i <
size(),
"out of range");
2415 return (
static_cast<T*
>(rr_array->void_ptr())[i]);
2421 BOOST_ASSERT_MSG(i <
size(),
"out of range");
2422 return (
static_cast<T*
>(rr_array->void_ptr())[i]);
2429 return (
static_cast<T*
>(rr_array->void_ptr())[i]);
2435 return (
static_cast<T*
>(rr_array->void_ptr())[i]);
2449 bool empty() {
return rr_array->empty(); }
2453 void rangecheck(size_type i)
const
2457 std::out_of_range e(
"array<>: index out of range");
2458 boost::throw_exception(e);
2473 RR_INTRUSIVE_PTR<RRArray<uint32_t> > Dims;
2474 virtual boost::string_ref RRElementTypeString() = 0;
2496template <
typename T>
2500 typename RR_INTRUSIVE_PTR<RRNamedArray<T> > NamedArray;
2502 RRNamedMultiDimArray() {}
2507 this->NamedArray = a;
2510 RR_OVIRTUAL ~RRNamedMultiDimArray() RR_OVERRIDE {}
2512 RR_OVIRTUAL std::string RRType() RR_OVERRIDE {
return "RobotRaconteur.RRNamedMultiDimArray"; }
2514 RR_OVIRTUAL boost::string_ref RRElementTypeString() RR_OVERRIDE {
return RRPrimUtil<T>::GetRRElementTypeString(); }
2525 const RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> >& buffer,
2526 const std::vector<uint32_t>& bufferpos,
const std::vector<uint32_t>& count)
2531 detail::MultiDimArray_CheckArraySize(mema_dims, NamedArray->size());
2532 detail::MultiDimArray_CheckArraySize(memb_dims, buffer->NamedArray->size());
2533 RR_SHARED_PTR<detail::MultiDimArray_CalculateCopyIndicesIter> iter =
2534 detail::MultiDimArray_CalculateCopyIndicesBeginIter(mema_dims, memorypos, memb_dims, bufferpos, count);
2537 uint32_t indexa = 0;
2538 uint32_t indexb = 0;
2540 while (iter->Next(indexa, indexb, len))
2542 for (
size_t i = 0; i < len; i++)
2544 (*buffer->NamedArray)[(indexb + i)] = (*NamedArray)[(indexa + i)];
2558 const RR_INTRUSIVE_PTR<RRNamedMultiDimArray<T> >& buffer,
2559 const std::vector<uint32_t>& bufferpos,
const std::vector<uint32_t>& count)
2564 detail::MultiDimArray_CheckArraySize(mema_dims, NamedArray->size());
2565 detail::MultiDimArray_CheckArraySize(memb_dims, buffer->NamedArray->size());
2566 RR_SHARED_PTR<detail::MultiDimArray_CalculateCopyIndicesIter> iter =
2567 detail::MultiDimArray_CalculateCopyIndicesBeginIter(mema_dims, memorypos, memb_dims, bufferpos, count);
2570 uint32_t indexa = 0;
2571 uint32_t indexb = 0;
2573 while (iter->Next(indexa, indexb, len))
2575 for (
size_t i = 0; i < len; i++)
2577 (*NamedArray)[(indexa + i)] = (*buffer->NamedArray)[(indexb + i)];
2596template <
typename T>
2599 typedef typename RRPrimUtil<T>::ElementArrayType a_type;
2617template <
typename T>
2620 uint32_t n_elems = boost::accumulate(dims, 1, std::multiplies<uint32_t>());
2634template <
typename T>
2637 std::vector<uint32_t> length;
2638 length.push_back(0);
2652template <
typename T>
2670template <
typename T>
2678 if (value->size() == 0)
2684#define RRPrimUtilEnum(x) \
2686 class RRPrimUtil<x> \
2689 static DataTypes GetTypeID() { return DataTypes_enum_t; } \
2690 static MessageStringPtr GetElementTypeString() { return MessageStringPtr(""); } \
2691 static boost::string_ref GetRRElementTypeString() { return ""; } \
2692 static RR_INTRUSIVE_PTR<RRArray<int32_t> > PrePack(const x& val) { return ScalarToRRArray((int32_t)val); } \
2693 template <typename U> \
2694 static x PreUnpack(const U& val) \
2696 return (x)RRArrayToScalar(rr_cast<RRArray<int32_t> >(val)); \
2698 typedef RR_INTRUSIVE_PTR<RRArray<int32_t> > BoxedType; \
2701class ROBOTRACONTEUR_CORE_API RobotRaconteurNode;
2768#ifdef ROBOTRACONTEUR_USE_SMALL_VECTOR
2769typedef boost::container::small_vector<boost::asio::const_buffer, 4> const_buffers;
2770typedef boost::container::small_vector<boost::asio::mutable_buffer, 4> mutable_buffers;
2772typedef std::vector<boost::asio::const_buffer> const_buffers;
2773typedef std::vector<boost::asio::mutable_buffer> mutable_buffers;
2776template <
typename BufferSequence>
2777void buffers_consume(BufferSequence& b,
size_t count)
2779 typename BufferSequence::iterator e = b.begin();
2781 typename BufferSequence::iterator end = b.end();
2786 if (count > boost::asio::buffer_size(*e))
2788 count -= boost::asio::buffer_size(*e);
2805template <
typename BufferSequence>
2806BufferSequence buffers_consume_copy(BufferSequence& b,
size_t count)
2809 typename BufferSequence::iterator e = b.begin();
2811 typename BufferSequence::iterator end = b.end();
2812 for (; e != end; e++)
2816 if (count > boost::asio::buffer_size(*e))
2818 count -= boost::asio::buffer_size(*e);
2822 o.push_back(*e + count);
2835template <
typename BufferSequence>
2836BufferSequence buffers_consume_copy(
const BufferSequence& b,
size_t count)
2839 typename BufferSequence::const_iterator e = b.begin();
2841 typename BufferSequence::const_iterator end = b.end();
2842 for (; e != end; e++)
2846 if (count > boost::asio::buffer_size(*e))
2848 count -= boost::asio::buffer_size(*e);
2852 o.push_back(*e + count);
2865template <
typename BufferSequence>
2866BufferSequence buffers_truncate(BufferSequence& b,
size_t count)
2869 typename BufferSequence::iterator e = b.begin();
2871 typename BufferSequence::iterator end = b.end();
2873 for (; e != end; e++)
2875 if (p + boost::asio::buffer_size(*e) <= count)
2878 p += boost::asio::buffer_size(*e);
2882 o.push_back(boost::asio::buffer(*e, count - p));
2890template <
typename BufferSequence>
2891BufferSequence buffers_truncate(
const BufferSequence& b,
size_t count)
2894 typename BufferSequence::const_iterator e = b.begin();
2896 typename BufferSequence::const_iterator end = b.end();
2898 for (; e != end; e++)
2900 if (p + boost::asio::buffer_size(*e) <= count)
2903 p += boost::asio::buffer_size(*e);
2907 o.push_back(boost::asio::buffer(*e, count - p));
2918struct ROBOTRACONTEUR_CORE_API ServicePathSegment
2921 ServicePathSegment();
2923 ServicePathSegment(
const std::string& name,
2924 const boost::optional<std::string>& index = boost::optional<std::string>());
2929 boost::optional<std::string> index;
2932ROBOTRACONTEUR_CORE_API
bool operator==(
const ServicePathSegment& lhs,
const ServicePathSegment& rhs);
2934ROBOTRACONTEUR_CORE_API
bool operator!=(
const ServicePathSegment& lhs,
const ServicePathSegment& rhs);
2958ROBOTRACONTEUR_CORE_API std::vector<ServicePathSegment>
ParseServicePath(
const std::string& path);
2966ROBOTRACONTEUR_CORE_API std::string
BuildServicePath(
const std::vector<ServicePathSegment>& segments);
2999ROBOTRACONTEUR_CORE_API std::string encode_index(boost::string_ref index);
3001ROBOTRACONTEUR_CORE_API std::string decode_index(boost::string_ref index);
3003template <
typename T,
typename U>
3004bool try_convert_string_to_number(
const U& arg, T& result)
3006 if (boost::conversion::try_lexical_convert(arg, result))
3011 if (!boost::is_integral<T>::value)
3016 boost::regex hex_regex(
"^[+\\-]?0x[\\da-fA-F]+$");
3017 if (!boost::regex_match(arg.begin(), arg.end(), hex_regex))
3022 std::stringstream ss;
3023 ss << std::hex << arg;
3026 if (ss.fail() || !ss.eof())
3038template <
typename U>
3039bool try_convert_string_to_number(
const U& arg, int8_t& result)
3042 if (!try_convert_string_to_number(arg, v))
3046 if (v < std::numeric_limits<int8_t>::min() || v > std::numeric_limits<int8_t>::max())
3050 result =
static_cast<int8_t
>(v);
3054template <
typename U>
3055bool try_convert_string_to_number(
const U& arg, uint8_t& result)
3058 if (!try_convert_string_to_number(arg, v))
3062 if (v < 0 || v > std::numeric_limits<uint8_t>::max())
3066 result =
static_cast<uint8_t
>(v);
3072#ifndef ROBOTRACONTEUR_NO_CXX11_TEMPLATE_ALIASES
3090template <
typename T>
3093template <
typename T>
3096template <
typename K,
typename T>
3099template <
typename K,
typename T>
3102template <
typename T>
3105template <
typename T>
3116template <
typename T>
3119template <
typename T>
3126template <
typename T>
3129template <
typename T>
3136template <
typename T>
3139template <
typename T>
3146template <
typename T>
3149template <
typename T>
3156template <
typename T>
3159template <
typename T>
boost::intrusive_ptr< RRMap< K, T > > AllocateEmptyRRMap()
Allocate an empty RRMap.
Definition DataTypes.h:1866
static T RRNamedArrayToScalar(const boost::intrusive_ptr< RRNamedArray< T > > &value)
Convert a namedarray array with one element into a namedarray.
Definition DataTypes.h:2671
boost::intrusive_ptr< RRArray< char > > stringToRRArray(boost::string_ref str)
Convert a string to an array of characters.
static boost::intrusive_ptr< RRPodArray< T > > AllocateEmptyRRPodArray(size_t length)
Allocate a pod array with the specified type and length and initialize to zero.
Definition DataTypes.h:2212
static boost::intrusive_ptr< RRArray< Y > > VectorToRRArray(const std::vector< U > &in)
Convert a std::vector to an RRArray<Y>.
Definition DataTypes.h:1267
boost::shared_ptr< const RRObject > RRObjectConstPtr
Convenience alias for RRObject const shared_ptr.
Definition DataTypes.h:3076
boost::intrusive_ptr< RRList< T > > RRListPtr
Convenience alias for RRList intrusive_ptr.
Definition DataTypes.h:3103
boost::intrusive_ptr< RRPodBaseMultiDimArray > RRPodBaseMultiDimArrayPtr
Convenience alias for RRPodBaseMultiDimArray intrusive_ptr.
Definition DataTypes.h:3132
boost::intrusive_ptr< T > & rr_null_check(boost::intrusive_ptr< T > &ptr)
Checks if a value RR_INTRUSIVE_PTR is null.
Definition DataTypes.h:1453
static boost::intrusive_ptr< RRArray< Y > > ArrayToRRArray(boost::array< U, N > in)
Convert a boost::array to an RRArray.
Definition DataTypes.h:1335
static T RRArrayToScalar(const boost::intrusive_ptr< RRArray< T > > &value)
Convert an array with one element into a scalar.
Definition DataTypes.h:1218
boost::intrusive_ptr< RRMap< K, T > > RRMapPtr
Convenience alias for RRMap intrusive_ptr.
Definition DataTypes.h:3097
static boost::intrusive_ptr< RRArray< T > > AttachRRArrayCopy(const T *data, const size_t length)
Allocates an array object and copies existing numeric.
Definition DataTypes.h:1131
boost::intrusive_ptr< const RRList< T > > RRListConstPtr
Convenience alias for RRList const intrusive_ptr.
Definition DataTypes.h:3106
boost::intrusive_ptr< RRPodBaseArray > RRPodBaseArrayPtr
Convenience alias for RRPodBaseArray intrusive_ptr.
Definition DataTypes.h:3122
static boost::shared_ptr< T > rr_cast(const boost::shared_ptr< U > &objin)
Dynamic cast a RR_SHARED_PTR type. Throws DataTypeMismatchException if cast is invalid instead of ret...
Definition DataTypes.h:200
boost::intrusive_ptr< RRPodArray< T > > RRPodArrayPtr
Convenience alias for RRPodArray intrusive_ptr.
Definition DataTypes.h:3127
size_t RRArrayElementSize(DataTypes type)
Get the number of bytes to store a numeric primitive scalar.
static boost::intrusive_ptr< RRPodMultiDimArray< T > > AllocateEmptyRRPodMultiDimArray(const std::vector< uint32_t > &dims)
Allocate an empty multidimensional pod array with the specified dimensions.
Definition DataTypes.h:2231
static boost::intrusive_ptr< RRArray< T > > ScalarToRRArray(T value)
Convert a scalar number into an array with one element.
Definition DataTypes.h:1205
boost::intrusive_ptr< const MessageElementData > MessageElementDataConstPtr
Convenience alias for MessageElementData const intrusive_ptr.
Definition DataTypes.h:3084
std::vector< ServicePathSegment > ParseServicePath(const std::string &path)
Parse a Robot Raconteur service path into segments.
boost::intrusive_ptr< const RRNamedBaseMultiDimArray > RRNamedBaseMultiDimBaseArrayConstPtr
Convenience alias for RRNamedBaseMultiDimArray const intrusive_ptr.
Definition DataTypes.h:3154
boost::intrusive_ptr< MessageElementData > MessageElementDataPtr
Convenience alias for MessageElementData intrusive_ptr.
Definition DataTypes.h:3082
bool IsStringIdentifier(boost::string_ref str)
Test if a string is a Robot Raconteur identifier.
boost::intrusive_ptr< RRValue > RRValuePtr
Convenience alias for RRValue intrusive_ptr.
Definition DataTypes.h:3078
boost::posix_time::ptime TimeSpecToPTime(const TimeSpec &ts)
Convert a TimeSpec into a boost::posix_time::ptime.
boost::intrusive_ptr< const RRPodMultiDimArray< T > > RRPodMultiDimArrayConstPtr
Convenience alias for RRPodMultiDimArray const intrusive_ptr.
Definition DataTypes.h:3140
static boost::intrusive_ptr< RRPodArray< T > > ScalarToRRPodArray(const T &value)
Convert a scalar pod into a pod array with one element.
Definition DataTypes.h:2172
boost::intrusive_ptr< RRList< T > > AllocateRRList(const U &c)
Allocate RRList with a value.
Definition DataTypes.h:1853
std::string RRArrayToString(const boost::intrusive_ptr< RRArray< char > > &arr)
Convert an array of characters into std::string.
TimeSpec ptimeToTimeSpec(const boost::posix_time::ptime &t)
Convert a boost::posix_time::ptime into a TimeSpec.
static T RRPodArrayToScalar(const boost::intrusive_ptr< RRPodArray< T > > &value)
Convert a pod array with one element into a scalar pod.
Definition DataTypes.h:2185
boost::intrusive_ptr< RRList< RRArray< char > > > stringVectorToRRList(const std::vector< std::string > &string_vector)
Convert a string vector to a RRList.
boost::intrusive_ptr< RRPodMultiDimArray< T > > RRPodMultiDimArrayPtr
Convenience alias for RRPodMultiDimArray intrusive_ptr.
Definition DataTypes.h:3137
boost::intrusive_ptr< const RRPodArray< T > > RRPodArrayConstPtr
Convenience alias for RRPodArray const intrusive_ptr.
Definition DataTypes.h:3130
boost::intrusive_ptr< const RRPodBaseMultiDimArray > RRPodBaseMultiDimBaseArrayConstPtr
Convenience alias for RRPodBaseMultiDimArray const intrusive_ptr.
Definition DataTypes.h:3134
boost::intrusive_ptr< const RRNamedBaseArray > RRNamedBaseArrayConstPtr
Convenience alias for RRNamedBaseArray const intrusive_ptr.
Definition DataTypes.h:3144
static boost::intrusive_ptr< RRArray< T > > AllocateEmptyRRArray(size_t length)
Allocate a numeric primitive or character array with the specified type and length and initialize to ...
Definition DataTypes.h:1172
boost::shared_ptr< RRObject > RRObjectPtr
Convenience alias for RRObject shared_ptr.
Definition DataTypes.h:3074
boost::intrusive_ptr< RRNamedArray< T > > RRNamedArrayPtr
Convenience alias for RRNamedArray intrusive_ptr.
Definition DataTypes.h:3147
boost::intrusive_ptr< const RRMultiDimArray< T > > RRMultiDimArrayConstPtr
Convenience alias for RRMultiDimArray const intrusive_ptr.
Definition DataTypes.h:3120
static boost::intrusive_ptr< RRNamedArray< T > > AllocateEmptyRRNamedArray(size_t length)
Allocate a namedarray array with the specified type and length and initialize to zero.
Definition DataTypes.h:2597
std::vector< std::string > RRListToStringVector(const boost::intrusive_ptr< RRList< RRArray< char > > > &list)
Convert a RRList containing strings to a string vector.
boost::intrusive_ptr< RRMultiDimBaseArray > RRMultiDimBaseArrayPtr
Convenience alias for RRMultiDimBaseArray intrusive_ptr.
Definition DataTypes.h:3112
static boost::intrusive_ptr< RRArray< T > > AllocateRRArray(size_t length)
Allocate a numeric primitive or character array with the specified type and length.
Definition DataTypes.h:1089
boost::intrusive_ptr< RRNamedBaseMultiDimArray > RRNamedBaseMultiDimArrayPtr
Convenience alias for RRNamedBaseMultiDimArray intrusive_ptr.
Definition DataTypes.h:3152
boost::intrusive_ptr< const RRArray< T > > RRArrayConstPtr
Convenience alias for RRArray const intrusive_ptr.
Definition DataTypes.h:3094
boost::intrusive_ptr< RRNamedMultiDimArray< T > > RRNamedMultiDimArrayPtr
Convenience alias for RRNamedMultiDimArray intrusive_ptr.
Definition DataTypes.h:3157
boost::intrusive_ptr< RRBaseArray > AllocateRRArrayByType(DataTypes type, size_t length)
Allocate an RRBaseArray by type code.
boost::intrusive_ptr< const RRMultiDimBaseArray > RRMultiDimBaseArrayConstPtr
Convenience alias for RRMultiDimBaseArray const intrusive_ptr.
Definition DataTypes.h:3114
boost::intrusive_ptr< RRArray< T > > RRArrayPtr
Convenience alias for RRArray intrusive_ptr.
Definition DataTypes.h:3091
boost::intrusive_ptr< RRStructure > RRStructurePtr
Convenience alias for RRStructure intrusive_ptr.
Definition DataTypes.h:3108
bool IsStringUUID(boost::string_ref str)
Test if a string is a UUID.
static boost::intrusive_ptr< RRMultiDimArray< T > > AllocateRRMultiDimArray(const boost::intrusive_ptr< RRArray< uint32_t > > &dims, const boost::intrusive_ptr< RRArray< T > > &array_)
Allocate a multidimensional using existing dimensions and data array.
Definition DataTypes.h:1826
static boost::intrusive_ptr< RRNamedArray< T > > ScalarToRRNamedArray(const T &value)
Convert a scalar namedarray into a namedarray array with one element.
Definition DataTypes.h:2653
bool IsStringName(boost::string_ref str)
Test if a string is a valid Robot Raconteur name.
boost::intrusive_ptr< const RRBaseArray > RRBaseArrayConstPtr
Convenience alias for RRBaseArray const intrusive_ptr.
Definition DataTypes.h:3088
boost::intrusive_ptr< RRBaseArray > RRBaseArrayPtr
Convenience alias for RRBaseArray intrusive_ptr.
Definition DataTypes.h:3086
static boost::intrusive_ptr< RRArray< T > > AttachRRArray(T *data, size_t length, bool owned)
Allocates an array object and attaches to existing numeric primitive or character array pointer.
Definition DataTypes.h:1113
boost::intrusive_ptr< RRMap< K, T > > AllocateRRMap(const U &c)
Allocate RRMap with value.
Definition DataTypes.h:1881
boost::intrusive_ptr< RRMultiDimArray< T > > RRMultiDimArrayPtr
Convenience alias for RRMultiDimArray intrusive_ptr.
Definition DataTypes.h:3117
boost::intrusive_ptr< const RRPodBaseArray > RRPodBaseArrayConstPtr
Convenience alias for RRPodBaseArray const intrusive_ptr.
Definition DataTypes.h:3124
boost::intrusive_ptr< const RRStructure > RRStructureConstPtr
Convenience alias for RRStructure const intrusive_ptr.
Definition DataTypes.h:3110
boost::intrusive_ptr< const RRValue > RRValueConstPtr
Convenience alias for RRValue const intrusive_ptr.
Definition DataTypes.h:3080
boost::intrusive_ptr< const RRMap< K, T > > RRMapConstPtr
Convenience alias for RRMap const intrusive_ptr.
Definition DataTypes.h:3100
boost::intrusive_ptr< const RRNamedMultiDimArray< T > > RRNamedMultiDimArrayConstPtr
Convenience alias for RRNamedMultiDimArray const intrusive_ptr.
Definition DataTypes.h:3160
std::string BuildServicePath(const std::vector< ServicePathSegment > &segments)
Build a Robot Raconteur service path from segments.
bool IsStringScopedName(boost::string_ref str)
Test if a string is a valid Robot Raconteur scoped name.
boost::intrusive_ptr< const RRNamedArray< T > > RRNamedArrayConstPtr
Convenience alias for RRNamedArray const intrusive_ptr.
Definition DataTypes.h:3150
boost::intrusive_ptr< RRList< T > > AllocateEmptyRRList()
Allocate an empty RRList.
Definition DataTypes.h:1839
static boost::container::static_vector< Y, N > RRArrayToStaticVector(const boost::intrusive_ptr< RRArray< U > > &in)
Convert an RRArray to a boost::static_vector.
Definition DataTypes.h:1358
static boost::intrusive_ptr< RRNamedMultiDimArray< T > > AllocateEmptyRRNamedMultiDimArray(const std::vector< uint32_t > &dims)
Allocate an empty multidimensional namedarray array with the specified dimensions.
Definition DataTypes.h:2618
std::string EncodeServicePathIndex(const std::string &index)
Encode a service path index for use in a Robot Raconteur service path.
static std::vector< Y > RRArrayToVector(const boost::intrusive_ptr< RRArray< U > > &in)
Convert an RRArray<U> to a std::vector<Y>.
Definition DataTypes.h:1245
static boost::array< Y, N > RRArrayToArray(const boost::intrusive_ptr< RRArray< U > > &in)
Convert an RRArray to a boost::array.
Definition DataTypes.h:1288
boost::intrusive_ptr< RRNamedBaseArray > RRNamedBaseArrayPtr
Convenience alias for RRNamedBaseArray intrusive_ptr.
Definition DataTypes.h:3142
static boost::intrusive_ptr< RRArray< Y > > StaticVectorToRRArray(boost::container::static_vector< U, N > in)
Convert a boost::container::static_vector to an RRArray.
Definition DataTypes.h:1411
std::string DecodeServicePathIndex(const std::string &index)
Decode a service path index from a Robot Raconteur service path.
static boost::intrusive_ptr< RRMultiDimArray< T > > AllocateEmptyRRMultiDimArray(const std::vector< uint32_t > &dims)
Allocate an empty multidimensional array with the specified dimensions.
Definition DataTypes.h:1795
DataTypes
Type codes for types supported by Robot Raconteur.
Definition RobotRaconteurConstants.h:41
@ DataTypes_single_t
IEEE-754 32-bit floating point number.
Definition RobotRaconteurConstants.h:47
@ DataTypes_uint8_t
8-bit unsigned integer
Definition RobotRaconteurConstants.h:51
@ DataTypes_int16_t
16-bit signed integer
Definition RobotRaconteurConstants.h:53
@ DataTypes_uint32_t
32-bit unsigned integer
Definition RobotRaconteurConstants.h:59
@ DataTypes_uint16_t
16-bit unsigned integer
Definition RobotRaconteurConstants.h:55
@ DataTypes_int8_t
8-bit signed integer
Definition RobotRaconteurConstants.h:49
@ DataTypes_uint64_t
64-bit unsigned integer
Definition RobotRaconteurConstants.h:63
@ DataTypes_double_t
IEEE-754 64-bit floating point number.
Definition RobotRaconteurConstants.h:45
@ DataTypes_int64_t
64-bit signed integer
Definition RobotRaconteurConstants.h:61
@ DataTypes_string_t
UTF-8 string.
Definition RobotRaconteurConstants.h:65
@ DataTypes_int32_t
32-bit signed integer
Definition RobotRaconteurConstants.h:57
@ DataTypes_void_t
void or null type
Definition RobotRaconteurConstants.h:43
@ DataTypes_bool_t
8-bit boolean
Definition RobotRaconteurConstants.h:71
@ DataTypes_cdouble_t
128-bit complex double (real,imag)
Definition RobotRaconteurConstants.h:67
@ DataTypes_csingle_t
64-bit complex float (real,imag)
Definition RobotRaconteurConstants.h:69
DataTypeMismatchException(const std::string &message, std::string sub_name="", const boost::intrusive_ptr< RRValue > ¶m_=boost::intrusive_ptr< RRValue >())
Construct a DataTypeMismatchException.
Base class for types that can be stored in MessageElement.
Definition DataTypes.h:375
Exception thrown for an unexpected null value.
Definition Error.h:669
Exception thrown when an attempt to access an array or container index is out of range.
Definition Error.h:875
Numeric primitive or character array value type.
Definition DataTypes.h:579
std::ptrdiff_t difference_type
Definition DataTypes.h:615
RRArray< T > & operator=(const RRArray< T2 > &rhs)
assignment with type conversion
Definition DataTypes.h:711
T value_type
Definition DataTypes.h:603
reference operator[](size_type i)
access specified element
Definition DataTypes.h:653
reference back()
access the last element
Definition DataTypes.h:686
RR_OVIRTUAL size_t size() RR_OVERRIDE
Get the number of elements in the array.
Definition DataTypes.h:595
const_reverse_iterator rend() const
returns a reverse iterator to the end
Definition DataTypes.h:648
const_iterator cend() const
returns a const iterator to the end
Definition DataTypes.h:631
bool empty()
checks whether the container is empty
Definition DataTypes.h:692
const T & const_reference
Definition DataTypes.h:611
std::size_t size_type
Definition DataTypes.h:613
void fill(const T &value)
Fill array with value.
Definition DataTypes.h:730
const_reference at(size_type i) const
access specified element with bounds checking
Definition DataTypes.h:673
iterator begin()
returns an iterator to the beginning
Definition DataTypes.h:620
const_reverse_iterator crend() const
returns a reverse iterator to the end
Definition DataTypes.h:650
reverse_iterator rend()
returns a reverse iterator to the end
Definition DataTypes.h:646
iterator end()
returns an iterator to the end
Definition DataTypes.h:627
const_reference operator[](size_type i) const
access specified element
Definition DataTypes.h:660
size_type max_size()
returns the maximum possible number of elements
Definition DataTypes.h:694
reverse_iterator rbegin()
returns a reverse iterator to the beginning
Definition DataTypes.h:639
boost::reverse_iterator< const_iterator > const_reverse_iterator
Definition DataTypes.h:636
boost::reverse_iterator< iterator > reverse_iterator
Definition DataTypes.h:634
const_iterator end() const
returns an iterator to the end
Definition DataTypes.h:629
const_reverse_iterator rbegin() const
returns a reverse iterator to the beginning
Definition DataTypes.h:641
T * data()
direct access to the underlying array
Definition DataTypes.h:699
const_reference back() const
access the last element
Definition DataTypes.h:689
reference front()
access the first element
Definition DataTypes.h:680
const T * const_iterator
Definition DataTypes.h:607
RR_OVIRTUAL void * void_ptr() RR_OVERRIDE
Get a void pointer to the contained array.
Definition DataTypes.h:591
T * iterator
Definition DataTypes.h:605
T & reference
Definition DataTypes.h:609
const_iterator cbegin() const
returns a const iterator to the beginning
Definition DataTypes.h:624
const_reverse_iterator crbegin() const
returns a reverse iterator to the beginning
Definition DataTypes.h:643
const_reference front() const
access the first element
Definition DataTypes.h:683
const_iterator begin() const
returns an iterator to the beginning
Definition DataTypes.h:622
void assign(const T &value)
Assign one value to all elements.
Definition DataTypes.h:724
reference at(size_type i)
access specified element with bounds checking
Definition DataTypes.h:667
const T * data() const
direct access to the underlying array
Definition DataTypes.h:697
RR_OVIRTUAL size_t ElementSize() RR_OVERRIDE
Get the number of bytes per element of the array.
Definition DataTypes.h:597
Base class for numeric and character array value types.
Definition DataTypes.h:526
virtual size_t size()=0
Get the number of elements in the array.
virtual size_t ElementSize()=0
Get the number of bytes per element of the array.
virtual void * void_ptr()=0
Get a void pointer to the contained array.
List container value type.
Definition DataTypes.h:952
const_iterator begin() const
returns an iterator to the beginning
Definition DataTypes.h:993
std::list< boost::intrusive_ptr< T > >::const_iterator const_iterator
Definition DataTypes.h:984
std::list< boost::intrusive_ptr< T > > & GetStorageContainer()
Get the underlying storage container.
Definition DataTypes.h:1056
void pop_back()
removes the last element
Definition DataTypes.h:1037
std::list< boost::intrusive_ptr< T > >::reference reference
Definition DataTypes.h:974
std::list< boost::intrusive_ptr< T > >::iterator iterator
Definition DataTypes.h:982
std::list< boost::intrusive_ptr< T > >::reverse_iterator reverse_iterator
Definition DataTypes.h:986
std::list< boost::intrusive_ptr< T > >::const_pointer const_pointer
Definition DataTypes.h:972
iterator erase(const_iterator first, const_iterator last)
erases element
Definition DataTypes.h:1043
std::list< boost::intrusive_ptr< T > >::const_reverse_iterator const_reverse_iterator
Definition DataTypes.h:988
const_reverse_iterator const crend()
returns a reverse iterator to the end
Definition DataTypes.h:1015
reference front()
access the first element
Definition DataTypes.h:1023
std::list< boost::intrusive_ptr< T > >::size_type size_type
Definition DataTypes.h:978
void clear()
clears the contents
Definition DataTypes.h:1045
size_type max_size() const
returns the maximum possible number of elements
Definition DataTypes.h:1021
const_reverse_iterator crend() const
returns a reverse iterator to the end
Definition DataTypes.h:1005
iterator insert(const_iterator p, const boost::intrusive_ptr< T > &x)
inserts element
Definition DataTypes.h:1039
std::list< boost::intrusive_ptr< T > >::pointer pointer
Definition DataTypes.h:970
const_reference back() const
access the last element
Definition DataTypes.h:1029
std::list< boost::intrusive_ptr< T > >::difference_type difference_type
Definition DataTypes.h:980
const_reference front() const
access the first element
Definition DataTypes.h:1025
void push_front(const boost::intrusive_ptr< T > &x)
inserts an element at the beginning
Definition DataTypes.h:1031
reference back()
access the last element
Definition DataTypes.h:1027
void remove(const boost::intrusive_ptr< T > &value)
removes elements equal to value
Definition DataTypes.h:1047
reverse_iterator rbegin()
returns a reverse iterator to the beginning
Definition DataTypes.h:999
void push_back(const boost::intrusive_ptr< T > &x)
adds an element to the end
Definition DataTypes.h:1033
const_iterator cend() const
returns an iterator to the end
Definition DataTypes.h:1011
const_reverse_iterator const crbegin()
returns a reverse iterator to the beginning
Definition DataTypes.h:1013
iterator begin()
returns an iterator to the beginning
Definition DataTypes.h:991
const_reverse_iterator rend() const
returns a reverse iterator to the end
Definition DataTypes.h:1007
bool empty() const
checks whether the container is empty
Definition DataTypes.h:1017
boost::intrusive_ptr< T > value_type
Definition DataTypes.h:968
void pop_front()
removes the first element
Definition DataTypes.h:1035
virtual size_type size() const
returns the number of elements
Definition DataTypes.h:1019
const_iterator end() const
returns an iterator to the end
Definition DataTypes.h:997
const_reverse_iterator rbegin() const
returns a reverse iterator to the beginning
Definition DataTypes.h:1001
std::list< boost::intrusive_ptr< T > >::const_reference const_reference
Definition DataTypes.h:976
const_iterator cbegin() const
returns an iterator to the beginning
Definition DataTypes.h:1009
reverse_iterator rend()
returns a reverse iterator to the end
Definition DataTypes.h:1003
iterator erase(const_iterator p)
erases element
Definition DataTypes.h:1041
iterator end()
returns an iterator to the end
Definition DataTypes.h:995
Map container value type.
Definition DataTypes.h:826
void erase(iterator p)
erases element
Definition DataTypes.h:917
std::pair< iterator, bool > insert(const value_type &x)
inserts elements
Definition DataTypes.h:903
iterator end()
returns an iterator to the end
Definition DataTypes.h:873
std::map< K, boost::intrusive_ptr< T > >::value_type value_type
Definition DataTypes.h:846
std::map< K, boost::intrusive_ptr< T > >::key_type key_type
Definition DataTypes.h:842
const_reverse_iterator rbegin() const
returns a reverse iterator to the beginning
Definition DataTypes.h:883
const_iterator begin() const
returns an iterator to the beginning
Definition DataTypes.h:871
const_reverse_iterator crbegin() const
returns a reverse iterator to the beginning
Definition DataTypes.h:881
mapped_type & operator[](const key_type &k)
access or insert the specified element
Definition DataTypes.h:897
std::map< K, boost::intrusive_ptr< T > > & GetStorageContainer()
Get the underlying storage container.
Definition DataTypes.h:938
std::map< K, boost::intrusive_ptr< T > >::const_iterator const_iterator
Definition DataTypes.h:860
const_reverse_iterator crend() const
returns a reverse iterator to the end
Definition DataTypes.h:887
size_type size() const
returns the number of elements
Definition DataTypes.h:893
const_iterator find(const key_type &x) const
finds element with the specified key
Definition DataTypes.h:927
bool empty() const
checks whether the container is empty
Definition DataTypes.h:891
iterator find(const key_type &x)
finds element with the specified key
Definition DataTypes.h:925
void erase(iterator first, iterator last)
erases element
Definition DataTypes.h:921
std::map< K, boost::intrusive_ptr< T > >::const_reverse_iterator const_reverse_iterator
Definition DataTypes.h:864
const mapped_type & at(const key_type &k) const
access specified element with bounds checking
Definition DataTypes.h:901
std::map< K, boost::intrusive_ptr< T > >::pointer pointer
Definition DataTypes.h:848
size_type count(const key_type &x) const
returns the number of elements matching the specified key
Definition DataTypes.h:929
reverse_iterator rend()
returns a reverse iterator to the end
Definition DataTypes.h:885
std::map< K, boost::intrusive_ptr< T > >::iterator iterator
Definition DataTypes.h:858
mapped_type & at(const key_type &k)
access specified element with bounds checking
Definition DataTypes.h:899
const_iterator end() const
returns an iterator to the end
Definition DataTypes.h:877
void clear()
clears the contents
Definition DataTypes.h:923
std::map< K, boost::intrusive_ptr< T > >::reverse_iterator reverse_iterator
Definition DataTypes.h:862
std::map< K, boost::intrusive_ptr< T > >::mapped_type mapped_type
Definition DataTypes.h:844
std::map< K, boost::intrusive_ptr< T > >::reference reference
Definition DataTypes.h:852
const_iterator cend() const
returns an iterator to the end
Definition DataTypes.h:875
size_type max_size() const
returns the maximum possible number of elements
Definition DataTypes.h:895
std::map< K, boost::intrusive_ptr< T > >::const_reference const_reference
Definition DataTypes.h:854
iterator begin()
returns an iterator to the beginning
Definition DataTypes.h:867
iterator insert(const_iterator p, const value_type &x)
inserts elements
Definition DataTypes.h:905
const_reverse_iterator rend() const
returns a reverse iterator to the end
Definition DataTypes.h:889
const_iterator cbegin() const
returns an iterator to the beginning
Definition DataTypes.h:869
std::map< K, boost::intrusive_ptr< T > >::const_pointer const_pointer
Definition DataTypes.h:850
std::map< K, boost::intrusive_ptr< T > >::size_type size_type
Definition DataTypes.h:856
size_type erase(const key_type &x)
erases element
Definition DataTypes.h:919
void insert(InputIterator first, InputIterator last)
inserts elements
Definition DataTypes.h:912
reverse_iterator rbegin()
returns a reverse iterator to the beginning
Definition DataTypes.h:879
Numeric primitive multidimensional array value type.
Definition DataTypes.h:1635
virtual void AssignSubArray(const std::vector< uint32_t > &memorypos, const boost::intrusive_ptr< RRMultiDimArray< T > > &buffer, const std::vector< uint32_t > &bufferpos, const std::vector< uint32_t > &count)
Assign a subset of an array.
Definition DataTypes.h:1693
virtual void RetrieveSubArray(const std::vector< uint32_t > &memorypos, const boost::intrusive_ptr< RRMultiDimArray< T > > &buffer, const std::vector< uint32_t > &bufferpos, const std::vector< uint32_t > &count)
Retrieve a subset of an array.
Definition DataTypes.h:1663
Base class for numeric multidimensional arrays.
Definition DataTypes.h:1585
namedarray array value type
Definition DataTypes.h:2312
iterator end()
returns an iterator to the end
Definition DataTypes.h:2386
T & reference
Definition DataTypes.h:2368
const_iterator end() const
returns an iterator to the end
Definition DataTypes.h:2388
const_reverse_iterator crend() const
returns a reverse iterator to the end
Definition DataTypes.h:2409
reverse_iterator rbegin()
returns a reverse iterator to the beginning
Definition DataTypes.h:2398
virtual size_t size() const
returns the number of elements (namedarray elements)
Definition DataTypes.h:2338
RR_OVIRTUAL boost::intrusive_ptr< RRBaseArray > GetNumericBaseArray() RR_OVERRIDE
get the underlying numeric array as an RRBaseArray
Definition DataTypes.h:2352
const_reference front() const
access the first element
Definition DataTypes.h:2441
bool empty()
checks whether the container is empty
Definition DataTypes.h:2449
virtual size_t size()
returns the number of elements (namedarray elements)
Definition DataTypes.h:2340
const_reference at(size_type i) const
access specified namedarray element with bounds checking
Definition DataTypes.h:2432
const_iterator cbegin() const
returns an iterator to the beginning
Definition DataTypes.h:2383
reference back()
access the last element
Definition DataTypes.h:2444
std::size_t size_type
Definition DataTypes.h:2372
const T & const_reference
Definition DataTypes.h:2370
RR_OVIRTUAL DataTypes ElementArrayType() RR_OVERRIDE
get the type of the underlying numeric array
Definition DataTypes.h:2346
const_reference operator[](size_type i) const
access specified namedarray element
Definition DataTypes.h:2419
iterator begin()
returns an iterator to the beginning
Definition DataTypes.h:2379
std::ptrdiff_t difference_type
Definition DataTypes.h:2374
reference front()
access the first element
Definition DataTypes.h:2439
RR_OVIRTUAL size_t ElementSize() RR_OVERRIDE
get the number of bytes per namedarray element of the array
Definition DataTypes.h:2344
const_reverse_iterator rbegin() const
returns a reverse iterator to the beginning
Definition DataTypes.h:2400
const_iterator begin() const
returns an iterator to the beginning
Definition DataTypes.h:2381
RR_OVIRTUAL size_t ElementArrayCount() RR_OVERRIDE
get the total number of elements in the underlying numeric array
Definition DataTypes.h:2348
RRNamedArray(const boost::intrusive_ptr< RRArray< typename RRPrimUtil< T >::ElementArrayType > > &rr_array)
Construct a RRNamedArray object.
Definition DataTypes.h:2329
const_reverse_iterator crbegin() const
returns a reverse iterator to the beginning
Definition DataTypes.h:2402
const_reference back() const
access the last element
Definition DataTypes.h:2446
virtual boost::intrusive_ptr< RRArray< typename RRPrimUtil< T >::ElementArrayType > > GetNumericArray()
get the underlying numeric RRArray
Definition DataTypes.h:2350
reverse_iterator rend()
returns a reverse iterator to the end
Definition DataTypes.h:2405
size_type max_size()
returns the maximum possible number of elements
Definition DataTypes.h:2451
reference operator[](size_type i)
access specified namedarray element
Definition DataTypes.h:2412
const_reverse_iterator rend() const
returns a reverse iterator to the end
Definition DataTypes.h:2407
T * iterator
Definition DataTypes.h:2364
T value_type
Definition DataTypes.h:2362
boost::reverse_iterator< const_iterator > const_reverse_iterator
Definition DataTypes.h:2395
const_iterator cend() const
returns an iterator to the end
Definition DataTypes.h:2390
const T * const_iterator
Definition DataTypes.h:2366
reference at(size_type i)
access specified namedarray element with bounds checking
Definition DataTypes.h:2426
boost::reverse_iterator< iterator > reverse_iterator
Definition DataTypes.h:2393
virtual void * void_ptr()
get a void pointer to the underlying numeric array
Definition DataTypes.h:2342
Base class for namedarray array value types.
Definition DataTypes.h:2283
Base class for namedarray multidimensional arrays.
Definition DataTypes.h:2471
namedarray multidimensional array value type
Definition DataTypes.h:2498
virtual void AssignSubArray(const std::vector< uint32_t > &memorypos, const boost::intrusive_ptr< RRNamedMultiDimArray< T > > &buffer, const std::vector< uint32_t > &bufferpos, const std::vector< uint32_t > &count)
Assign a subset of an array.
Definition DataTypes.h:2557
virtual void RetrieveSubArray(const std::vector< uint32_t > &memorypos, const boost::intrusive_ptr< RRNamedMultiDimArray< T > > &buffer, const std::vector< uint32_t > &bufferpos, const std::vector< uint32_t > &count)
Retrieve a subset of an array.
Definition DataTypes.h:2524
virtual std::string RRType()=0
Gets the type of the object as a string. This string is in C++ format, using two colons to separate n...
pod array value type
Definition DataTypes.h:1926
std::vector< T >::iterator iterator
Definition DataTypes.h:1958
size_type max_size() const
returns the maximum possible number of elements
Definition DataTypes.h:1995
reference front()
access the first element
Definition DataTypes.h:1997
const_reverse_iterator rbegin() const
returns a reverse iterator to the beginning
Definition DataTypes.h:1977
T * data()
direct access to the underlying array
Definition DataTypes.h:2013
const_reference at(size_type i) const
access the specified element with bounds checking
Definition DataTypes.h:2011
std::vector< T >::const_reverse_iterator const_reverse_iterator
Definition DataTypes.h:1964
std::vector< T >::const_reference const_reference
Definition DataTypes.h:1954
reference operator[](size_type i)
access the specified element
Definition DataTypes.h:2005
const_iterator cend() const
returns an iterator to the end
Definition DataTypes.h:1985
const_reference operator[](size_type i) const
access the specified element
Definition DataTypes.h:2007
const_reverse_iterator const crend()
returns a reverse iterator to the end
Definition DataTypes.h:1989
const_reverse_iterator const crbegin()
returns a reverse iterator to the beginning
Definition DataTypes.h:1987
T value_type
Definition DataTypes.h:1946
iterator begin()
returns an iterator to the beginning
Definition DataTypes.h:1967
const_reference back() const
access the last element
Definition DataTypes.h:2003
std::vector< T > & GetStorageContainer()
Get the underlying storage container.
Definition DataTypes.h:2024
reverse_iterator rend()
returns a reverse iterator to the end
Definition DataTypes.h:1979
const_iterator cbegin() const
returns an iterator to the beginning
Definition DataTypes.h:1983
const_iterator end() const
returns an iterator to the end
Definition DataTypes.h:1973
std::vector< T >::reference reference
Definition DataTypes.h:1952
reference back()
access the last element
Definition DataTypes.h:2001
std::vector< T >::const_iterator const_iterator
Definition DataTypes.h:1960
const T * data() const
direct access to the underlying array
Definition DataTypes.h:2015
const_reference front() const
access the first element
Definition DataTypes.h:1999
std::vector< T >::size_type size_type
Definition DataTypes.h:1956
virtual size_type size() const
returns the number of elements
Definition DataTypes.h:1993
iterator end()
returns an iterator to the end
Definition DataTypes.h:1971
reference at(size_type i)
access the specified element with bounds checking
Definition DataTypes.h:2009
const_iterator begin() const
returns an iterator to the beginning
Definition DataTypes.h:1969
reverse_iterator rbegin()
returns a reverse iterator to the beginning
Definition DataTypes.h:1975
bool empty() const
checks whether the container is empty
Definition DataTypes.h:1991
std::vector< T >::pointer pointer
Definition DataTypes.h:1948
std::vector< T >::reverse_iterator reverse_iterator
Definition DataTypes.h:1962
const_reverse_iterator rend() const
returns a reverse iterator to the end
Definition DataTypes.h:1981
std::vector< T >::const_pointer const_pointer
Definition DataTypes.h:1950
Base class for pod array value types.
Definition DataTypes.h:1905
Base class for pod multidimensional arrays.
Definition DataTypes.h:2052
Base class for user defined pod value types.
Definition DataTypes.h:1894
pod multidimensional array value type
Definition DataTypes.h:2079
virtual void AssignSubArray(const std::vector< uint32_t > &memorypos, const boost::intrusive_ptr< RRPodMultiDimArray< T > > &buffer, const std::vector< uint32_t > &bufferpos, const std::vector< uint32_t > &count)
Assign a subset of an array.
Definition DataTypes.h:2138
virtual void RetrieveSubArray(const std::vector< uint32_t > &memorypos, const boost::intrusive_ptr< RRPodMultiDimArray< T > > &buffer, const std::vector< uint32_t > &bufferpos, const std::vector< uint32_t > &count)
Retrieve a subset of an array.
Definition DataTypes.h:2105
Base class for user defined structure value types.
Definition DataTypes.h:1068
Represents. a point in time. Used by wire members to timestamp packets.
Definition DataTypes.h:2713
bool operator==(const TimeSpec &t2) const
equality comparison
int64_t seconds
Seconds since epoch.
Definition DataTypes.h:2716
bool operator<=(const TimeSpec &t2) const
less-than-or-equal comparison
TimeSpec operator-(const TimeSpec &t2) const
subtraction operator
void cleanup_nanosecs()
normalize nanoseconds to be within 0 and 1e9-1
bool operator>=(const TimeSpec &t2) const
greater-than-or-equal comparison
TimeSpec(int64_t seconds, int32_t nanoseconds)
Construct timespec with specified time.
bool operator!=(const TimeSpec &t2) const
inequality comparison
bool operator<(const TimeSpec &t2) const
less-then comparison
TimeSpec operator+(const TimeSpec &t2) const
addition operator
bool operator>(const TimeSpec &t2) const
greater-than comparison
int32_t nanoseconds
Nanoseconds from epoch. Normalized to be between 0 and 1e9-1.
Definition DataTypes.h:2718
TimeSpec()
Construct empty timespec.
Complex double precision floating point number.
Definition DataTypes.h:78
double real
real component
Definition DataTypes.h:80
cdouble(double r, double i)
Construct a new cdouble.
Definition DataTypes.h:91
cdouble()
Construct a new cdouble with 0.0 real and imag.
Definition DataTypes.h:84
double imag
imaginary component
Definition DataTypes.h:82
Complex single precision floating point number.
Definition DataTypes.h:100
cfloat()
Construct a new csingle with 0.0 real and imag.
Definition DataTypes.h:106
float real
real component
Definition DataTypes.h:102
float imag
imaginary component
Definition DataTypes.h:104
cfloat(float r, float i)
Construct a new cfloat.
Definition DataTypes.h:113
Logical boolean represented using 8 bits.
Definition DataTypes.h:123
rr_bool()
Construct a new false rr_bool.
Definition DataTypes.h:132
uint8_t value
The value of the boolean.
Definition DataTypes.h:129
rr_bool(uint8_t b)
Construct a new rr_bool object.
Definition DataTypes.h:138