/* *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* */ /* ** Copyright UCAR */ /* ** University Corporation for Atmospheric Research (UCAR) */ /* ** National Center for Atmospheric Research (NCAR) */ /* ** Boulder, Colorado, USA */ /* ** BSD licence applies - redistribution and use in source and binary */ /* ** forms, with or without modification, are permitted provided that */ /* ** the following conditions are met: */ /* ** 1) If the software is modified to produce derivative works, */ /* ** such modified software should be clearly marked, so as not */ /* ** to confuse it with the version available from UCAR. */ /* ** 2) Redistributions of source code must retain the above copyright */ /* ** notice, this list of conditions and the following disclaimer. */ /* ** 3) Redistributions in binary form must reproduce the above copyright */ /* ** notice, this list of conditions and the following disclaimer in the */ /* ** documentation and/or other materials provided with the distribution. */ /* ** 4) Neither the name of UCAR nor the names of its contributors, */ /* ** if any, may be used to endorse or promote products derived from */ /* ** this software without specific prior written permission. */ /* ** DISCLAIMER: THIS SOFTWARE IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESS */ /* ** OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ /* ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ /* *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* */ //////////////////////////////////////////// // Params.hh // // TDRP header file for 'Params' class. // // Code for program MdvTComp // // This header file has been automatically // generated by TDRP, do not modify. // ///////////////////////////////////////////// /** * * @file Params.hh * * This class is automatically generated by the Table * Driven Runtime Parameters (TDRP) system * * @class Params * * @author automatically generated * */ #ifndef Params_hh #define Params_hh #include #include #include #include #include #include #include using namespace std; // Class definition class Params { public: // enum typedefs typedef enum { DEBUG_OFF = 0, DEBUG_NORM = 1, DEBUG_VERBOSE = 2 } debug_t; typedef enum { ARCHIVE = 0, REALTIME = 1, FILELIST = 2 } mode_t; typedef enum { MAXIMUM = 0, AVERAGE = 1 } composite_t; typedef enum { ENCODING_INT8 = 1, ENCODING_INT16 = 2, ENCODING_FLOAT32 = 5 } encoding_type_t; typedef enum { SYNCH_OUTPUT_TO_TRIGGER = 0, SYNCH_OUTPUT_TO_COMPOSITE = 1, SYNCH_OUTPUT_TO_LIST = 2 } output_t; // struct typedefs typedef struct { char* name; tdrp_bool_t constrain_values; double min_value; double max_value; tdrp_bool_t reset_missing; double missing_fill_value; } field_t; typedef struct { int hour; int minute; int second; } Hms_t; /////////////////////////// // Member functions // //////////////////////////////////////////// // Default constructor // Params (); //////////////////////////////////////////// // Copy constructor // Params (const Params&); //////////////////////////////////////////// // Destructor // ~Params (); //////////////////////////////////////////// // Assignment // void operator=(const Params&); //////////////////////////////////////////// // loadFromArgs() // // Loads up TDRP using the command line args. // // Check usage() for command line actions associated with // this function. // // argc, argv: command line args // // char **override_list: A null-terminated list of overrides // to the parameter file. // An override string has exactly the format of an entry // in the parameter file itself. // // char **params_path_p: // If this is non-NULL, it is set to point to the path // of the params file used. // // bool defer_exit: normally, if the command args contain a // print or check request, this function will call exit(). // If defer_exit is set, such an exit is deferred and the // private member _exitDeferred is set. // Use exidDeferred() to test this flag. // // Returns 0 on success, -1 on failure. // int loadFromArgs(int argc, char **argv, char **override_list, char **params_path_p, bool defer_exit = false); bool exitDeferred() { return (_exitDeferred); } //////////////////////////////////////////// // loadApplyArgs() // // Loads up TDRP using the params path passed in, and applies // the command line args for printing and checking. // // Check usage() for command line actions associated with // this function. // // const char *param_file_path: the parameter file to be read in // // argc, argv: command line args // // char **override_list: A null-terminated list of overrides // to the parameter file. // An override string has exactly the format of an entry // in the parameter file itself. // // bool defer_exit: normally, if the command args contain a // print or check request, this function will call exit(). // If defer_exit is set, such an exit is deferred and the // private member _exitDeferred is set. // Use exidDeferred() to test this flag. // // Returns 0 on success, -1 on failure. // int loadApplyArgs(const char *params_path, int argc, char **argv, char **override_list, bool defer_exit = false); //////////////////////////////////////////// // isArgValid() // // Check if a command line arg is a valid TDRP arg. // static bool isArgValid(const char *arg); //////////////////////////////////////////// // load() // // Loads up TDRP for a given class. // // This version of load gives the programmer the option to load // up more than one class for a single application. It is a // lower-level routine than loadFromArgs, and hence more // flexible, but the programmer must do more work. // // const char *param_file_path: the parameter file to be read in. // // char **override_list: A null-terminated list of overrides // to the parameter file. // An override string has exactly the format of an entry // in the parameter file itself. // // expand_env: flag to control environment variable // expansion during tokenization. // If TRUE, environment expansion is set on. // If FALSE, environment expansion is set off. // // Returns 0 on success, -1 on failure. // int load(const char *param_file_path, char **override_list, int expand_env, int debug); //////////////////////////////////////////// // loadFromBuf() // // Loads up TDRP for a given class. // // This version of load gives the programmer the option to // load up more than one module for a single application, // using buffers which have been read from a specified source. // // const char *param_source_str: a string which describes the // source of the parameter information. It is used for // error reporting only. // // char **override_list: A null-terminated list of overrides // to the parameter file. // An override string has exactly the format of an entry // in the parameter file itself. // // const char *inbuf: the input buffer // // int inlen: length of the input buffer // // int start_line_num: the line number in the source which // corresponds to the start of the buffer. // // expand_env: flag to control environment variable // expansion during tokenization. // If TRUE, environment expansion is set on. // If FALSE, environment expansion is set off. // // Returns 0 on success, -1 on failure. // int loadFromBuf(const char *param_source_str, char **override_list, const char *inbuf, int inlen, int start_line_num, int expand_env, int debug); //////////////////////////////////////////// // loadDefaults() // // Loads up default params for a given class. // // See load() for more detailed info. // // Returns 0 on success, -1 on failure. // int loadDefaults(int expand_env); //////////////////////////////////////////// // sync() // // Syncs the user struct data back into the parameter table, // in preparation for printing. // // This function alters the table in a consistent manner. // Therefore it can be regarded as const. // void sync() const; //////////////////////////////////////////// // print() // // Print params file // // The modes supported are: // // PRINT_SHORT: main comments only, no help or descriptions // structs and arrays on a single line // PRINT_NORM: short + descriptions and help // PRINT_LONG: norm + arrays and structs expanded // PRINT_VERBOSE: long + private params included // void print(FILE *out, tdrp_print_mode_t mode = PRINT_NORM); //////////////////////////////////////////// // checkAllSet() // // Return TRUE if all set, FALSE if not. // // If out is non-NULL, prints out warning messages for those // parameters which are not set. // int checkAllSet(FILE *out); ////////////////////////////////////////////////////////////// // checkIsSet() // // Return TRUE if parameter is set, FALSE if not. // // int checkIsSet(const char *param_name); //////////////////////////////////////////// // arrayRealloc() // // Realloc 1D array. // // If size is increased, the values from the last array // entry is copied into the new space. // // Returns 0 on success, -1 on error. // int arrayRealloc(const char *param_name, int new_array_n); //////////////////////////////////////////// // array2DRealloc() // // Realloc 2D array. // // If size is increased, the values from the last array // entry is copied into the new space. // // Returns 0 on success, -1 on error. // int array2DRealloc(const char *param_name, int new_array_n1, int new_array_n2); //////////////////////////////////////////// // freeAll() // // Frees up all TDRP dynamic memory. // void freeAll(void); //////////////////////////////////////////// // usage() // // Prints out usage message for TDRP args as passed // in to loadFromArgs(). // static void usage(ostream &out); /////////////////////////// // Data Members // char _start_; // start of data region // needed for zeroing out data // and computing offsets debug_t debug; char* instance; mode_t mode; char* input_url; tdrp_bool_t set_vlevel_limits; float lower_vlevel; float upper_vlevel; tdrp_bool_t vert_composite; composite_t composite_type; int composite_period; int min_delta_time; field_t *_fields; int fields_n; char* output_url; encoding_type_t output_encoding_type; output_t output_frequency; Hms_t *_output_times; int output_times_n; char _end_; // end of data region // needed for zeroing out data private: void _init(); mutable TDRPtable _table[22]; const char *_className; bool _exitDeferred; }; #endif