/usr/include/Gyoto/GyotoValue.h is in libgyoto4-dev 1.0.2-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | /**
* \file GyotoObject.h
* \brief Introspectbale objects
*/
/*
Copyright 2014 Thibaut Paumard
This file is part of Gyoto.
Gyoto is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gyoto is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GyotoValue_H_
#define __GyotoValue_H_
#include "GyotoConfig.h"
#include "GyotoSmartPointer.h"
#include <string>
#include <vector>
namespace Gyoto {
class Value;
namespace Metric {class Generic;}
namespace Astrobj {class Generic;}
namespace Spectrum {class Generic;}
namespace Spectrometer {class Generic;}
class Screen;
}
/// Container for the value of a Property
/**
* The Value class is very similar to the C union type (although not
* as memory efficient): it can hold several type of values, but only
* one at a time. Care must be taken to ensure only the member that
* was set is retrieved. The purpose of the Value class is to be used
* together with the Property class: code determines dynamicaly the
* type of a Property, reads the corresponding value appropriateley
* (e.g. from XML or from the Yorick prompt), stores the value in a
* Value instance, and sets the Property using the Object::set()
* method. Likewise, the Object::get() method returns a
* Gyoto::Value. Property::type must be used to determine which member
* of the Value is meaningful.
*
* Casting between Value and the various data type it can hold is
* normally automatic, but the members can also be accessed
* explicitly make code more easy to read and less ambiguous.
*/
class Gyoto::Value {
public:
/// Constructor
Value();
/// Destructor
~Value();
/// Assignement operator
Value& operator=(Value const&);
/// Type of this instance
int type;
private:
/// A double value
double Double;
public:
/// Construct/cast from double
Value(double);
/// Cast to double
operator double() const;
private:
/// A boolean value
bool Bool;
public:
/// Construct/cast from boolean
Value(bool);
/// Cast to bool
operator bool() const;
private:
/// A long value
long Long;
public:
/// Construct/cast from long
Value(long);
/// Cast to long
operator long() const;
private:
/// An unsigned long (a.k.a. size_t)
unsigned long ULong;
public:
/// Construct/cast from unsigned long
Value(unsigned long);
/// Cast to unsigned long
operator unsigned long() const;
#if !defined(GYOTO_SIZE__T_IS_UNSIGNED_LONG)
private:
/// A size_t (only if distinct from unsigned long)
size_t SizeT;
public:
/// Construct/cast from unsigned long
Value(size_t);
/// Cast to unsigned long
operator size_t() const;
#endif
private:
/// A string value
std::string String;
public:
/// Construct/cast from string
Value(std::string);
/// Cast to string
operator std::string() const;
private:
/// A vector of double values
std::vector<double> VDouble;
public:
/// Construct/cast from vector of doubles
Value(std::vector<double>);
/// Cast to vector of doubles
operator std::vector<double>() const;
private:
/// A vector of unsigned long values
std::vector<unsigned long> VULong;
public:
/// Construct/cast from vector of unsigned long values
Value(std::vector<unsigned long>);
/// Cast to vector of unsigned long values
operator std::vector<unsigned long>() const;
private:
/// A Metric object
Gyoto::SmartPointer<Gyoto::Metric::Generic> Metric;
public:
/// Cast from Metric object
Value(Gyoto::SmartPointer<Gyoto::Metric::Generic>);
/// Cast to Metric object
operator Gyoto::SmartPointer<Gyoto::Metric::Generic>() const;
private:
/// An Astrobj Object
Gyoto::SmartPointer<Gyoto::Astrobj::Generic> Astrobj;
public:
/// Cast from Astrobj
Value(Gyoto::SmartPointer<Gyoto::Astrobj::Generic>);
/// Cast to Astrobj
operator Gyoto::SmartPointer<Gyoto::Astrobj::Generic>() const;
private:
/// A Spectrum object
Gyoto::SmartPointer<Gyoto::Spectrum::Generic> Spectrum;
public:
/// Cast from Spectrum
Value(Gyoto::SmartPointer<Gyoto::Spectrum::Generic>);
/// Cast to Spectrum
operator Gyoto::SmartPointer<Gyoto::Spectrum::Generic>() const;
private:
/// A Spectrometer object
Gyoto::SmartPointer<Gyoto::Spectrometer::Generic> Spectrometer;
public:
/// Cast from Spectrometer
Value(Gyoto::SmartPointer<Gyoto::Spectrometer::Generic>);
/// Cast to Spectrometer
operator Gyoto::SmartPointer<Gyoto::Spectrometer::Generic>() const;
private:
/// A Screen object
Gyoto::SmartPointer<Gyoto::Screen> Screen;
public:
/// Cast from Screen
Value(Gyoto::SmartPointer<Gyoto::Screen>);
/// Cast to Screen
operator Gyoto::SmartPointer<Gyoto::Screen>() const;
};
#endif
|