CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ArrayPayload.cc
Go to the documentation of this file.
2 #include <sstream>
3 
5  p_i( -1 ),
6  p_s(""){
7 }
8 
9 Param::Param( int seed ):
10  p_i( seed ),
11  p_s(""){
12  std::stringstream ss;
13  ss << seed;
14  p_s = ss.str();
15 }
16 
17 bool Param::operator ==(const Param& rhs) const {
18  if( p_i != rhs.p_i ) return false;
19  if( p_s != rhs.p_s ) return false;
20  return true;
21 }
22 
23 bool Param::operator !=(const Param& rhs) const {
24  return !operator==( rhs );
25 }
26 
27 void setDefaultBitSet( std::bitset<128>& val ){
28  size_t i = 0;
29  while( i<128 ){
30  if( i%2==0 ) val.set(i);
31  i++;
32  }
33 }
34 
36  m_i(-1),
37  m_p0(),
38  m_p1(),
39  m_p2(),
40  m_vec0(),
41  m_vec1(),
42  m_map0(),
43  m_map1(),
44  m_list(),
45  m_set(),
46  m_bitset(),
47  m_vec2(),
48  m_map2(),
49  m_vec3(){
51 }
52 
54  m_i( seed + 99 ),
55  m_p0(),
56  m_p1(),
57  m_p2(),
58  m_vec0(),
59  m_vec1(),
60  m_map0(),
61  m_map1(),
62  m_list(),
63  m_set(),
64  m_bitset(),
65  m_vec2(),
66  m_map2(),
67  m_vec3(){
68  for( size_t i=0;i<4; i++ ){
69  m_ai0[i]= seed + i;
70  }
71  for( size_t i=0;i<112; i++ ){
72  m_ai1[i]= seed + i;
73  }
74  for( size_t i=0;i<2; i++ ){
75  for( size_t j=0;i<3; i++ ){
76  m_ai2[j][i]= seed + i + j;
77  }
78  }
79  for( size_t i=0;i<80; i++ ){
80  for( size_t j=0;i<2; i++ ){
81  m_ai3[j][i]= seed + i + j;
82  }
83  }
84  for( size_t i=0;i<4; i++ ){
85  std::stringstream ss;
86  ss << (seed + i);
87  m_as0[i]= ss.str();
88  }
89  for( size_t i=0;i<112; i++ ){
90  std::stringstream ss;
91  ss << (seed + i);
92  m_as1[i]= ss.str();
93  }
94  for( int i=0;i<4; i++ ){
95  m_ap0[i] = Param(i+seed);
96  }
97  for( int i=0;i<112; i++ ){
98  m_ap1[i] = Param(i+seed);
99  }
100  m_p0.first = seed;
101  m_p0.second = seed*10;
102  m_p1.first = seed;
103  std::stringstream ss;
104  ss << (seed*10);
105  m_p1.second = ss.str();
106  m_p2.first = seed;
107  m_p2.second = Param( seed );
108 
109  for( int i=0;i<seed;i++){
110  m_vec0.push_back(i);
111  std::stringstream ss0;
112  ss0 << "vec1_"<<seed;
113  m_vec1.push_back( ss0.str() );
114  m_map0.insert(std::make_pair((unsigned int)seed,(unsigned int)seed));
115  std::stringstream ss1;
116  ss1 << "map1_"<<seed;
117  m_map1.insert(std::make_pair( ss1.str(),ss1.str() ) );
118  m_list.push_back( seed );
119  m_set.insert( ss1.str() );
120  m_vec2.push_back( Param( seed ) );
121  m_map2.insert( std::make_pair( seed, Param( seed ) ) );
122  m_vec3.push_back( Param( seed ) );
123  }
124 
125  size_t i=0;
126  int j = 1;
127  while( j<128 ){
128  if( seed & j )m_bitset.set(i);
129  j = j << 1;
130  i++;
131  }
132 }
133 
134 #include <iostream>
135 bool ArrayPayload::operator ==(const ArrayPayload& rhs) const {
136  if( m_i != rhs.m_i ) return false;
137  for( int i=0;i<4;i++){
138  if(m_ai0[i] != rhs.m_ai0[i] ) return false;
139  }
140  for( int i=0;i<112;i++){
141  if(m_ai1[i] != rhs.m_ai1[i] ) return false;
142  }
143  for( size_t i=0;i<2; i++ ){
144  for( size_t j=0;i<3; i++ ){
145  if( m_ai2[j][i] != rhs.m_ai2[j][i] ) return false;
146  }
147  }
148  for( size_t i=0;i<80; i++ ){
149  for( size_t j=0;i<2; i++ ){
150  if( m_ai3[j][i] != rhs.m_ai3[j][i] ) return false;
151  }
152  }
153  for( size_t i=0;i<4; i++ ){
154  if(m_as0[i] != rhs.m_as0[i] ) return false;
155  }
156  for( size_t i=0;i<112; i++ ){
157  if(m_as1[i] != rhs.m_as1[i] ) return false;
158  }
159  for( int i=0;i<4; i++ ){
160  if(m_ap0[i] != rhs.m_ap0[i] ) return false;
161  }
162  for( int i=0;i<112; i++ ){
163  if(m_ap1[i] != rhs.m_ap1[i] ) return false;
164  }
165  if(m_p0 != rhs.m_p0 ) return false;
166  if(m_p1 != rhs.m_p1 ) return false;
167  if(m_p2 != rhs.m_p2 ) return false;
168  if(m_vec0 != rhs.m_vec0 ) return false;
169  if(m_vec1 != rhs.m_vec1 ) return false;
170  if(m_vec2 != rhs.m_vec2 ) return false;
171  if(m_vec3 != rhs.m_vec3 ) return false;
172  if(m_map0 != rhs.m_map0 ) return false;
173  if(m_map1 != rhs.m_map1 ) return false;
174  if(m_map2 != rhs.m_map2 ) return false;
175  if(m_list != rhs.m_list ) return false;
176  if(m_set != rhs.m_set ) return false;
177  std::bitset<128> defValue;
178  setDefaultBitSet( defValue );
179  if( m_bitset == defValue ){
180  std::cout <<"WARNING: data member \"m_bitset\" read with the default value."<<std::endl;
181  } else {
182  if( m_bitset != rhs.m_bitset ) return false;
183  }
184  return true;
185 }
186 
187 bool ArrayPayload::operator !=(const ArrayPayload& rhs) const {
188  return !operator==(rhs);
189 }
Param m_ap0[4]
Definition: ArrayPayload.h:32
int i
Definition: DBlmapReader.cc:9
bool operator==(const ArrayPayload &rhs) const
bool operator!=(const ArrayPayload &rhs) const
std::set< std::string > m_set
Definition: ArrayPayload.h:43
Param m_ap1[112]
Definition: ArrayPayload.h:33
std::vector< int > m_vec0
Definition: ArrayPayload.h:38
std::vector< Param > m_vec2
Definition: ArrayPayload.h:45
std::vector< Param > m_vec3
Definition: ArrayPayload.h:48
std::pair< int, std::string > m_p1
Definition: ArrayPayload.h:36
std::bitset< 128 > m_bitset
Definition: ArrayPayload.h:44
void setDefaultBitSet(std::bitset< 128 > &val)
Definition: ArrayPayload.cc:27
int m_ai2[3][2]
Definition: ArrayPayload.h:28
bool operator!=(const Param &rhs) const
Definition: ArrayPayload.cc:23
std::string m_as0[4]
Definition: ArrayPayload.h:30
int m_ai1[112]
Definition: ArrayPayload.h:27
std::string p_s
Definition: ArrayPayload.h:12
std::pair< unsigned int, unsigned int > m_p0
Definition: ArrayPayload.h:35
int p_i
Definition: ArrayPayload.h:11
int j
Definition: DBlmapReader.cc:9
std::map< std::string, std::string > m_map1
Definition: ArrayPayload.h:41
bool operator==(const Param &rhs) const
Definition: ArrayPayload.cc:17
std::pair< int, Param > m_p2
Definition: ArrayPayload.h:37
std::map< int, Param > m_map2
Definition: ArrayPayload.h:46
std::list< int > m_list
Definition: ArrayPayload.h:42
std::string m_as1[112]
Definition: ArrayPayload.h:31
int m_ai3[2][80]
Definition: ArrayPayload.h:29
std::map< unsigned int, unsigned int > m_map0
Definition: ArrayPayload.h:40
int m_ai0[4]
Definition: ArrayPayload.h:26
tuple cout
Definition: gather_cfg.py:121
std::vector< std::string > m_vec1
Definition: ArrayPayload.h:39