Pothos  0.1.1
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Label.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
13 #include <Pothos/Object/Object.hpp>
14 #include <string>
15 
16 namespace Pothos {
17 
24 {
25 public:
27  Label(void);
28 
30  template <typename ValueType>
31  Label(const std::string &id, ValueType &&data, const unsigned long long index);
32 
39  std::string id;
40 
45 
51  unsigned long long index;
52 
54  bool operator<(const Label &other) const;
55 
57  template<class Archive>
58  void serialize(Archive & ar, const unsigned int version);
59 };
60 
62 inline bool operator==(const Label &rhs, const Label &lhs);
63 
69 {
70 public:
71 
73  typedef const Label* const_iterator;
74 
76  LabelIteratorRange(void);
77 
79  template <typename IterType>
80  LabelIteratorRange(const IterType &begin, const IterType &end);
81 
83  template <typename RangeType>
84  LabelIteratorRange(const RangeType &range);
85 
87  const_iterator begin(void) const;
88 
90  const_iterator end(void) const;
91 
92 private:
93  const_iterator _begin;
94  const_iterator _end;
95 };
96 
97 } //namespace Pothos
98 
99 template <typename ValueType>
100 Pothos::Label::Label(const std::string &id, ValueType &&data, const unsigned long long index):
101  id(id),
102  data(Object(std::forward<ValueType>(data))),
103  index(index)
104 {
105  return;
106 }
107 
108 inline bool Pothos::operator==(const Label &rhs, const Label &lhs)
109 {
110  return rhs.index == lhs.index and rhs.data == lhs.data;
111 }
112 
113 inline bool Pothos::Label::operator<(const Label &other) const
114 {
115  return this->index < other.index;
116 }
117 
118 template <typename IterType>
119 Pothos::LabelIteratorRange::LabelIteratorRange(const IterType &begin, const IterType &end):
120  _begin(begin), _end(end)
121 {
122  return;
123 }
124 
125 template <typename RangeType>
127  _begin(range.data()), _end(range.data() + range.size())
128 {
129  return;
130 }
131 
133 {
134  return _begin;
135 }
136 
138 {
139  return _end;
140 }
const_iterator end(void) const
Get the end of the iterator range (exclusive)
Definition: Label.hpp:137
Definition: Label.hpp:23
Definition: Label.hpp:68
#define POTHOS_API
Definition: Config.hpp:41
const Label * const_iterator
Const Label iterator type.
Definition: Label.hpp:73
unsigned long long index
Definition: Label.hpp:51
bool operator<(const Label &other) const
support for sorting Labels by index
Definition: Label.hpp:113
bool operator==(const ManagedBuffer &lhs, const ManagedBuffer &rhs)
Definition: ManagedBuffer.hpp:132
Label(void)
Create an empty label with null data and zero index.
Definition: Object.hpp:55
void serialize(Archive &, Pothos::Detail::ObjectContainer &, const unsigned int)
Definition: Serialize.hpp:46
Object data
Definition: Label.hpp:44
std::string id
Definition: Label.hpp:39
const_iterator begin(void) const
Get the begining of the iterator range (inclusive)
Definition: Label.hpp:132
LabelIteratorRange(void)
Create an empty/invalid LabelIteratorRange.