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 protected:
319 };
320 
321 
322 
323 template<typename Derived, typename T>
325 {
326 public:
327 
329 
330  // push down some important types from our base
331  typedef typename Base::Shared Shared;
333  typedef typename Base::Slot Slot;
334  typedef typename Base::ValueType ValueType;
335 
336 public:
337 
340 
342  ChannelReadWriteBase(ChannelTypePtr channel, Slot* slot) : Base(channel,slot) {}
343 
344 protected:
345 
352  this->checkValid();
353  return this->shared->slot->data;
354  }
355 
361  const ValueType& internalValue() const {
362  this->checkValid();
363  return this->shared->slot->data;
364  }
365 
366 };
367 
368 
373 template<typename Derived>
374 class ChannelReadWriteBase<Derived, void> : public ChannelReadWriteCommonBase<Derived>
375 {
376 public:
377 
379 
380  // push down some important types from our base
381  typedef typename Base::Shared Shared;
383  typedef typename Base::Slot Slot;
384  typedef typename Base::ValueType ValueType;
385 
386 public:
387 
390 
392  ChannelReadWriteBase(ChannelTypePtr channel, Slot* slot) : Base(channel,slot) {}
393 
394 protected:
395 
402  this->checkValid();
403  return this->shared->channel->getBuffer()->getStampedHeader(this->shared->slot);
404  }
405 
411  const ValueType& internalValue() const {
412  this->checkValid();
413  return this->shared->channel->getBuffer()->getStampedHeader(this->shared->slot);
414  }
415 
416 };
417 
419 
434 template<typename T>
435 class ChannelRead : public ChannelReadWriteBase<ChannelRead<T>,T>
436 {
437 protected:
438 
440 
441  // push down some important types from our base
442  typedef typename Base::Shared Shared;
444  typedef typename Base::Slot Slot;
445  typedef typename Base::ValueType ValueType;
446 
447 public:
448 
459 
465  ChannelRead(ChannelTypePtr channel, Slot* slot) : Base(channel, slot) {}
466 
467 public:
468 
475  operator const ValueType&() const { return this->internalValue(); }
476 
484  const ValueType& operator*() const { return this->internalValue(); }
485 
505  const ValueType* operator->() const { return &this->internalValue(); }
506 
507 public:
508  // make read-methods public
509 
511  return Base::readSerializedValue();
512  }
513 
514  const Buffer<uint8>& readSerializedValue(uint8 formatVersion, bool orLower) {
515  return Base::readSerializedValue(formatVersion, orLower);
516  }
517 
518  Buffer<uint8> readSerializedValue(std::list<BinarySerializerCodecPtr>& codecs) {
519  return Base::readSerializedValue(codecs);
520  }
521 
522  Buffer<uint8> readSerializedValue(std::list<BinarySerializerCodecPtr>& codecs,
523  uint8 formatVersion, bool orLower) {
524  return Base::readSerializedValue(codecs, formatVersion, orLower);
525  }
526 
527 
528  void readJSON(JSONValue& oValue) {
529  Base::readJSON(oValue);
530  }
531 
532  void readJSON(JSONValue& oValue, JSONSerializer& serializer) {
533  Base::readJSON(oValue, serializer);
534  }
535 
536 public:
537 
543  void finish() {
544  if(this->isValid())
545  finish(this->shared.get());
546  }
547 
548 public:
549 
554 
555 protected:
556 
558 
559  // API for ~ChannelReadWriteShared
560  static void finish(Shared* shared) {
561  assert(shared!=NULL);
562  if(shared->lock.owns_lock())
563  shared->lock.unlock();
564  }
565 
566  static void discard(Shared* shared) {
567  // for read objects a "discard" is equal to a "finish"
568  finish(shared);
569  }
570 
571 };
572 
574 
593 template<typename T>
594 class ChannelWrite : public ChannelReadWriteBase<ChannelWrite<T>, T>
595 {
596 protected:
598 
599  // push down some important types from our base
600  typedef typename Base::Shared Shared;
602  typedef typename Base::Slot Slot;
603  typedef typename Base::ValueType ValueType;
604 
605 
606 public:
607 
618 
625  ChannelWrite(ChannelTypePtr channel, Slot* slot) : Base(channel, slot) {
626  static_cast<StampedHeader&>(this->internalValue()).timestamp = Time::now();
627  }
628 
629 public:
630 
637  operator ValueType&() { return this->internalValue(); }
638 
646  ValueType& operator*() { return this->internalValue(); }
647 
648 
649  /*const ValueType& operator=(const T& value) {
650  this->internalValue() = value;
651  return this->internalValue();
652  }*/
653 
654  const ValueType& operator=(const ValueType& value) {
655  this->internalValue() = value;
656  return this->internalValue();
657  }
658 
659 
679  ValueType* operator->() { return &this->internalValue(); }
680 
681 public:
682  // make write-methods public
683 
685  Base::writeSerializedValue(std::move(data));
686  }
687 
688  void writeJSON(const JSONValue& value) {
689  Base::writeJSON(value);
690  }
691 
692  void writeJSON(JSONDeserializer& deserializer) {
693  Base::writeJSON(deserializer);
694  }
695 
696 public:
697 
704  void finish()
705  {
706  if(this->isValid())
707  finish(this->shared.get());
708  }
709 
718  void discard()
719  {
720  if(this->isValid())
721  discard(this->shared.get());
722  }
723 
724 
725 public:
726 
731 
732 protected:
734 
735  // API for ~ChannelReadWriteShared
736  static void finish(Shared* shared)
737  {
738  assert(shared!=NULL);
739  if(shared->lock.owns_lock()) {
740  // release lock object, since it is unlocked by finishWrite()
741  shared->lock.release();
742  // inform the channel, that the writing was finished
743  shared->channel->finishWrite(shared->slot);
744  }
745  }
746 
747  static void discard(Shared* shared)
748  {
749  assert(shared!=NULL);
750  if(shared->lock.owns_lock()) {
751  // release lock object, since it is unlocked by discardWrite()
752  shared->lock.release();
753  // inform the channel, to discard writing
754  shared->channel->discardWrite(shared->slot);
755  }
756  }
757 };
758 
760 // typed read and writes
761 
762 template<typename T>
764 {
768  typedef boost::shared_lock<boost::shared_mutex> Lock; // use shared locks for readers
769 };
770 
771 template<typename T>
773 {
777  typedef boost::unique_lock<boost::shared_mutex> Lock; // use unique locks for writers
778 };
779 
781 // untyped read and writes
782 
783 template<>
785 {
789  typedef boost::shared_lock<boost::shared_mutex> Lock; // use shared locks for readers
790 };
791 
792 template<>
794 {
798  typedef boost::unique_lock<boost::shared_mutex> Lock; // use unique locks for writers
799 };
800 
802 
803 }
804 
805 
806 #endif
static void finish(Shared *shared)
Definition: ChannelReadWrite.h:560
Serializer for serializing objects in JSON format.
Definition: JSONSerializer.h:93
AbstractChannel ChannelType
Definition: ChannelReadWrite.h:786
Base::Shared Shared
Definition: ChannelReadWrite.h:331
Base::ValueType ValueType
Definition: ChannelReadWrite.h:334
ChannelReadWriteBase()
Constructs an empty (invalid) ChannelReadWriteBase object.
Definition: ChannelReadWrite.h:339
Base::ChannelTypePtr ChannelTypePtr
Definition: ChannelReadWrite.h:382
Base::Shared Shared
Definition: ChannelReadWrite.h:381
void finish()
Releases the lock explicitly.
Definition: ChannelReadWrite.h:543
boost::shared_lock< boost::shared_mutex > Lock
Definition: ChannelReadWrite.h:768
~ChannelReadWriteShared()
Definition: ChannelReadWrite.h:100
void discard()
Releases the lock explicitly WITHOUT informing the Channel and without signaling the subscribers...
Definition: ChannelReadWrite.h:718
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:378
ChannelBuffer< T >::ValueType ValueType
Definition: ChannelReadWrite.h:776
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:787
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:601
static void discard(Shared *shared)
Definition: ChannelReadWrite.h:566
const ValueType & internalValue() const
Returns a const reference on the data.
Definition: ChannelReadWrite.h:411
An object that allows exclusive write access to data of a channel.
Definition: ChannelReadWrite.h:594
const ValueType & operator=(const ValueType &value)
Definition: ChannelReadWrite.h:654
#define MIRA_LOG(level)
Use this macro to log data.
Definition: LoggingCore.h:528
Base::ChannelTypePtr ChannelTypePtr
Definition: ChannelReadWrite.h:443
ChannelBuffer< T >::Slot SlotType
Definition: ChannelReadWrite.h:775
ChannelBuffer< T >::Slot SlotType
Definition: ChannelReadWrite.h:766
ChannelBuffer< T >::ValueType ValueType
Definition: ChannelReadWrite.h:767
Base::Shared Shared
Definition: ChannelReadWrite.h:442
ChannelReadWriteShared(ChannelTypePtr iChannel, Slot *iSlot)
Definition: ChannelReadWrite.h:97
AbstractChannel ChannelType
Definition: ChannelReadWrite.h:795
ChannelBuffer< void >::Slot SlotType
Definition: ChannelReadWrite.h:796
void addFlags(uint32 moreFlags) const
For internal use only.
Definition: ChannelReadWrite.h:233
boost::unique_lock< boost::shared_mutex > Lock
Definition: ChannelReadWrite.h:777
void writeSerializedValue(Buffer< uint8 > data)
Definition: ChannelReadWrite.h:684
Definition: ChannelReadWrite.h:65
ChannelReadWriteBase()
Constructs an empty (invalid) ChannelReadWriteBase object.
Definition: ChannelReadWrite.h:389
void writeJSON(JSONDeserializer &deserializer)
Definition: ChannelReadWrite.h:692
An object that allows read access to data of a channel.
Definition: ChannelReadWrite.h:435
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:704
Base::Shared Shared
Definition: ChannelReadWrite.h:600
void writeJSON(const JSONValue &value)
Definition: ChannelReadWrite.h:307
ChannelBuffer< void >::ValueType ValueType
Definition: ChannelReadWrite.h:797
const ValueType & internalValue() const
Returns a const reference on the data.
Definition: ChannelReadWrite.h:361
Base::Slot Slot
Definition: ChannelReadWrite.h:333
Wrapper class for boost::posix_time::ptime for adding more functionality to it.
Definition: Time.h:421
ChannelReadWriteCommonBase< Derived > Base
Definition: ChannelReadWrite.h:328
const Buffer< uint8 > & readSerializedValue()
Definition: ChannelReadWrite.h:510
ValueType * operator->()
Returns a pointer on the data.
Definition: ChannelReadWrite.h:679
ValueType & internalValue()
Returns a reference on the data.
Definition: ChannelReadWrite.h:401
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:617
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
Base::Slot Slot
Definition: ChannelReadWrite.h:444
Shared::Slot Slot
Definition: ChannelReadWrite.h:158
Definition: AbstractChannel.h:70
Base::Slot Slot
Definition: ChannelReadWrite.h:383
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:484
ChannelRead()
Default constructor that constructs a ChannelRead object that is invalid at the beginning and contain...
Definition: ChannelReadWrite.h:458
ChannelReadWriteBase< ChannelWrite< T >, T > Base
Definition: ChannelReadWrite.h:597
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:646
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
ChannelReadWriteBase< ChannelRead< T >, T > Base
Definition: ChannelReadWrite.h:439
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:774
Container for storing a single data element in the linked list.
Definition: ChannelBuffer.h:165
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:505
static void discard(Shared *shared)
Definition: ChannelReadWrite.h:747
#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:342
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:625
ConcreteChannel< T > ChannelType
Definition: ChannelReadWrite.h:765
Base::ValueType ValueType
Definition: ChannelReadWrite.h:384
boost::shared_lock< boost::shared_mutex > Lock
Definition: ChannelReadWrite.h:789
void readJSON(JSONValue &oValue)
Definition: ChannelReadWrite.h:528
Shared::ValueType ValueType
Definition: ChannelReadWrite.h:159
SharedPtr shared
Definition: ChannelReadWrite.h:318
Base::ValueType ValueType
Definition: ChannelReadWrite.h:445
Base::Slot Slot
Definition: ChannelReadWrite.h:602
boost::unique_lock< boost::shared_mutex > Lock
Definition: ChannelReadWrite.h:798
void writeJSON(const JSONValue &value)
Definition: ChannelReadWrite.h:688
ChannelReadWriteBase(ChannelTypePtr channel, Slot *slot)
Constructs a valid ChannelReadWriteBase object that is assigned to a channel and slot.
Definition: ChannelReadWrite.h:392
ValueType & internalValue()
Returns a reference on the data.
Definition: ChannelReadWrite.h:351
Buffer< uint8 > readSerializedValue(std::list< BinarySerializerCodecPtr > &codecs)
Definition: ChannelReadWrite.h:518
void readJSON(JSONValue &oValue, JSONSerializer &serializer)
Definition: ChannelReadWrite.h:532
Base::ChannelTypePtr ChannelTypePtr
Definition: ChannelReadWrite.h:332
ChannelBuffer< void >::ValueType ValueType
Definition: ChannelReadWrite.h:788
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:324
Base::ValueType ValueType
Definition: ChannelReadWrite.h:603
Buffer< uint8 > readSerializedValue(std::list< BinarySerializerCodecPtr > &codecs, uint8 formatVersion, bool orLower)
Definition: ChannelReadWrite.h:522
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:465
const Time & getTimestamp() const
Definition: ChannelReadWrite.h:203
static void finish(Shared *shared)
Definition: ChannelReadWrite.h:736
ChannelReadWriteTraits< DerivedContainer >::ChannelType ChannelType
Definition: ChannelReadWrite.h:87
const Buffer< uint8 > & readSerializedValue(uint8 formatVersion, bool orLower)
Definition: ChannelReadWrite.h:514