| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DayaBay::HeaderObject Class Reference

Default implementation of IHeader that provides simple data members and accessors. More...

#include <HeaderObject.h>

Inheritance diagram for DayaBay::HeaderObject:

[legend]
Collaboration diagram for DayaBay::HeaderObject:
[legend]
List of all members.

Public Types

typedef std::vector< IHeader * > Vector
 typedef for std::vector of IHeader
typedef std::vector< const
IHeader * > 
ConstVector

Public Member Functions

virtual const std::string & defLoc () const
 HeaderObject ()
 Default Constructor.
 ~HeaderObject ()
 destructor
virtual const CLIDclID () const
void setInputHeaders (const std::vector< const DayaBay::IHeader * > &iheaders)
 set input headers
void addInputHeader (const DayaBay::IHeader *iheader)
 add input header
std::ostream & fillStream (std::ostream &s) const
 Serialize to an ostream.
const TimeStamptimeStamp () const
 Access the context's timestamp, compatibility method.
void setTimeStamp (const TimeStamp &ts)
 Set the context's timestamp, compatibility method.
const std::vector< const DayaBay::IHeader * > findHeaders (const CLID &clid) const
 Recursively find all input headers with requested type.
const Contextcontext () const
 Retrieve const The Context this data applies to.
void setContext (const Context &value)
 Update The Context this data applies to.
int execNumber () const
 Retrieve const The Algorithm's execution count that made this object.
void setExecNumber (int value)
 Update The Algorithm's execution count that made this object.
const std::vector< unsigned
long > & 
randomState () const
 Retrieve const The state of the pseudo-random number generator at the start of algorithm execution, filled via serialize.
void setRandomState (const std::vector< unsigned long > &value)
 Update The state of the pseudo-random number generator at the start of algorithm execution, filled via serialize.
const std::vector< const DayaBay::IHeader * > & inputHeaders () const
 Retrieve const IHeaders used for input when making this one.
const DayaBay::JobIdjobId () const
 Retrieve const The ID number for the job which generated this data.
void setJobId (const DayaBay::JobId &value)
 Update The ID number for the job which generated this data.
virtual const std::string & defLoc ()
 Default location in the TES for this type of object.
virtual void setOutputAddress (const GenericAddress *roa)
 Set the output address when this header object is written out.
virtual void setInputAddress (const GenericAddress *ria)
 Set the input address when this header object is read in.
virtual const TimeStampearliest () const
 Retrieve const The earliest time of the existence of the object.
void setEarliest (const TimeStamp &value)
 Update The earliest time of the existence of the object.
virtual const TimeStamplatest () const
 Retrieve const The latest time of the existence of the object.
void setLatest (const TimeStamp &value)
 Update The latest time of the existence of the object.
virtual const GenericAddressoutputAddress () const
 Retrieve const Output address containing output stream, entry and path (base class of RootIOAddress).
virtual const GenericAddressinputAddress () const
 Retrieve const Input address containing input stream, entry and path (base class of RootIOAddress).
void setRegistry (IRegistry *pRegistry)
IRegistryregistry () const
LinkManagerlinkMgr () const
unsigned char version () const
void setVersion (unsigned char vsn)
unsigned long refCount () const
virtual unsigned long addRef ()
virtual unsigned long release ()
const std::string & name () const
virtual StreamBufferserialize (StreamBuffer &s)
virtual StreamBufferserialize (StreamBuffer &s) const

Static Public Member Functions

static const std::string & defaultLocation ()
 Give access to default location from class scope.
static const CLIDclassID ()
static void * operator new (size_t size)
 operator new
