DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
STR.h
Go to the documentation of this file.
1 // AIDA Detector description implementation
2 //--------------------------------------------------------------------------
3 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
4 // All rights reserved.
5 //
6 // For the licensing terms see $DD4hepINSTALL/LICENSE.
7 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
8 //
9 // \author F.Gaede
10 // \date 2015-12-11
11 // \version 1.0
12 //
13 //==========================================================================
14 // $Id$
15 #ifndef DDTEST_SRC_STR_H
16 #define DDTEST_SRC_STR_H 1
17 
18 #include <sstream>
19 #include <string>
20 
21 namespace {
22 
23  template <typename T> std::string _to_string(const T& _val) {
24  std::stringstream res;
25  res << _val ;
26  return res.str();
27  }
28 
30 
36  class STR {
37  STR() {}
38  float _val ;
39  std::string _str ;
40  public:
41  STR ( float val ) : _val(val), _str(_to_string(val)) { }
42  std::string str() const { return _str ; }
43  float value() const { return _val; }
44  bool operator==( const STR& s2) const {
45  return this->str() == s2.str() ;
46  }
47  };
48 
49 
50  inline std::ostream& operator<<(std::ostream& os , const STR& s) {
51  os << s.str() ;
52  return os ;
53  }
54 }
55 
56 #endif // DDTEST_SRC_STR_H
operator==
bool operator==(const TiXmlString &a, const TiXmlString &b)
Definition: tinystr.h:271
operator<<
std::ostream & operator<<(std::ostream &s, const dd4hep::Delta &data)
print alignment delta object
Definition: AlignmentData.cpp:88