Main Page Class Hierarchy Compound List File List Compound Members File Members

# global_pick_rw.h

Go to the documentation of this file.

    00001 #ifndef _GLOBAL_PICK_H
    00002 #define _GLOBAL_PICK_H
    00003 /*---------------------------------------------------------------------------*/
    00004
    00005 #include <global_msg.h>
    00006 #include <trace_buf.h> /*  TRACE_STA_LEN, TRACE_CHAN_LEN, TRACE_NET_LEN, TRACE_LOC_LEN */
    00007
    00008 /*---------------------------------------------------------------------------*/
    00009
    00010
    00011
    00012 /* ==========================================================================
    00013 **                    SIZE DEFINES AND LIMITS
    00014 ** ========================================================================= */
    00015
    00016 /* Global Pick 01
    00017 **
    00018 ** <author> <sequence_number> <version> <station> <comp> <net> <loc> <pick_time> <phase_name> <quality> <polarity>
    00019 **
    00020 ** 001002003 sssssssssssssss vv ssssss cccccccc nnnnnnnn llllllll yyyymmddhhmmss.sss nnnnnnnn qqqqqqqqqqqqq.qq p
    00021 **                                                                                                     1
    00022 **           1         2         3         4         5         6         7         8         9         0
    00023 ** 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
    00024 */
    00025
    00026 #define GLOBAL_PICK_MAXBUFSIZE (108 + BUFF_OVERRUN_SIZE)
    00027
    00028 typedef char GLOBAL_PICK_BUFFER[GLOBAL_PICK_MAXBUFSIZE+1];
    00029
    00030
    00031 typedef struct GLOBAL_PICK_MSG
    00032 {
    00033    short              version;  /* only set using InitGlobalPick() or StringToPick() */
    00034    MSG_LOGO           logo;
    00035    long               sequence;
    00036    char               station[TRACE_STA_LEN];  /* aka "site"      */
    00037    char               channel[TRACE_CHAN_LEN]; /* aka "component" */
    00038    char               network[TRACE_NET_LEN];
    00039    char               location[TRACE_LOC_LEN];
    00040    char               pick_time[19];
    00041    char               phase_name[9];
    00042    double             quality;
    00043    char               polarity;
    00044 } GLOBAL_PICK_STRUCT;
    00045
    00046
    00047
    00048
    00049 /* ==========================================================================
    00050 **                    FUNCTION PROTOTYPES
    00051 ** ========================================================================= */
    00052
    00053 /* InitGlobalPick
    00054 **
    00055 **   Used to initialize, including allocate working memory for
    00056 **   a global pick struct.
    00057 **
    00058 **
    00059 ** PARAMETER:
    00060 **    p_struct -- pointer to structure to contain the message information
    00061 **
    00062 ** RETURNS:
    00063 **    GLOBAL_MSG_SUCCESS
    00064 **    GLOBAL_MSG_NULLSTRUCT = structure pointer is NULL
    00065 */
    00066 GLOBAL_MSG_STATUS InitGlobalPick( GLOBAL_PICK_STRUCT * p_struct );
    00067
    00068
    00069
    00070
    00071 /* WritePickToBuffer
    00072 **
    00073 **    Writes a global pick structure to a buffer.
    00074 **
    00075 ** PARAMETERS:
    00076 **    p_struct -- the source structure
    00077 **    p_buffer -- the target buffer
    00078 **                (on successful return, buffer will be null-terminated)
    00079 **    p_length -- the available buffer size
    00080 **
    00081 ** RETURNS:
    00082 **    GLOBAL_MSG_SUCCESS
    00083 **    GLOBAL_MSG_NULL        = structure pointer is NULL
    00084 **    GLOBAL_MSG_VERSINVALID = invalid message version
    00085 **    GLOBAL_MSG_BADPARAM = buffer pointer is NULL
    00086 **    GLOBAL_MSG_TOOSMALL = buffer not large enough to contain message
    00087 **                          (may be partly written anyway)
    00088 **    GLOBAL_MSG_DEFINESMALL = max buffer size too small for normal write
    00089 */
    00090 GLOBAL_MSG_STATUS WritePickToBuffer( GLOBAL_PICK_STRUCT * p_struct, char * p_buffer, unsigned int p_length );
    00091
    00092
    00093
    00094 /* StringToPick
    00095 **
    00096 **   Parses a global pick message from a supplied string.
    00097 **
    00098 ** RETURNS:
    00099 **    GLOBAL_MSG_SUCCESS
    00100 **    GLOBAL_MSG_NULL        = structure pointer is NULL
    00101 **    GLOBAL_MSG_VERSINVALID = invalid message version
    00102 **    GLOBAL_MSG_BADPARAM    = string pointer is NULL
    00103 **    GLOBAL_MSG_FORMATERROR = invalid string format
    00104 **
    00105 */
    00106 GLOBAL_MSG_STATUS StringToPick( GLOBAL_PICK_STRUCT * p_pick, char * p_string );
    00107
    00108
    00109
    00110 #endif
    00111