CMS 3D CMS Logo

Public Member Functions | Public Attributes

ora::Record Class Reference

#include <Record.h>

List of all members.

Public Member Functions

void const * address (int i) const
template<typename T >
T const & data (int i) const
template<typename T >
Tdata (int i)
void destroy ()
void const * get (int i) const
int index (std::string const &iname) const
void init (RecordSpec ispecs)
bool isNull (int i) const
std::string const & name (int i) const
 Record (RecordSpec ispecs)
 Record ()
void set (int i, void *p)
void setNotNull (int i)
void setNull (int i)
size_t size () const
void swap (Record &lh)
std::type_info const * type (int i) const
 ~Record ()

Public Attributes

std::vector< AnyDatam_field
std::vector< bool > m_null
boost::shared_ptr< RecordSpecImplspecs

Detailed Description

Definition at line 28 of file Record.h.


Constructor & Destructor Documentation

Record::Record ( )

Definition at line 48 of file Record.cc.

{}
Record::Record ( RecordSpec  ispecs) [explicit]

Definition at line 50 of file Record.cc.

References init().

                                  {
    init(ispecs);
  }
Record::~Record ( )

Definition at line 66 of file Record.cc.

References destroy().

                  {
    destroy();
  }

Member Function Documentation

void const * Record::address ( int  i) const

Definition at line 99 of file Record.cc.

References i, m_field, and specs.

Referenced by data().

                                          {
    return specs->items[i].handler->address(m_field[i]);
  }
template<typename T >
T& ora::Record::data ( int  i) [inline]

Definition at line 43 of file Record.h.

References address().

                    {
      // assert???
      return
        *reinterpret_cast<T*>(const_cast<void*>(address(i)));
    }
template<typename T >
T const& ora::Record::data ( int  i) const [inline]

Definition at line 50 of file Record.h.

References address(), and compareJSON::const.

                                {
       // assert???
     return 
        *reinterpret_cast<T const*>(address(i));
    }
void Record::destroy ( )

Definition at line 70 of file Record.cc.

References ora::TypeHandler::destroy(), ora::RecordSpecImpl::Item::handler, i, m_field, m_null, and specs.

Referenced by init(), and ~Record().

                       {
    if (m_field.empty()) return;
    for (size_t i=0; i<m_field.size(); ++i) {
      RecordSpecImpl::Item const & item = specs->items[i];
      item.handler->destroy(m_field[i]);
    }
    m_field.clear();
    m_null.clear();
  }
void const * Record::get ( int  i) const

Definition at line 103 of file Record.cc.

References i, m_field, and specs.

                                      {
    return specs->items[i].handler->get(m_field[i]);
  }
int Record::index ( std::string const &  iname) const

Definition at line 88 of file Record.cc.

References m_field, L1TEmulatorMonitor_cff::p, and specs.

                                                 {
    if (m_field.empty()) return -1;
    RecordSpecImpl::Lookup::const_iterator p = specs->indexes.find(iname);
    return (p==specs->indexes.end()) ? -1 : (*p).second;
  }
void Record::init ( RecordSpec  ispecs)

Definition at line 54 of file Record.cc.

References ora::TypeHandler::create(), destroy(), ora::RecordSpecImpl::Item::handler, i, m_field, m_null, asciidump::s, ora::RecordSpec::specs, and specs.

Referenced by Record().

                                     {
    destroy();
    specs = ispecs.specs;
    size_t s = specs->items.size();
    m_field.resize(s);
    m_null.resize(s,true);
    for (size_t i=0; i<s; ++i) {
      RecordSpecImpl::Item const & item = specs->items[i];
      item.handler->create(m_field[i]);
    }
  }
bool ora::Record::isNull ( int  i) const [inline]

Definition at line 65 of file Record.h.

References i, and m_null.

{ return m_null[i];}
std::string const & Record::name ( int  i) const

Definition at line 112 of file Record.cc.

References i, and specs.

                                            {
    return specs->items[i].name;
  }
void Record::set ( int  i,
void *  p 
)

Definition at line 107 of file Record.cc.

References i, m_field, and specs.

                                  {
    specs->items[i].handler->set(m_field[i],p);
  }
void ora::Record::setNotNull ( int  i) [inline]

Definition at line 57 of file Record.h.

References i, and m_null.

{  m_null[i]=false;  } 
void ora::Record::setNull ( int  i) [inline]

Definition at line 56 of file Record.h.

References i, and m_null.

{  m_null[i]=true;  } 
size_t ora::Record::size ( void  ) const [inline]

Definition at line 40 of file Record.h.

References m_null.

Referenced by ora::MultiIndexDataTrie::lookupAndClear().

{ return m_null.size();}
void Record::swap ( Record lh)

Definition at line 81 of file Record.cc.

References m_field, m_null, and specs.

Referenced by ora::MultiIndexDataTrie::clear(), ora::MultiIndexDataTrie::lookupAndClear(), ora::MultiIndexDataTrie::push(), and swap().

                               {
    specs.swap(lh.specs);
    m_field.swap(lh.m_field);
    m_null.swap(lh.m_null);
  }
std::type_info const * Record::type ( int  i) const

Definition at line 95 of file Record.cc.

References i, and specs.

                                               {
    return specs->items[i].handler->type;
  }

Member Data Documentation

Definition at line 68 of file Record.h.

Referenced by address(), destroy(), get(), index(), init(), set(), and swap().

std::vector<bool> ora::Record::m_null

Definition at line 69 of file Record.h.

Referenced by destroy(), init(), isNull(), setNotNull(), setNull(), size(), and swap().

boost::shared_ptr<RecordSpecImpl> ora::Record::specs

Definition at line 67 of file Record.h.

Referenced by address(), destroy(), get(), index(), init(), name(), set(), swap(), and type().