antioch-0.4.0
siprefix.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // Antioch - A Gas Dynamics Thermochemistry Library
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Benjamin S. Kirk,
7 // Sylvain Plessis, Roy H. Stonger
8 //
9 // Copyright (C) 2013 The PECOS Development Team
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the Version 2.1 GNU Lesser General
13 // Public License as published by the Free Software Foundation.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
23 // Boston, MA 02110-1301 USA
24 //
25 //-----------------------------------------------------------------------el-
26 #ifndef ANTIOCH_SI_PREFIX_H
27 #define ANTIOCH_SI_PREFIX_H
28 
29 //Antioch
32 
33 //C++
34 #include <string>
35 #include <iostream>
36 
37 namespace Antioch{
38 
51 template <typename T = double>
52 class SIPrefixes{
53  public:
54 
56  SIPrefixes(const std::string &str, const std::string & na, const T &num):
57  _symbol(str),_name(na),_value(num){}
60 
62  template <typename P = T>
63  const P value() const {return _value;}
65  const std::string symbol() const {return _symbol;}
67  const std::string name() const {return _name;}
68 
70  template <typename P>
71  SIPrefixes &operator=(const SIPrefixes<P> &rhs);
73  template <typename P>
74  bool operator==(const SIPrefixes<P> &rhs) const {return (_value == rhs.value());}
76  template <typename P>
77  bool operator!=(const SIPrefixes<P> &rhs) const {return !(*this == rhs);}
78 
79  private:
83  std::string _symbol,_name;
85  T _value;
86 };
87 
88 template <typename T>
89 template <typename P>
90 inline
92 {
93  if(this == &rhs){return *this;}
94  _symbol = rhs.symbol();
95  Antioch::init_clone(_value,rhs.value());
96  return *this;
97 }
98 }// Antioch namespace
99 
100 #endif
bool operator!=(const SIPrefixes< P > &rhs) const
Comparison operator, not equal is not "equal".
Definition: siprefix.h:77
const std::string name() const
Name getter.
Definition: siprefix.h:67
bool operator==(const SIPrefixes< P > &rhs) const
Comparison operator, equal if values are equal.
Definition: siprefix.h:74
std::string _symbol
Two std::strings for the symbol and the name.
Definition: siprefix.h:83
#define antioch_error()
const P value() const
Value getter.
Definition: siprefix.h:63
std::string _name
Definition: siprefix.h:83
void init_clone(T &output, const T &example)
Prefixes in unit.
Definition: siprefix.h:52
T _value
A double for the value.
Definition: siprefix.h:85
SIPrefixes & operator=(const SIPrefixes< P > &rhs)
Assignement operator, copy value and std::string.
~SIPrefixes()
Default destructor.
Definition: siprefix.h:59
SIPrefixes()
Default constructor, never uninitialize this stuff.
Definition: siprefix.h:81
SIPrefixes(const std::string &str, const std::string &na, const T &num)
Default constructor, a std::string and a value.
Definition: siprefix.h:56
The parameters are reduced parameters.
const std::string symbol() const
Symbol getter.
Definition: siprefix.h:65

Generated on Thu Jul 7 2016 11:09:46 for antioch-0.4.0 by  doxygen 1.8.8