static void * operator new (size_t size, void *pObj)
 placement operator new it is needed by libstdc++ 3.2.3 (e.g.
static void operator delete (void *p)
 operator delete
static void operator delete (void *p, void *pObj)
 placement operator delete not sure if really needed, but it does not harm

Private Attributes

Context m_context
 The Context this data applies to.
int m_execNumber
 The Algorithm's execution count that made this object.
std::vector< unsigned long > m_randomState
 The state of the pseudo-random number generator at the start of algorithm execution, filled via serialize.
std::vector< const DayaBay::IHeader * > m_inputHeaders
 IHeaders used for input when making this one.
DayaBay::JobId m_jobId
 The ID number for the job which generated this data.

Friends

friend std::ostream & operator<< (std::ostream &s, const DataObject &obj)

Detailed Description

Default implementation of IHeader that provides simple data members and accessors.

Author:
<bv@bnl.gov> created Mon Apr 11 03:25:53 2011

Definition at line 53 of file HeaderObject.h.


Member Typedef Documentation

typedef std::vector<IHeader*> DayaBay::IHeader::Vector [inherited]

typedef for std::vector of IHeader

Definition at line 45 of file IHeader.h.

typedef std::vector<const IHeader*> DayaBay::IHeader::ConstVector [inherited]

Definition at line 46 of file IHeader.h.


Constructor & Destructor Documentation

DayaBay::HeaderObject::HeaderObject (  )  [inline]

Default Constructor.

Definition at line 62 of file HeaderObject.h.

00062                    : m_context(),
00063                      m_execNumber(0),
00064                      m_randomState(),
00065                      m_inputHeaders(),
00066                      m_jobId() {}

DayaBay::HeaderObject::~HeaderObject (  ) 

destructor

Definition at line 3 of file HeaderObject.cc.

00004 {
00005     const DayaBay::IHeader         *pIHeader;
00006     const DayaBay::HeaderObject    *pHeaderObj;
00007     DayaBay::HeaderObject          *pNonConst;
00008     
00009     //inputHeaders may live in a different time frame
00010     //This will improve the robustness of the code.
00011     //pull method and I/O will need this.
00012     for(size_t ind=0;ind<m_inputHeaders.size();ind++) {
00013         pIHeader=m_inputHeaders[ind];
00014         try{
00015             pHeaderObj=dynamic_cast<const DayaBay::HeaderObject*>(pIHeader);
00016             pNonConst=const_cast<DayaBay::HeaderObject*>(pHeaderObj);
00017         }
00018         catch(...) {
00019             // output something
00020         }
00021         pNonConst->release();
00022     }
00023     m_inputHeaders.clear();
00024 }


Member Function Documentation

static const std::string& DayaBay::HeaderObject::defaultLocation (  )  [inline, static]

Give access to default location from class scope.

Definition at line 58 of file HeaderObject.h.

virtual const std::string& DayaBay::HeaderObject::defLoc (  )  const [inline, virtual]

Definition at line 59 of file HeaderObject.h.

const CLID & DayaBay::HeaderObject::clID (  )  const [inline, virtual]

Reimplemented from DayaBay::TemporalDataObject.

Definition at line 187 of file HeaderObject.h.

00188 {
00189   return DayaBay::HeaderObject::classID();
00190 }

const CLID & DayaBay::HeaderObject::classID (  )  [inline, static]

Reimplemented from DayaBay::TemporalDataObject.

Definition at line 192 of file HeaderObject.h.

00193 {
00194   return CLID_HeaderObject;
00195 }

void DayaBay::HeaderObject::setInputHeaders ( const std::vector< const DayaBay::IHeader * > &  iheaders  ) 

set input headers

Definition at line 61 of file HeaderObject.cc.

00062 {
00063     const DayaBay::IHeader         *pIHeader;
00064     const DayaBay::HeaderObject    *pHeaderObj;
00065     DayaBay::HeaderObject          *pNonConst;
00066 
00067     // release the old ones first if they exist
00068     for(size_t ind=0;ind<m_inputHeaders.size();ind++) {
00069         pIHeader=m_inputHeaders[ind];
00070         try{
00071             pHeaderObj=dynamic_cast<const DayaBay::HeaderObject*>(pIHeader);
00072             pNonConst=const_cast<DayaBay::HeaderObject*>(pHeaderObj);
00073         }
00074         catch(...) {
00075             // output something
00076         }
00077         pNonConst->release();
00078     }
00079     m_inputHeaders.clear();
00080 
00081     // then set the new one
00082     m_inputHeaders = iheaders;
00083 
00084     //inputHeaders may live in a different time frame
00085     //This will improve the robustness of the code. 
00086     //pull method and I/O will need this.
00087     for(size_t ind=0;ind<m_inputHeaders.size();ind++) {
00088         pIHeader=m_inputHeaders[ind];
00089         try{
00090             pHeaderObj=dynamic_cast<const DayaBay::HeaderObject*>(pIHeader);
00091             pNonConst=const_cast<DayaBay::HeaderObject*>(pHeaderObj);
00092         }
00093         catch(...){
00094             // output something
00095         }       
00096         pNonConst->addRef();
00097     }
00098 }

void DayaBay::HeaderObject::addInputHeader ( const DayaBay::IHeader iheader  ) 

add input header

Definition at line 100 of file HeaderObject.cc.

00101 {
00102     // Append this input header
00103     m_inputHeaders.push_back(iheader);
00104 
00105     // Add a reference to ensure this object is not prematurely deleted
00106     const DayaBay::HeaderObject    *pHeaderObj;
00107     DayaBay::HeaderObject          *pNonConst;
00108     try{
00109       pHeaderObj=dynamic_cast<const DayaBay::HeaderObject*>(iheader);
00110       pNonConst=const_cast<DayaBay::HeaderObject*>(pHeaderObj);
00111     }
00112     catch(...){
00113       // output something
00114     }       
00115     pNonConst->addRef();
00116 
00117 }

std::ostream & DayaBay::HeaderObject::fillStream ( std::ostream &  s  )  const [virtual]

Serialize to an ostream.

Reimplemented from DayaBay::IHeader.

Definition at line 26 of file HeaderObject.cc.

00027 {
00028     TemporalDataObject::fillStream(s);
00029     IHeader::fillStream(s);
00030 
00031     s << "{ " 
00032       << "context :     " << m_context << std::endl
00033       << "execNumber :  " << m_execNumber << std::endl
00034       << "jobId :       " << m_jobId.uuid() << std::endl;
00035 
00036     s << "randomState : [";
00037     for (size_t ind=0; ind<m_randomState.size(); ++ind) {
00038         s << " " << m_randomState[ind];
00039     }
00040     s << " ]" << std::endl;
00041 
00042     size_t siz = m_inputHeaders.size();
00043     s << "inputHeaders :\t" << siz << ": [\n";
00044     for (size_t ind=0; ind<siz; ++ind) {
00045         m_inputHeaders[ind]->fillStream(s);
00046     }
00047     s << "\n]\n}";
00048     return s;
00049 }

const TimeStamp & DayaBay::HeaderObject::timeStamp (  )  const [virtual]

Access the context's timestamp, compatibility method.

Implements DayaBay::IHeader.

Definition at line 51 of file HeaderObject.cc.

00052 {
00053     return m_context.GetTimeStamp();
00054 }

void DayaBay::HeaderObject::setTimeStamp ( const TimeStamp ts  ) 

Set the context's timestamp, compatibility method.

Definition at line 56 of file HeaderObject.cc.

00057 {
00058     m_context.SetTimeStamp(ts);
00059 }

const std::vector< const DayaBay::IHeader * > DayaBay::HeaderObject::findHeaders ( const CLID clid  )  const

Recursively find all input headers with requested type.

Definition at line 120 of file HeaderObject.cc.

00121 {
00122   // This is for output
00123   std::vector<const DayaBay::IHeader*> iHeaders;
00124   // By default, nothing found
00125   iHeaders.clear();
00126   
00127   const DayaBay::IHeader* pIH;
00128   const DayaBay::HeaderObject* pHO;
00129   std::vector<const DayaBay::IHeader*> grandparents;
00130   std::vector<const DayaBay::IHeader*>::const_iterator cit;
00131 
00132   // Searching in the immediate parent level
00133   for( size_t ind=0; ind<m_inputHeaders.size(); ind++ ) {
00134 
00135     pIH = m_inputHeaders[ind];
00136     pHO = dynamic_cast< const DayaBay::HeaderObject* > (pIH);
00137 
00138     if( pHO->clID()==clid ) {
00139       // check for duplications
00140       cit = find( iHeaders.begin(), iHeaders.end(), pIH );
00141       if( cit==iHeaders.end() ) {
00142         // add it to output
00143         iHeaders.push_back(pIH);
00144       }
00145     }
00146 
00147     // Searching in the grandparents level
00148     grandparents = pHO->findHeaders( clid );
00149 
00150     for( size_t idx=0; idx<grandparents.size(); idx++ ) {
00151       pIH = grandparents[idx];
00152       // Check for duplications
00153       cit = find( iHeaders.begin(), iHeaders.end(), pIH );
00154       if( cit==iHeaders.end() ) {
00155         // Not find, then add it.
00156         iHeaders.push_back(pIH);
00157       }
00158     }
00159   }
00160 
00161   return iHeaders;
00162 }

const Context & DayaBay::HeaderObject::context (  )  const [inline]

Retrieve const The Context this data applies to.

Definition at line 197 of file HeaderObject.h.

00198 {
00199   return m_context;
00200 }

void DayaBay::HeaderObject::setContext ( const Context value  )  [inline]

Update The Context this data applies to.

Definition at line 202 of file HeaderObject.h.

00203 {
00204   m_context = value;
00205 }

int DayaBay::HeaderObject::execNumber (  )  const [inline, virtual]

Retrieve const The Algorithm's execution count that made this object.

Implements DayaBay::IHeader.

Definition at line 207 of file HeaderObject.h.

00208 {
00209   return m_execNumber;
00210 }

void DayaBay::HeaderObject::setExecNumber ( int  value  )  [inline]

Update The Algorithm's execution count that made this object.

Definition at line 212 of file HeaderObject.h.

00213 {
00214   m_execNumber = value;
00215 }

const std::vector< unsigned long > & DayaBay::HeaderObject::randomState (  )  const [inline, virtual]

Retrieve const The state of the pseudo-random number generator at the start of algorithm execution, filled via serialize.

Implements DayaBay::IHeader.

Definition at line 217 of file HeaderObject.h.

00218 {
00219   return m_randomState;
00220 }

void DayaBay::HeaderObject::setRandomState ( const std::vector< unsigned long > &  value  )  [inline]

Update The state of the pseudo-random number generator at the start of algorithm execution, filled via serialize.

Definition at line 222 of file HeaderObject.h.

00223 {
00224   m_randomState = value;
00225 }

const std::vector< const DayaBay::IHeader * > & DayaBay::HeaderObject::inputHeaders (  )  const [inline, virtual]

Retrieve const IHeaders used for input when making this one.

Implements DayaBay::IHeader.

Definition at line 227 of file HeaderObject.h.

00228 {
00229   return m_inputHeaders;
00230 }

const DayaBay::JobId & DayaBay::HeaderObject::jobId (  )  const [inline]

Retrieve const The ID number for the job which generated this data.

Definition at line 232 of file HeaderObject.h.

00233 {
00234   return m_jobId;
00235 }

void DayaBay::HeaderObject::setJobId ( const DayaBay::JobId value  )  [inline]

Update The ID number for the job which generated this data.

Definition at line 237 of file HeaderObject.h.

00238 {
00239   m_jobId = value;
00240 }

static void* DayaBay::HeaderObject::operator new ( size_t  size  )  [inline, static]

operator new

Reimplemented from DayaBay::IHeader.

Definition at line 132 of file HeaderObject.h.

00133     {
00134       return ( sizeof(HeaderObject) == size ? 
00135                boost::singleton_pool<HeaderObject, sizeof(HeaderObject)>::malloc() :
00136                ::operator new(size) );
00137     }

static void* DayaBay::HeaderObject::operator new ( size_t  size,
void *  pObj 
) [inline, static]

placement operator new it is needed by libstdc++ 3.2.3 (e.g.

in std::vector) it is not needed in libstdc++ >= 3.4

Reimplemented from DayaBay::IHeader.

Definition at line 142 of file HeaderObject.h.

00143     {
00144       return ::operator new (size,pObj);
00145     }

static void DayaBay::HeaderObject::operator delete ( void *  p  )  [inline, static]

operator delete

Reimplemented from DayaBay::IHeader.

Definition at line 148 of file HeaderObject.h.

00149     {
00150       boost::singleton_pool<HeaderObject, sizeof(HeaderObject)>::is_from(p) ?
00151       boost::singleton_pool<HeaderObject, sizeof(HeaderObject)>::free(p) :
00152       ::operator delete(p);
00153     }

static void DayaBay::HeaderObject::operator delete ( void *  p,
void *  pObj 
) [inline, static]

placement operator delete not sure if really needed, but it does not harm

Reimplemented from DayaBay::IHeader.

Definition at line 157 of file HeaderObject.h.

00158     {
00159       ::operator delete (p, pObj);
00160     }

const std::string & DayaBay::TemporalDataObject::defLoc (  )  [virtual, inherited]

Default location in the TES for this type of object.

Definition at line 17 of file TemporalDataObject.cc.

00018 {
00019     cerr << "TemporalDataObject::defLoc() called.  Some method did not define a default location!" << endl;
00020     static string empty("");
00021     return empty;
00022 }

void DayaBay::TemporalDataObject::setOutputAddress ( const GenericAddress roa  )  [virtual, inherited]

Set the output address when this header object is written out.

Definition at line 26 of file TemporalDataObject.cc.

00027 {
00028   // bad input
00029   if(roa==0) {
00030     return;
00031   }
00032     
00033   // prepare to set
00034   if(m_outputAddress!=0) {
00035     m_outputAddress->release();
00036   }
00037 
00038   GenericAddress* non_const_roa=const_cast<GenericAddress*>(roa);
00039 
00040   m_outputAddress=non_const_roa;
00041   m_outputAddress->addRef();
00042 }

void DayaBay::TemporalDataObject::setInputAddress ( const GenericAddress ria  )  [virtual, inherited]

Set the input address when this header object is read in.

Definition at line 46 of file TemporalDataObject.cc.

00047 {
00048   // bad input
00049   if(ria==0) {
00050     return;
00051   }
00052 
00053   // prepare to set
00054   if(m_inputAddress!=0) {
00055     m_inputAddress->release();
00056   }
00057 
00058   GenericAddress* non_const_ria=const_cast<GenericAddress*>(ria);
00059 
00060   m_inputAddress=non_const_ria;
00061   m_inputAddress->addRef();
00062 }

const TimeStamp & DayaBay::TemporalDataObject::earliest (  )  const [inline, virtual, inherited]

Retrieve const The earliest time of the existence of the object.

Implements DayaBay::ITemporal.

Definition at line 177 of file TemporalDataObject.h.

00178 {
00179   return m_earliest;
00180 }

void DayaBay::TemporalDataObject::setEarliest ( const TimeStamp value  )  [inline, virtual, inherited]

Update The earliest time of the existence of the object.

Implements DayaBay::ITemporal.

Definition at line 182 of file TemporalDataObject.h.

00183 {
00184   m_earliest = value;
00185 }

const TimeStamp & DayaBay::TemporalDataObject::latest (  )  const [inline, virtual, inherited]

Retrieve const The latest time of the existence of the object.

Implements DayaBay::ITemporal.

Definition at line 187 of file TemporalDataObject.h.

00188 {
00189   return m_latest;
00190 }

void DayaBay::TemporalDataObject::setLatest ( const TimeStamp value  )  [inline, virtual, inherited]

Update The latest time of the existence of the object.

Implements DayaBay::ITemporal.

Definition at line 192 of file TemporalDataObject.h.

00193 {
00194   m_latest = value;
00195 }

const GenericAddress * DayaBay::TemporalDataObject::outputAddress (  )  const [inline, virtual, inherited]

Retrieve const Output address containing output stream, entry and path (base class of RootIOAddress).

Definition at line 197 of file TemporalDataObject.h.

00198 {
00199   return m_outputAddress;
00200 }

const GenericAddress * DayaBay::TemporalDataObject::inputAddress (  )  const [inline, virtual, inherited]

Retrieve const Input address containing input stream, entry and path (base class of RootIOAddress).

Definition at line 202 of file TemporalDataObject.h.

00203 {
00204   return m_inputAddress;
00205 }


Member Data Documentation

Context DayaBay::HeaderObject::m_context [private]

The Context this data applies to.

Definition at line 166 of file HeaderObject.h.

int DayaBay::HeaderObject::m_execNumber [private]

The Algorithm's execution count that made this object.

Definition at line 167 of file HeaderObject.h.

std::vector<unsigned long> DayaBay::HeaderObject::m_randomState [private]

The state of the pseudo-random number generator at the start of algorithm execution, filled via serialize.

Definition at line 168 of file HeaderObject.h.

std::vector<const DayaBay::IHeader*> DayaBay::HeaderObject::m_inputHeaders [private]

IHeaders used for input when making this one.

Definition at line 169 of file HeaderObject.h.

DayaBay::JobId DayaBay::HeaderObject::m_jobId [private]

The ID number for the job which generated this data.

Definition at line 170 of file HeaderObject.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:18:03 2011 for BaseEvent by doxygen 1.4.7