WXP C++ Library Version 6.74.9
|
This class ingests WMO formated data (see NOAAPORT/FOS) More...
#include "../include/WmoIngest.h"
Public Member Functions | |
WmoIngest () | |
int | init () |
int | setParam (const char *str) |
int | setProdFile (const char *name) |
int | setLogFile (const char *name) |
int | setDate (Date &rdate) |
int | terminate () |
int | printLog (const char *mess,...) |
int | readProdFile (const char *filename) |
int | readProdFile () |
int | isSelected () |
int | cleanLine (char *line, int len, int flag) |
int | setAction (const char *command, int offset, char *string, int len) |
int | action () |
int | close () |
int | saveHeader (const char *fullhead, const char *header, const char *header2) |
int | saveLine (unsigned char *line, int size) |
int | sendPAN () |
int | process (const char *filename) |
int | checkProcessing () |
This class ingests WMO formated data (see NOAAPORT/FOS)
WmoIngest::WmoIngest | ( | ) |
Constructor
References init().
int WmoIngest::action | ( | ) |
Perform action on data
References action(), WXP::Product::APPEND, WXP::Product::file, WXP::Product::hfile, WXP::Wxp::isDebug(), WXP::File::open(), WXP::Wxp::outMessage(), WXP::Product::PIPE, WXP::Product::print(), printLog(), setAction(), and WXP::Product::WRITE.
Referenced by action(), close(), isSelected(), process(), and readProdFile().
|
inline |
Returns if object still processing data
int WmoIngest::cleanLine | ( | char * | line, |
int | len, | ||
int | flag | ||
) |
Cleans a line, stripping non-printable characters
line | The string to clean |
len | The length of the string |
flag | Type of cleaning. 1=strip, retain newline, 2=strip, retain carriage return and newline, 3=strip and convert "/" to "-" for header processing. |
Referenced by saveLine(), and setAction().
int WmoIngest::close | ( | ) |
Closes open files
References action(), WXP::Product::APPEND, WXP::File::close(), WXP::Product::file, WXP::Product::hfile, and WXP::File::printf().
Referenced by process().
int WmoIngest::init | ( | ) |
Initializes the class
References setLogFile(), setParam(), and setProdFile().
Referenced by WmoIngest().
int WmoIngest::isSelected | ( | ) |
Determines if a WMO header is selected to be processed. Header is stored in header and header2.
References action(), WXP::StrLib::equal(), WXP::Product::NONE, and WXP::Product::selected.
Referenced by process().
int WmoIngest::printLog | ( | const char * | mess, |
... | |||
) |
Prints information to log file
mess | The message to write to log file. This can be a format to be passed to vsprintf. |
References WXP::FileTool::addPath(), WXP::File::close(), WXP::StrLib::equal(), WXP::String::get(), WXP::NameConvFile::getFilename(), WXP::File::isOpen(), WXP::File::open(), WXP::File::printf(), WXP::Date::set(), WXP::NameConv::set(), WXP::NameConv::setFile(), and WXP::Date::toText().
Referenced by action(), process(), readProdFile(), saveLine(), and terminate().
int WmoIngest::process | ( | const char * | filename | ) |
Processes data in data stream, extracts header, checks product file for action and saves data to file/program.
filename | The filename to process. |
References action(), WXP::StrLib::append(), WXP::StrLib::bcopy(), close(), WXP::StrLib::copy(), WXP::StrLib::equal(), WXP::String::get(), WXP::Date::getHour(), WXP::Date::getMinute(), WXP::Date::getSecond(), WXP::Wxp::isDebug(), isSelected(), WXP::Wxp::outDebug(), WXP::Wxp::outMessage(), printLog(), readProdFile(), saveHeader(), saveLine(), sendPAN(), WXP::Date::set(), WXP::ForeTime::toCode(), WXP::Variable::toIndCode(), WXP::Level::toLevelCode(), WXP::Level::toTypeCode(), and WXP::StrLib::trimWS().
int WmoIngest::readProdFile | ( | ) |
Reads the product file into memory
References WXP::String::get(), and readProdFile().
Referenced by process(), and readProdFile().
int WmoIngest::readProdFile | ( | const char * | name | ) |
Reads the product file into memory
name | The product file name |
References WXP::Product::act_str, WXP::Product::action, action(), WXP::FileTool::addPath(), WXP::Product::APPEND, WXP::Product::binary, WXP::File::close(), WXP::StrLib::copy(), WXP::StrLib::equal(), WXP::Product::FILE, WXP::Product::file_tmpl, WXP::String::get(), WXP::Wxp::getDatabasePath(), WXP::File::getLine(), WXP::Strings::getNum(), WXP::Strings::getString(), WXP::Product::hfile_tmpl, WXP::StrLib::iequal(), WXP::File::isOpen(), WXP::Product::NONE, WXP::Product::offset, WXP::File::open(), WXP::Wxp::outMessage(), WXP::Product::pan, WXP::Product::PIPE, printLog(), WXP::Product::raw, WXP::Product::RUN, WXP::Strings::set(), WXP::StrLib::toInt(), WXP::StrLib::trimWS(), WXP::Product::unique, and WXP::Product::WRITE.
int WmoIngest::saveHeader | ( | const char * | fullhead, |
const char * | header, | ||
const char * | header2 | ||
) |
Saves the WMO header to output file/program
fullhead | The full header with control characters |
header | The actual WMO header |
header2 | The secondary header (AWIPS header) |
References WXP::Product::file, WXP::Product::hfile, WXP::Product::pos, WXP::File::printf(), and WXP::File::tell().
Referenced by process().
int WmoIngest::saveLine | ( | unsigned char * | line, |
int | size | ||
) |
Saves a line to the output file/program
line | The line of data |
size | The number of bytes in line |
References cleanLine(), WXP::Product::file, printLog(), and WXP::File::write().
Referenced by process().
int WmoIngest::sendPAN | ( | ) |
Sends a PAN (Product Arrival Notification) to the end user.
References WXP::Product::action, WXP::Product::APPEND, WXP::File::close(), WXP::Product::file, WXP::Date::getDay(), WXP::Date::getHour(), WXP::Date::getMinute(), WXP::Date::getMonth(), WXP::Date::getSecond(), WXP::Date::getYear(), WXP::File::isOpen(), WXP::Wxp::outDebug(), WXP::Product::pan, WXP::Product::PIPE, WXP::Product::pos, WXP::File::printf(), WXP::Date::set(), WXP::File::tell(), and WXP::Product::WRITE.
Referenced by process().
int WmoIngest::setAction | ( | const char * | command, |
int | offset, | ||
char * | string, | ||
int | len | ||
) |
Sets up action string using wildcard characters in command string.
command | The command string to interpret |
offset | Offset time by this amount (-sec) |
string | Output string |
len | Length of output string |
References WXP::Date::addSeconds(), WXP::Date::adjustMinute(), cleanLine(), WXP::DateVal::day, WXP::Date::get(), WXP::Date::getJulian(), WXP::DateTool::getMonthLower(), WXP::DateVal::hour, WXP::Date::isSet(), WXP::StrLib::lowCase(), WXP::DateVal::min, WXP::DateVal::month, WXP::Date::set(), WXP::StrLib::upCase(), and WXP::DateVal::year.
Referenced by action().
int WmoIngest::setLogFile | ( | const char * | name | ) |
Sets the log file name
name | The log file name |
References WXP::String::set().
Referenced by init(), and setParam().
int WmoIngest::setParam | ( | const char * | str | ) |
Sets class parameters
str | String with parameters to set |
References WXP::Strings::equal(), WXP::Strings::getInt(), WXP::Strings::getNum(), WXP::Strings::getStringAfter(), setLogFile(), and setProdFile().
Referenced by init().
int WmoIngest::setProdFile | ( | const char * | name | ) |
Sets the product file name
name | The product file name |
References WXP::String::set().
Referenced by init(), and setParam().
int WmoIngest::terminate | ( | ) |
Terminates ingest. If idle, exits program, otherwise sets flag to end ingest after product is transmitted.
References WXP::Wxp::exit(), WXP::Date::getSeconds(), WXP::Wxp::NOERR, and printLog().