FEDRA emulsion software from the OPERA Collaboration
Catalog Class Reference

#include <Catalog.h>

Collaboration diagram for Catalog:

Public Member Functions

 Catalog ()
 
int findConfig (std::string configName)
 
std::string getConfigValue (int index, std::string configName)
 
unsigned int getFragmentIndexes (unsigned int y, unsigned int x)
 
HeaderInfo getHeaderInfo ()
 
unsigned int getNfragments ()
 
SetupStringRepresentationgetSetup ()
 
double getXmax ()
 
double getXmin ()
 
double getXstep ()
 
unsigned int getXviews ()
 
double getYmax ()
 
double getYmin ()
 
double getYstep ()
 
unsigned int getYviews ()
 
void initFragmentIndexes (unsigned int yviews, unsigned int xviews)
 
bool setFragmentIndexes (unsigned int y, unsigned int x, unsigned int value)
 
void setHeaderInfo (HeaderInfo headerInfo)
 
void setNfragments (unsigned int n)
 
void setXmax (double xMax)
 
void setXmin (double xMin)
 
void setXstep (double xStep)
 
void setXviews (unsigned int x)
 
void setYmax (double yMax)
 
void setYmin (double yMin)
 
void setYstep (double yStep)
 
void setYviews (unsigned int y)
 
 ~Catalog ()
 

Public Attributes

SetupStringRepresentation setup
 

Private Attributes

Area _area
 
HeaderInfo _headerInfo
 
unsigned int _nConfigs
 
unsigned int * _pFragmentIndexes
 
SetupStringRepresentation _setup
 
unsigned int _xViews
 
unsigned int _yViews
 
unsigned char Reserved [256]
 

Constructor & Destructor Documentation

◆ Catalog()

Catalog::Catalog ( )
inline
unsigned int * _pFragmentIndexes
Definition: Catalog.h:11

◆ ~Catalog()

Catalog::~Catalog ( )
inline
20{delete [] _pFragmentIndexes;}

Member Function Documentation

◆ findConfig()

int Catalog::findConfig ( std::string  configName)
22{
23 bool found = false;
24 std::vector<std::string> tokens;
25 const std::string delimiters=" ";
26 unsigned int index = -1;
27 for (unsigned int i = 0; i <_setup.length; i++)
28 {
29 tokens.clear();
30
31
32 // Skip delimiters at beginning.
33 std::string::size_type lastPos = _setup.configs.at(i).name.find_first_not_of(delimiters, 0);
34 // Find first "non-delimiter".
35 std::string::size_type pos = _setup.configs.at(i).name.find_first_of(delimiters, lastPos);
36
37 while (std::string::npos != pos || std::string::npos != lastPos)
38 {
39 // Found a token, add it to the vector.
40 tokens.push_back(_setup.configs.at(i).name.substr(lastPos, pos - lastPos));
41 // Skip delimiters. Note the "not_of"
42 lastPos = _setup.configs.at(i).name.find_first_not_of(delimiters, pos);
43 // Find next "non-delimiter"
44 pos = _setup.configs.at(i).name.find_first_of(delimiters, lastPos);
45 }
46// std::cout << "============================" << std::endl;
47 for (int j = 0; j < static_cast<int>(tokens.size()); j++)
48 {
49
50 if (tokens.at(j) == configName)
51 {
52 found = true;
53// std::cout << "FOUND!!!\n" << tokens.at(j) << std::endl;
54 index = i;
55 break;
56 }
57 }
58 if (found)
59 break;
60 }
61
62 return index;
63}
SetupStringRepresentation _setup
Definition: Catalog.h:14
unsigned int length
Definition: Struct.h:65
std::vector< ConfigStringRepresentation > configs
Definition: Struct.h:64

◆ getConfigValue()

std::string Catalog::getConfigValue ( int  index,
std::string  configName 
)
68{
69 bool found = false;
70 std::vector<std::string> tokens;
71 const std::string delimiters=" ";
72 unsigned int indexConf = -1;
73 //std::cout << _setup.configs.at(index).length << std::endl;
74 for (unsigned int i = 0; i <_setup.configs.at(index).length; i++)
75 {
76 tokens.clear();
77
78
79 // Skip delimiters at beginning.
80 std::string::size_type lastPos = _setup.configs.at(index).keys.at(i).name.find_first_not_of(delimiters, 0);
81 // Find first "non-delimiter".
82 std::string::size_type pos = _setup.configs.at(index).keys.at(i).name.find_first_of(delimiters, lastPos);
83
84 while (std::string::npos != pos || std::string::npos != lastPos)
85 {
86 // Found a token, add it to the vector.
87 tokens.push_back(_setup.configs.at(index).keys.at(i).name.substr(lastPos, pos - lastPos));
88 // Skip delimiters. Note the "not_of"
89 lastPos = _setup.configs.at(index).keys.at(i).name.find_first_not_of(delimiters, pos);
90 // Find next "non-delimiter"
91 pos = _setup.configs.at(index).keys.at(i).name.find_first_of(delimiters, lastPos);
92 }
93
94 for (int j = 0; j < static_cast<int>(tokens.size()); j++)
95 {
96 if (tokens.at(j) == value)
97 {
98 found = true;
99 indexConf = i;
100 break;
101 }
102 }
103 if (found)
104 break;
105 }
106
107 _setup.configs.at(index).keys.at(indexConf);
108 std::string retValue = _setup.configs.at(index).keys.at(indexConf).value;
109// std::cout << retValue << std::endl;
110
111
112 return retValue;
113}

