TConsumerInfo Class Reference

#include <TConsumerInfo.h>

List of all members.

Classes

struct  psa

Public Types

enum  { Okay, Warning, Error }

Public Member Functions

 TConsumerInfo (const char *const consumername="", int runnumber=0)
 ~TConsumerInfo ()
const char * consumername () const
void setConsumername (const char *name)
void addObject (const TString &name, const TString &path, int status, TObject *obj=NULL)
void removeObject (const TString &name)
void removeObject (TObject *obj)
void emptyWarningFolder ()
void setPath (const TString &name, const TString &path)
void setStatus (const TString &name, int status)
void setAddress (const TString &name, TObject *obj)
TString getPath (const TString &name)
Int_t getStatus (const TString &name)
TObject * getAddress (const TString &name)
void setNevents (int nevents)
void setRunNumber (int number)
int runnumber () const
int nevents () const
bool isModified () const
void setModified (bool modified)
void setInputName (const TString &inputname)
const TString & getInputName () const
long estimatedSize () const
TList * list ()
void updateListTree (TGListTree *listtree)
void updateList (TList *list, TSocket *sock)
void print (std::ostream &output=std::cout) const

Private Attributes

bool _modified
Int_t _runnumber
Int_t _nevents
long _estimatedsize
TString _inputname
TList * _list
std::map< TString, psa_objectlist

Friends

class TIterConsumerInfo

Detailed Description

Definition at line 31 of file TConsumerInfo.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
Okay 
Warning 
Error 

Definition at line 72 of file TConsumerInfo.h.

00073   {
00074     Okay,
00075     Warning,
00076     Error
00077   };


Constructor & Destructor Documentation

TConsumerInfo::TConsumerInfo ( const char *const   consumername = "",
int  runnumber = 0 
)

Definition at line 40 of file TConsumerInfo.cxx.

00041   : TNamed("ConsumerInfo",consumername), 
00042     _runnumber(runnumber),_nevents(0),
00043     _estimatedsize(100000),_inputname(),
00044     _list(new TList)
00045 {
00046 }

TConsumerInfo::~TConsumerInfo (  ) 

Definition at line 49 of file TConsumerInfo.cxx.

References _list, and emptyWarningFolder().

00050 {
00051   emptyWarningFolder();
00052   delete _list;
00053 }


Member Function Documentation

void TConsumerInfo::addObject ( const TString &  name,
const TString &  path,
int  status,
TObject *  obj = NULL 
)

Definition at line 138 of file TConsumerInfo.cxx.

References _estimatedsize, _list, _modified, and _objectlist.

Referenced by CDFMonitoringModuleImp::AddObject(), main(), and HistoDisplay::MakeConsumerInfo().

00139 {
00140   //cout << "adding object " << name <<  " to " << path << endl;
00141   // check if entry exists
00142   //cout << _objectlist[name].path << endl;
00143   if(_objectlist[name].path != "")
00144     {
00145       if (_objectlist[name].path == "Warning!/")
00146         {
00147           cout << "TConsumerInfo: object" << name << "  already in Warning folder!" << endl;
00148           assert(0);
00149           return;
00150         }
00151       else
00152         cout << "TConsumerInfo: replacing existing entry for " << name << endl;
00153     }
00154   _objectlist[name] = psa(path,status,obj);
00155   if(obj)
00156     {
00157       _list->Add(obj);
00158       // increase estimatedsize
00159 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,1)
00160       TBufferFile testbuffer(TBuffer::kWrite);
00161 #else
00162       TBuffer testbuffer(TBuffer::kWrite);
00163 #endif
00164       obj->Streamer(testbuffer);
00165       _estimatedsize += testbuffer.BufferSize();
00166       _estimatedsize += 10000;
00167     } 
00168   _modified = true;
00169 }

const char* TConsumerInfo::consumername (  )  const [inline]

Definition at line 40 of file TConsumerInfo.h.

00040 {return GetTitle();}  

void TConsumerInfo::emptyWarningFolder (  ) 

Definition at line 199 of file TConsumerInfo.cxx.

References _objectlist, TConsumerInfo::psa::address, TConsumerInfo::psa::path, and removeObject().

Referenced by ~TConsumerInfo().

00200 {
00201   //cout << "removing error objects" << endl;
00202   for(std::map<TString,psa>::const_iterator iter=_objectlist.begin() ;
00203       iter != _objectlist.end() ; ++iter)
00204     {
00205       psa pns = iter->second;
00206       if(pns.path == "Warning!/")
00207         {
00208           //cout << "removing object" << iter->first << endl;
00209           --iter;
00210           removeObject(pns.address);
00211           delete pns.address;  
00212           //cout << "object removed" << endl;
00213         }
00214     }
00215 }

long TConsumerInfo::estimatedSize (  )  const [inline]

Definition at line 64 of file TConsumerInfo.h.

References _estimatedsize.

00064 {return _estimatedsize;}

TObject * TConsumerInfo::getAddress ( const TString &  name  ) 

Definition at line 120 of file TConsumerInfo.cxx.

References _objectlist, and TConsumerInfo::psa::address.

Referenced by removeObject().

00121 {
00122   psa pns = _objectlist[name];
00123   return pns.address;
00124 } 

const TString & TConsumerInfo::getInputName (  )  const

Definition at line 133 of file TConsumerInfo.cxx.

References _inputname.

00134 {
00135   return _inputname;
00136 }

TString TConsumerInfo::getPath ( const TString &  name  ) 

Definition at line 108 of file TConsumerInfo.cxx.

References _objectlist, and TConsumerInfo::psa::path.

Referenced by HistoDisplay::AddTreeItemsOfInput().

00109 {
00110   psa pns = _objectlist[name];
00111   return pns.path;
00112 } 

Int_t TConsumerInfo::getStatus ( const TString &  name  ) 

Definition at line 114 of file TConsumerInfo.cxx.

References _objectlist, and TConsumerInfo::psa::status.

00115 {
00116   psa pns = _objectlist[name];
00117   return pns.status;
00118 } 

bool TConsumerInfo::isModified (  )  const [inline]

Definition at line 60 of file TConsumerInfo.h.

References _modified.

Referenced by ConsumerExport::send().

00060 { return _modified;}

TList* TConsumerInfo::list (  )  [inline]

Definition at line 65 of file TConsumerInfo.h.

References _list.

Referenced by ConsumerExport::send().

00065 {return _list;}

int TConsumerInfo::nevents (  )  const [inline]

Definition at line 59 of file TConsumerInfo.h.

References _nevents.

Referenced by timer(), and DisplayServer::updateStateManager().

00059 {return _nevents;}

void TConsumerInfo::print ( std::ostream &  output = std::cout  )  const

Definition at line 279 of file TConsumerInfo.cxx.

References _objectlist.

00280 {
00281   cout << endl;
00282   output << fName << "  " << fTitle << endl;
00283   output << "run:" << _runnumber << "  number of events:" << _nevents << endl;
00284   cout << "objects:" << endl;
00285   for(std::map<TString,psa>::const_iterator iter=_objectlist.begin() ; iter != _objectlist.end() ; ++iter)
00286     cout << iter->second.path << iter->first << "  " 
00287          << iter->second.status << endl;
00288   //cout << "list:" << endl;
00289   //_list->ls();
00290   cout << endl << endl;
00291 }

void TConsumerInfo::removeObject ( TObject *  obj  ) 

Definition at line 182 of file TConsumerInfo.cxx.

References _estimatedsize, _list, _modified, and _objectlist.

00183 {
00184   //cout << "removing  object " << obj->GetName() << endl;
00185   // remove objects from the lists 
00186   _list->Remove(obj);
00187   _objectlist.erase(obj->GetName());
00188 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,1)
00189   TBufferFile testbuffer(TBuffer::kWrite);
00190 #else
00191   TBuffer testbuffer(TBuffer::kWrite);
00192 #endif
00193   obj->Streamer(testbuffer);
00194   _estimatedsize -= testbuffer.BufferSize();
00195   _estimatedsize -= 10000;
00196   _modified = true;
00197 }

void TConsumerInfo::removeObject ( const TString &  name  ) 

Definition at line 171 of file TConsumerInfo.cxx.

References _modified, _objectlist, and getAddress().

Referenced by emptyWarningFolder(), and main().

00172 {
00173   TObject* add = getAddress(name);
00174   if(! add)
00175     {
00176       _objectlist.erase(name);
00177       _modified = true;
00178     }
00179   else removeObject(getAddress(name));
00180 }

int TConsumerInfo::runnumber (  )  const [inline]

Definition at line 58 of file TConsumerInfo.h.

References _runnumber.

Referenced by timer(), and DisplayServer::updateStateManager().

00058 {return _runnumber;}

void TConsumerInfo::setAddress ( const TString &  name,
TObject *  obj 
)

Definition at line 101 of file TConsumerInfo.cxx.

References _objectlist, and TConsumerInfo::psa::address.

