inlib  1.2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
inlib::rroot::branch_element Class Reference
Inheritance diagram for inlib::rroot::branch_element:
Inheritance graph
[legend]
Collaboration diagram for inlib::rroot::branch_element:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void * cast (const std::string &a_class) const
virtual bool stream (buffer &a_buffer)
virtual bool read_leaves (buffer &a_buffer)
virtual bool find_entry (uint32 a_entry, uint32 &a_nbytes)
 branch_element (ifile &a_file, ifac &a_fac)
virtual ~branch_element ()
const std::string & class_name () const
int type () const
int streamer_type () const
int id () const
iroobject ()

Static Public Member Functions

static const std::string & s_class ()

Protected Member Functions

 branch_element (const branch_element &a_from)
branch_elementoperator= (const branch_element &)

Protected Attributes

irom_obj
std::string fClassName
int fClassVersion
int fID
int fType
int fStreamerType

Detailed Description

Definition at line 12 of file branch_element.


Constructor & Destructor Documentation

inlib::rroot::branch_element::branch_element ( ifile a_file,
ifac a_fac 
) [inline]

Definition at line 267 of file branch_element.

  : branch(a_file,a_fac)
  ,m_obj(0)
  ,fClassVersion(0)
  ,fID(0)
  ,fType(0)
  ,fStreamerType(-1)
  {}
virtual inlib::rroot::branch_element::~branch_element ( ) [inline, virtual]

Definition at line 276 of file branch_element.

{delete m_obj;}
inlib::rroot::branch_element::branch_element ( const branch_element a_from) [inline, protected]

Definition at line 278 of file branch_element.

  :iro(a_from),branch(a_from){}

Member Function Documentation

virtual void* inlib::rroot::branch_element::cast ( const std::string &  a_class) const [inline, virtual]

Reimplemented from inlib::rroot::branch.

Definition at line 19 of file branch_element.

                                                     {
    if(void* p = inlib::cmp_cast<branch_element>(this,a_class)) {return p;}
    else return branch::cast(a_class);
  }
const std::string& inlib::rroot::branch_element::class_name ( ) const [inline]

Definition at line 282 of file branch_element.

{return fClassName;}
virtual bool inlib::rroot::branch_element::find_entry ( uint32  a_entry,
uint32 a_nbytes 
) [inline, virtual]

Reimplemented from inlib::rroot::branch.

Definition at line 246 of file branch_element.

                                                          {
    //The below line will call the upper read_leaves.
    if(!branch::find_entry(a_entry,a_nbytes)) return false;

    if(m_branches.size()) {
      //if(!m_obj) {
      //  m_obj = m_fac.create(fClassName);
      //  if(!m_obj) return false;
      //}

      std::vector<branch*>::iterator it;
      for(it=m_branches.begin();it!=m_branches.end();++it) {
        uint32 n;
        if(!(*it)->find_entry(a_entry,n)) return false;
        a_nbytes += n;
      } 
    }

    return true;
  }
int inlib::rroot::branch_element::id ( ) const [inline]

Definition at line 285 of file branch_element.

{return fID;}
iro* inlib::rroot::branch_element::object ( ) [inline]

Definition at line 286 of file branch_element.

{return m_obj;}
branch_element& inlib::rroot::branch_element::operator= ( const branch_element ) [inline, protected]

Definition at line 280 of file branch_element.

{return *this;}
virtual bool inlib::rroot::branch_element::read_leaves ( buffer a_buffer) [inline, virtual]

STL container /////////////////////////////////////

TClonesArray container ////////////////////////////

Reimplemented from inlib::rroot::branch.

Definition at line 80 of file branch_element.

                                            {
    if(fType==4) {
      // STL container master branch (has only the number of elements).
      //from v4-00-01
      int n;
      if(!a_buffer.read(n)) return false;
      //fNdata = n;

      m_out << "inlib::rroot::branch_element::read_leaves :"
            << " name " << m_name << " ref_cls " << fClassName
            << " : type " << fType << " not treated."
            << std::endl;  
      return false;

    } else if(fType==41) {
      // STL container sub-branch (contains the elements).
      m_out << "inlib::rroot::branch_element::read_leaves :"
            << " name " << m_name << " ref_cls " << fClassName
            << " : type " << fType << " not treated."
            << std::endl;
      return false;

    } else if(fType==3) {
      // TClonesArray master branch (has only the number of elements).
      //from v4-00-01
      int n;
      if(!a_buffer.read(n)) return false;

      //fNdata = n;
      //TClonesArray *clones = (TClonesArray*)fObject;
      //if (!clones) return;
      //if (clones->IsZombie()) return;
      //clones->Clear();
      //clones->ExpandCreateFast(fNdata);

      m_out << "inlib::rroot::branch_element::read_leaves :"
            << " name " << m_name << " ref_cls " << fClassName
            << " : type " << fType << " not treated."
            << std::endl;
      return false;

    } else if(fType==31) {
      // TClonesArray sub-branch (contains the elements).
      m_out << "inlib::rroot::branch_element::read_leaves :"
            << " name " << m_name << " ref_cls " << fClassName
            << " : type " << fType << " not treated."
            << std::endl;
      return false;

    } else if(fType<=2) {
      // branch in split mode

      //from v4-00-01
      //if (fBranchCount) fNdata = (Int_t)fBranchCount->GetValue(0,0);
      //else fNdata = 1;
      //if (!fInfo) return;
      //fInfo->ReadBuffer(b,fObject,fID);
      //if (fStreamerType == 6) fNdata = (Int_t)GetValue(0,0);

      //from 3.0.06
      //if (fID >= 0) {
      //  fInfo->ReadBuffer(b,fAddress,fID);
      //} else if (fID == -1) {   // top level branch in non split mode
      //  char **ppointer = (char**)fAddress;
      //  fInfo->ReadBuffer(b,*ppointer,fID);
      //}

      //m_out << "inlib::rroot::branch_element::read_leaves :"
      //      << " name " << m_name << " ref_cls " << fClassName << " :"
      //      << " type " << fType << " with ID " << fID << "."
      //      << " and then ?"
      //      << std::endl;

      // read object ?
      if(!m_obj) {
        ifac::args args;
        m_obj = m_fac.create(fClassName,args);
        if(!m_obj) return false;
      }

      if(!m_obj->stream(a_buffer)){
        m_out << "inlib::rroot::branch_element::read_leaves :"
              << " name " << m_name << " ref_cls " << fClassName << " :"
              << " obj stream failed."
              << std::endl;          
        return false;
      }

      //m_out << "inlib::rroot::branch_element::read_leaves :"
      //      << " name " << m_name << " ref_cls " << fClassName << " :"
      //      << " obj streamed."
      //      << std::endl;          

      return true;
/*
    } else if(fType==0) {
       if(fID>=0) {
         // branch in split mode
         m_out << "inlib::rroot::branch_element::read_leaves :"
               << " name " << m_name << " ref_cls " << fClassName << " :"
               << " type 0 with ID " << fID << "."
               << std::endl;

         return true;
       } else if(fID==-1) {
         // top level branch in non split mode
         m_out << "inlib::rroot::branch_element::read_leaves :"
               << " name " << m_name << " ref_cls " << fClassName << " :"
               << " type 0 with ID " << fID
               << " : fill object."
               << std::endl;

         if(!m_obj) {
           m_out << "inlib::rroot::branch_element::read_leaves :"
                 << " name " << m_name << " ref_cls " << fClassName << " :"
                 << " m_obj is null."
                 << std::endl;
           return false;
         }
         if(!m_obj->stream(a_buffer)){
           m_out << "inlib::rroot::branch_element::read_leaves :"
                 << " name " << m_name << " ref_cls " << fClassName << " :"
                 << " obj stream failed."
                 << std::endl;          
           return false;
         }
         return true;

       } else {
         m_out << "inlib::rroot::branch_element::read_leaves :"
               << " name " << m_name << " ref_cls " << fClassName << " :"
               << " type 0 with ID " << fID << " not treated."
               << std::endl;
         return false;
       }

    //LHCb files :
    } else if(fType==1) {
      // parent branch is a base class branch.
      // Ok, and then ?
      m_out << "inlib::rroot::branch_element::read_leaves :"
            << " name " << m_name << " ref_cls " << fClassName << " :"
            << " type " << fType << " with ID " << fID << "."
            << std::endl;
      return true;
*/
    } else {
      m_out << "inlib::rroot::branch_element::read_leaves :"
            << " name " << m_name << " ref_cls " << fClassName << " :"
            << " type " << fType << " with ID " << fID << "."
            << " unknown case."
            << std::endl;
      return false;
    }

  }
static const std::string& inlib::rroot::branch_element::s_class ( ) [inline, static]

Reimplemented from inlib::rroot::branch.

Definition at line 14 of file branch_element.

                                    {
    static const std::string s_v("inlib::rroot::branch_element");
    return s_v;
  }
virtual bool inlib::rroot::branch_element::stream ( buffer a_buffer) [inline, virtual]

Reimplemented from inlib::rroot::branch.

Definition at line 23 of file branch_element.

                                        {
    short v;
    unsigned int s, c;
    if(!a_buffer.read_version(v,s,c)) return false;
    if(!branch::stream(a_buffer)) return false;

    if(v<=7) {
      if(!a_buffer.read(fClassName)) return false;
      if(!a_buffer.read(fClassVersion)) return false;
      if(!a_buffer.read(fID)) return false;
      if(!a_buffer.read(fType)) return false;
      if(!a_buffer.read(fStreamerType)) return false;
    } else { //v>=8
      if(!a_buffer.read(fClassName)) return false;
      std::string fParentName;
      if(!a_buffer.read(fParentName)) return false;
      std::string fCloneName;
      if(!a_buffer.read(fCloneName)) return false;
      int dummy_int;
      if(!a_buffer.read(dummy_int)) return false; //fCheckSum
      if(!a_buffer.read(dummy_int)) return false; //fClassVersion

      if(!a_buffer.read(fID)) return false;
      if(!a_buffer.read(fType)) return false;
      if(!a_buffer.read(fStreamerType)) return false;

      if(!a_buffer.read(dummy_int)) return false; //fMaximum

      //TBranchElement* fBranchCount;
     {ifac::args args;
      iro* obj;
      if(!a_buffer.read_object(m_fac,args,obj)) {
        m_out << "inlib::rroot::base_element::stream : "
              << "can't read fAliases."
              << std::endl;
        return false;
      }
      delete obj;}

      //TBranchElement* fBranchCount2;
     {ifac::args args;
      iro* obj;
      if(!a_buffer.read_object(m_fac,args,obj)) {
        m_out << "inlib::rroot::base_element::stream : "
              << "can't read fAliases."
              << std::endl;
        return false;
      }
      delete obj;}

    }

    if(!a_buffer.check_byte_count(s,c,"TBranchElement")) return false;
    return true;
  }
int inlib::rroot::branch_element::streamer_type ( ) const [inline]

Definition at line 284 of file branch_element.

{return fStreamerType;}
int inlib::rroot::branch_element::type ( ) const [inline]

Definition at line 283 of file branch_element.

{return fType;}

Member Data Documentation

Definition at line 290 of file branch_element.

Definition at line 291 of file branch_element.

Definition at line 292 of file branch_element.

Definition at line 294 of file branch_element.

Definition at line 293 of file branch_element.

Definition at line 288 of file branch_element.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines