ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
TestClassSimpleContainers Class Reference

#include <TestClassSimpleContainers.h>

Collaboration diagram for TestClassSimpleContainers:

Public Member Functions

 TestClassSimpleContainers ()
 
 ~TestClassSimpleContainers ()
 
void setNonZero ()
 
bool operator== (const TestClassSimpleContainers &rhs) const
 
bool operator!= (const TestClassSimpleContainers &rhs) const
 
std::ostream & streamOut (std::ostream &os) const
 

Public Attributes

std::vector< int > m_vector_of_int
 
std::list< double > m_list_of_double
 
std::map< std::string, long > m_map_of_string_to_long
 
std::set< unsigned short > m_set_of_ushort
 
std::deque< float > m_deque_of_float
 

Detailed Description

Definition at line 16 of file TestClassSimpleContainers.h.

Constructor & Destructor Documentation

◆ TestClassSimpleContainers()

TestClassSimpleContainers::TestClassSimpleContainers ( )
inline

Definition at line 19 of file TestClassSimpleContainers.h.

19  :
25  {}

◆ ~TestClassSimpleContainers()

TestClassSimpleContainers::~TestClassSimpleContainers ( )
inline

Definition at line 27 of file TestClassSimpleContainers.h.

27 {}

Member Function Documentation

◆ operator!=()

Definition at line 155 of file TestClassSimpleContainers.h.

156 {
157  return ( ( (*this) == rhs ) ? false : true );
158 }

◆ operator==()

bool TestClassSimpleContainers::operator== ( const TestClassSimpleContainers rhs) const
inline

Definition at line 100 of file TestClassSimpleContainers.h.

101 {
102  // Check first the sizes of the containers
103  if ( m_vector_of_int.size() != rhs.m_vector_of_int.size() ) return false;
104  if ( m_list_of_double.size() != rhs.m_list_of_double.size() ) return false;
105  if ( m_map_of_string_to_long.size() != rhs.m_map_of_string_to_long.size() ) return false;
106  if ( m_set_of_ushort.size() != rhs.m_set_of_ushort.size() ) return false;/*
107  if ( m_deque_of_float.size() != rhs.m_deque_of_float.size() ) return false;*/
108 
109  // Check element by element.
110  std::vector< int >::const_iterator this_i_vector_of_int = m_vector_of_int.begin();
111  std::vector< int >::const_iterator rhs_i_vector_of_int = rhs.m_vector_of_int.begin();
112  while ( this_i_vector_of_int != m_vector_of_int.end() ) {
113  if ( *this_i_vector_of_int != *rhs_i_vector_of_int ) return false;
114  ++this_i_vector_of_int;
115  ++rhs_i_vector_of_int;
116  }
117 
118  std::list< double >::const_iterator this_i_list_of_double = m_list_of_double.begin();
119  std::list< double >::const_iterator rhs_i_list_of_double = rhs.m_list_of_double.begin();
120  while ( this_i_list_of_double != m_list_of_double.end() ) {
121  if ( *this_i_list_of_double != *rhs_i_list_of_double ) return false;
122  ++this_i_list_of_double;
123  ++rhs_i_list_of_double;
124  }
125 
126  std::map< std::string, long >::const_iterator this_i_map_of_string_to_long = m_map_of_string_to_long.begin();
127  std::map< std::string, long >::const_iterator rhs_i_map_of_string_to_long = rhs.m_map_of_string_to_long.begin();
128  while ( this_i_map_of_string_to_long != m_map_of_string_to_long.end() ) {
129  if ( this_i_map_of_string_to_long->first != rhs_i_map_of_string_to_long->first ||
130  this_i_map_of_string_to_long->second != rhs_i_map_of_string_to_long->second ) return false;
131  ++this_i_map_of_string_to_long;
132  ++rhs_i_map_of_string_to_long;
133  }
134 
135  std::set< unsigned short >::const_iterator this_i_set_of_ushort = m_set_of_ushort.begin();
136  std::set< unsigned short >::const_iterator rhs_i_set_of_ushort = rhs.m_set_of_ushort.begin();
137  while ( this_i_set_of_ushort != m_set_of_ushort.end() ) {
138  if ( *this_i_set_of_ushort != *rhs_i_set_of_ushort ) return false;
139  ++this_i_set_of_ushort;
140  ++rhs_i_set_of_ushort;
141  }
142 
143  std::deque< float >::const_iterator this_i_deque_of_float = m_deque_of_float.begin();
144  std::deque< float >::const_iterator rhs_i_deque_of_float = rhs.m_deque_of_float.begin();
145  while ( this_i_deque_of_float != m_deque_of_float.end() ) {
146  if ( *this_i_deque_of_float != *rhs_i_deque_of_float ) return false;
147  ++this_i_deque_of_float;
148  ++rhs_i_deque_of_float;
149  }
150 
151  return true;
152 }

