inlib  1.2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
inlib::aida::base_ntu Class Reference
Inheritance diagram for inlib::aida::base_ntu:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void * cast (const std::string &a_class) const
std::ostream & out ()
const std::vector< base_col * > & cols () const
std::string title ()
const std::string & title () const
void set_title (const std::string &a_title)
uint64 rows () const
void clear ()
bool reset ()
void start ()
bool next ()
int64 row_index () const
bool add_row ()
base_colfind_column (const std::string &a_name)
void add_column (base_col *a_col)

Static Public Member Functions

static const std::string & s_class ()

Protected Member Functions

 base_ntu (std::ostream &a_out, const std::string &a_title)
virtual ~base_ntu ()
 base_ntu (const base_ntu &a_from)
base_ntuoperator= (const base_ntu &a_from)
void set_columns_index (uint64 a_index)

Protected Attributes

std::ostream & m_out
std::string m_title
int64 m_index
std::vector< base_col * > m_cols

Detailed Description

Definition at line 80 of file aida_ntuple.


Constructor & Destructor Documentation

inlib::aida::base_ntu::base_ntu ( std::ostream &  a_out,
const std::string &  a_title 
) [inline, protected]

Definition at line 94 of file aida_ntuple.

  :m_out(a_out),m_title(a_title),m_index(-1){
#ifdef INLIB_MEM
    mem::increment(s_class().c_str());
#endif
  }
virtual inlib::aida::base_ntu::~base_ntu ( ) [inline, protected, virtual]

Definition at line 100 of file aida_ntuple.

                      {
    clear();
#ifdef INLIB_MEM
    mem::decrement(s_class().c_str());
#endif
  }
inlib::aida::base_ntu::base_ntu ( const base_ntu a_from) [inline, protected]

Definition at line 107 of file aida_ntuple.

  :m_out(a_from.m_out)
  ,m_title(a_from.m_title),m_index(a_from.m_index)
  {
#ifdef INLIB_MEM
    mem::increment(s_class().c_str());
#endif
    std::vector<base_col*>::const_iterator it;
    for(it=a_from.m_cols.begin();it!=a_from.m_cols.end();++it) {
      base_col* column = (*it)->copy();
      if(!column) {
        m_out << s_class() << "::cstor :"
              << " can't copy column."
              << std::endl;
        inlib::clear<base_col>(m_cols);
        m_index = -1;
        return; //throw
      }
      m_cols.push_back(column);
    }
  }

Member Function Documentation

void inlib::aida::base_ntu::add_column ( base_col a_col) [inline]

Definition at line 210 of file aida_ntuple.

                                   { //we take ownership.
    m_cols.push_back(a_col);
  }
bool inlib::aida::base_ntu::add_row ( ) [inline]

Definition at line 196 of file aida_ntuple.

                 {
    bool status = true;
    std::vector<base_col*>::iterator it;
    for(it=m_cols.begin();it!=m_cols.end();++it) {
      if(!(*it)->add()) status = false;
    }
    return status;
  }
virtual void* inlib::aida::base_ntu::cast ( const std::string &  a_class) const [inline, virtual]

Reimplemented in inlib::aida::ntuple.

Definition at line 86 of file aida_ntuple.

                                                     {
    if(void* p = cmp_cast<base_ntu>(this,a_class)) {return p;}
    else return 0;
  }
void inlib::aida::base_ntu::clear ( ) [inline]

Definition at line 162 of file aida_ntuple.

               { //must not be confused with reset().
    inlib::clear<base_col>(m_cols);
    m_index = -1;
  }
const std::vector<base_col*>& inlib::aida::base_ntu::cols ( ) const [inline]

Definition at line 151 of file aida_ntuple.

{return m_cols;}
base_col* inlib::aida::base_ntu::find_column ( const std::string &  a_name) [inline]

Reimplemented in inlib::aida::ntuple.

Definition at line 206 of file aida_ntuple.

                                                {
    return find_named<base_col>(m_cols,a_name);
  }
bool inlib::aida::base_ntu::next ( ) [inline]

Definition at line 179 of file aida_ntuple.

              { 
    // a tuple loop is of the form :
    //  tuple.start();
    //  while(tuple.next()) {
    //    ...
    //    double v;
    //    if(!col->get_entry(v)) {}
    //    ...
    //  }
    if((m_index+1)>=(int64)rows()) return false;
    m_index++;
    set_columns_index(m_index);
    return true;
  }
base_ntu& inlib::aida::base_ntu::operator= ( const base_ntu a_from) [inline, protected]

Definition at line 128 of file aida_ntuple.

                                             {
    inlib::clear<base_col>(m_cols);
    m_index = a_from.m_index;

    m_title = a_from.m_title;
    std::vector<base_col*>::const_iterator it;
    for(it=a_from.m_cols.begin();it!=a_from.m_cols.end();++it) {
      base_col* column = (*it)->copy();
      if(!column) {
        m_out << s_class() << "::operator=() :"
              << " can't copy column."
              << std::endl;
        inlib::clear<base_col>(m_cols);
        m_index = -1;
        return *this;
      }
      m_cols.push_back(column);
    }

    return *this;
  }
std::ostream& inlib::aida::base_ntu::out ( ) [inline]

Definition at line 150 of file aida_ntuple.

{return m_out;}
bool inlib::aida::base_ntu::reset ( ) [inline]

Definition at line 167 of file aida_ntuple.

               { //clear data in columns (but not the column set)
    bool status = true;
    std::vector<base_col*>::iterator it;
    for(it=m_cols.begin();it!=m_cols.end();++it) {
      if(!(*it)->reset()) status = false;
    }
    m_index = -1;
    return status;
  }
int64 inlib::aida::base_ntu::row_index ( ) const [inline]

Definition at line 193 of file aida_ntuple.

{return m_index;}
uint64 inlib::aida::base_ntu::rows ( ) const [inline]

Definition at line 157 of file aida_ntuple.

                      {
    if(m_cols.empty()) return 0;
    return m_cols.front()->num_elems();
  }
static const std::string& inlib::aida::base_ntu::s_class ( ) [inline, static]

Reimplemented in inlib::aida::ntuple.

Definition at line 82 of file aida_ntuple.

                                    {
    static const std::string s_v("inlib::aida::base_ntu");
    return s_v;
  }
void inlib::aida::base_ntu::set_columns_index ( uint64  a_index) [inline, protected]

Definition at line 214 of file aida_ntuple.

                                         {
    std::vector<base_col*>::iterator it;
    for(it=m_cols.begin();it!=m_cols.end();++it) {
      (*it)->set_index(a_index);
    }
  }
void inlib::aida::base_ntu::set_title ( const std::string &  a_title) [inline]

Definition at line 155 of file aida_ntuple.

{m_title = a_title;}
void inlib::aida::base_ntu::start ( ) [inline]

Definition at line 178 of file aida_ntuple.

std::string inlib::aida::base_ntu::title ( ) [inline]

Definition at line 153 of file aida_ntuple.

{return m_title;}
const std::string& inlib::aida::base_ntu::title ( ) const [inline]

Definition at line 154 of file aida_ntuple.

{return m_title;}

Member Data Documentation

std::vector<base_col*> inlib::aida::base_ntu::m_cols [protected]

Definition at line 224 of file aida_ntuple.

Definition at line 223 of file aida_ntuple.

std::ostream& inlib::aida::base_ntu::m_out [protected]

Definition at line 221 of file aida_ntuple.

std::string inlib::aida::base_ntu::m_title [protected]

Definition at line 222 of file aida_ntuple.


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