CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CondCore/ORA/interface/Selection.h

Go to the documentation of this file.
00001 #ifndef INCLUDE_ORA_SELECTION_H
00002 #define INCLUDE_ORA_SELECTION_H
00003 
00004 //
00005 #include <vector>
00006 // externals
00007 #include "CoralBase/AttributeList.h"
00008 #include "CoralBase/Exception.h"
00009 #include "CoralBase/Attribute.h"
00010 
00011 namespace ora    {
00012 
00013   typedef enum { EQ, NE, GT, GE, LT, LE } SelectionItemType;
00014 
00015   class Selection{
00016     public:
00017 
00018     static const int endOfRange = -1;
00019     static std::string indexVariable();
00020     static std::vector<std::string>& selectionTypes();
00021     static std::string variableNameFromUniqueString(const std::string& uniqueString);
00022 
00023     public:
00024     
00025     Selection();
00026 
00027     virtual ~Selection();
00028 
00029     void addIndexItem( int startIndex, int endIndex=endOfRange );
00030     
00031     template <typename Prim> void addDataItem(const std::string& dataMemberName, SelectionItemType stype, Prim selectionData);
00032 
00033     bool isEmpty() const;
00034     
00035     const std::vector<std::pair<std::string,std::string> >& items() const;
00036     
00037     const coral::AttributeList& data() const;
00038 
00039     private:
00040 
00041     std::string uniqueVariableName(const std::string& varName) const;
00042     
00043     private:
00044 
00045     std::vector<std::pair<std::string,std::string> > m_items;
00046     coral::AttributeList m_data;
00047   };
00048   
00049 }
00050 
00051 template <typename Prim> void ora::Selection::addDataItem(const std::string& dataMemberName, ora::SelectionItemType stype, Prim selectionData){
00052   std::string varName = uniqueVariableName( dataMemberName );
00053   m_items.push_back(std::make_pair(varName,selectionTypes()[stype]));
00054   m_data.extend<Prim>(varName);
00055   m_data[varName].data<Prim>()=selectionData;
00056 }
00057 
00058 #endif  //