/usr/include/getdata/entry.h is in libgetdata-dev 0.10.0-3build2.
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 215 216 217 218 219 220 | // Copyright (C) 2008-2013, 2015-2017 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
// This file is part of the GetData project.
//
// GetData is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 2.1 of the License, or (at your
// option) any later version.
//
// GetData 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 Lesser General Public
// License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with GetData; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#ifndef GETDATA_ENTRY_H
#define GETDATA_ENTRY_H
#include <getdata/types.h>
#include <complex>
namespace GetData {
class Dirfile;
class Entry {
friend class Dirfile;
public:
Entry();
virtual ~Entry();
/* Generic data */
int Associated() const { return (D != NULL); };
const char *Name() const { return E.field; };
EntryType Type() const { return (EntryType)E.field_type; };
void Dissociate() { D = NULL; };
int FragmentIndex() const { return E.fragment_index; };
int Move(int new_fragment, unsigned flags = 0);
int Rename(const char* new_name, unsigned flags = 0);
/* Specific data */
virtual const char *Input(int index) const {
return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ?
E.in_fields[index] : NULL;
};
virtual int ComplexScalars() const {
if (E.field_type == GD_LINCOM_ENTRY ||
E.field_type == GD_POLYNOM_ENTRY ||
E.field_type == GD_RECIP_ENTRY)
if (E.flags & GD_EN_COMPSCAL)
return 1;
return 0;
}
unsigned int Flags() const { return E.flags; };
virtual const char *Scalar(int index) const;
virtual int ScalarIndex(int index) const;
/* RAW methods */
virtual unsigned int SamplesPerFrame() const {
return (E.field_type == GD_RAW_ENTRY) ? E.u.raw.spf : 0;
};
virtual DataType RawType() const {
return (E.field_type == GD_RAW_ENTRY) ? (DataType)E.u.raw.data_type :
Unknown;
};
/* LINCOM methods */
virtual int NFields() const {
return (E.field_type == GD_LINCOM_ENTRY) ? E.u.lincom.n_fields : 0;
};
virtual double Scale(int index) const {
return (E.field_type == GD_LINCOM_ENTRY &&
CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ?
E.u.lincom.m[index] : 0;
}
virtual std::complex<double> CScale(int index) const {
return (E.field_type == GD_LINCOM_ENTRY &&
CheckIndex(E.field_type, E.u.lincom.n_fields, index))
? std::complex<double>(E.u.lincom.cm[index][0],
E.u.lincom.cm[index][1]) : 0;
}
virtual double Offset(int index) const {
return (E.field_type == GD_LINCOM_ENTRY &&
CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ?
E.u.lincom.b[index] : 0;
}
virtual std::complex<double> COffset(int index) const {
return (E.field_type == GD_LINCOM_ENTRY &&
CheckIndex(E.field_type, E.u.lincom.n_fields, index))
? std::complex<double>(E.u.lincom.cb[index][0],
E.u.lincom.cb[index][1]) : 0;
}
/* LINTERP methods */
virtual const char *Table() const {
return (E.field_type == GD_LINTERP_ENTRY) ? E.u.linterp.table : NULL;
};
/* (S)BIT methods */
virtual int FirstBit() const {
return (E.field_type == GD_BIT_ENTRY) ? E.u.bit.bitnum : -1;
};
virtual int NumBits() const {
return (E.field_type == GD_BIT_ENTRY) ? E.u.bit.numbits : -1;
};
/* PHASE methods */
virtual gd_int64_t Shift() const {
return (E.field_type == GD_PHASE_ENTRY) ? E.u.phase.shift : 0;
};
/* CONST methods */
virtual DataType ConstType() const {
return (E.field_type == GD_CONST_ENTRY || E.field_type ==
GD_CARRAY_ENTRY) ? (DataType)E.u.scalar.const_type : Unknown;
};
/* CARRAY methods */
virtual size_t ArrayLen() const {
return (E.field_type == GD_CARRAY_ENTRY) ? E.u.scalar.array_len : 0;
};
/* POLYNOM methods */
virtual int PolyOrd() const {
return (E.field_type == GD_POLYNOM_ENTRY) ? E.u.polynom.poly_ord : 0;
};
virtual double Coefficient(int index) const {
return (E.field_type == GD_POLYNOM_ENTRY && index <=
E.u.polynom.poly_ord) ? E.u.polynom.a[index] : 0;
}
virtual std::complex<double> CCoefficient(int index) const {
return (E.field_type == GD_POLYNOM_ENTRY && index <=
E.u.polynom.poly_ord) ?
std::complex<double>(E.u.polynom.ca[index][0],
E.u.polynom.ca[index][1]) : 0;
}
/* RECIP methods */
virtual double Dividend() const {
return (E.field_type == GD_RECIP_ENTRY) ? E.u.recip.dividend : 0;
};
virtual std::complex<double> CDividend() const {
return (E.field_type == GD_RECIP_ENTRY) ?
std::complex<double>(E.u.recip.cdividend[0], E.u.recip.cdividend[1]) :
0;
};
/* WINDOW methods */
virtual WindOpType WindOp() const {
return (E.field_type == GD_WINDOW_ENTRY) ? (WindOpType)E.u.window.windop
: (WindOpType)0;
}
virtual gd_triplet_t Threshold() const {
gd_triplet_t zero;
zero.r = 0;
return (E.field_type == GD_WINDOW_ENTRY) ? E.u.window.threshold : zero;
}
/* MPLEX methods */
virtual int CountVal() const {
return (E.field_type == GD_MPLEX_ENTRY) ? E.u.mplex.count_val : 0;
}
virtual int Period() const {
return (E.field_type == GD_MPLEX_ENTRY) ? E.u.mplex.period : 0;
}
/* deprecated in GetData-0.8.4; use Period() instead */
virtual int gd_deprecated CountMax() const { return Period(); }
/* Set methods */
void SetName(const char* name);
void SetFragmentIndex(int fragment_index);
protected:
Entry(const Dirfile *dirfile, const char* field_code);
static int CheckIndex(gd_entype_t field_type, int n_fields,
int index);
void SetDirfile(const GetData::Dirfile* dirfile);
void SetScalar(int n, const char *code);
gd_entry_t E;
const Dirfile* D;
};
}
#endif
|