DD.h
5.57 KB
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
/*=================================================================================================
* DD SYSTEM
* DD.h
* Version: 6.0
* Description: The public header to use DD library libDD.a
* List of changes:
* Apr. 17, 2002 Fedorov, - New error constant to interrupt the
* transmission if data dimensions are changed from file
* to file
* Nov 18, 2004 - V.4.2 - Fedorov, New errors for CACH manipulating
* Jun 17, 2007 - V.4.6 Fedorov New requestes and external executables
* Aug 02, 2007 - V.4.7 Fedorov Modification of call external executables
* Sep 24, 2007 - V.5.0 Fedorov New status of Get Data: MOREDELAY
* May 21, 2008 - V.5.1 Fedorov New Status of SetTime: CTIMEISSHIFTED
* Oct 18, 2012 - V.5.2 Knizhnikova New DD_SetTimeInfo() function
*=================================================================================================*/
#include "DD_time.h"
typedef struct { int type; /* Type of variable in netcdf style */
int DimNumber; /* number of dimensions */
int *Dimensions; /* Dimensions array
* fastest change is last */
int VarNumber; /* Dimension of variable array */
void **Variables;/* Variables array pointer
* It is static array refreshed
* each call
*/
} DD_data_t;
/*------------------- FUNCTIONS ---------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
extern int DD_SetVariable(char *VarName);
/*
* VarName - full name of variable <project>:<instrument>:<Variable>
* Returns VarID or negative in case of error (see bellow)
*/
extern int DD_GetInform(int VarID,char *AttrName, DD_data_t **data);
/*
* VarID - Variable ID from DD_SetVariable
* AttrName - name of attribute ( defined by konvention )
* data - address of data structure
* Returns 1 if OK and negative value in case of error (see bellow)
*/
extern int DD_SetTime(int VarID, char *Time);
/*
* VarID - Variable ID from DD_SetVariable
* Time - string defined in DD_time.h
* Returns 1 if OK and negative value in case of error (see bellow)
*/
extern int DD_SetTimeInfo(int VarID, char *Time, double *RealTime);
/*
* VarID - Variable ID from DD_SetVariable
* Time - string defined in DD_time.h
* RealTime - time pointer was set to
* Returns 1 if OK and negative value in case of error (see bellow)
*/
extern int DD_GetMultiData(int VarID, size_t VarSize, char **VarNames, char *TimeInt, DD_data_t **data, int BackFlag);
/*
* VarID - Variable ID from DD_SetVariable
* VarSize - number of variables to return
* VarNames - the array of Names of the requested Variable
* TimeInt - String of Time interval in DD_time style
* data - Data structures array
* BackFlag - 0 - pointer is at the lasy position, 1 - pointer returns to the start point
* Returns 1 if OK and negative value in case of error (see bellow)
*/
/* ----------------------------------------
* This function below just call DD_GetMultiData
* for backup
*---------------------------------------*/
extern int DD_GetData(int VarID, char *VarName, char *TimeInt, DD_data_t **data);
extern int DD_MovePoint(int VarID, int RecordNumber);
/*
* VarID - Open virtual instrument ID
* int RecordNumber - +/- records to move
* Move pointer in the open instrument and return 1 or negative if error
*/
extern int DD_Close(int VarID);
/*
* VarID - Variable ID from DD_SetVariable
* Returns 1 if OK and negative value in case of error (see bellow)
*/
extern char *DD_GetVersion();
/*
* return static pointer to internal string with the DDLIB-SERVER package version
*/
/*----------- Data Update functions -----------------------------------*/
extern int DD_AddDataSet(char *DataSetName, char *RemSetID, char *BaseName);
/*
* Request for new VI. See ../DOC/TECHDOC/DDServFunct.html
*/
#ifdef __cplusplus
}
#endif
/*--------------------- CONSTANTS -----------------------------------------*/
#define MOREDATA 1 /* There is data, but we have to call GetData again right now*/
#define MOREDELAY 2 /* There is data, but we have to call GetData again after delay */
#define OK 0 /* It is last data packet */
#define NOCONNECTION -1
#define TOOMANYREQ -2
#define REQSENDERR -3
#define REPLYRECERR -4
#define NOID -5
#define NOREFFILE -6
#define NOTIMESFILE -7
#define NOINFOFILE -8
#define NOVAR -9
#define OUTOFTIME -10
#define CACHERR -11 /* The error occured when program manipulated the cach */
#define CACHTOOREC -33 /* Off files in the CASH are created less then 5 sec ago */
#define WAITEXTCALL -34 /* Server Waits external call finish */
#define TRYAGAIN -35 /* Times file is locked. This request should be repeated again */
#define NODATAATTIME -36 /* Requested time is inside NODATA time interval */
#define GAPISSMALL -37 /* Gap is too small to call external archive */
#define CTIMEISSHIFTED -38 /* The request was in NoData interval, try again with time at the end */
#define DATAFILEERR -12 /* The error while manipulate with data file */
#define ENVIRERROR -13 /* Error in Environments */
#define NOPOINTER -14 /* The pointer points nowhere, SetTime were failed */
#define INTSERERR -15 /* Server internal error */
#define TIMEINEMPTY -16 /* No data for specified time interval */
#define NOEXEC -17 /* No executable */
#define DD_SHORT 4
#define DD_INT 1
#define DD_FLOAT 2
#define DD_DOUBLE 3
#define DD_CHAR 0