GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EMP / V1-4-0 > asc_write / sun-gcc
#include <EMP/ASC.h>
#include <EMP/ASC_dgmPrint.h>
#include <EMP/ASC_pubdefs.h>
#include <EMP/LSD_sdi.h>
#include <EDS/io/EBF_stream.h>
#include <EDS/io/LCBP.h>
#include <EDS/EDS_fw.h>
#include <EDS/LCBV.h>
#include <ITC/ITC_pubdefs.h>
#include <IMM/FPM_pubdefs.h>
#include <IMM/RBM_pubdefs.h>
#include <EMP_DB/ASC_DB_schema.h>
#include <EFC_DB/EH_ids.h>
#include <LSE/CCSDS_ostream.h>
#include <LSF/LSF_reason.h>
#include <MSG/MSG_pubdefs.h>
#include <CDM/CDM_pubdefs.h>
#include <PBS/PBS.h>
#include <PBS/TMR.h>
#include <PBS/MBA.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Classes | |
struct | _GetCtx |
Structure to hold the context for retrieving a pointer to the next input file. More... | |
struct | _OutputCtx |
Output context. More... | |
struct | _Ctl |
Collections all the control parameters together. These are essentially the interpretted command line options. More... | |
Typedefs | |
typedef struct _GetCtx | GetCtx |
Typedef for struct _GetCtx. | |
typedef const char *(* | Get_filename )(void *ctx) |
Typedef of the callback routine to retrieve the next input file name. | |
typedef struct _OutputCtx | OutputCtx |
Typedef for struct _OutputCtx. | |
typedef struct _Ctl | Ctl |
Typedef for struct _Ctl. | |
Functions | |
static void | CheckClearTiming (void) |
quick timing test for clearing the histograms | |
static int | asc_init (Ctl *ctl) |
One-time ASC initialization. | |
int | asc_close (Ctl *ctl) |
Closes the asc context. | |
static void | emp_setup (const ASC_DB_Schema *db, ASC_handlerConstructCfg *cfg, int *retEdsPriority, EDS_fw **retFw, ASC **retAsc) |
Install EMP/ASC into the EDS system. | |
static int | do_it (Ctl *ctl) |
Simple driver program to setup, accumulate and print the statistics. | |
static unsigned int | process (EBF_stream *stream, int nloops, int nskip, int nprocess, LCBV_pktCb rtn, void *prm) |
Convenience routine to formalize the processing. | |
static ASC_handlerConstructCfg * | output_construct (const char *ofilename, unsigned int *options) |
Construct the output configuration structure. | |
static int | output_write (OutputCtx *ctx, LSD_sdiPds *pds) |
Processes an output packet. | |
static int | output_print (unsigned int *options, LSD_sdiPds *pds) |
Processes an output packet by just printing it. | |
static int | file_write (FILE *file, void *buf, int nbytes) |
A CCSDS_ostream output callback routine used when writing the specified buffer to a file. | |
static int | InstallServices (EDS_fw *fw, int edsPriority, ASC **asc, const ASC_DB_Schema *db, ASC_handlerConstructCfg *cfg) |
Install EMP/ASC services into the EDS system. | |
static const char * | get_filename (GetCtx *ctx) |
User provide callback routine to retrieve the next input file. | |
static void | reportUsage (void) |
Gives a terse explanation of this commands usage. | |
static int | fill_ctl (Ctl *ctl, int argc, char *const argv[]) |
Examines the command line parameters and fills the print control structure. | |
int | main (int argc, char *const argv[]) |
Usual entry point for the asc_write. | |
static unsigned int | get_reporting_options (const char *s) |
Returns a bit mask of the reporting options. | |
Variables | |
const unsigned int | EbfData [] |
A small set of test data. |
$ asc_write -n <number_of_events> -o<output_file> <input_files> Do an asc_write with no arguments for a more complete explanation of the parameters.
CVS $Id: asc_write.c,v 1.4 2011/03/26 20:07:42 russell Exp $
const char *(* Get_filename)(void *ctx) |
Typedef of the callback routine to retrieve the next input file name.
ctx | The context block, holds the list of files to process and a pointer to the file to process |
int asc_close | ( | Ctl * | ctl | ) |
static int asc_init | ( | Ctl * | ctl | ) | [static] |
One-time ASC initialization.
ctl | The control information |
References _Ctl::asc, _Ctl::db, emp_setup(), _Ctl::fw, _Ctl::lcb, _Ctl::ofile, _Ctl::options, output_construct(), _Ctl::priority, and _Ctl::rate.
Referenced by main().
static int do_it | ( | Ctl * | ctl | ) | [static] |
Simple driver program to setup, accumulate and print the statistics.
ctl | The control statistics, containing such things as the list of files to accumulate over, the number of events to process etc |
References CheckClearTiming(), _Ctl::ebfData, _Ctl::fw, _Ctl::get, _Ctl::get_ctx, _Ctl::options, _Ctl::priority, process(), _Ctl::to_loop, _Ctl::to_process, and _Ctl::to_skip.
Referenced by main().
static void emp_setup | ( | const ASC_DB_Schema * | db, | |
ASC_handlerConstructCfg * | cfg, | |||
int * | retEdsPriority, | |||
EDS_fw ** | retFw, | |||
ASC ** | retAsc | |||
) | [static] |
Install EMP/ASC into the EDS system.
db | The configuration database | |
cfg | The user configuration to pass to the handler construction routine. | |
retEdsPriority | if not NULL return eds priority used | |
retFw | if not NULL fw pointer for EDS | |
retAsc | if not NULL return ctl pointer for EDS |
References InstallServices().
Referenced by asc_init().
static int file_write | ( | FILE * | file, | |
void * | buf, | |||
int | len | |||
) | [static] |
A CCSDS_ostream output callback routine used when writing the specified buffer to a file.
0,to | satisfy the interface requriements of CCSDS_ostream |
file | The output file handle | |
buf | The buffer to write | |
len | The number of bytes in buffer to write |
Referenced by output_construct().
static int fill_ctl | ( | Ctl * | ctl, | |
int | argc, | |||
char *const | argv[] | |||
) | [static] |
Examines the command line parameters and fills the print control structure.
fn static int fill_ctl (Ctl *ctl, int argc, char *const argv[])
0 | Everything is okay. | |
-1 | Incorrect command usage. Usually this means that the input file name was absent. |
ctl | The parameter control block. HELLO | |
argc | The number of command line parameters. | |
argv | The array of pointers to the command line parameters. |
References _GetCtx::cnt, _GetCtx::cur, _Ctl::db, EbfData, _Ctl::ebfData, _Ctl::get, _Ctl::get_ctx, get_filename(), get_reporting_options(), _GetCtx::names, _Ctl::ofile, _Ctl::options, _Ctl::rate, reportUsage(), _Ctl::to_loop, _Ctl::to_process, and _Ctl::to_skip.
Referenced by main().
const char * get_filename | ( | GetCtx * | ctx | ) | [static] |
User provide callback routine to retrieve the next input file.
ctx | The input file context handle |
References _GetCtx::cnt, _GetCtx::cur, and _GetCtx::names.
Referenced by fill_ctl().
static unsigned int get_reporting_options | ( | const char * | s | ) | [static] |
Returns a bit mask of the reporting options.
s | The option string to parse |
Referenced by fill_ctl().
static int InstallServices | ( | EDS_fw * | fw, | |
int | edsPriority, | |||
ASC ** | retAsc, | |||
const ASC_DB_Schema * | db, | |||
ASC_handlerConstructCfg * | cfg | |||
) | [static] |
Install EMP/ASC services into the EDS system.
fw | Framework ptr init'ed by EDS_fwConstruct | |
edsPriority | Index of eds func pointer, 0 is first habndler | |
retAsc | Returned as ASC handle created by constructore | |
db | The ASC_DB configuration database | |
cfg | The user configuration to pass to the handler construction routine. |
Referenced by emp_setup().
int main | ( | int | argc, | |
char *const | argv[] | |||
) |
Usual entry point for the asc_write.
argc | The number of arguments | |
argv | The vector of arguments. |
$ asc_write -omyAsc.lsd myEventFile.ebf Accumulates the statistics for events in given EBF file
References asc_close(), asc_init(), do_it(), and fill_ctl().
static ASC_handlerConstructCfg * output_construct | ( | const char * | ofilename, | |
unsigned int * | options | |||
) | [static] |
Construct the output configuration structure.
ofilename | The name of the output file, may be HULL in which case no output file is written | |
options | Pointer to the output display options. |
References file_write(), _OutputCtx::options, _OutputCtx::ostream, output_print(), and output_write().
Referenced by asc_init().
static int output_print | ( | unsigned int * | options, | |
LSD_sdiPds * | pds | |||
) | [static] |
Processes an output packet by just printing it.
options | The printing options | |
pds | The packet descriptor structure for the packet to be output |
Referenced by output_construct().
static int output_write | ( | OutputCtx * | ctx, | |
LSD_sdiPds * | pds | |||
) | [static] |
Processes an output packet.
ctx | The output processing context | |
pds | The packet descriptor structure for the packet to be output |
References _OutputCtx::options, and _OutputCtx::ostream.
Referenced by output_construct().
static unsigned int process | ( | EBF_stream * | stream, | |
int | nloops, | |||
int | nskip, | |||
int | nprocess, | |||
LCBV_pktCb | rtn, | |||
void * | prm | |||
) | [static] |
Convenience routine to formalize the processing.
stream | The stream to process | |
nloops | The number of times to process the same stream | |
nskip | The number of events to skip | |
nprocess | The number of events to process | |
rtn | The event processing routine | |
prm | The event processing routine's parameter |
Referenced by do_it().