das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
Macros | Functions
send.h File Reference

More...

#include <stdarg.h>
#include <stdlib.h>
#include <das3/das1.h>
#include <das3/oob.h>
Include dependency graph for send.h:
This graph shows which files directly or indirectly include this file:

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.
 

Detailed Description

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).

Macro Definition Documentation

◆ das_msb_float

#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.

Function Documentation

◆ das_send_stub()

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_send_except()

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.

Parameters
nDasVerThe stream major version, 2 or 3. das1 streams have no in-band exceptions, so for any other version nothing is written.
nTypeThe exception type, its name in the stream depends on nDasVer, see das_except_toStr()
sMsgThe message, a plain string not a format. It's XML escaped here, so pass it as is.

◆ das_send_nodata()

DAS_API int das_send_nodata ( int  nDasVer,
const char *  sFmt,
  ... 
)

Output a no data in interval message.

Returns
the integer 0

◆ das_send_queryerr()

DAS_API int das_send_queryerr ( int  nDasVer,
const char *  sFmt,
  ... 
)

Output a "user-messed up" message when receiving a badly formed query.

Returns
the integer 47

◆ das_send_srverr()

DAS_API int das_send_srverr ( int  nDasVer,
const char *  sFmt,
  ... 
)

Output a server problem message (i.e.

missing spice kernel, etc)

Returns
the integer 48

◆ das_send_msg()

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)

◆ das_send_progbeg()

void das_send_progbeg ( int  nDasVer,
const char *  sSrc,
double  fBeg,
double  fEnd 
)

Start a progress bar on the recieving client.

Warning
Not thread safe, only use from your writing thread

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

Note
: most das clients don't use this method for tracking progress the data packets themselves usually contain time values which can be compared to the query range. The value of the current packet thus provides a natural progress bar. Kept for old statically linked programs that need this capability.
Parameters
nDasVerthe das stream version number you're writing, either 1 or 2
sSrcThe name of the thing setting the progress bar
fBegsome begin mark, can be any floating point number.
fEndsome end mark, can be any floating point number bigger than fBeg

◆ das_send_progup()

void das_send_progup ( int  nDasVer,
const char *  sSrc,
double  fCurrent 
)

Update a progress bar on the receiving client.

Warning
Not thread safe, only use from your writing thread
Note
: you probably don't need to call this function, see the note in das_send_progbeg()
Parameters
nDasVerthe das stream version number you're writing, either 1 or 2
sSrcThe name of the thing setting the progress bar
fCurrentsome floating point number between the start and end marks set in das_send_progbeg().