/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
DayaBay::HeaderObject Class Reference

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

#include <HeaderObject.h>

Inheritance diagram for DayaBay::HeaderObject:
Inheritance graph
[legend]
Collaboration diagram for DayaBay::HeaderObject:
Collaboration graph
[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 CLID & clID () const
void setInputHeaders (const std::vector< const DayaBay::IHeader * > &iheaders)
 set input headers
void clearInputHeaders ()
 clear any existing 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 std::vector< const
DayaBay::IHeader * > 
findHeaders (const std::string &name) const
 Recursively find all input headers with requested name.
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 GenericAddress * outputAddress () const
 Retrieve const Output address containing output stream, entry and path (base class of RootIOAddress)
virtual const GenericAddress * inputAddress () const
 Retrieve const Input address containing input stream, entry and path (base class of RootIOAddress)

Static Public Member Functions

static const std::string & defaultLocation ()
 Give access to default location from class scope.
static const CLID & classID ()
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.

Detailed Description

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

Author:
<bv@bnl.gov> created Thu Dec 5 17:38:15 2013

Definition at line 54 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 63 of file HeaderObject.h.

DayaBay::HeaderObject::~HeaderObject ( )

destructor

Definition at line 14 of file HeaderObject.cc.

{
    //inputHeaders may live in a different time frame
    //This will improve the robustness of the code.
    //pull method and I/O will need this.
    for(size_t ind=0;ind<m_inputHeaders.size();ind++) {
        DayaBay::HeaderObject* ho = bustconst(m_inputHeaders[ind]);
        //std::cerr << "InputHeader " << (void*)ho << " with " << ho->refCount() << " references released by " << (void*)this << std::endl;
        ho->release();
    }
    m_inputHeaders.clear();
}

Member Function Documentation

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

Give access to default location from class scope.

Definition at line 59 of file HeaderObject.h.

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

Definition at line 60 of file HeaderObject.h.

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

Reimplemented from DayaBay::TemporalDataObject.

Definition at line 194 of file HeaderObject.h.

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

Reimplemented from DayaBay::TemporalDataObject.

Definition at line 199 of file HeaderObject.h.

{
  return CLID_HeaderObject;
}
void DayaBay::HeaderObject::setInputHeaders ( const std::vector< const DayaBay::IHeader * > &  iheaders)

set input headers

Definition at line 72 of file HeaderObject.cc.

{
    clearInputHeaders();

    // then set the new one
    m_inputHeaders = iheaders;

    //inputHeaders may live in a different time frame
    //This will improve the robustness of the code. 
    //pull method and I/O will need this.
    for(size_t ind=0;ind<m_inputHeaders.size();ind++) {
        DayaBay::HeaderObject* ho = bustconst(m_inputHeaders[ind]);
        ho->addRef();
    }
}
void DayaBay::HeaderObject::clearInputHeaders ( )

clear any existing input headers

Definition at line 62 of file HeaderObject.cc.

{
    // release the old ones first if they exist
    for(size_t ind=0;ind<m_inputHeaders.size();ind++) {
        DayaBay::HeaderObject* ho = bustconst(m_inputHeaders[ind]);
        ho->release();
    }
    m_inputHeaders.clear();
}
void DayaBay::HeaderObject::addInputHeader ( const DayaBay::IHeader iheader)

add input header

Definition at line 88 of file HeaderObject.cc.

{
    // Append this input header
    m_inputHeaders.push_back(iheader);

    // Add a reference to ensure this object is not prematurely deleted
    DayaBay::HeaderObject* ho = bustconst(iheader);;;
    ho->addRef();
}
std::ostream & DayaBay::HeaderObject::fillStream ( std::ostream &  s) const [virtual]

Serialize to an ostream.

Reimplemented from DayaBay::IHeader.

Definition at line 27 of file HeaderObject.cc.

{
    TemporalDataObject::fillStream(s);
    IHeader::fillStream(s);

    s << "{ " 
      << "context :     " << m_context << std::endl
      << "execNumber :  " << m_execNumber << std::endl
      << "jobId :       " << m_jobId.uuid() << std::endl;

    s << "randomState : [";
    for (size_t ind=0; ind<m_randomState.size(); ++ind) {
        s << " " << m_randomState[ind];
    }
    s << " ]" << std::endl;

    size_t siz = m_inputHeaders.size();
    s << "inputHeaders :\t" << siz << ": [\n";
    for (size_t ind=0; ind<siz; ++ind) {
        m_inputHeaders[ind]->fillStream(s);
    }
    s << "\n]\n}";
    return s;
}
const TimeStamp & DayaBay::HeaderObject::timeStamp ( ) const [virtual]

Access the context's timestamp, compatibility method.

Implements DayaBay::IHeader.

Definition at line 52 of file HeaderObject.cc.

{
    return m_context.GetTimeStamp();
}
void DayaBay::HeaderObject::setTimeStamp ( const TimeStamp ts)

Set the context's timestamp, compatibility method.

Definition at line 57 of file HeaderObject.cc.

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

Recursively find all input headers with requested type.

Definition at line 152 of file HeaderObject.cc.

{
    CompareByID compare(clid);
    return find_headers(m_inputHeaders,compare);
}
const std::vector< const DayaBay::IHeader * > DayaBay::HeaderObject::findHeaders ( const std::string &  name) const

Recursively find all input headers with requested name.

Definition at line 179 of file HeaderObject.cc.

{
    // This is for output
    std::vector<const DayaBay::IHeader*> iHeaders;
    if (name.size() < 1) {
        // Invalid name requested
        return iHeaders;
    }
    CompareByName compare(name);
    return find_headers(m_inputHeaders,compare);
}
const Context & DayaBay::HeaderObject::context ( ) const [inline]

Retrieve const The Context this data applies to.

Definition at line 204 of file HeaderObject.h.

{
  return m_context;
}
void DayaBay::HeaderObject::setContext ( const Context value) [inline]

Update The Context this data applies to.

Definition at line 209 of file HeaderObject.h.

{
  m_context = value;
}
int DayaBay::HeaderObject::execNumber ( ) const [inline, virtual]

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

Implements DayaBay::IHeader.

Definition at line 214 of file HeaderObject.h.

{
  return m_execNumber;
}
void DayaBay::HeaderObject::setExecNumber ( int  value) [inline]

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

Definition at line 219 of file HeaderObject.h.

{
  m_execNumber = value;
}
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 224 of file HeaderObject.h.

{
  return m_randomState;
}
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 229 of file HeaderObject.h.

{
  m_randomState = value;
}
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 234 of file HeaderObject.h.

{
  return m_inputHeaders;
}
const DayaBay::JobId & DayaBay::HeaderObject::jobId ( ) const [inline]

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

Definition at line 239 of file HeaderObject.h.

{
  return m_jobId;
}
void DayaBay::HeaderObject::setJobId ( const DayaBay::JobId value) [inline]

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

Definition at line 244 of file HeaderObject.h.

{
  m_jobId = value;
}
static void* DayaBay::HeaderObject::operator new ( size_t  size) [inline, static]

operator new

Reimplemented from DayaBay::IHeader.

Definition at line 139 of file HeaderObject.h.

    {
      return ( sizeof(HeaderObject) == size ? 
               boost::singleton_pool<HeaderObject, sizeof(HeaderObject)>::malloc() :
               ::operator new(size) );
    }
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 149 of file HeaderObject.h.

    {
      return ::operator new (size,pObj);
    }
static void DayaBay::HeaderObject::operator delete ( void *  p) [inline, static]

operator delete

Reimplemented from DayaBay::IHeader.

Definition at line 155 of file HeaderObject.h.

    {
      boost::singleton_pool<HeaderObject, sizeof(HeaderObject)>::is_from(p) ?
      boost::singleton_pool<HeaderObject, sizeof(HeaderObject)>::free(p) :
      ::operator delete(p);
    }
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 164 of file HeaderObject.h.

    {
      ::operator delete (p, pObj);
    }
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.

{
    cerr << "TemporalDataObject::defLoc() called.  Some method did not define a default location!" << endl;
    static string empty("");
    return empty;
}
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.

{
  // bad input
  if(roa==0) {
    return;
  }
    
  // prepare to set
  if(m_outputAddress!=0) {
    m_outputAddress->release();
  }

  GenericAddress* non_const_roa=const_cast<GenericAddress*>(roa);

  m_outputAddress=non_const_roa;
  m_outputAddress->addRef();
}
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.

{
  // bad input
  if(ria==0) {
    return;
  }

  // prepare to set
  if(m_inputAddress!=0) {
    m_inputAddress->release();
  }

  GenericAddress* non_const_ria=const_cast<GenericAddress*>(ria);

  m_inputAddress=non_const_ria;
  m_inputAddress->addRef();
}
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.

{
  return m_earliest;
}
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.

{
  m_earliest = value;
}
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.

{
  return m_latest;
}
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.

{
  m_latest = value;
}
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.

{
  return m_outputAddress;
}
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.

{
  return m_inputAddress;
}

Member Data Documentation

The Context this data applies to.

Definition at line 173 of file HeaderObject.h.

The Algorithm's execution count that made this object.

Definition at line 174 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 175 of file HeaderObject.h.

IHeaders used for input when making this one.

Definition at line 176 of file HeaderObject.h.

The ID number for the job which generated this data.

Definition at line 177 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 Fri May 16 2014 09:58:11 for BaseEvent by doxygen 1.7.4