CMS 3D CMS Logo

IgCollection Class Reference

#include <Iguana/Framework/interface/IgCollection.h>

List of all members.

Public Types

typedef std::pair< const char *,
IgColumnHandle
LabelColumn
typedef std::vector< std::string > Labels
typedef std::vector< IgPropertyProperties
typedef std::pair< ColumnType,
IgColumnHandle
TypeColumn

Public Member Functions

template<class T>
IgPropertyaddProperty (const char *label, T defaultValue)
IgCollectionIterator begin (void)
void clear (void)
std::vector< LabelColumn > & columnLabels (void)
void compress (void)
IgCollectionItem create ()
IgCollectionIterator end (void)
IgColumnHandlegetHandleByLabel (const char *label)
IgColumnHandlegetHandleByPosition (const unsigned int position)
IgPropertygetProperty (const char *label)
bool hasProperty (const char *label)
int id (void) const
const char * name (void) const
Propertiesproperties (void)
void reserve (unsigned int size)
void resize (unsigned int size)
int size (void)

Protected Member Functions

 IgCollection (const char *name, int id)
 ~IgCollection ()

Private Types

typedef std::vector< LabelColumnColumnLabels
typedef std::map< ColumnType,
std::vector< IgColumnHandle > > 
ColumnTypeIndex
typedef std::vector< TypeColumnColumnTypes

Private Member Functions

bool doHasProperty (const char *label, Labels::iterator *i=0)

Private Attributes

std::vector< LabelColumnm_columnLabelsIndex
ColumnTypeIndex m_columnTypesIndex
int m_id
std::vector< std::string > m_labels
std::string m_name
std::vector< intm_primaryKeys
Properties m_properties
int m_rowCount

Friends

class IgDataStorage


Detailed Description

Definition at line 560 of file IgCollection.h.


Member Typedef Documentation

typedef std::vector<LabelColumn> IgCollection::ColumnLabels [private]

Definition at line 713 of file IgCollection.h.

typedef std::map<ColumnType, std::vector<IgColumnHandle> > IgCollection::ColumnTypeIndex [private]

Definition at line 715 of file IgCollection.h.

typedef std::vector<TypeColumn> IgCollection::ColumnTypes [private]

Definition at line 714 of file IgCollection.h.

typedef std::pair<const char *, IgColumnHandle> IgCollection::LabelColumn

Definition at line 564 of file IgCollection.h.

typedef std::vector<std::string> IgCollection::Labels

Definition at line 563 of file IgCollection.h.

typedef std::vector<IgProperty> IgCollection::Properties

Definition at line 566 of file IgCollection.h.

typedef std::pair<ColumnType, IgColumnHandle> IgCollection::TypeColumn

Definition at line 565 of file IgCollection.h.


Constructor & Destructor Documentation

IgCollection::IgCollection ( const char *  name,
int  id 
) [inline, protected]

Definition at line 694 of file IgCollection.h.

00695   : m_name (name), m_id(id), m_rowCount(0)
00696   { }

IgCollection::~IgCollection (  )  [inline, protected]

Definition at line 698 of file IgCollection.h.

00699   {
00700   }


Member Function Documentation

template<class T>
IgProperty& IgCollection::addProperty ( const char *  label,
defaultValue 
) [inline]

Definition at line 569 of file IgCollection.h.

References doHasProperty(), edm::es::l(), m_columnLabelsIndex, m_columnTypesIndex, m_labels, m_properties, and ColumnTypeHelper< T >::typeId().

Referenced by VisEBRecHit::analyze(), VisMuon::analyze(), VisHORecHit::analyze(), VisSiPixelCluster::analyze(), VisCaloTower::analyze(), VisEcalRecHit::analyze(), VisHBRecHit::analyze(), VisMET::analyze(), VisJet::analyze(), VisRPCRecHit::analyze(), VisDTDigi::analyze(), VisTrackingRecHit::analyze(), VisDTRecHit::analyze(), VisDTRecSegment4D::analyze(), VisSiStripCluster::analyze(), VisEERecHit::analyze(), VisPFRecTrack::analyze(), VisSiStripDigi::analyze(), VisCSCSegment::analyze(), VisPFRecHit::analyze(), VisSiPixelRecHit::analyze(), VisBasicCluster::analyze(), VisHERecHit::analyze(), VisHFRecHit::analyze(), VisPFCluster::analyze(), VisTrack::analyze(), VisEvent::analyze(), VisPixelDigi::analyze(), VisEventSetup::build(), VisEventSetup::buildCSC(), VisEventSetup::buildDriftTubes(), VisEventSetup::buildRPC(), VisEventSetup::buildTracker(), and IgParser::createColumn().

