00001
00003 #ifndef _das2_plane_h_
00004 #define _das2_plane_h_
00005
00006 #include <stdbool.h>
00007
00008 #include <das2/buffer.h>
00009 #include <das2/descriptor.h>
00010 #include <das2/units.h>
00011 #include <das2/encoding.h>
00012
00013
00035 typedef enum plane_type {Invalid=-1, X=2001, Y=2003, Z=2004, YScan=2012
00036 } plane_type_t;
00037
00039 plane_type_t str2PlaneType(const char * type);
00040
00042 const char* PlaneType_toString( plane_type_t type );
00043
00044
00045
00093 typedef struct plane_descriptor{
00094 Descriptor base;
00095
00096 plane_type_t planeType;
00097 char* sName;
00098
00099
00100 DasEncoding* pEncoding;
00101
00102
00103 UnitType units;
00104
00105
00106
00107
00108 size_t uItems;
00109
00110 double* pData;
00111 double value;
00112 bool bAlloccedBuf;
00113
00114 double* pYTags;
00115 UnitType yTagUnits;
00116 DasEncoding* pYEncoding;
00117
00118
00119
00120 bool bPlaneDataValid;
00121
00122
00123
00124
00125
00126
00127
00128
00129 void* pUser;
00130
00131 } PlaneDesc;
00132
00136 PlaneDesc* new_PlaneDesc_empty(void);
00137
00156 PlaneDesc* new_PlaneDesc(
00157 plane_type_t pt, const char* sName, DasEncoding* pType, UnitType units
00158 );
00159
00185 PlaneDesc* new_PlaneDesc_yscan(
00186 const char* sName, DasEncoding* pZType, UnitType zUnits, size_t uItems,
00187 DasEncoding* pYType, const double* pYTags, UnitType yUnits
00188 );
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220 PlaneDesc* new_PlaneDesc_pairs(
00221 Descriptor* pParent, plane_type_t pt, const char** attrs
00222 );
00223
00231 PlaneDesc* PlaneDesc_copy(const PlaneDesc* pThis);
00232
00233
00242 void del_PlaneDesc(PlaneDesc* pThis);
00243
00250 plane_type_t PlaneDesc_getType(const PlaneDesc* pThis);
00251
00259 size_t PlaneDesc_getNItems(const PlaneDesc* pThis);
00260
00273 double PlaneDesc_getValue(const PlaneDesc* pThis, size_t uIdx);
00274
00284 ErrorCode PlaneDesc_setValue(PlaneDesc* pThis, size_t uIdx, double value);
00285
00302 ErrorCode PlaneDesc_setTimeValue(
00303 PlaneDesc* pThis, const char* sTime, size_t idx
00304 );
00305
00314 DasEncoding* PlaneDesc_getValEncoder(PlaneDesc* pThis);
00315
00324 void PlaneDesc_setValEncoder(PlaneDesc* pThis, DasEncoding* pEnc);
00325
00338 const double* PlaneDesc_getValues(const PlaneDesc* pThis);
00339
00340
00350 void PlaneDesc_setValues(PlaneDesc* pThis, const double* pData);
00351
00352
00358 double PlaneDesc_getFill(const PlaneDesc* pThis );
00359
00364 bool PlaneDesc_isFill(const PlaneDesc* pThis, double value );
00365
00369 void PlaneDesc_setFill( PlaneDesc* pThis, double value );
00370
00375 const char* PlaneDesc_getName(const PlaneDesc* pThis );
00376
00382 void PlaneDesc_setName(PlaneDesc* pThis, const char* sName);
00383
00388 UnitType PlaneDesc_getUnits(const PlaneDesc* pThis );
00389
00400 void PlaneDesc_setUnits(PlaneDesc* pThis, UnitType units);
00401
00402
00403
00408 UnitType PlaneDesc_getYTagUnits( PlaneDesc* pThis );
00409
00414 const double* PlaneDesc_getYTags(const PlaneDesc* pThis);
00415
00416
00429 ErrorCode PlaneDesc_encode(
00430 PlaneDesc* pThis, DasBuf* pBuf, const char* sIndent, bool bDependant
00431 );
00432
00450 ErrorCode PlaneDesc_encodeData(PlaneDesc* pThis, DasBuf* pBuf, bool bLast);
00451
00459 ErrorCode PlaneDesc_decodeData(const PlaneDesc* pThis, DasBuf* pBuf);
00460
00461 #endif