Gyoto
GyotoValue.h
Go to the documentation of this file.
1 
6 /*
7  Copyright 2014 Thibaut Paumard
8 
9  This file is part of Gyoto.
10 
11  Gyoto is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  Gyoto is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 
26 #ifndef __GyotoValue_H_
27 #define __GyotoValue_H_
28 
29 #include "GyotoConfig.h"
30 #include "GyotoSmartPointer.h"
31 #include <string>
32 #include <vector>
33 
34 namespace Gyoto {
35  class Value;
36  namespace Metric {class Generic;}
37  namespace Astrobj {class Generic;}
38  namespace Spectrum {class Generic;}
39  namespace Spectrometer {class Generic;}
40  class Screen;
41 }
43 
60 class Gyoto::Value {
61  public:
63  Value();
64 
65  // Copy constructor
66  Value(const Value& orig);
67 
69  ~Value();
70 
72  Value& operator=(Value const&);
73 
75  int type;
76 
77  private:
79  double Double;
80  public:
82  Value(double);
84  operator double() const;
85 
86  private:
88  bool Bool;
89  public:
91  Value(bool);
93  operator bool() const;
94 
95  private:
97  long Long;
98  public:
100  Value(long);
102  operator long() const;
103 
104  private:
106  unsigned long ULong;
107  public:
109  Value(unsigned long);
111  operator unsigned long() const;
112 
113  private:
115  size_t SizeT;
116  public:
117 #if !defined(GYOTO_SIZE__T_IS_UNSIGNED_LONG)
118  Value(size_t);
121  operator size_t() const;
122 #endif
123 
124  private:
126  std::string String;
127  public:
129  Value(std::string);
131  operator std::string() const;
132 
133  private:
135  std::vector<double> VDouble;
136  public:
138  Value(std::vector<double>);
140  operator std::vector<double>() const;
141 
142  private:
144  std::vector<unsigned long> VULong;
145  public:
147  Value(std::vector<unsigned long>);
149  operator std::vector<unsigned long>() const;
150 
151  private:
154  public:
159 
160  private:
163  public:
168 
169  private:
172  public:
177 
178  private:
181  public:
186 
187  private:
190  public:
194  operator Gyoto::SmartPointer<Gyoto::Screen>() const;
195 };
196 
197 #endif
std::vector< double > VDouble
A vector of double values.
Definition: GyotoValue.h:135
Gyoto::SmartPointer< Gyoto::Screen > Screen
A Screen object.
Definition: GyotoValue.h:189
int type
Type of this instance.
Definition: GyotoValue.h:75
Reference-counting pointers.
Gyoto::SmartPointer< Gyoto::Metric::Generic > Metric
A Metric object.
Definition: GyotoValue.h:153
std::vector< unsigned long > VULong
A vector of unsigned long values.
Definition: GyotoValue.h:144
std::string String
A string value.
Definition: GyotoValue.h:126
#define size_t
If not defined in <sys/types.h>.
Definition: GyotoConfig.h:424
Value()
Default onstructor.
long Long
A long value.
Definition: GyotoValue.h:97
unsigned long ULong
An unsigned long (a.k.a. size_t)
Definition: GyotoValue.h:106
Compile-time configuration.
size_t SizeT
A size_t (only if distinct from unsigned long)
Definition: GyotoValue.h:115
Gyoto::SmartPointer< Gyoto::Astrobj::Generic > Astrobj
An Astrobj Object.
Definition: GyotoValue.h:162
Gyoto::SmartPointer< Gyoto::Spectrum::Generic > Spectrum
A Spectrum object.
Definition: GyotoValue.h:171
~Value()
Destructor.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:46
Value & operator=(Value const &)
Assignement operator.
Container for the value of a Property.
Definition: GyotoValue.h:60
Gyoto::SmartPointer< Gyoto::Spectrometer::Generic > Spectrometer
A Spectrometer object.
Definition: GyotoValue.h:180
bool Bool
A boolean value.
Definition: GyotoValue.h:88
double Double
A double value.
Definition: GyotoValue.h:79