12#ifndef ROOT_MPSendRecv
13#define ROOT_MPSendRecv
42template<class T, typename std::enable_if<std::is_class<T>::value>
::type * =
nullptr>
45template < class T, typename std::enable_if < !std::is_class<T>::value &&!std::is_pointer<T>::value >
::type * =
nullptr >
48template<class T, typename std::enable_if<std::is_same<const char *, T>::value>
::type * =
nullptr>
51template < class T, typename std::enable_if < std::is_pointer<T>::value &&std::is_constructible<TObject *, T>::value >
::type * =
nullptr >
58template<class T, typename std::enable_if<std::is_class<T>::value>
::type * =
nullptr>
62template < class T, typename std::enable_if < !std::is_class<T>::value &&!std::is_pointer<T>::value >
::type * =
nullptr >
66template<class T, typename std::enable_if<std::is_same<const char *, T>::value>
::type * =
nullptr>
70template < class T, typename std::enable_if < std::is_pointer<T>::value &&std::is_constructible<TObject *, T>::value >
::type * =
nullptr >
91template<class T, typename std::enable_if<std::is_class<T>::value>
::type *>
94 TClass *
c = TClass::GetClass<T>();
96 Error(
"MPSend",
"[E] Could not find cling definition for class %s\n",
typeid(T).
name());
111template < class T, typename std::enable_if < !std::is_class<T>::value &&!std::is_pointer<T>::value >
::type * >
116 wBuf << code <<
size << obj;
117 return s->
SendRaw(wBuf.Buffer(), wBuf.Length());
122template<class T, typename std::enable_if<std::is_same<const char *, T>::value>
::type *>
126 wBuf.WriteUInt(code);
127 wBuf.WriteULong(strlen(obj) + 1);
128 wBuf.WriteString(obj);
129 return s->
SendRaw(wBuf.Buffer(), wBuf.Length());
133template < class T, typename std::enable_if < std::is_pointer<T>::value && std::is_constructible<TObject *, T>::value >
::type * >
139 objBuf.WriteObjectAny(obj, obj->IsA());
143 wBuf.WriteUInt(code);
144 wBuf.WriteULong(objBuf.Length());
146 wBuf.WriteBuf(objBuf.Buffer(), objBuf.Length());
147 return s->
SendRaw(wBuf.Buffer(), wBuf.Length());
157template<class T, typename std::enable_if<std::is_class<T>::value>
::type *>
168template < class T, typename std::enable_if < !std::is_class<T>::value &&!std::is_pointer<T>::value >
::type * >
177template<class T, typename std::enable_if<std::is_same<const char *, T>::value>
::type *>
186template < class T, typename std::enable_if < std::is_pointer<T>::value &&std::is_constructible<TObject *, T>::value >
::type * >
190 using objType =
typename std::remove_pointer<T>::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.
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
void WriteBuf(const void *buf, Int_t max) override
Write max bytes from buf into the I/O buffer.
void WriteUInt(UInt_t i) override
char * ReadString(char *s, Int_t max) override
Read string from I/O buffer.
void WriteULong(ULong_t l) override
void * ReadObjectAny(const TClass *cast) override
Read object from I/O buffer.
Int_t WriteObjectAny(const void *obj, const TClass *ptrClass, Bool_t cacheReuse=kTRUE) override
Write object to I/O buffer.
TClass instances represent classes, structs and namespaces in the ROOT type system.
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 SendRaw(const void *buffer, Int_t length, ESendRecvOptions opt=kDefault)
Send a raw buffer of specified length.