MFClient  1.3.0
 All Classes Functions Variables Enumerations
MFProtoMsgWrapper.h
1 #ifndef _MF_PROTOOUTPUTBUFFERWRAPPER_H_
2 #define _MF_PROTOOUTPUTBUFFERWRAPPER_H_
3 
4 #include <MFProtoOutputBuffer.h>
5 
6 #include <boost/noncopyable.hpp>
7 
14 
15 //=================================================================================
16 template <class T>
17 class MFProtoMsgWrapper : private boost::noncopyable {
18  public:
19  MFProtoMsgWrapper() { _buf.allocateNextMsg(_msg); }
20 
28  T& msg() { return _msg; }
29 
34  MFProtoOutputBuffer& buf() { return _buf; }
35 
41  void reset() {
42  _buf.clear();
43  _buf.allocateNextMsg(_msg);
44  }
45 
54  void reset(size_t msgSize) {
55  _buf.clear();
56  _buf.allocateNextMsg(_msg, msgSize);
57  }
58 
59  private:
60  MFProtoOutputBuffer _buf;
61  T _msg;
62 };
63 #endif
A wrapper to encapsulate an SBE class instance and the buffer where the message payload is actually s...
Definition: MFProtoMsgWrapper.h:17
void reset(size_t msgSize)
Clear out the buffer - resetting counters to the beginning. Allocate a block of the buffer for the he...
Definition: MFProtoMsgWrapper.h:54
void reset()
Clear out the buffer - resetting counters to the beginning. Allocate a block of the buffer for the he...
Definition: MFProtoMsgWrapper.h:41
T & msg()
Return a reference to the message object. Note that if the message has been sent, this reference will...
Definition: MFProtoMsgWrapper.h:28
MFProtoOutputBuffer & buf()
Return a reference to the buffer where the object payload is stored.
Definition: MFProtoMsgWrapper.h:34