inlib  1.2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
inlib::rroot::leaf< T > Class Template Reference
Inheritance diagram for inlib::rroot::leaf< T >:
Inheritance graph
[legend]
Collaboration diagram for inlib::rroot::leaf< T >:
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 const std::string & s_cls () const
virtual bool read_basket (buffer &a_buffer)
virtual bool print_value (std::ostream &a_out, uint32 a_index) const
virtual uint32 num_elem () const
 leaf (std::ostream &a_out, rroot::branch &a_branch, ifac &a_fac)
virtual ~leaf ()
value (uint32 a_index=0) const

Static Public Member Functions

static const std::string & s_class ()

Protected Member Functions

 leaf (const leaf &a_from)
leafoperator= (const leaf &)

Protected Attributes

m_min
m_max
T * m_value

Detailed Description

template<class T>
class inlib::rroot::leaf< T >

Definition at line 48 of file leaf.


Constructor & Destructor Documentation

template<class T>
inlib::rroot::leaf< T >::leaf ( std::ostream &  a_out,
rroot::branch a_branch,
ifac a_fac 
) [inline]

Definition at line 149 of file leaf.

  : base_leaf(a_out,a_branch,a_fac)
  ,m_min(T()),m_max(T())
  ,m_value(0)
  {}
template<class T>
virtual inlib::rroot::leaf< T >::~leaf ( ) [inline, virtual]

Definition at line 154 of file leaf.

                 {
    delete [] m_value;
  }
template<class T>
inlib::rroot::leaf< T >::leaf ( const leaf< T > &  a_from) [inline, protected]

Definition at line 158 of file leaf.

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

Member Function Documentation

template<class T>
virtual void* inlib::rroot::leaf< T >::cast ( const std::string &  a_class) const [inline, virtual]

Reimplemented from inlib::rroot::base_leaf.

Definition at line 55 of file leaf.

                                                     {
    if(void* p = inlib::cmp_cast< leaf<T> >(this,a_class)) {return p;}
    else return base_leaf::cast(a_class);
  }
template<class T>
virtual uint32 inlib::rroot::leaf< T >::num_elem ( ) const [inline, virtual]

Implements inlib::rroot::base_leaf.

Definition at line 147 of file leaf.

{return m_length;}
template<class T>
leaf& inlib::rroot::leaf< T >::operator= ( const leaf< T > &  ) [inline, protected]

Definition at line 159 of file leaf.

{return *this;}
template<class T>
virtual bool inlib::rroot::leaf< T >::print_value ( std::ostream &  a_out,
uint32  a_index 
) const [inline, virtual]

Implements inlib::rroot::base_leaf.

Definition at line 142 of file leaf.

                                                                   {
    //if(!m_value) return false;
    a_out << m_value[a_index];
    return true;
  }
template<class T>
virtual bool inlib::rroot::leaf< T >::read_basket ( buffer a_buffer) [inline, virtual]

Implements inlib::rroot::base_leaf.

Definition at line 77 of file leaf.

                                             {
    if(!m_leaf_count && (m_ndata == 1)) {
/*
      if(!aBuffer.read(m_value[0])) {
        std::ostream& out = this->branch().out();
        out << "Rio::Leaf::readBasket : \"" << name() << "\" :"
            << " read value failed."
            << std::endl;
        return false;
      }
      return true;
*/
      m_out << "inlib::rroot::leaf::read_basket :"
            << " case(1) not yet handled."
            << std::endl;
      return false;
    }else {
      if(m_leaf_count) {
        m_out << "inlib::rroot::leaf::read_basket :"
              << " case(2) not yet handled."
              << std::endl;
        return false;
/*
        int len = m_leaf_count->number();
        if (len > m_leaf_count->maximum()) {
          std::ostream& out = this->branch().out();
          out << "Rio::Leaf::readBasket : \"" 
              << name() << "\", len = " << len << " and max = " 
              << m_leaf_count->maximum() << std::endl;
          len = m_leaf_count->maximum();
        }
        m_ndata = len * fLength;
        if(!aBuffer.readFastArray(m_value,len * fLength)) {
          std::ostream& out = this->branch().out();
          out << "Rio::Leaf::readBasket : \"" << name() << "\" :"
              << " readFastArray failed."
              << std::endl;
          return false;
        }
        return true;
*/
      } else {
        if(m_length) {
          if(!m_value) {
            delete [] m_value;
            m_value = new T[m_length]; //we assume m_length is constant.
          }
          if(!a_buffer.read_fast_array<T>(m_value,m_length)) {
            m_out << "inlib::rroot::leaf::read_basket :"
                  << " read_fast_array failed. m_length " << m_length
                  << std::endl;
            return false;
          }
          return true;
        } else {
          m_out << "inlib::rroot::leaf::read_basket :"
                << " read_fast_array failed. m_length is zero."
                << std::endl;
          return false;
        }
        //::printf("debug : value : %d %g\n",m_value[0],m_value[0]);
      }
    }
    return true;
  }
template<class T>
static const std::string& inlib::rroot::leaf< T >::s_class ( ) [inline, static]

Reimplemented from inlib::rroot::base_leaf.

Definition at line 50 of file leaf.

                                    {
    static const std::string s_v("inlib::rroot::leaf<"+stype(T())+">");
    return s_v;
  }
template<class T>
virtual const std::string& inlib::rroot::leaf< T >::s_cls ( ) const [inline, virtual]

Implements inlib::rroot::base_leaf.

Definition at line 76 of file leaf.

{return s_class();}
template<class T>
virtual bool inlib::rroot::leaf< T >::stream ( buffer a_buffer) [inline, virtual]

Reimplemented from inlib::rroot::base_leaf.

Definition at line 59 of file leaf.

                                        {
    delete [] m_value;
    m_value = 0;

    short v;
    unsigned int s,c;
    if(!a_buffer.read_version(v,s,c)) return false;
    if(!base_leaf::stream(a_buffer)) return false;
    if(!a_buffer.read(m_min)) return false;
    if(!a_buffer.read(m_max)) return false;
    if(!a_buffer.check_byte_count(s,c,leaf_store_class(T()))) return false;

    m_value = new T[m_length];

    return true;
  }
template<class T>
T inlib::rroot::leaf< T >::value ( uint32  a_index = 0) const [inline]

Definition at line 161 of file leaf.

                                    {
    //WARNING : fast getter. No check are done on m_value and a_index.
    return m_value[a_index];
  }

Member Data Documentation

template<class T>
T inlib::rroot::leaf< T >::m_max [protected]

Definition at line 167 of file leaf.

template<class T>
T inlib::rroot::leaf< T >::m_min [protected]

Definition at line 166 of file leaf.

template<class T>
T* inlib::rroot::leaf< T >::m_value [protected]

Definition at line 168 of file leaf.


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