00570   {
00571     Labels::iterator l;
00572     if (doHasProperty(label, &l))
00573     {
00574       return m_properties[std::distance(m_labels.begin(), l)]; 
00575     }
00576     
00577     m_labels.push_back(label);
00578     std::vector<T> *columnData = new std::vector<T>;
00579     IgColumnHandle handle((void *)columnData, ColumnTypeHelper<T>::typeId ());
00580     m_columnLabelsIndex.push_back(LabelColumn(m_labels.back().c_str(), handle));
00581     m_columnTypesIndex[ColumnTypeHelper<T>::typeId()].push_back(handle);
00582     m_properties.push_back (IgProperty(handle));
00583     return m_properties.back();
00584   }

IgCollectionIterator IgCollection::begin ( void   ) 

Definition at line 31 of file IgCollection.cc.

Referenced by operator<<().

00032 {
00033     return IgCollectionIterator(this, 0);
00034 }

void IgCollection::clear ( void   )  [inline]

Definition at line 664 of file IgCollection.h.

References i, and m_properties.

00665   {
00666     for (Properties::iterator i = m_properties.begin ();
00667          i != m_properties.end();
00668          i++)
00669     {
00670       i->handle().clear();
00671     }
00672   }

std::vector<LabelColumn>& IgCollection::columnLabels ( void   )  [inline]

Definition at line 690 of file IgCollection.h.

References m_columnLabelsIndex.

Referenced by operator<<().

00691   { return m_columnLabelsIndex; };

void IgCollection::compress ( void   )  [inline]

Definition at line 654 of file IgCollection.h.

References i, and m_properties.

Referenced by IgParser::parseCollection().

00655   {
00656     for (Properties::iterator i = m_properties.begin();
00657          i != m_properties.end();
00658          i++)
00659     {
00660       i->handle().compress();
00661     }    
00662   }

IgCollectionItem IgCollection::create ( void   ) 

Definition at line 14 of file IgCollection.cc.

References i, m_properties, and m_rowCount.

Referenced by VisMuon::analyze(), VisEBRecHit::analyze(), VisSiPixelCluster::analyze(), VisHORecHit::analyze(), VisMET::analyze(), VisHBRecHit::analyze(), VisEcalRecHit::analyze(), VisCaloTower::analyze(), VisJet::analyze(), VisRPCRecHit::analyze(), VisDTDigi::analyze(), VisTrackingRecHit::analyze(), VisSiStripCluster::analyze(), VisDTRecSegment4D::analyze(), VisDTRecHit::analyze(), VisSiStripDigi::analyze(), VisPFRecTrack::analyze(), VisEERecHit::analyze(), VisPFRecHit::analyze(), VisCSCSegment::analyze(), VisSiPixelRecHit::analyze(), VisHERecHit::analyze(), VisBasicCluster::analyze(), VisTrack::analyze(), VisPFCluster::analyze(), VisHFRecHit::analyze(), VisPixelDigi::analyze(), VisEvent::analyze(), VisEventSetup::build(), VisEventSetup::buildCSC(), VisEventSetup::buildDriftTubes(), VisEventSetup::buildRPC(), VisEventSetup::buildTracker(), and VisMuon::refitTrack().

00015 {
00016   assert (!m_properties.empty());
00017   for (std::vector<IgProperty>::iterator i = m_properties.begin();
00018            i != m_properties.end();
00019            i++)
00020   {
00021         i->handle().extend(); 
00022   }
00023   return IgCollectionItem(this, m_rowCount++);
00024 }

bool IgCollection::doHasProperty ( const char *  label,
Labels::iterator *  i = 0 
) [inline, private]

Definition at line 705 of file IgCollection.h.

References find(), i, edm::es::l(), and m_labels.

Referenced by addProperty(), getProperty(), and hasProperty().

00706   {
00707     Labels::iterator l = std::find(m_labels.begin(), m_labels.end(), label);
00708     if (i != 0)
00709       *i = l;
00710     return l != m_labels.end();
00711   }

IgCollectionIterator IgCollection::end ( void   ) 

Definition at line 36 of file IgCollection.cc.

References m_rowCount.

Referenced by operator<<().

00037 {
00038     return IgCollectionIterator(this, m_rowCount);
00039 }

IgColumnHandle& IgCollection::getHandleByLabel ( const char *  label  )  [inline]

Definition at line 612 of file IgCollection.h.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), i, m_columnLabelsIndex, and m_name.

Referenced by IgCollectionItem::get(), and IgCollectionItem::operator[]().

