ATLAS Offline Software
Loading...
Searching...
No Matches
TestClassVectors.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TESTCLASSSVECTORS_H
6#define TESTCLASSSVECTORS_H
7
8#include <string>
9#include <vector>
10#include <ostream>
11
13public:
16
17 void setNonZero();
18 bool operator==( const TestClassVectors& rhs ) const;
19 bool operator!=( const TestClassVectors& rhs ) const;
20 std::ostream& streamOut( std::ostream& os ) const;
21
22 std::vector< std::string > m_vector_of_string;
23 std::vector< double > m_vector_of_double;
24 std::vector< std::vector< double > > m_vector_of_vector_of_double;
25};
26
27
28inline
34
35inline std::ostream&
36TestClassVectors::streamOut( std::ostream& os ) const
37{
38 os << "m_vector_of_string( " << m_vector_of_string.size() << " ) :";
39 for ( std::vector< std::string >::const_iterator i = m_vector_of_string.begin();
40 i != m_vector_of_string.end(); ++i ) {
41 os << " " << *i;
42 }
43 os << std::endl;
44 os << "m_vector_of_double( " << m_vector_of_double.size() << " ) :";
45 for ( std::vector< double >::const_iterator i = m_vector_of_double.begin();
46 i != m_vector_of_double.end(); ++i ) {
47 os << " " << *i;
48 }
49 os << std::endl;
50 os << "m_vector_of_vector_of_double( " << m_vector_of_vector_of_double.size() << " ) :";
51 for ( std::vector< std::vector< double > >::const_iterator i = m_vector_of_vector_of_double.begin();
52 i != m_vector_of_vector_of_double.end(); ++i ) {
53 os << std::endl << " (" << i->size() << ") :";
54 for ( std::vector< double >::const_iterator j = i->begin();
55 j != i->end(); ++j ) {
56 os << " " << *j;
57 }
58 }
59
60 return os;
61}
62
63inline void
65{
66 m_vector_of_string.clear();
67 m_vector_of_string.push_back( "lcg" );
68 m_vector_of_string.push_back( "app" );
69 m_vector_of_string.push_back( "pool" );
70 m_vector_of_double.clear();
71 m_vector_of_double.push_back( 1 );
72 m_vector_of_double.push_back( 2 );
75 m_vector_of_double.push_back( 3 );
76}
77
78inline bool
80{
81 if ( m_vector_of_string.size() != rhs.m_vector_of_string.size() ) return false;
82 if ( m_vector_of_double.size() != rhs.m_vector_of_double.size() ) return false;
83 if ( m_vector_of_vector_of_double.size() != rhs.m_vector_of_vector_of_double.size() ) return false;
84
85 std::vector< std::string >::const_iterator i_vector_of_string_rhs = rhs.m_vector_of_string.begin();
86 for ( std::vector< std::string >::const_iterator i = m_vector_of_string.begin();
87 i != m_vector_of_string.end(); ++i, ++i_vector_of_string_rhs ) {
88 if ( *i != *i_vector_of_string_rhs ) return false;
89 }
90
91 std::vector< double >::const_iterator i_vector_of_double_rhs = rhs.m_vector_of_double.begin();
92 for ( std::vector< double >::const_iterator i = m_vector_of_double.begin();
93 i != m_vector_of_double.end(); ++i, ++i_vector_of_double_rhs ) {
94 if ( *i != *i_vector_of_double_rhs ) return false;
95 }
96
97 std::vector< std::vector< double > >::const_iterator i_vector_of_vector_of_double_rhs = rhs.m_vector_of_vector_of_double.begin();
98 for ( std::vector< std::vector< double > >::const_iterator i = m_vector_of_vector_of_double.begin();
99 i != m_vector_of_vector_of_double.end(); ++i, ++i_vector_of_vector_of_double_rhs ) {
100 if ( i->size() != i_vector_of_vector_of_double_rhs->size() ) return false;
101
102 std::vector< double >::const_iterator j_vector_of_vector_of_double_rhs = i_vector_of_vector_of_double_rhs->begin();
103 for ( std::vector< double >::const_iterator j = i->begin();
104 j != i->end(); ++j, ++j_vector_of_vector_of_double_rhs ) {
105 if ( *j != *j_vector_of_vector_of_double_rhs ) return false;
106 }
107 }
108
109 return true;
110}
111
112
113inline bool
115{
116 return ( ( (*this) == rhs ) ? false : true );
117}
118
119
120#endif
std::vector< std::string > m_vector_of_string
bool operator==(const TestClassVectors &rhs) const
bool operator!=(const TestClassVectors &rhs) const
std::vector< std::vector< double > > m_vector_of_vector_of_double
std::vector< double > m_vector_of_double
std::ostream & streamOut(std::ostream &os) const