g4tools  5.4.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tools::rroot::leaf_object Class Reference
Inheritance diagram for tools::rroot::leaf_object:
Inheritance graph
[legend]
Collaboration diagram for tools::rroot::leaf_object:
Collaboration graph
[legend]

Public Member Functions

virtual void * cast (const std::string &a_class) const
 
virtual const std::string & s_cls () const
 
virtual void * cast (cid a_class) const
 
virtual irocopy () const
 
virtual bool stream (buffer &a_buffer)
 
virtual bool read_buffer (buffer &a_buffer)
 
virtual bool print_value (std::ostream &, uint32) const
 
virtual uint32 num_elem () const
 
 leaf_object (std::ostream &a_out, ifac &a_fac)
 
virtual ~leaf_object ()
 
void set_object (iobject *a_obj)
 
- Public Member Functions inherited from tools::rroot::base_leaf
 base_leaf (std::ostream &a_out, ifac &a_fac)
 
virtual ~base_leaf ()
 
const std::string & name () const
 
const std::string & title () const
 
const base_leafleaf_count () const
 
- Public Member Functions inherited from tools::rroot::iro
virtual ~iro ()
 

Static Public Member Functions

static const std::string & s_class ()
 
static cid id_class ()
 
- Static Public Member Functions inherited from tools::rroot::base_leaf
static const std::string & s_class ()
 
static cid id_class ()
 

Protected Member Functions

 leaf_object (const leaf_object &a_from)
 
leaf_objectoperator= (const leaf_object &)
 
- Protected Member Functions inherited from tools::rroot::base_leaf
 base_leaf (const base_leaf &a_from)
 
base_leafoperator= (const base_leaf &)
 

Protected Attributes

iobjectm_obj
 
bool fVirtual
 
- Protected Attributes inherited from tools::rroot::base_leaf
std::ostream & m_out
 
ifacm_fac
 
std::string m_name
 
std::string m_title
 
uint32 m_length
 
uint32 m_length_type
 
bool m_is_range
 
base_leafm_leaf_count
 
bool m_own_leaf_count
 

Detailed Description

Definition at line 378 of file leaf.

Constructor & Destructor Documentation

◆ leaf_object() [1/2]

tools::rroot::leaf_object::leaf_object ( std::ostream &  a_out,
ifac a_fac 
)
inline

Definition at line 466 of file leaf.

467  :base_leaf(a_out,a_fac),m_obj(0),fVirtual(true){}

◆ ~leaf_object()

virtual tools::rroot::leaf_object::~leaf_object ( )
inlinevirtual

Definition at line 468 of file leaf.

468 {}

◆ leaf_object() [2/2]

tools::rroot::leaf_object::leaf_object ( const leaf_object a_from)
inlineprotected

Definition at line 470 of file leaf.

471  :iro(a_from),base_leaf(a_from),m_obj(0),fVirtual(true){}

Member Function Documentation

◆ cast() [1/2]

virtual void* tools::rroot::leaf_object::cast ( cid  a_class) const
inlinevirtual

Reimplemented from tools::rroot::base_leaf.

Definition at line 396 of file leaf.

396  {
397  if(void* p = cmp_cast<leaf_object>(this,a_class)) {return p;}
398  return base_leaf::cast(a_class);
399  }

◆ cast() [2/2]

virtual void* tools::rroot::leaf_object::cast ( const std::string &  a_class) const
inlinevirtual

Reimplemented from tools::rroot::base_leaf.

Definition at line 389 of file leaf.

389  {
390  if(void* p = cmp_cast<leaf_object>(this,a_class)) {return p;}
391  return base_leaf::cast(a_class);
392  }

◆ copy()

virtual iro* tools::rroot::leaf_object::copy ( ) const
inlinevirtual

Implements tools::rroot::iro.

Definition at line 401 of file leaf.

401 {return new leaf_object(*this);}

◆ id_class()

static cid tools::rroot::leaf_object::id_class ( )
inlinestatic

Definition at line 395 of file leaf.

395 {return leaf_object_cid();}

◆ num_elem()

virtual uint32 tools::rroot::leaf_object::num_elem ( ) const
inlinevirtual

Implements tools::rroot::base_leaf.

Definition at line 464 of file leaf.

464 {return 0;}

◆ operator=()

leaf_object& tools::rroot::leaf_object::operator= ( const leaf_object )
inlineprotected

Definition at line 472 of file leaf.

472 {return *this;}

◆ print_value()

virtual bool tools::rroot::leaf_object::print_value ( std::ostream &  ,
uint32   
) const
inlinevirtual

Implements tools::rroot::base_leaf.

Definition at line 460 of file leaf.

