14#include "TObjString.h"
26 fSocket =
new TSocket(host, port);
27 printf(
"Connected to %s:%d\n", host, port);
32 std::string host =
fSocket->GetName();
36 fSocket =
new TSocket(host.c_str(), port);
37 printf(
"Connected to %s:%d\n", host.c_str(), port);
44 printf(
"Request [%s]\n", req);
47 printf(
"Request sent %d\n", s);
56 printf(
"Error reading from socket!\n");
64 obj = (TObject*)mr->ReadObjectAny(mr->GetClass());
72 if (!obj->InheritsFrom(type)) {
74 if (obj->IsA() == TObjString::Class()) {
75 TObjString *ostr = (TObjString*)obj;
76 printf(
"Instead of a %s, received a %s reading \'%s\'\n", type->GetName(), obj->IsA()->GetName(), ostr->GetName());
80 printf(
"Object type mismatch, received %s, expected %s\n", obj->IsA()->GetName(), type->GetName());
93 :
TDirectory(remoteServerName, remoteServerName,
"", motherDir)
96 printf(
"TNetDirectory::ctor: %s\n", remoteServerName);
99 strcpy(hostname, remoteServerName);
100 char* s = strchr(hostname,
':');
114 printf(
"TNetDirectory::ctor: conn %p, path [%s]\n", conn, path.c_str());
122 printf(
"TNetDirectory::dtor\n");
134 printf(
"TNetDirectory(%s)::ResetTH1(%s)\n",
fPath.c_str(), name);
136 std::string req =
"ResetTH1 ";
137 if (
fPath.length() > 0)
143 if (name && strlen(name)>0)
156 printf(
"TNetDirectory(%s)::Append(%p, name: %s)\n",
fPath.c_str(), obj, obj->GetName());
173 printf(
"TNetDirectory(%s)::FindObject(%s)\n",
fPath.c_str(), name);
175 for (
unsigned int i=0; i<
fSubDirs.size(); i++)
178 if (strcmp(name, s->GetName()) == 0)
185 std::string req =
"FindObjectByName ";
186 if (
fPath.length() > 0)
196 if (obj && strcmp(obj->IsA()->GetName(),
"TObjString") == 0)
198 const char* s = ((TObjString*)obj)->GetName();
199 if (strncmp(s,
"TDirectory ", 11) == 0)
210 assert(!
"not implemented");
218 printf(
"TNetDirectory(%s)::Get(%s)\n",
fPath.c_str(), namecycle);
220 std::string req =
"FindObjectByName ";
221 if (
fPath.length() > 0)
231 if (obj && strcmp(obj->IsA()->GetName(),
"TObjString") == 0)
233 const char* s = ((TObjString*)obj)->GetName();
234 if (strncmp(s,
"TDirectory ", 11) == 0)
236 const char* dirname = s+11;
238 printf(
"Got TDirectory %s\n", dirname);
260 printf(
"TNetDirectory(%s)::GetListOfKeys()\n",
fPath.c_str());
262 std::string req =
"GetListOfKeys";
263 if (
fPath.length() > 0)
virtual void Print(Option_t *option="") const
TObject * ReadObject(TClass *type)
TNetDirectoryConnection(const char *host, int port)
void Request(const char *req)
virtual void DeleteAll(Option_t *option="")
virtual TKey * FindKeyAny(const char *keyname) const
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
virtual void ReadAll(Option_t *option="")
virtual Int_t GetBufferSize() const
virtual void Print(Option_t *option="") const
virtual void Clear(Option_t *option="")
virtual void SetName(const char *newname)
virtual void Purge(Short_t nkeep=1)
virtual Long64_t GetSeekKeys() const
virtual TObject * Get(const char *namecycle)
virtual Int_t WriteTObject(const TObject *obj, const char *name, Option_t *option, Int_t bufsize)
virtual TObject * FindObject(const char *name) const
virtual Bool_t cd(const char *path=0)
virtual Int_t Sizeof() const
TNetDirectoryConnection * fConn
virtual const char * GetPathStatic() const
virtual TList * GetList() const
std::deque< TNetDirectory * > fSubDirs
virtual TKey * FindKey(const char *keyname) const
virtual void rmdir(const char *name)
virtual void Browse(TBrowser *b)
virtual Int_t GetNbytesKeys() const
virtual void Draw(Option_t *option="")
virtual void ls(Option_t *option="") const
virtual void SetBufferSize(Int_t bufsize)
void ResetTH1(const char *name)
virtual void RecursiveRemove(TObject *obj)
std::string fPath
pointer to network connection
virtual void SaveSelf(Bool_t force=kFALSE)
virtual void Append(TObject *obj, Bool_t replace)
virtual Int_t WriteObjectAny(const void *obj, const char *classname, const char *name, Option_t *option, Int_t bufsize)
virtual void WriteDirHeader()
virtual Long64_t GetSeekParent() const
virtual Int_t GetNkeys() const
virtual void Delete(const char *namecycle="")
virtual TList * GetListOfKeys() const
virtual const char * GetPath() const
virtual TObject * FindObjectAny(const char *name) const
virtual void Close(Option_t *option="")
virtual Int_t Write(const char *name=0, Int_t opt=0, Int_t bufsiz=0)
virtual Long64_t GetSeekDir() const
virtual TKey * GetKey(const char *name, Short_t cycle=9999) const
virtual void Paint(Option_t *option="")
virtual void * GetObjectUnchecked(const char *namecycle)
virtual TDirectory * mkdir(const char *name, const char *title, Bool_t returnExistingDirectory)
virtual TFile * GetFile() const
virtual void * GetObjectChecked(const char *namecycle, const char *classname)
virtual void FillBuffer(char *&buffer)