![]() |
das2C
das core C utilities (v3)
|


Go to the source code of this file.
Macros | |
| #define | das_msb_float(x) swapFloatIfHostLE(x) |
| Big endian float on any host, a no-op on big endian machines. | |
Functions | |
| DAS_API void | das_send_stub (int nDasVer) |
| Send a stub stream header. | |
| DAS_API void | das_send_except (int nDasVer, das_except_t nType, const char *sMsg) |
| Output an exception of any type. | |
| DAS_API int | das_send_nodata (int nDasVer, const char *sFmt,...) |
| Output a no data in interval message. | |
| DAS_API int | das_send_queryerr (int nDasVer, const char *sFmt,...) |
| Output a "user-messed up" message when receiving a badly formed query. | |
| DAS_API int | das_send_srverr (int nDasVer, const char *sFmt,...) |
| Output a server problem message (i.e. | |
| DAS_API void | das_send_msg (int nDasVer, const char *source, const char *sFmt,...) |
| Output a log status message (i.e. | |
| void | das_send_progbeg (int nDasVer, const char *sSrc, double fBeg, double fEnd) |
| Start a progress bar on the recieving client. | |
| void | das_send_progup (int nDasVer, const char *sSrc, double fCurrent) |
| Update a progress bar on the receiving client. | |
The core library, libdas3, supplies a full API for generating das streams, however any particular das stream is easy to write. Just print to standard output and check it in a verifier. These functions are provided for readers that mostly want to format thier own streams and just need assistance with peripheral affairs such as sending error messages.
Note when writing your own output formatter, put stdout in to binary mode first via das_stdio_binary() before sending packets. This is critical on Windows. Also, call flush after each packet (slow readers) or group of packets (fast readers).
| #define das_msb_float | ( | x | ) | swapFloatIfHostLE(x) |
Big endian float on any host, a no-op on big endian machines.
This is useful for Das1 readers that must output all data in big endian format. Same as swapFloatIfHostLE() in das1.h.
| DAS_API void das_send_stub | ( | int | nDasVer | ) |
Send a stub stream header.
All das2 streams must start with a stream header. This function sends a minimal stream header which is just good enough to be the prefix for an error message. Only call this if your program needs to output an error message before it's sent it's own stream header.
| DAS_API void das_send_except | ( | int | nDasVer, |
| das_except_t | nType, | ||
| const char * | sMsg | ||
| ) |
Output an exception of any type.
The other exception writers below are built on this one. Unlike them it only writes the exception, nothing is logged to standard error.
| nDasVer | The stream major version, 2 or 3. das1 streams have no in-band exceptions, so for any other version nothing is written. |
| nType | The exception type, its name in the stream depends on nDasVer, see das_except_toStr() |
| sMsg | The message, a plain string not a format. It's XML escaped here, so pass it as is. |
| DAS_API int das_send_nodata | ( | int | nDasVer, |
| const char * | sFmt, | ||
| ... | |||
| ) |
Output a no data in interval message.
| DAS_API int das_send_queryerr | ( | int | nDasVer, |
| const char * | sFmt, | ||
| ... | |||
| ) |
Output a "user-messed up" message when receiving a badly formed query.
| DAS_API int das_send_srverr | ( | int | nDasVer, |
| const char * | sFmt, | ||
| ... | |||
| ) |
Output a server problem message (i.e.
missing spice kernel, etc)
| DAS_API void das_send_msg | ( | int | nDasVer, |
| const char * | source, | ||
| const char * | sFmt, | ||
| ... | |||
| ) |
Output a log status message (i.e.
reading file T120101.DAT)
| void das_send_progbeg | ( | int | nDasVer, |
| const char * | sSrc, | ||
| double | fBeg, | ||
| double | fEnd | ||
| ) |
Start a progress bar on the recieving client.
This function keeps track of the last progress update and will not issue a new one unless at least 1% more progress has been made
| nDasVer | the das stream version number you're writing, either 1 or 2 |
| sSrc | The name of the thing setting the progress bar |
| fBeg | some begin mark, can be any floating point number. |
| fEnd | some end mark, can be any floating point number bigger than fBeg |
| void das_send_progup | ( | int | nDasVer, |
| const char * | sSrc, | ||
| double | fCurrent | ||
| ) |
Update a progress bar on the receiving client.
| nDasVer | the das stream version number you're writing, either 1 or 2 |
| sSrc | The name of the thing setting the progress bar |
| fCurrent | some floating point number between the start and end marks set in das_send_progbeg(). |