12#ifndef ROOT_MPSendRecv
13#define ROOT_MPSendRecv
41template<class T, typename std::enable_if<std::is_class<T>::value>
::type * =
nullptr>
44template < class T, typename std::enable_if < !std::is_class<T>::value &&!std::is_pointer<T>::value >
::type * =
nullptr >
47template<class T, typename std::enable_if<std::is_same<const char *, T>::value>
::type * =
nullptr>
50template < class T, typename std::enable_if < std::is_pointer<T>::value &&std::is_constructible<TObject *, T>::value >
::type * =
nullptr >
57template<class T, typename std::enable_if<std::is_class<T>::value>
::type * =
nullptr>
61template < class T, typename std::enable_if < !std::is_class<T>::value &&!std::is_pointer<T>::value >
::type * =
nullptr >
65template<class T, typename std::enable_if<std::is_same<const char *, T>::value>
::type * =
nullptr>
69template < class T, typename std::enable_if < std::is_pointer<T>::value &&std::is_constructible<TObject *, T>::value >
::type * =
nullptr >
90template<class T, typename std::enable_if<std::is_class<T>::value>
::type *>
95 Error(
"MPSend",
"[E] Could not find cling definition for class %s\n",
typeid(
T).
name());
110template < class T, typename std::enable_if < !std::is_class<T>::value &&!std::is_pointer<T>::value >
::type * >
115 wBuf << code << size << obj;
116 return s->SendRaw(wBuf.Buffer(), wBuf.Length());
121template<class T, typename std::enable_if<std::is_same<const char *, T>::value>
::type *>
125 wBuf.WriteUInt(code);
126 wBuf.WriteULong(strlen(obj) + 1);
127 wBuf.WriteString(obj);
128 return s->SendRaw(wBuf.Buffer(), wBuf.Length());
132template < class T, typename std::enable_if < std::is_pointer<T>::value && std::is_constructible<TObject *, T>::value >
::type * >
138 objBuf.WriteObjectAny(obj, obj->IsA());
142 wBuf.WriteUInt(code);
143 wBuf.WriteULong(objBuf.Length());
145 wBuf.WriteBuf(objBuf.Buffer(), objBuf.Length());
146 return s->SendRaw(wBuf.Buffer(), wBuf.Length());
156template<class T, typename std::enable_if<std::is_class<T>::value>
::type *>
167template < class T, typename std::enable_if < !std::is_class<T>::value &&!std::is_pointer<T>::value >
::type * >
176template<class T, typename std::enable_if<std::is_same<const char *, T>::value>
::type *>
185template < class T, typename std::enable_if < std::is_pointer<T>::value &&std::is_constructible<TObject *, T>::value >
::type * >
std::pair< unsigned, std::unique_ptr< TBufferFile > > MPCodeBufPair
An std::pair that wraps the code and optional object contained in a message.
MPCodeBufPair MPRecv(TSocket *s)
Receive message from a socket.
int MPSend(TSocket *s, unsigned code)
Send a message with the specified code on the specified socket.
T ReadBuffer(TBufferFile *buf)
One of the template functions used to read objects from messages.
void Error(const char *location, const char *msgfmt,...)
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
virtual void WriteULong(ULong_t l)
virtual void WriteBuf(const void *buf, Int_t max)
Write max bytes from buf into the I/O buffer.
virtual void WriteUInt(UInt_t i)
virtual char * ReadString(char *s, Int_t max)
Read string from I/O buffer.
virtual void * ReadObjectAny(const TClass *cast)
Read object from I/O buffer.
virtual Int_t WriteObjectAny(const void *obj, const TClass *ptrClass, Bool_t cacheReuse=kTRUE)
Write object to I/O buffer.
The ROOT global object gROOT contains a list of all defined classes.
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.
static constexpr double s