CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 8 of file APVCyclePhaseCollection.h.

Member Enumeration Documentation

anonymous enum

Constructor & Destructor Documentation

APVCyclePhaseCollection::APVCyclePhaseCollection ( )
inline

Definition at line 10 of file APVCyclePhaseCollection.h.

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

Definition at line 11 of file APVCyclePhaseCollection.h.

11 {};

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

Definition at line 23 of file APVCyclePhaseCollection.cc.

References _apvmap, empty, invalid, and phases.

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

Member Data Documentation

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

Definition at line 24 of file APVCyclePhaseCollection.h.

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