CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
APVCyclePhaseCollection Class Reference

#include <APVCyclePhaseCollection.h>

Public Types

enum  { nopartition =-91, multiphase =-92, empty =-98, invalid =-99 }
 

Public Member Functions

 APVCyclePhaseCollection ()
 
const std::map< std::string,
int > & 
get () const
 
std::map< std::string, int > & get ()
 
const int getPhase (const std::string partition) const
 
const std::vector< int > getPhases (const std::string partition) const
 
 ~APVCyclePhaseCollection ()
 

Private Attributes

std::map< std::string, int > _apvmap
 

Detailed Description

Definition at line 9 of file APVCyclePhaseCollection.h.

Member Enumeration Documentation

anonymous enum

Constructor & Destructor Documentation

APVCyclePhaseCollection::APVCyclePhaseCollection ( )
inline

Definition at line 12 of file APVCyclePhaseCollection.h.

12 : _apvmap() { };
std::map< std::string, int > _apvmap
APVCyclePhaseCollection::~APVCyclePhaseCollection ( )
inline

Definition at line 13 of file APVCyclePhaseCollection.h.

13 { };

Member Function Documentation

const std::map<std::string,int>& APVCyclePhaseCollection::get ( ) const
inline
std::map<std::string,int>& APVCyclePhaseCollection::get ( )
inline
const int APVCyclePhaseCollection::getPhase ( const std::string  partition) const

Definition at line 5 of file APVCyclePhaseCollection.cc.

References _apvmap, empty, multiphase, and nopartition.

5  {
6 
7  int phase = empty;
8 
9  for(std::map<std::string,int>::const_iterator it=_apvmap.begin();it!=_apvmap.end();it++) {
10  if(strstr(it->first.c_str(),partition.c_str())==it->first.c_str() || strcmp(partition.c_str(),"All")==0 ) {
11  if(phase==empty ) {
12  phase = it->second;
13  }
14  else if(phase!=it->second) {
15  return multiphase;
16  }
17  }
18  }
19 
20  if(phase==empty) return nopartition;
21  return phase;
22 
23 
24 }
std::map< std::string, int > _apvmap
const std::vector< int > APVCyclePhaseCollection::getPhases ( const std::string  partition) const

Definition at line 26 of file APVCyclePhaseCollection.cc.

References _apvmap, empty, and invalid.

26  {
27 
28  std::set<int> phasesset;
29 
30  for(std::map<std::string,int>::const_iterator it=_apvmap.begin();it!=_apvmap.end();it++) {
31  if(strstr(it->first.c_str(),partition.c_str())==it->first.c_str() || strcmp(partition.c_str(),"Any")==0 ) {
32  if(it->second>=0 ) {
33  phasesset.insert(it->second);
34  }
35  }
36  }
37 
38  std::vector<int> phases;
39 
40  for(std::set<int>::const_iterator phase=phasesset.begin();phase!=phasesset.end();++phase) {
41  if(*phase!=empty && *phase!=invalid) {
42  phases.push_back(*phase);
43  }
44  }
45 
46  return phases;
47 
48 
49 }
std::map< std::string, int > _apvmap

Member Data Documentation

std::map<std::string,int> APVCyclePhaseCollection::_apvmap
private

Definition at line 28 of file APVCyclePhaseCollection.h.

Referenced by get(), getPhase(), and getPhases().