/usr/include/Gyoto/GyotoComplexSpectrometer.h is in libgyoto2-dev 0.2.3-1.
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 | /**
* \file GyotoComplexSpectrometer.h
* \brief Combine spectrometer objects
*
* A spectrometer made of several spectrometers
*/
/*
Copyright 2013 Thibaut Paumard, Frederic Vincent
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 __GyotoComplexSpectrometer_H_
#define __GyotoComplexSpectrometer_H_
#include <GyotoSpectrometer.h>
namespace Gyoto{
namespace Spectrometer {
class Complex;
}
}
/**
* \class Gyoto::Spectrometer::Complex
* \brief Complex spectrometer object
*
* A Gyoto::Spectrometer::Generic whic contain several
* Gyoto::Spectrometer::Generic instances. It is essentially a
* SmartPointer<Spectrometer::Generic> array, which some methods
* arround. Indeed, the operator[](size_t i) method is implemented to
* retrieve the i-th element.
*
* In an XML description, the <Spectrometer> section is unique,
* its kind is "Complex". Each sub-spectrometer then appears as a
* <SubSpectrometer> subsection. For instance, to compute 10
* channels ovr the K infrared band plus 10 channels in the high
* energy domain:
* \code
* <Spectrometer kind = "Complex">
* <SubSpectrometer kind = "wave" nsamples=10 unit="µm">
* 2.0 2.4
* </SubSpectrometer>
* <SubSpectrometer kind = "freqlog" nsamples=10 unit="eV">
* 14 22
* </SubSpectrometer>
* </Spectrometer>
* \endcode
*
*/
class Gyoto::Spectrometer::Complex
: public Gyoto::Spectrometer::Generic,
public Gyoto::Hook::Listener
{
friend class Gyoto::SmartPointer<Gyoto::Spectrometer::Complex>;
// Data :
// -----
protected:
/**
* \brief Number of subspectrometers
*
* Size of elements_.
*/
size_t cardinal_;
/**
* \brief Actual array of SmartPointer<Spectrometer::Generic> objects
*/
Gyoto::SmartPointer<Gyoto::Spectrometer::Generic> * elements_;
public:
Complex(); ///< Default constructor.
Complex(const Complex& ) ; ///< Copy constructor.
/**
* \brief Clone an instance
*
* Use this to get a deep copy of an instance;
* \code
* SmartPointer<Generic> myclone = orig->clone();
* \endcode
*
* Most implementations will use the copy constructor:
* \code
* Generic* Uniform::clone() const { return new Uniform(*this); }
* \endcode
*/
virtual Complex* clone() const;
/**
* Frees every SmartPointer<Spectrometer::Generic> before freed the
* array itself.
*/
virtual ~Complex() ; ///< Destructor
// Mutators
// --------
public:
/**
* If the Spectrometer::Complex itself does not have a metric already
* assigned, it takes it from the new element. Else, it sets the
* metric in the new element to its own. This ensures that all
* elements use the same metric (this heuristic is not entirely
* fool-proof, it's safer to set the metric directly in the
* Spectrometer::Complex).
*/
void append(Gyoto::SmartPointer<Gyoto::Spectrometer::Generic> element);
///< Add element at the end of the array.
void remove(size_t i);
///< Remove i-th element from the array.
size_t getCardinal() const;
///< Get the number of elements in the array.
virtual void tell(Gyoto::Hook::Teller *msg);
public:
#ifdef GYOTO_USE_XERCES
/**
* \brief Fill in the XML entity
*
* Loops on elements_[i]->fillElement();
*/
virtual void fillElement(FactoryMessenger *fmp) const ;
/**
* \brief Main loop in the (templated) subcontractor
*
* In the case of Spectrometer::Complex, the setParameter() API is
* not sufficient: setParameters() needs acces to the
* FactoryMessenger to instanciate childs for the SubSpectrometers.
*/
virtual void setParameters(FactoryMessenger *fmp);
#endif
// Outputs
// -------
public:
/**
* This should work as expected:
\code
SmartPointer<Spectrometer::Complex> cplx;
SmartPointer<Spectrometer::TypeA> objA;
SmartPointer<Spectrometer::TypeB> objB;
cplx -> append(objA);
cplx[0] = objB;
\endcode
*/
Gyoto::SmartPointer<Gyoto::Spectrometer::Generic> operator[](size_t i) ;
///< Retrieve i-th element.
Gyoto::SmartPointer<Gyoto::Spectrometer::Generic> const operator[](size_t i) const;
///< Retrieve a const version of the i-th element.
/**
* \brief "Complex"
*
* Use this static member attribute to check whether a Spectrometer
* object spectro is of kind Complex:
* \code
* if (spectro->kind() == Complex::Kind) ... ;
* \endcode
*
*/
static kind_t const Kind;
protected:
};
#endif
|