TNetDirectoryConnection Class Reference

Collaboration diagram for TNetDirectoryConnection:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TNetDirectoryConnection (const char *host, int port)
int Reconnect ()
void Request (const char *req)
TObject * ReadObject (TClass *type)

Private Attributes

TSocket * fSocket

Detailed Description

Definition at line 18 of file TNetDirectory.cxx.


Constructor & Destructor Documentation

TNetDirectoryConnection::TNetDirectoryConnection ( const char *  host,
int  port 
) [inline]

Definition at line 24 of file TNetDirectory.cxx.

References fSocket.

00025   {
00026     fSocket = new TSocket(host, port);
00027     printf("Connected to %s:%d\n", host, port);
00028   }


Member Function Documentation

TObject* TNetDirectoryConnection::ReadObject ( TClass *  type  )  [inline]

Definition at line 49 of file TNetDirectory.cxx.

References fSocket.

Referenced by TNetDirectory::FindObject(), TNetDirectory::Get(), TNetDirectory::GetListOfKeys(), and TNetDirectory::ResetTH1().

00050   {
00051     TMessage *mr = 0;
00052     int r = fSocket->Recv(mr);
00053     //printf("ReadObject recv %d\n", r);
00054     if (r <= 0) {
00055       printf("Error reading from socket!\n");
00056       return NULL;
00057     }
00058 
00059     TObject *obj = NULL;
00060 
00061     if (mr) {
00062       //mr->Print();
00063       obj = (TObject*)mr->ReadObjectAny(mr->GetClass());
00064     }
00065 
00066     //printf("mr %p, obj %p, class %p, %s\n", mr, obj, mr->GetClass(), mr->GetClass()->GetName());
00067 
00068     if (obj) {
00069       //obj->Print();
00070 
00071       if (!obj->InheritsFrom(type)) {
00072 
00073         if (obj->IsA() == TObjString::Class()) {
00074             TObjString *ostr = (TObjString*)obj;
00075             printf("Instead of a %s, received a %s reading \'%s\'\n", type->GetName(), obj->IsA()->GetName(), ostr->GetName());
00076             return NULL;
00077         }
00078 
00079         printf("Object type mismatch, received %s, expected %s\n", obj->IsA()->GetName(), type->GetName());
00080         return NULL;
00081       }
00082     }
00083 
00084     if (mr)
00085       delete mr;
00086 
00087     return obj;
00088   }

Here is the caller graph for this function:

int TNetDirectoryConnection::Reconnect (  )  [inline]

Definition at line 30 of file TNetDirectory.cxx.

References fSocket.

Referenced by TNetDirectory::Reconnect().

00031   {
00032     std::string host = fSocket->GetName();
00033     int         port = fSocket->GetPort();
00034     fSocket->Close();
00035     delete fSocket;
00036     fSocket = new TSocket(host.c_str(), port);
00037     printf("Connected to %s:%d\n", host.c_str(), port);
00038     return 0;
00039   }

Here is the caller graph for this function:

void TNetDirectoryConnection::Request ( const char *  req  )  [inline]

Definition at line 41 of file TNetDirectory.cxx.

References fSocket, and gVerbose.

Referenced by TNetDirectory::FindObject(), TNetDirectory::Get(), TNetDirectory::GetListOfKeys(), and TNetDirectory::ResetTH1().

00042   {
00043     if (gVerbose)
00044       printf("Request [%s]\n", req);
00045     int s = fSocket->Send(req);
00046     //printf("Request sent %d\n", s);
00047   }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 20 of file TNetDirectory.cxx.

Referenced by ReadObject(), Reconnect(), Request(), and TNetDirectoryConnection().


The documentation for this class was generated from the following file:

Generated on 12 Feb 2016 for ROOT Analyzer by  doxygen 1.6.1