00613   {
00614     for (std::vector<LabelColumn>::iterator i = m_columnLabelsIndex.begin();
00615          i != m_columnLabelsIndex.end();
00616          i++)
00617     {
00618       if (strcmp(i->first, label) == 0)
00619       {
00620         return i->second;
00621       }
00622     }
00623     std::cout << "IgColumnHandle::getHandleByLabel " << label << " from " << m_name << std::endl;
00624     
00625     assert(false && "Column not found. Did you create it?");
00626   }

IgColumnHandle& IgCollection::getHandleByPosition ( const unsigned int  position  )  [inline]

Definition at line 628 of file IgCollection.h.

References m_properties.

Referenced by IgCollectionItem::currentHandle(), and IgCollectionItem::ContainerTraits< C, T, A >::put().

00629   {
00630     return m_properties[position].handle();
00631   }

IgProperty& IgCollection::getProperty ( const char *  label  )  [inline]

Definition at line 589 of file IgCollection.h.

References doHasProperty(), edm::es::l(), m_labels, and m_properties.

00590   {
00591     Labels::iterator l;
00592     if (!doHasProperty (label, &l))
00593     {
00594       throw IgSchemaError();
00595     } 
00596 
00597     return m_properties[std::distance(m_labels.begin(), l)]; 
00598   }

bool IgCollection::hasProperty ( const char *  label  )  [inline]

Definition at line 600 of file IgCollection.h.

References doHasProperty().

00601   {
00602     return doHasProperty(label);
00603   }

int IgCollection::id ( void   )  const [inline]

Definition at line 685 of file IgCollection.h.

References m_id.

Referenced by IgCollectionItem::operator IgRef().

00686   {
00687     return m_id;
00688   }

const char* IgCollection::name ( void   )  const [inline]

Definition at line 680 of file IgCollection.h.

References m_name.

Referenced by operator<<().

00681   {
00682     return m_name.c_str();
00683   }

Properties& IgCollection::properties ( void   )  [inline]

Definition at line 674 of file IgCollection.h.

References m_properties.

Referenced by IgCollectionItem::moveToColumn(), IgParser::parseCollection(), and IgCollectionItem::stream().

00675   {
00676     return m_properties;
00677   }

void IgCollection::reserve ( unsigned int  size  )  [inline]

Definition at line 633 of file IgCollection.h.

References i, and m_properties.

Referenced by IgParser::parseCollection().

00634   {
00635     for (Properties::iterator i = m_properties.begin();
00636          i != m_properties.end();
00637          i++)
00638     {
00639       i->handle().reserve(size);
00640     }
00641   }

void IgCollection::resize ( unsigned int  size  )  [inline]

Definition at line 643 of file IgCollection.h.

References i, m_properties, and m_rowCount.

Referenced by IgParser::parseCollection().

00644   {
00645     for (Properties::iterator i = m_properties.begin();
00646          i != m_properties.end();
00647          i++)
00648     {
00649       i->handle().resize(size);
00650     }
00651     m_rowCount = size;
00652   }

int IgCollection::size ( void   )  [inline]

Definition at line 605 of file IgCollection.h.

References m_rowCount.

00606   {
00607     // We consider the size of the first column as the size of the whole
00608     // collection.
00609     return m_rowCount;
00610   }


Friends And Related Function Documentation

friend class IgDataStorage [friend]

Definition at line 702 of file IgCollection.h.


Member Data Documentation

std::vector<LabelColumn> IgCollection::m_columnLabelsIndex [private]

Definition at line 718 of file IgCollection.h.

Referenced by addProperty(), columnLabels(), and getHandleByLabel().

ColumnTypeIndex IgCollection::m_columnTypesIndex [private]

Definition at line 720 of file IgCollection.h.

Referenced by addProperty().

int IgCollection::m_id [private]

Definition at line 722 of file IgCollection.h.

Referenced by id().

std::vector<std::string> IgCollection::m_labels [private]

Definition at line 716 of file IgCollection.h.

Referenced by addProperty(), doHasProperty(), and getProperty().

std::string IgCollection::m_name [private]

Definition at line 721 of file IgCollection.h.

Referenced by getHandleByLabel(), and name().

std::vector<int> IgCollection::m_primaryKeys [private]

Definition at line 717 of file IgCollection.h.

Properties IgCollection::m_properties [private]

Definition at line 719 of file IgCollection.h.

Referenced by addProperty(), clear(), compress(), create(), getHandleByPosition(), getProperty(), properties(), reserve(), and resize().

int IgCollection::m_rowCount [private]

Definition at line 723 of file IgCollection.h.

Referenced by create(), end(), resize(), and size().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:07 2009 for CMSSW by  doxygen 1.5.4