/usr/include/odinpara/jdxnumbers.h is in libodin-dev 1.8.8-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 | /***************************************************************************
jdxnumbers.h - description
-------------------
begin : Mon Jul 12 2004
copyright : (C) 2000-2014 by Thies H. Jochimsen
email : thies@jochimsen.de
***************************************************************************/
/***************************************************************************
* *
* This program 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef JDXNUMBERS_H
#define JDXNUMBERS_H
#include <odinpara/jdxbase.h>
#include <tjutils/tjtypes.h>
/**
* @addtogroup jcampdx
* @{
*/
//////////////////////////////////////////////////////////////////
/**
*
* JCAMP-DX template class for representing built-in numbers
*/
template<class T>
class JDXnumber : public virtual JcampDxClass {
public:
/**
* Default constructor
*/
JDXnumber() {set_defaults();}
/**
* Constructor with the following arguments:
* - v: Initial value for the number
* - name: The label of the JCAMP-DX parameter
* - userParameter: Whether this is a user defined JCAMP-DX parameter
* - mode: Mode for ASCII representation of strings or arrays of strings
* - parameter_mode: Mode for GUI accesibility of the parameter
* - parx_equivalent: Equivalent parameter in PARX to which this parameter will be assigned
* - parx_assign_factor: Scaling factor when assigning to the equivalent parameter in PARX
* - parx_assign_offset: Offset when assigning to the equivalent parameter in PARX
*/
JDXnumber(T v, const STD_string& name="",bool userParameter=true,
compatMode mode=notBroken,parameterMode parameter_mode=edit,
const STD_string& parx_equivalent="",
float parx_assign_factor=1.0,float parx_assign_offset=0.0);
/**
* Copy constructor
*/
JDXnumber(const JDXnumber<T>& bi) {JDXnumber<T>::operator = (bi);}
/**
* Assignment operator from a built-in number
*/
JDXnumber<T>& operator = (T v) {val=v; return *this;}
/**
* Copy assignment
*/
JDXnumber<T>& operator = (const JDXnumber<T>& bi);
// code to make the number appear like a built-in number
operator T () const {return val;}
T operator += (T rhsval) {val+=rhsval; return *this;}
T operator -= (T rhsval) {val-=rhsval; return *this;}
T operator *= (T rhsval) {val*=rhsval; return *this;}
T operator /= (T rhsval) {val/=rhsval; return *this;}
T operator ++ () {val=val+(T)1; return val;} // prefix
T operator ++ (int) {T tmp=val; val=val+(T)1; return tmp;} // postfix
T operator -- () {val=val-(T)1; return val;} // prefix
T operator -- (int) {T tmp=val; val=val-(T)1; return tmp;} // postfix
/**
* Specifies the minimum and maximum allowed value for this number.
* Only useful when editing the parameter in a GUI
*/
JDXnumber<T>& set_minmaxval(double min,double max) {minval=min; maxval=max; return *this;}
// overwriting virtual functions from JcampDxClass
STD_string printvalstring() const;
bool parsevalstring (const STD_string& parstring);
STD_string get_parx_code(parxCodeType type, const ParxEquiv& equiv) const;
ParxEquiv get_parx_equiv() const {return parx_equiv;}
double get_minval() const {return minval;}
double get_maxval() const {return maxval;}
const char* get_typeInfo() const {return TypeTraits::type2label(val);}
JcampDxClass* create_copy() const {return new JDXnumber<T>(*this);}
T* cast(T*) {return &val;}
private:
void set_defaults();
T val;
mutable ParxEquiv parx_equiv;
double minval,maxval;
};
/////////////////////////////////////////////////////////////////////////////
//
// Aliases:
/**
* An integer number
*/
typedef JDXnumber<int> JDXint;
/**
* An single-precision floating point number
*/
typedef JDXnumber<float> JDXfloat;
/**
* An double-precision floating point number
*/
typedef JDXnumber<double> JDXdouble;
/**
* Complex number
*/
typedef JDXnumber<STD_complex> JDXcomplex;
/** @}
*/
#endif
|