◆ setNonZero()

void TestClassSimpleContainers::setNonZero ( )
inline

Definition at line 43 of file TestClassSimpleContainers.h.

44 {
45  m_vector_of_int.clear();
46  m_vector_of_int.push_back( 1 );
47  m_list_of_double.clear();
48  m_list_of_double.push_back( 2 );
49  m_list_of_double.push_back( 3 );
51  m_map_of_string_to_long.insert( std::make_pair( std::string( "key1" ), 4L ) );
52  m_map_of_string_to_long.insert( std::make_pair( std::string( "key2" ), 5L ) );
53  m_set_of_ushort.clear();
54  m_set_of_ushort.insert( 6 );
55  m_set_of_ushort.insert( 7 );
56  m_set_of_ushort.insert( 8 );
57  m_deque_of_float.clear();
58  m_deque_of_float.push_back( 9 );
59  m_deque_of_float.push_front( 10 );
60 }

◆ streamOut()

std::ostream & TestClassSimpleContainers::streamOut ( std::ostream &  os) const
inline

Definition at line 63 of file TestClassSimpleContainers.h.

64 {
65  os << "m_vector_of_int( " << m_vector_of_int.size() << " ) :";
66  for ( std::vector< int >::const_iterator i = m_vector_of_int.begin();
67  i != m_vector_of_int.end(); ++i ) {
68  os << " " << *i;
69  }
70  os << std::endl;
71  os << "m_list_of_double( " << m_list_of_double.size() << " ) :";
72  for ( std::list< double >::const_iterator i = m_list_of_double.begin();
73  i != m_list_of_double.end(); ++i ) {
74  os << " " << *i;
75  }
76  os << std::endl;
77  os << "m_map_of_string_to_long( " << m_map_of_string_to_long.size() << " ) :";
78  for ( std::map< std::string, long >::const_iterator i = m_map_of_string_to_long.begin();
79  i != m_map_of_string_to_long.end(); ++i ) {
80  os << " (" << i->first << "," << i->second << ")";
81  }
82  os << std::endl;
83  os << "m_set_of_ushort( " << m_set_of_ushort.size() << " ) :";
84  for ( std::set< unsigned short >::const_iterator i = m_set_of_ushort.begin();
85  i != m_set_of_ushort.end(); ++i ) {
86  os << " " << *i;
87  }
88 
89  os << std::endl;
90  os << "m_deque_of_float( " << m_deque_of_float.size() << " ) :";
91  for ( std::deque< float >::const_iterator i = m_deque_of_float.begin();
92  i != m_deque_of_float.end(); ++i ) {
93  os << " " << *i;
94  }
95 
96  return os;
97 }

Member Data Documentation

◆ m_deque_of_float

std::deque< float > TestClassSimpleContainers::m_deque_of_float

Definition at line 38 of file TestClassSimpleContainers.h.

◆ m_list_of_double

std::list< double > TestClassSimpleContainers::m_list_of_double

Definition at line 35 of file TestClassSimpleContainers.h.

◆ m_map_of_string_to_long

std::map< std::string, long > TestClassSimpleContainers::m_map_of_string_to_long

Definition at line 36 of file TestClassSimpleContainers.h.

◆ m_set_of_ushort

std::set< unsigned short > TestClassSimpleContainers::m_set_of_ushort

Definition at line 37 of file TestClassSimpleContainers.h.

◆ m_vector_of_int

std::vector< int > TestClassSimpleContainers::m_vector_of_int

Definition at line 34 of file TestClassSimpleContainers.h.


The documentation for this class was generated from the following file:
TestClassSimpleContainers::m_set_of_ushort
std::set< unsigned short > m_set_of_ushort
Definition: TestClassSimpleContainers.h:37
TestClassSimpleContainers::m_list_of_double
std::list< double > m_list_of_double
Definition: TestClassSimpleContainers.h:35
lumiFormat.i
int i
Definition: lumiFormat.py:85
TestClassSimpleContainers::m_vector_of_int
std::vector< int > m_vector_of_int
Definition: TestClassSimpleContainers.h:34
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
TestClassSimpleContainers::m_map_of_string_to_long
std::map< std::string, long > m_map_of_string_to_long
Definition: TestClassSimpleContainers.h:36
TestClassSimpleContainers::m_deque_of_float
std::deque< float > m_deque_of_float
Definition: TestClassSimpleContainers.h:38