460  {
461  m_out << m_obj << std::endl;
462  return true;
463  }

◆ read_buffer()

virtual bool tools::rroot::leaf_object::read_buffer ( buffer a_buffer)
inlinevirtual

Implements tools::rroot::base_leaf.

Definition at line 412 of file leaf.

412  {
413  if(!m_obj) {
414  m_out << "tools::rroot::leaf_object::read_buffer : m_obj is null." << std::endl;
415  return false;
416  }
417  std::string fClassName;
418  if (fVirtual) {
419  unsigned char n;
420  if(!a_buffer.read(n)) {
421  m_out << "tools::rroot::leaf_object::read_buffer :"
422  << " read(unsigned char) failed."
423  << std::endl;
424  return false;
425  }
426  char classname[128];
427  if(!a_buffer.read_fast_array(classname,n+1)) {
428  m_out << "tools::rroot::leaf_object::read_buffer :"
429  << " readFastArray failed."
430  << std::endl;
431  return false;
432  }
433  fClassName = classname;
434  }
435  if(m_obj->store_class_name()!=fClassName) {
436  m_out << "tools::rroot::leaf_object::read_buffer : WARNING : class mismatch :"
437  << " fClassName " << sout(fClassName)
438  << ". m_obj.store_class_name() " << sout(m_obj->store_class_name())
439  << std::endl;
440  //return false;
441  }
442  if(!m_obj->stream(a_buffer)) {
443  m_out << "tools::rroot::leaf_object::read_buffer :"
444  << " object stream failed."
445  << " Object store class was " << m_obj->store_class_name() << "."
446  << std::endl;
447  return false;
448  }
449  // in case we had written a null pointer a Zombie object was created
450  // we must delete it
451  //FIXME
452  //if (object->TestBit(kInvalidObject)) {
453  // if (object->GetUniqueID() == 123456789) {
454  // delete object;
455  // object = 0;
456  // }
457  //}
458  return true;
459  }

◆ s_class()

static const std::string& tools::rroot::leaf_object::s_class ( )
inlinestatic

Definition at line 384 of file leaf.

384  {
385  static const std::string s_v("tools::rroot::leaf_object");
386  return s_v;
387  }

◆ s_cls()

virtual const std::string& tools::rroot::leaf_object::s_cls ( ) const
inlinevirtual

Reimplemented from tools::rroot::base_leaf.

Definition at line 393 of file leaf.

393 {return s_class();}

◆ set_object()

void tools::rroot::leaf_object::set_object ( iobject a_obj)
inline

Definition at line 474 of file leaf.

474 {m_obj = a_obj;} //do not get ownership.

◆ stream()

virtual bool tools::rroot::leaf_object::stream ( buffer a_buffer)
inlinevirtual

Reimplemented from tools::rroot::base_leaf.

Definition at line 402 of file leaf.

402  {
403  short v;
404  unsigned int s,c;
405  if(!a_buffer.read_version(v,s,c)) return false;
406  if(!base_leaf::stream(a_buffer)) return false;
407  if(!a_buffer.read(fVirtual)) return false;
408  if(!a_buffer.check_byte_count(s,c,s_store_class())) return false;
409  return true;
410  }

Member Data Documentation

◆ fVirtual

bool tools::rroot::leaf_object::fVirtual
protected

Definition at line 478 of file leaf.

◆ m_obj

iobject* tools::rroot::leaf_object::m_obj
protected

Definition at line 476 of file leaf.


The documentation for this class was generated from the following file:
tools::rroot::leaf_object::m_obj
iobject * m_obj
Definition: leaf:476
tools::rroot::base_leaf::m_out
std::ostream & m_out
Definition: base_leaf:174
tools::rroot::iobject::stream
virtual bool stream(buffer &)=0
tools::rroot::iobject::store_class_name
virtual const std::string & store_class_name() const =0
tools::rroot::leaf_object::leaf_object
leaf_object(std::ostream &a_out, ifac &a_fac)
Definition: leaf:466
tools::rroot::leaf_object::s_class
static const std::string & s_class()
Definition: leaf:384
tools::rroot::base_leaf::stream
virtual bool stream(buffer &a_buffer)
Definition: base_leaf:35
tools::rroot::leaf_object::fVirtual
bool fVirtual
Definition: leaf:478
tools::rroot::base_leaf::cast
virtual void * cast(const std::string &a_class) const
Definition: base_leaf:23
tools::rroot::leaf_object_cid
cid leaf_object_cid()
Definition: cids:41
tools::rroot::base_leaf::base_leaf
base_leaf(std::ostream &a_out, ifac &a_fac)
Definition: base_leaf:105