/usr/include/odinpara/jdxarrays.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 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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | /***************************************************************************
jdxarrays.h - description
-------------------
begin : Mon Jul 5 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 JDXARRAYS_H
#define JDXARRAYS_H
#include <tjutils/tjarray.h>
#include <odinpara/jdxbase.h>
#include <odinpara/jdxnumbers.h>
#include <odinpara/jdxtypes.h>
#define COMPRESSION_THRESHOLD_SIZE 256
/**
* @addtogroup jcampdx
* @{
*/
/**
*
* JCAMP-DX template class for representing multi-dimensional arrays
*/
template<class A,class J>
class JDXarray : public A, public virtual JcampDxClass {
public:
/**
* Default constructor
*/
JDXarray () : A() {common_init();}
/**
* Constructor with the following arguments:
* - a: Initial value for the array base class
* - 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
*/
JDXarray (const A& a,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);
/**
* Assignment from scalar, i.e. fill all elements with this value
*/
// JDXarray (const J& jv) {common_init(); A::operator = (jv);}
/**
* Copy constructor
*/
JDXarray (const JDXarray<A,J>& ja) {common_init(); JDXarray<A,J>::operator = (ja);}
/**
* Assignment operator from an array
*/
JDXarray<A,J>& operator = (const A& a);
/**
* Assignment operator from scalar, i.e. fill all elements with this value
*/
JDXarray<A,J>& operator = (const J& jv) {A::operator = (jv); return *this;}
/**
* Copy assignment
*/
JDXarray<A,J>& operator = (const JDXarray<A,J>& ja);
// overwriting virtual functions from JcampDxClass
STD_ostream& print2stream(STD_ostream& os) const;
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;}
GuiProps get_gui_props() const {return guiprops;}
JcampDxClass& set_gui_props(const GuiProps& gp) {guiprops=gp; return *this;}
const char* get_typeInfo() const;
JcampDxClass* create_copy() const {return new JDXarray<A,J>(*this);}
A* cast(A*) {return this;}
// final overrider
friend STD_ostream& operator << (STD_ostream& s,const JDXarray<A,J>& ja) { return ja.print2stream(s);}
int write(const STD_string& filename) const {return JcampDxClass::write(filename);}
int load(const STD_string &filename) {return JcampDxClass::load(filename);}
private:
void common_init();
STD_string get_dim_str() const;
bool encode(STD_string* ostring, STD_ostream* ostream) const;
bool use_compression() const {return (get_filemode()==compressed)&&(A::total()>COMPRESSION_THRESHOLD_SIZE);}
ParxEquiv parx_equiv;
GuiProps guiprops;
mutable STD_string typeInfo_cache;
};
//////////////////////////////////////////////////////////////////////////////////
//
// Aliases:
//
/**
* A JCAMP-DX array of strings
*/
typedef JDXarray<sarray,JDXstring> JDXstringArr;
/**
* A JCAMP-DX array of integer numbers
*/
typedef JDXarray<iarray,JDXint> JDXintArr;
/**
* A JCAMP-DX array of single-precision floating point numbers
*/
typedef JDXarray<farray,JDXfloat> JDXfloatArr;
/**
* A JCAMP-DX array of double-precision floating point numbers
*/
typedef JDXarray<darray,JDXdouble> JDXdoubleArr;
/**
* A JCAMP-DX array of single-precision complex numbers
*/
typedef JDXarray<carray,JDXcomplex> JDXcomplexArr;
/////////////////////////////////////////////////////////////////////////////
// Specialised array classes:
/**
* A JCAMP-DX vector of 3 float values which is used to store spatial positions, FOVs, etc.
*/
class JDXtriple : public JDXfloatArr {
public:
/**
* Default constructor
*/
JDXtriple () : JDXfloatArr(farray(3)) {}
/**
* Constructor with the following arguments:
* - xpos: Spatial position in the first dimension
* - ypos: Spatial position in the second dimension
* - zpos: Spatial position in the third dimension
* - 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
*/
JDXtriple (float xpos,float ypos, float zpos,
const STD_string& name="",bool userParameter=true,
compatMode mode=notBroken,parameterMode parameter_mode=edit);
/**
* Copy constructor
*/
JDXtriple (const JDXtriple& pos) {JDXtriple::operator = (pos);}
/**
* Copy assignment
*/
JDXtriple& operator = (const JDXtriple& pos) {
JDXfloatArr::operator = (pos);
return *this;
}
// overwriting virtual functions from JcampDxClass
const char* get_typeInfo() const {return "triple";}
JcampDxClass* create_copy() const {return new JDXtriple(*this);}
JDXtriple* cast(JDXtriple*) {return this;}
farray* cast(farray*) {return 0;} // disable casting to base class
};
/** @}
*/
#endif
|