MIRA
ChannelReadWrite.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
48 #ifndef _MIRA_CHANNELLOCKEDREADWRITE_H_
49 #define _MIRA_CHANNELLOCKEDREADWRITE_H_
50 
51 #ifndef Q_MOC_RUN
52 #include <boost/shared_ptr.hpp>
53 #include <boost/thread/shared_mutex.hpp>
54 #include <boost/thread/locks.hpp>
55 #endif
56 
57 #include <fw/AbstractChannel.h>
58 
59 namespace mira {
60 
62 
63 // forward declaration
64 template<typename T>
66 
67 template<typename T>
68 class Channel;
69 
70 // forward declaration
71 template <typename ConcreteChannelReadWrite>
73 
75 
83 template<typename DerivedContainer>
85 {
86 public:
91 
93 
94 
95 public:
96 
98  channel(iChannel), slot(iSlot), lock(iSlot->lock, boost::adopt_lock) {}
99 
101  // if our destructor was invoked due to stack unwinding in an exception
102  // handling mechanism, we do NOT write the data but discard it. The
103  // data is written only if the destructor is called as we got out
104  // of scope WITHOUT a raised exception.
105 #if __cplusplus >= 201703L
106  if(std::uncaught_exceptions() == 0)
107 #else
108  if(!std::uncaught_exception()) // deprecated in C++17
109 #endif
110  try {
111  DerivedContainer::finish(this); // may throw
112  }
113  // do not allow exceptions to escape from the destructor,
114  // they will terminate the program!
115  catch(std::exception& ex) {
116  MIRA_LOG_EXCEPTION(ERROR, ex) << "Error in ChannelRead/Write::finish(): ";
117  }
118  catch(...) {
119  MIRA_LOG(ERROR) << "Unknown error in ChannelRead/Write::finish()";
120  }
121  else
122  DerivedContainer::discard(this); // must not throw
123  }
124 
125 public:
126 
129 
135 
138 };
139 
141 
147 template<typename Derived>
149 {
150 public:
151 
153  typedef boost::shared_ptr<Shared> SharedPtr;
154 
155  // import some important types from our Shared class
158  typedef typename Shared::Slot Slot;
159  typedef typename Shared::ValueType ValueType;
160 
161 public:
162 
165 
168  shared(new Shared(channel, slot) )
169  {}
170 
171 public:
172 
183  bool isValid() const {
184  // channel must be assigned and data must be locked
185  return shared.get()!=NULL && shared->lock.owns_lock();
186  }
187 
188 public:
189 
190  const std::string& getChannelID() {
191  static std::string emptyString;
192  return shared.get()!=NULL ? shared->channel->getID() : emptyString;
193  }
194 
195  std::string getTypename() const {
196  return shared.get()!=NULL ? shared->channel->getTypename() : "";
197  }
198 
200  return shared.get()!=NULL ? shared->channel->getTypeMeta() : TypeMetaPtr();
201  }
202 
203  const Time& getTimestamp() const {
204  checkValid();
205  return shared->slot->timestamp();
206  }
207 
212  int getUseCount() const {
213  return shared.get()!=NULL ? shared.use_count() : 0;
214  }
215 
216 public:
217 
223  uint32 getFlags() const {
224  checkValid();
225  return shared->slot->flags;
226  }
227 
233  void addFlags(uint32 moreFlags) const {
234  checkValid();
235  shared->slot->flags |= moreFlags;
236  }
237 
238 protected:
239 
241  void checkValid() const {
242  if(shared.get()==NULL)
243  MIRA_THROW(XAccessViolation, "Trying to access ChannelRead / "
244  "ChannelWrite that was not assigned with valid data");
245 
246  if(!shared->lock.owns_lock())
247  MIRA_THROW(XAccessViolation, "Trying to access data of ChannelRead "
248  "/ ChannelWrite after losing the lock");
249  }
250 
251 protected:
252  // these read and write methods are protected by default. They will be
253  // made public in the final ChannelRead/Write classes.
254 
256  checkValid();
257  const Buffer<uint8>& res =
258  shared->channel->getBuffer()->readSerializedValue(shared->slot);
259 
260  // ??? can we ever have an empty vector here ???
261  // I think we can't, since:
262  // 1. we either have a typed buffer where we can deserialize the
263  // data, if it doesn't exist.
264  // 2. If we have an untyped buffer, someone has probably written
265  // some serialized data, otherwise the reader would never get a
266  // ChannelRead object since the channel is empty. He would have
267  // got an exception when trying to obtain the read object.
268  assert(!res.empty());
269  return res;
270  }
271 
272  const Buffer<uint8>& readSerializedValue(uint8 formatVersion, bool orLower) {
273  checkValid();
274  return shared->channel->getBuffer()->readSerializedValue(shared->slot, formatVersion, orLower);
275  }
276 
278  Buffer<uint8> readSerializedValue(std::list<BinarySerializerCodecPtr>& codecs) {
279  checkValid();
280  return shared->channel->getBuffer()->readSerializedValue(shared->slot, codecs);
281  }
282 
283  Buffer<uint8> readSerializedValue(std::list<BinarySerializerCodecPtr>& codecs,
284  uint8 formatVersion, bool orLower) {
285  checkValid();
286  return shared->channel->getBuffer()->readSerializedValue(shared->slot, codecs,
287  formatVersion, orLower);
288  }
289 
290  void readJSON(JSONValue& oValue) {
291  checkValid();
292  shared->channel->getBuffer()->readJSON(shared->slot, oValue);
293  }
294 
295  void readJSON(JSONValue& oValue, JSONSerializer& serializer) {
296  checkValid();
297  shared->channel->getBuffer()->readJSON(shared->slot, oValue, serializer);
298  }
299 
300 protected:
301 
303  checkValid();
304  shared->channel->getBuffer()->writeSerializedValue(shared->slot, std::move(data));
305  }
306 
307  void writeJSON(const JSONValue& value) {
308  checkValid();
309  shared->channel->getBuffer()->writeJSON(shared->slot, value);
310  }
311 
312  void writeJSON(JSONDeserializer& deserializer) {
313  checkValid();
314  shared->channel->getBuffer()->writeJSON(shared->slot, deserializer);
315  }
316 
317  void writeXML(const XMLDom::const_iterator& node) {
318  checkValid();
319  shared->channel->getBuffer()->writeXML(shared->slot, node);
320  }
321 
322 protected:
324 };
325 
326 
327 
328 template<typename Derived, typename T>
330 {
331 public:
332 
334 
335  // push down some important types from our base
336  typedef typename Base::Shared Shared;
338  typedef typename Base::Slot Slot;
339  typedef typename Base::ValueType ValueType;
340 
341 public:
342 
345 
347  ChannelReadWriteBase(ChannelTypePtr channel, Slot* slot) : Base(channel,slot) {}
348 
349 protected:
350 
357  this->checkValid();
358  return this->shared->slot->data;
359  }
360 
366  const ValueType& internalValue() const {
367  this->checkValid();
368  return this->shared->slot->data;
369  }
370 
371 };
372 
373 
378 template<typename Derived>
379 class ChannelReadWriteBase<Derived, void> : public ChannelReadWriteCommonBase<Derived>
380 {
381 public:
382 
384 
385  // push down some important types from our base
386  typedef typename Base::Shared Shared;
388  typedef typename Base::Slot Slot;
389  typedef typename Base::ValueType ValueType;
390 
391 public:
392 
395 
397  ChannelReadWriteBase(ChannelTypePtr channel, Slot* slot) : Base(channel,slot) {}
398 
399 protected:
400 
407  this->checkValid();
408  return this->shared->channel->getBuffer()->getStampedHeader(this->shared->slot);
409  }
410 
416  const ValueType& internalValue() const {
417  this->checkValid();
418  return this->shared->channel->getBuffer()->getStampedHeader(this->shared->slot);
419  }
420 
421 };
422 
424 
439 template<typename T>
440 class ChannelRead : public ChannelReadWriteBase<ChannelRead<T>,T>
441 {
442 protected:
443 
445 
446  // push down some important types from our base
447  typedef typename Base::Shared Shared;
449  typedef typename Base::Slot Slot;
450  typedef typename Base::ValueType ValueType;
451 
452 public:
453 
464 
470  ChannelRead(ChannelTypePtr channel, Slot* slot) : Base(channel, slot) {}
471 
472 public:
473 
480  operator const ValueType&() const { return this->internalValue(); }
481 
489  const ValueType& operator*() const { return this->internalValue(); }
490 
510  const ValueType* operator->() const { return &this->internalValue(); }
511 
512 public:
513  // make read-methods public
514 
516  return Base::readSerializedValue();
517  }
518 
519  const Buffer<uint8>& readSerializedValue(uint8 formatVersion, bool orLower) {
520  return Base::readSerializedValue(formatVersion, orLower);
521  }
522 
523  Buffer<uint8> readSerializedValue(std::list<BinarySerializerCodecPtr>& codecs) {
524  return Base::readSerializedValue(codecs);
525  }
526 
527  Buffer<uint8> readSerializedValue(std::list<BinarySerializerCodecPtr>& codecs,
528  uint8 formatVersion, bool orLower) {
529  return Base::readSerializedValue(codecs, formatVersion, orLower);
530  }
531 
532 
533  void readJSON(JSONValue& oValue) {
534  Base::readJSON(oValue);
535  }
536 
537  void readJSON(JSONValue& oValue, JSONSerializer& serializer) {
538  Base::readJSON(oValue, serializer);
539  }
540 
541 public:
542 
548  void finish() {
549  if(this->isValid())
550  finish(this->shared.get());
551  }
552 
553 public:
554 
559 
560 protected:
561 
563 
564  // API for ~ChannelReadWriteShared
565  static void finish(Shared* shared) {
566  assert(shared!=NULL);
567  if(shared->lock.owns_lock())
568  shared->lock.unlock();
569  }
570 
571  static void discard(Shared* shared) {
572  // for read objects a "discard" is equal to a "finish"
573  finish(shared);
574  }
575 
576 };
577 
579 
598 template<typename T>
599 class ChannelWrite : public ChannelReadWriteBase<ChannelWrite<T>, T>
600 {
601 protected:
603 
604  // push down some important types from our base
605  typedef typename Base::Shared Shared;
607  typedef typename Base::Slot Slot;
608  typedef typename Base::ValueType ValueType;
609 
610 
611 public:
612 
623 
630  ChannelWrite(ChannelTypePtr channel, Slot* slot) : Base(channel, slot) {
631  static_cast<StampedHeader&>(this->internalValue()).timestamp = Time::now();
632  }
633 
634 public:
635 
642  operator ValueType&() { return this->internalValue(); }
643 
651  ValueType& operator*() { return this->internalValue(); }
652 
653 
654  /*const ValueType& operator=(const T& value) {
655  this->internalValue() = value;
656  return this->internalValue();
657  }*/
658 
659  const ValueType& operator=(const ValueType& value) {
660  this->internalValue() = value;
661  return this->internalValue();
662  }
663 
664 
684  ValueType* operator->() { return &this->internalValue(); }
685 
686 public:
687  // make write-methods public
688 
690  Base::writeSerializedValue(std::move(data));
691  }
692 
693  void writeJSON(const JSONValue& value) {
694  Base::writeJSON(value);
695  }
696 
697  void writeJSON(JSONDeserializer& deserializer) {
698  Base::writeJSON(deserializer);
699  }
700 
701  void writeXML(const XMLDom::const_iterator& node) {
702  Base::writeXML(node);
703  }
704 
705 public:
706 
713  void finish()
714  {
715  if(this->isValid())
716  finish(this->shared.get());
717  }
718 
727  void discard()
728  {
729  if(this->isValid())
730  discard(this->shared.get());
731  }
732 
733 
734 public:
735 
740 
741 protected:
743 
744  // API for ~ChannelReadWriteShared
745  static void finish(Shared* shared)
746  {
747  assert(shared!=NULL);
748  if(shared->lock.owns_lock()) {
749  // release lock object, since it is unlocked by finishWrite()
750  shared->lock.release();
751  // inform the channel, that the writing was finished
752  shared->channel->finishWrite(shared->slot);
753  }
754  }
755 
756  static void discard(Shared* shared)
757  {
758  assert(shared!=NULL);
759  if(shared->lock.owns_lock()) {
760  // release lock object, since it is unlocked by discardWrite()
761  shared->lock.release();
762  // inform the channel, to discard writing
763  shared->channel->discardWrite(shared->slot);
764  }
765  }
766 };
767 
769 // typed read and writes
770 
771 template<typename T>
773 {
777  typedef boost::shared_lock<boost::shared_mutex> Lock; // use shared locks for readers
778 };
779 
780 template<typename T>
782 {
786  typedef boost::unique_lock<boost::shared_mutex> Lock; // use unique locks for writers
787 };
788 
790 // untyped read and writes
791 
792 template<>
794 {
798  typedef boost::shared_lock<boost::shared_mutex> Lock; // use shared locks for readers
799 };
800 
801 template<>
803 {
807  typedef boost::unique_lock<boost::shared_mutex> Lock; // use unique locks for writers
808 };
809 
811 
812 }
813 
814 
815 #endif
static void finish(Shared *shared)
Definition: ChannelReadWrite.h:565
Serializer for serializing objects in JSON format.
Definition: JSONSerializer.h:93
AbstractChannel ChannelType
Definition: ChannelReadWrite.h:795
Base::Shared Shared
Definition: ChannelReadWrite.h:336
Base::ValueType ValueType
Definition: ChannelReadWrite.h:339
ChannelReadWriteBase()
Constructs an empty (invalid) ChannelReadWriteBase object.
Definition: ChannelReadWrite.h:344
Base::ChannelTypePtr ChannelTypePtr
Definition: ChannelReadWrite.h:387
Base::Shared Shared
Definition: ChannelReadWrite.h:386
void finish()
Releases the lock explicitly.
Definition: ChannelReadWrite.h:548
boost::shared_lock< boost::shared_mutex > Lock
Definition: ChannelReadWrite.h:777
~ChannelReadWriteShared()
Definition: ChannelReadWrite.h:100
void discard()
Releases the lock explicitly WITHOUT informing the Channel and without signaling the subscribers...
Definition: ChannelReadWrite.h:727
Definition: SyncTimedRead.h:62
An exception that occurs whenever a channel has no data.
Definition: Channel.h:88
const Buffer< uint8 > & readSerializedValue(uint8 formatVersion, bool orLower)
Definition: ChannelReadWrite.h:272
void readJSON(JSONValue &oValue)
Definition: ChannelReadWrite.h:290
ChannelReadWriteCommonBase< Derived > Base
Definition: ChannelReadWrite.h:383
ChannelBuffer< T >::ValueType ValueType
Definition: ChannelReadWrite.h:785
Slot * slot
the slot in that channel we are pointing on (this pointer is valid unless the channel&#39;s buffer is des...
Definition: ChannelReadWrite.h:134
ChannelBuffer< void >::Slot SlotType
Definition: ChannelReadWrite.h:796
uint32 getFlags() const
For internal use only.
Definition: ChannelReadWrite.h:223
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Shared::ChannelType ChannelType
Definition: ChannelReadWrite.h:156
Base::ChannelTypePtr ChannelTypePtr
Definition: ChannelReadWrite.h:606
static void discard(Shared *shared)
Definition: ChannelReadWrite.h:571
const ValueType & internalValue() const
Returns a const reference on the data.
Definition: ChannelReadWrite.h:416
An object that allows exclusive write access to data of a channel.
Definition: ChannelReadWrite.h:599
const ValueType & operator=(const ValueType &value)
Definition: ChannelReadWrite.h:659
#define MIRA_LOG(level)
Use this macro to log data.
Definition: LoggingCore.h:528
Base::ChannelTypePtr ChannelTypePtr
Definition: ChannelReadWrite.h:448
ChannelBuffer< T >::Slot SlotType
Definition: ChannelReadWrite.h:784
ChannelBuffer< T >::Slot SlotType
Definition: ChannelReadWrite.h:775
ChannelBuffer< T >::ValueType ValueType
Definition: ChannelReadWrite.h:776
Base::Shared Shared
Definition: ChannelReadWrite.h:447
ChannelReadWriteShared(ChannelTypePtr iChannel, Slot *iSlot)
Definition: ChannelReadWrite.h:97
AbstractChannel ChannelType
Definition: ChannelReadWrite.h:804
ChannelBuffer< void >::Slot SlotType
Definition: ChannelReadWrite.h:805
void addFlags(uint32 moreFlags) const
For internal use only.
Definition: ChannelReadWrite.h:233
boost::unique_lock< boost::shared_mutex > Lock
Definition: ChannelReadWrite.h:786
void writeSerializedValue(Buffer< uint8 > data)
Definition: ChannelReadWrite.h:689
Definition: ChannelReadWrite.h:65
ChannelReadWriteBase()
Constructs an empty (invalid) ChannelReadWriteBase object.
Definition: ChannelReadWrite.h:394
void writeJSON(JSONDeserializer &deserializer)
Definition: ChannelReadWrite.h:697
An object that allows read access to data of a channel.
Definition: ChannelReadWrite.h:440
void readJSON(JSONValue &oValue, JSONSerializer &serializer)
Definition: ChannelReadWrite.h:295
#define MIRA_THROW(ex, msg)
Macro for throwing an exception.
Definition: Exception.h:81
Internally used by ChannelReadWriteBase! It contains the information about the channel and slot that ...
Definition: ChannelReadWrite.h:84
void finish()
Releases the lock explicitly and informs the Channel to signal all Subscribers that new data is avail...
Definition: ChannelReadWrite.h:713
Base::Shared Shared
Definition: ChannelReadWrite.h:605
void writeJSON(const JSONValue &value)
Definition: ChannelReadWrite.h:307
ChannelBuffer< void >::ValueType ValueType
Definition: ChannelReadWrite.h:806
const ValueType & internalValue() const
Returns a const reference on the data.
Definition: ChannelReadWrite.h:366
Const sibling_iterator for iterating over xml nodes that have the same parent (siblings) ...
Definition: XMLDom.h:671
Base::Slot Slot
Definition: ChannelReadWrite.h:338
Wrapper class for boost::posix_time::ptime for adding more functionality to it.
Definition: Time.h:421
ChannelReadWriteCommonBase< Derived > Base
Definition: ChannelReadWrite.h:333
const Buffer< uint8 > & readSerializedValue()
Definition: ChannelReadWrite.h:515
ValueType * operator->()
Returns a pointer on the data.
Definition: ChannelReadWrite.h:684
ValueType & internalValue()
Returns a reference on the data.
Definition: ChannelReadWrite.h:406
bool isValid() const
Returns true, if data was assigned to the ChannelRead or ChannelWrite and if this data is locked...
Definition: ChannelReadWrite.h:183
Definition: ChannelReadWrite.h:72
boost::shared_ptr< Shared > SharedPtr
Definition: ChannelReadWrite.h:153
ChannelWrite()
Default constructor that constructs a ChannelWrite object that is invalid at the beginning and contai...
Definition: ChannelReadWrite.h:622
Deserializer for serializing objects from JSON format.
Definition: JSONSerializer.h:400
ChannelReadWriteTraits< DerivedContainer >::Lock Lock
Definition: ChannelReadWrite.h:88
void writeJSON(JSONDeserializer &deserializer)
Definition: ChannelReadWrite.h:312
void writeXML(const XMLDom::const_iterator &node)
Definition: ChannelReadWrite.h:317
Base::Slot Slot
Definition: ChannelReadWrite.h:449
Shared::Slot Slot
Definition: ChannelReadWrite.h:158
Definition: AbstractChannel.h:70
Base::Slot Slot
Definition: ChannelReadWrite.h:388
The common header for all stamped data.
Definition: Stamped.h:62
const ValueType & operator*() const
Returns a const reference on the data.
Definition: ChannelReadWrite.h:489
ChannelRead()
Default constructor that constructs a ChannelRead object that is invalid at the beginning and contain...
Definition: ChannelReadWrite.h:463
ChannelReadWriteBase< ChannelWrite< T >, T > Base
Definition: ChannelReadWrite.h:602
bool empty() const
Checks if the buffer is empty (used size == 0).
Definition: Buffer.h:303
ValueType & operator*()
Returns a reference on the data.
Definition: ChannelReadWrite.h:651
TypeMetaPtr getTypeMeta() const
Definition: ChannelReadWrite.h:199
ChannelReadWriteShared< Derived > Shared
Definition: ChannelReadWrite.h:152
int getUseCount() const
Returns the number of shared instances for this data, may be useful for debugging purposes...
Definition: ChannelReadWrite.h:212
void writeXML(const XMLDom::const_iterator &node)
Definition: ChannelReadWrite.h:701
ChannelReadWriteBase< ChannelRead< T >, T > Base
Definition: ChannelReadWrite.h:444
const std::string & getChannelID()
Definition: ChannelReadWrite.h:190
Mix in for adding a time stamp, an optional frame id and an optional sequence id to data types like P...
Definition: Stamped.h:149
Shared::ChannelTypePtr ChannelTypePtr
Definition: ChannelReadWrite.h:157
boost::shared_ptr< TypeMeta > TypeMetaPtr
Definition: MetaSerializer.h:309
Definition: ChannelReadWrite.h:148
Buffer< uint8 > readSerializedValue(std::list< BinarySerializerCodecPtr > &codecs, uint8 formatVersion, bool orLower)
Definition: ChannelReadWrite.h:283
const Buffer< uint8 > & readSerializedValue()
Definition: ChannelReadWrite.h:255
void writeSerializedValue(Buffer< uint8 > data)
Definition: ChannelReadWrite.h:302
ChannelType * ChannelTypePtr
Definition: ChannelReadWrite.h:92
ChannelReadWriteTraits< DerivedContainer >::SlotType Slot
Definition: ChannelReadWrite.h:89
void checkValid() const
checks if we are still locked, if not it throws a XAccessViolation
Definition: ChannelReadWrite.h:241
ConcreteChannel< T > ChannelType
Definition: ChannelReadWrite.h:783
Container for storing a single data element in the linked list.
Definition: ChannelBuffer.h:166
Lock lock
a shared lock for that data in the channel&#39;s buffer
Definition: ChannelReadWrite.h:137
const ValueType * operator->() const
Returns a const pointer on the data.
Definition: ChannelReadWrite.h:510
static void discard(Shared *shared)
Definition: ChannelReadWrite.h:756
#define MIRA_LOG_EXCEPTION(level, ex)
Log the specified exception, including all information that the exception object carries.
Definition: LoggingAux.h:107
Channel< T > getChannel()
Returns a read-only channel proxy object of the underlying channel.
ChannelReadWriteCommonBase()
Constructs an empty (invalid) ChannelReadWriteBase object.
Definition: ChannelReadWrite.h:164
std::string getTypename() const
Definition: ChannelReadWrite.h:195
ChannelTypePtr channel
pointer to the channel our data/slot belongs to
Definition: ChannelReadWrite.h:128
ChannelReadWriteBase(ChannelTypePtr channel, Slot *slot)
Constructs a valid ChannelReadWriteBase object that is assigned to a channel and slot.
Definition: ChannelReadWrite.h:347
static Time now() static Time eternity()
Returns the current utc based time.
Definition: Time.h:484
ChannelWrite(ChannelTypePtr channel, Slot *slot)
Is called by Channel to construct a valid ChannelWrite object with the corresponding data...
Definition: ChannelReadWrite.h:630
ConcreteChannel< T > ChannelType
Definition: ChannelReadWrite.h:774
Base::ValueType ValueType
Definition: ChannelReadWrite.h:389
boost::shared_lock< boost::shared_mutex > Lock
Definition: ChannelReadWrite.h:798
void readJSON(JSONValue &oValue)
Definition: ChannelReadWrite.h:533
Shared::ValueType ValueType
Definition: ChannelReadWrite.h:159
SharedPtr shared
Definition: ChannelReadWrite.h:323
Base::ValueType ValueType
Definition: ChannelReadWrite.h:450
Base::Slot Slot
Definition: ChannelReadWrite.h:607
boost::unique_lock< boost::shared_mutex > Lock
Definition: ChannelReadWrite.h:807
void writeJSON(const JSONValue &value)
Definition: ChannelReadWrite.h:693
ChannelReadWriteBase(ChannelTypePtr channel, Slot *slot)
Constructs a valid ChannelReadWriteBase object that is assigned to a channel and slot.
Definition: ChannelReadWrite.h:397
ValueType & internalValue()
Returns a reference on the data.
Definition: ChannelReadWrite.h:356
Buffer< uint8 > readSerializedValue(std::list< BinarySerializerCodecPtr > &codecs)
Definition: ChannelReadWrite.h:523
void readJSON(JSONValue &oValue, JSONSerializer &serializer)
Definition: ChannelReadWrite.h:537
Base::ChannelTypePtr ChannelTypePtr
Definition: ChannelReadWrite.h:337
ChannelBuffer< void >::ValueType ValueType
Definition: ChannelReadWrite.h:797
Definition: LoggingCore.h:74
json::Value JSONValue
Imports the json::Value type into mira namespace.
Definition: JSON.h:363
Base class for all framework channels.
ChannelReadWriteTraits< DerivedContainer >::ValueType ValueType
Definition: ChannelReadWrite.h:90
ChannelReadWriteCommonBase(ChannelTypePtr channel, Slot *slot)
Constructs a valid ChannelReadWriteBase object that is assigned to a channel and slot.
Definition: ChannelReadWrite.h:167
Definition: ChannelReadWrite.h:329
Base::ValueType ValueType
Definition: ChannelReadWrite.h:608
Buffer< uint8 > readSerializedValue(std::list< BinarySerializerCodecPtr > &codecs, uint8 formatVersion, bool orLower)
Definition: ChannelReadWrite.h:527
Channel< T > getChannel()
Returns a write-only channel proxy object of the underlying channel.
Buffer< uint8 > readSerializedValue(std::list< BinarySerializerCodecPtr > &codecs)
Same as above, but allows to specify codecs for serialization.
Definition: ChannelReadWrite.h:278
ChannelRead(ChannelTypePtr channel, Slot *slot)
Is called by Channel to construct a ChannelRead object.
Definition: ChannelReadWrite.h:470
const Time & getTimestamp() const
Definition: ChannelReadWrite.h:203
static void finish(Shared *shared)
Definition: ChannelReadWrite.h:745
ChannelReadWriteTraits< DerivedContainer >::ChannelType ChannelType
Definition: ChannelReadWrite.h:87
const Buffer< uint8 > & readSerializedValue(uint8 formatVersion, bool orLower)
Definition: ChannelReadWrite.h:519