◆ getFragmentIndexes()

unsigned int Catalog::getFragmentIndexes ( unsigned int  y,
unsigned int  x 
)
inline
38{return _pFragmentIndexes[y*_xViews+x];};
unsigned int _xViews
Definition: Catalog.h:10

◆ getHeaderInfo()

HeaderInfo Catalog::getHeaderInfo ( )
inline
22{return _headerInfo;}
HeaderInfo _headerInfo
Definition: Catalog.h:13

◆ getNfragments()

unsigned int Catalog::getNfragments ( )
inline
47{return _area.nFragments;}
Area _area
Definition: Catalog.h:9
unsigned int nFragments
Definition: Struct.h:44

◆ getSetup()

SetupStringRepresentation * Catalog::getSetup ( )
inline
48{return &_setup;}

◆ getXmax()

double Catalog::getXmax ( )
inline
42{return _area.xMax;}
double xMax
Definition: Struct.h:42

◆ getXmin()

double Catalog::getXmin ( )
inline
41{return _area.xMin;}
double xMin
Definition: Struct.h:42

◆ getXstep()

double Catalog::getXstep ( )
inline
45{return _area.xStep;}
double xStep
Definition: Struct.h:43

◆ getXviews()

unsigned int Catalog::getXviews ( )
inline
39{return _xViews;}

◆ getYmax()

double Catalog::getYmax ( )
inline
44{return _area.yMax;}
double yMax
Definition: Struct.h:42

◆ getYmin()

double Catalog::getYmin ( )
inline
43{return _area.yMin;}
double yMin
Definition: Struct.h:42

◆ getYstep()

double Catalog::getYstep ( )
inline
46{return _area.yStep;}
double yStep
Definition: Struct.h:43

◆ getYviews()

unsigned int Catalog::getYviews ( )
inline
40{return _yViews;}
unsigned int _yViews
Definition: Catalog.h:10

◆ initFragmentIndexes()

void Catalog::initFragmentIndexes ( unsigned int  yviews,
unsigned int  xviews 
)
inline
23{_pFragmentIndexes = new unsigned int[yviews*xviews];}

◆ setFragmentIndexes()

bool Catalog::setFragmentIndexes ( unsigned int  y,
unsigned int  x,
unsigned int  value 
)
14{
16 return false;
17 _pFragmentIndexes[y*_xViews + x] = value;
18 return true;
19}

◆ setHeaderInfo()

void Catalog::setHeaderInfo ( HeaderInfo  headerInfo)
5{
6 _headerInfo.part0 = headerInfo.part0;
7 _headerInfo.part1 = headerInfo.part1;
8 _headerInfo.part2 = headerInfo.part2;
9 _headerInfo.part3 = headerInfo.part3;
10}
int part2
Definition: Struct.h:23
int part0
Definition: Struct.h:21
int part3
Definition: Struct.h:24
int part1
Definition: Struct.h:22

◆ setNfragments()

void Catalog::setNfragments ( unsigned int  n)
inline
33{_area.nFragments = n;}

◆ setXmax()

void Catalog::setXmax ( double  xMax)
inline
28{_area.xMax = xMax;}

◆ setXmin()

void Catalog::setXmin ( double  xMin)
inline
27{_area.xMin = xMin;}

◆ setXstep()

void Catalog::setXstep ( double  xStep)
inline
31{_area.xStep = xStep;}

◆ setXviews()

void Catalog::setXviews ( unsigned int  x)
inline
25{_xViews = x;}

◆ setYmax()

void Catalog::setYmax ( double  yMax)
inline
30{_area.yMax = yMax;}

◆ setYmin()

void Catalog::setYmin ( double  yMin)
inline
29{_area.yMin = yMin;}

◆ setYstep()

void Catalog::setYstep ( double  yStep)
inline
32{_area.yStep = yStep;}

◆ setYviews()

void Catalog::setYviews ( unsigned int  y)
inline
26{_yViews = y;}

Member Data Documentation

◆ _area

Area Catalog::_area
private

◆ _headerInfo

HeaderInfo Catalog::_headerInfo
private

◆ _nConfigs

unsigned int Catalog::_nConfigs
private

◆ _pFragmentIndexes

unsigned int* Catalog::_pFragmentIndexes
private

◆ _setup

SetupStringRepresentation Catalog::_setup
private

◆ _xViews

unsigned int Catalog::_xViews
private

◆ _yViews

unsigned int Catalog::_yViews
private

◆ Reserved

unsigned char Catalog::Reserved[256]
private

◆ setup

SetupStringRepresentation Catalog::setup

The documentation for this class was generated from the following files: