WXP C++ Library Version 6.74.9
|
This class creates a name convention used to create filenames. More...
#include "../include/NameConv.h"
Public Types | |
enum | Type { FILENAME , HEADER } |
Public Member Functions | |
NameConv (const char *type) | |
NameConv () | |
~NameConv () | |
int | initParam () |
int | init () |
int | set (const char *type) |
int | setOutput (bool val) |
int | setFixDate (const char *str) |
int | setFixDate (DateVal &rdate) |
int | getFixDate (DateVal &rdate) |
int | setLateLimit (int val) |
int | setLateDate (Date rdate) |
int | setOffset (int val) |
int | getOffset () |
int | getMinSize () |
int | getMinTime () |
const char * | getType () |
int | setForeTime (int val) |
int | getForeTime () |
const char * | getFile () |
int | setExt (const char *str) |
const char * | getExt () |
int | setKey (char ch, const char *str) |
const char * | getKey (char ch) |
int | setPath (const char *path) |
int | setPath (String &path) |
const char * | getPath () |
int | getNumPath () |
int | setPathNum (int ind) |
int | encode (Date &rdate, int flag, String &filename) |
int | encodeFile (Date &rdate, String &filename) |
int | encodeHdr (Date &rdate, String &filename) |
int | decode (const char *filename) |
int | setLatest (const char *str, NameConvFile &file) |
int | setFile (Date &rdate, NameConvFile &file) |
int | getDate (Date &rdate) |
int | print () |
Static Public Member Functions | |
static int | setOffset (const char *file) |
This class creates a name convention used to create filenames.
enum WXP::NameConv::Type |
NameConv::NameConv | ( | const char * | rtype | ) |
Constructor. Sets name convention tag
type | Name convention tag |
References initParam(), and set().
NameConv::NameConv | ( | ) |
Constructor. Initializes class values
References init(), and initParam().
NameConv::~NameConv | ( | ) |
Destructor.
int NameConv::decode | ( | const char * | filename | ) |
Decodes filename and extracts path, date/time, extension and tags.
filename | Filename to decode |
References WXP::StrLib::copy(), WXP::DateVal::day, WXP::DateTool::decodeMonth(), WXP::StrLib::equal(), WXP::DateVal::hour, WXP::StrLib::length(), WXP::DateVal::min, WXP::DateVal::month, WXP::Wxp::outDebug(), WXP::Date::set(), WXP::Date::setJulian(), setKey(), and WXP::DateVal::year.
Referenced by WXP::Filename::checkFile().
Encodes a filename from the name convention
rdate | Date to use in encoding filename |
flag | Specifies type of filename (FILENAME or HEADER) |
filename | String containing filename |
References WXP::String::append(), WXP::String::clear(), WXP::DateVal::day, WXP::FileTool::exist(), WXP::Date::get(), WXP::String::get(), WXP::Date::getDay(), WXP::Date::getJulian(), WXP::Date::getMonth(), WXP::DateTool::getMonth(), WXP::DateTool::getMonthLower(), WXP::FileTool::getPath(), HEADER, WXP::DateVal::hour, WXP::DateVal::init(), WXP::Wxp::isDebug(), WXP::DateVal::min, WXP::Const::MISS, WXP::DateVal::month, WXP::FileTool::numPath(), WXP::Wxp::outDebug(), WXP::Date::print(), WXP::Date::set(), WXP::String::valid(), and WXP::DateVal::year.
Referenced by encodeFile(), encodeHdr(), setFile(), and setLatest().
int NameConv::getDate | ( | Date & | rdate | ) |
Gets the date value
rdate | The base date for sets of files. |
Referenced by WXP::Filename::checkFile().
const char * NameConv::getExt | ( | ) |
Gets the file name convention extension string (past last _)
Referenced by WXP::Filename::listFile().
const char * NameConv::getFile | ( | ) |
Gets the file name convention string.
Referenced by WXP::Filename::checkFile(), and WXP::Filename::listFile().
const char * NameConv::getKey | ( | char | ch | ) |
Gets the key string.
ch | Key to get |
Referenced by WXP::Filename::listFile().
|
inline |
Returns the min size of file used in latest
|
inline |
Returns the min time of file used in latest
|
inline |
Returns the time offset between file times
Referenced by WXP::Filename::checkFile(), WXP::Filename::set(), WXP::Filename::set(), WXP::Filename::setNameConv(), and WXP::Filename::setNumFiles().
const char * NameConv::getPath | ( | ) |
Gets the file path as extracted from the name convention
References WXP::String::get().
int NameConv::init | ( | ) |
int NameConv::initParam | ( | ) |
int NameConv::set | ( | const char * | rtype | ) |
Sets the name convention parameters. Reads the name convention parameters from the name convention file given a convention tag.
type | String specifying convention tag. |
References WXP::FileTool::addPath(), WXP::StrLib::copy(), WXP::Strings::equal(), WXP::FileTool::exist(), WXP::String::get(), WXP::String::getChar(), WXP::Strings::getInt(), WXP::File::getLine(), WXP::Strings::getLong(), WXP::Strings::getNum(), WXP::Strings::getString(), WXP::StrLib::iequal(), init(), WXP::File::isOpen(), WXP::String::length(), WXP::Wxp::outDebug(), WXP::Wxp::outWarning(), WXP::String::scanf(), WXP::Strings::scanf(), WXP::Strings::set(), setOffset(), and WXP::StrLib::valid().
Referenced by NameConv(), WXP::WmoIngest::printLog(), WXP::Filename::set(), WXP::Filename::set(), WXP::Filename::setFile(), and WXP::Filename::setNameConv().
int NameConv::setExt | ( | const char * | str | ) |
Sets the file name convention extension string (past last _)
References WXP::StrLib::copy().
int NameConv::setFile | ( | Date & | rdate, |
NameConvFile & | file | ||
) |
Sets the filename given the name convention and date
rdate | The date to use in encoding the filename |
file | The NameConvFile class containing filename information |
References encode(), FILENAME, WXP::String::get(), WXP::FileTool::getSize(), HEADER, WXP::Wxp::outDebug(), WXP::NameConvFile::setDate(), WXP::NameConvFile::setFilename(), WXP::NameConvFile::setHdrFilename(), WXP::NameConvFile::setOffset(), and WXP::NameConvFile::setType().
Referenced by WXP::Filename::checkFile(), WXP::WmoIngest::printLog(), WXP::Filename::set(), WXP::Filename::setFile(), and WXP::Filename::setFile().
int NameConv::setFixDate | ( | const char * | str | ) |
Sets the set date used to determine files. Parameters in date fix those values in filename. Default is undefined.
str | String specifying values |
References WXP::DateVal::day, WXP::DateVal::hour, WXP::DateVal::min, WXP::DateVal::month, WXP::StrLib::valid(), and WXP::DateVal::year.
Referenced by WXP::Filename::setFixDate(), and WXP::Filename::setFixDate().
int NameConv::setFixDate | ( | DateVal & | rdate | ) |
Sets the set date used to determine files. Parameters in date fix those values in filename. Default is undefined.
rdate | Set date for files |
|
inline |
Sets the forecast time
int NameConv::setKey | ( | char | ch, |
const char * | str | ||
) |
Sets the key string.
ch | Key to set |
str | String associated with the key. |
References WXP::StrLib::copy().
Referenced by decode().
int NameConv::setLateDate | ( | Date | rdate | ) |
Sets the base date used to determine latest files. Default is current time.
rdate | Base date for latest files |
Referenced by WXP::Filename::setLateDate().
int NameConv::setLateLimit | ( | int | val | ) |
Sets the number of files back to search for latest available
val | Number of files to search through |
Referenced by WXP::Filename::setLateLimit().
int NameConv::setLatest | ( | const char * | str, |
NameConvFile & | file | ||
) |
Sets the latest filename given the name convention and available files
str | Latest parameter |
file | NameConvFile class containing filename info |
References WXP::Date::addDays(), WXP::Date::addHours(), WXP::Date::addMonths(), WXP::Date::addSeconds(), WXP::Date::addYears(), WXP::DateVal::day, encode(), WXP::FileTool::exist(), FILENAME, WXP::String::get(), WXP::Date::getDay(), WXP::Date::getHour(), WXP::Date::getMinute(), WXP::Date::getMonth(), WXP::Date::getSeconds(), WXP::FileTool::getSize(), WXP::Date::getYear(), HEADER, WXP::DateVal::hour, WXP::NameConvFile::init(), WXP::Wxp::isDebug(), WXP::Date::isSet(), WXP::DateVal::min, WXP::Const::MISS, WXP::DateVal::month, WXP::Wxp::outDebug(), WXP::Date::print(), WXP::DateVal::sec, WXP::Date::set(), WXP::DateVal::set(), WXP::NameConvFile::setDate(), WXP::Date::setDay(), WXP::NameConvFile::setFilename(), WXP::NameConvFile::setHdrFilename(), WXP::Date::setHour(), WXP::Date::setMinute(), WXP::Date::setMonth(), WXP::NameConvFile::setOffset(), WXP::NameConvFile::setType(), and WXP::DateVal::year.
Referenced by WXP::Filename::checkFile(), WXP::Filename::set(), WXP::Filename::setFile(), and WXP::Filename::setFile().
|
static |
Sets the time offset value between file times in seconds
file | Name convention string to extract offset |
References WXP::Const::MISS.
|
inline |
Sets the time offset between file times
Referenced by set().
int NameConv::setOutput | ( | bool | val | ) |
Sets whether the file is an output file or not. If output, cannot search for latest file.
val | Whether output file |
Referenced by WXP::Filename::setOutput().
int NameConv::setPath | ( | const char * | str | ) |
Sets the path
str | Path string |
References WXP::StrLib::equal(), and WXP::String::set().
Referenced by WXP::Filename::setPath().