1 #ifndef ROOT_MPSendRecv
2 #define ROOT_MPSendRecv
10 #include <type_traits>
20 using MPCodeBufPair = std::pair<unsigned, std::unique_ptr<TBufferFile>>;
84 std::cerr <<
"[E] Could not find cling definition for class " <<
typeid(
T).
name() <<
"\n";
104 wBuf << code << size <<
obj;
105 return s->
SendRaw(wBuf.Buffer(), wBuf.Length());
114 wBuf.WriteUInt(code);
115 wBuf.WriteULong(strlen(obj) + 1);
116 wBuf.WriteString(obj);
117 return s->
SendRaw(wBuf.Buffer(), wBuf.Length());
127 objBuf.WriteObjectAny(obj, obj->IsA());
131 wBuf.WriteUInt(code);
132 wBuf.WriteULong(objBuf.Length());
134 wBuf.WriteBuf(objBuf.Buffer(), objBuf.Length());
135 return s->
SendRaw(wBuf.Buffer(), wBuf.Length());
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket...
Small helper to encapsulate whether to return the value pointed to by the iterator or its address...
T ReadBuffer(TBufferFile *buf)
One of the template functions used to read objects from messages.
int MPSend(TSocket *s, unsigned code)
Send a message with the specified code on the specified socket.
virtual void * ReadObjectAny(const TClass *cast)
Read object from I/O buffer.
virtual void WriteULong(ULong_t l)
virtual Int_t SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.
virtual char * ReadString(char *s, Int_t max)
Read string from I/O buffer.
virtual void WriteUInt(UInt_t i)
The ROOT global object gROOT contains a list of all defined classes.
virtual void WriteBuf(const void *buf, Int_t max)
Write max bytes from buf into the I/O buffer.
std::pair< unsigned, std::unique_ptr< TBufferFile >> MPCodeBufPair
An std::pair that wraps the code and optional object contained in a message.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
virtual Int_t WriteObjectAny(const void *obj, const TClass *ptrClass)
Write object to I/O buffer.
MPCodeBufPair MPRecv(TSocket *s)
Receive message from a socket.