00102 {
00103   psa pns = _objectlist[name];
00104   pns.address = obj;
00105   _objectlist[name] = pns;
00106 } 

void TConsumerInfo::setConsumername ( const char *  name  )  [inline]

Definition at line 41 of file TConsumerInfo.h.

00041 {SetTitle(name);}

void TConsumerInfo::setInputName ( const TString &  inputname  ) 

Definition at line 127 of file TConsumerInfo.cxx.

References _inputname.

Referenced by HistoDisplay::MakeConsumerInfo().

00128 {
00129   _inputname = inputname;
00130 }

void TConsumerInfo::setModified ( bool  modified  )  [inline]

Definition at line 61 of file TConsumerInfo.h.

References _modified.

Referenced by ConsumerExport::send().

00061 { _modified = modified;}

void TConsumerInfo::setNevents ( int  nevents  ) 

Definition at line 217 of file TConsumerInfo.cxx.

References _nevents.

Referenced by main(), and HistoDisplay::MakeConsumerInfo().

00218 {
00219   _nevents = nevents;
00220 }

void TConsumerInfo::setPath ( const TString &  name,
const TString &  path 
)

Definition at line 86 of file TConsumerInfo.cxx.

References _objectlist, and TConsumerInfo::psa::path.

00087 {
00088   psa pns = _objectlist[name];
00089   pns.path = path;
00090   _objectlist[name] = pns;
00091 } 

void TConsumerInfo::setRunNumber ( int  number  ) 

Definition at line 222 of file TConsumerInfo.cxx.

References _runnumber.

Referenced by HistoDisplay::MakeConsumerInfo().

00223 {
00224   _runnumber = number;
00225 }

void TConsumerInfo::setStatus ( const TString &  name,
int  status 
)

Definition at line 94 of file TConsumerInfo.cxx.

References _objectlist, and TConsumerInfo::psa::status.

00095 {
00096   psa pns = _objectlist[name];
00097   pns.status = status;
00098   _objectlist[name] = pns;
00099 }

void TConsumerInfo::updateList ( TList *  list,
TSocket *  sock 
)

Definition at line 55 of file TConsumerInfo.cxx.

References _objectlist.

Referenced by HistoDisplay::MakeHistoListS().

00056 {
00057   TMessage *mess = NULL;
00058   TObject *obj;
00059   for(std::map<TString,psa>::const_iterator iter=_objectlist.begin() ;
00060       iter != _objectlist.end() ; ++iter)
00061     {
00062       //cout << "requesting " << iter->first << endl;
00063       sock->Send(iter->first);
00064       sock->Recv(mess);
00065       if (mess->What() == kMESS_OBJECT)
00066         {
00067           obj = (TObject*)mess->ReadObject(mess->GetClass());
00068           delete mess;
00069           if (obj->InheritsFrom(TH1::Class())||
00070               obj->InheritsFrom(TCanvas::Class()))
00071             list->Add(obj);
00072         }
00073       else delete mess;
00074     }
00075 }

void TConsumerInfo::updateListTree ( TGListTree *  listtree  ) 

Definition at line 78 of file TConsumerInfo.cxx.

00079 {
00080   //TGListTreeItem *consitem = listtree->FindChildByName(NULL,consumername);
00081   //if(consitem) listtree->DeleteItem(consitem);
00082   //consitem = listtree->AddItem(NULL,consumername);
00083 }


Friends And Related Function Documentation

friend class TIterConsumerInfo [friend]

Definition at line 34 of file TConsumerInfo.h.


Member Data Documentation

Definition at line 83 of file TConsumerInfo.h.

Referenced by addObject(), estimatedSize(), and removeObject().

TString TConsumerInfo::_inputname [private]

Definition at line 85 of file TConsumerInfo.h.

Referenced by getInputName(), and setInputName().

TList* TConsumerInfo::_list [private]

Definition at line 87 of file TConsumerInfo.h.

Referenced by addObject(), list(), removeObject(), and ~TConsumerInfo().

bool TConsumerInfo::_modified [private]

Definition at line 80 of file TConsumerInfo.h.

Referenced by addObject(), isModified(), removeObject(), and setModified().

Int_t TConsumerInfo::_nevents [private]

Definition at line 82 of file TConsumerInfo.h.

Referenced by nevents(), and setNevents().

std::map<TString,psa> TConsumerInfo::_objectlist [private]
Int_t TConsumerInfo::_runnumber [private]

Definition at line 81 of file TConsumerInfo.h.

Referenced by runnumber(), and setRunNumber().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1