WXP C++ Library Version 6.74.6
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
WXP::NameConv Class Reference

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)
 

Detailed Description

This class creates a name convention used to create filenames.

Author
Dan Vietor

Member Enumeration Documentation

◆ Type

Enumerator
FILENAME 

Regular filename

HEADER 

Header filename

Constructor & Destructor Documentation

◆ NameConv() [1/2]

NameConv::NameConv ( const char *  rtype)

Constructor. Sets name convention tag

Parameters
typeName convention tag

References initParam(), and set().

◆ NameConv() [2/2]

NameConv::NameConv ( )

Constructor. Initializes class values

References init(), and initParam().

◆ ~NameConv()

NameConv::~NameConv ( )

Destructor.

Member Function Documentation

◆ decode()

int NameConv::decode ( const char *  filename)

◆ encode()

int NameConv::encode ( Date rdate,
int  flag,
String filename 
)

◆ encodeFile()

int NameConv::encodeFile ( Date rdate,
String filename 
)

Encodes a filename from the name convention

Parameters
rdateDate to use in encoding filename
Return values
filenameString containing filename

References encode(), and FILENAME.

◆ encodeHdr()

int NameConv::encodeHdr ( Date rdate,
String filename 
)

Encodes a header filename from the name convention

Parameters
rdateDate to use in encoding filename
Return values
filenameString containing filename

References encode(), and HEADER.

◆ getDate()

int NameConv::getDate ( Date rdate)

Gets the date value

Return values
rdateThe base date for sets of files.

Referenced by WXP::Filename::checkFile().

◆ getExt()

const char * NameConv::getExt ( )

Gets the file name convention extension string (past last _)

Returns
Extension string

Referenced by WXP::Filename::listFile().

◆ getFile()

const char * NameConv::getFile ( )

Gets the file name convention string.

Returns
File name convention string

Referenced by WXP::Filename::checkFile(), and WXP::Filename::listFile().

◆ getKey()

const char * NameConv::getKey ( char  ch)

Gets the key string.

Parameters
chKey to get
Returns
String associated with the key.

Referenced by WXP::Filename::listFile().

◆ getMinSize()

int WXP::NameConv::getMinSize ( )
inline

Returns the min size of file used in latest

◆ getMinTime()

int WXP::NameConv::getMinTime ( )
inline

Returns the min time of file used in latest

◆ getOffset()

int WXP::NameConv::getOffset ( )
inline

Returns the time offset between file times

Referenced by WXP::Filename::checkFile(), WXP::Filename::set(), WXP::Filename::setNameConv(), and WXP::Filename::setNumFiles().

◆ getPath()

const char * NameConv::getPath ( )

Gets the file path as extracted from the name convention

Returns
Extension string

References WXP::String::get().

◆ init()

int NameConv::init ( )

Initializes the class data

References WXP::Const::MISS.

Referenced by NameConv(), and set().

◆ initParam()

int NameConv::initParam ( )

Initializes just the

References WXP::String::clear().

Referenced by NameConv().

◆ set()

int NameConv::set ( const char *  rtype)

◆ setExt()

int NameConv::setExt ( const char *  str)

Sets the file name convention extension string (past last _)

Returns
Extension string

References WXP::StrLib::copy().

◆ setFile()

int NameConv::setFile ( Date rdate,
NameConvFile file 
)

Sets the filename given the name convention and date

Parameters
rdateThe date to use in encoding the filename
Return values
fileThe 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(), and WXP::Filename::setFile().

◆ setFixDate() [1/2]

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.

Parameters
strString 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().

◆ setFixDate() [2/2]

int NameConv::setFixDate ( DateVal rdate)

Sets the set date used to determine files. Parameters in date fix those values in filename. Default is undefined.

Parameters
rdateSet date for files

◆ setForeTime()

int WXP::NameConv::setForeTime ( int  val)
inline

Sets the forecast time

◆ setKey()

int NameConv::setKey ( char  ch,
const char *  str 
)

Sets the key string.

Parameters
chKey to set
strString associated with the key.

References WXP::StrLib::copy().

Referenced by decode().

◆ setLateDate()

int NameConv::setLateDate ( Date  rdate)

Sets the base date used to determine latest files. Default is current time.

Parameters
rdateBase date for latest files

Referenced by WXP::Filename::setLateDate().

◆ setLateLimit()

int NameConv::setLateLimit ( int  val)

Sets the number of files back to search for latest available

Parameters
valNumber of files to search through

Referenced by WXP::Filename::setLateLimit().

◆ setLatest()

int NameConv::setLatest ( const char *  str,
NameConvFile file 
)

◆ setOffset() [1/2]

int NameConv::setOffset ( const char *  file)
static

Sets the time offset value between file times in seconds

Parameters
fileName convention string to extract offset

References WXP::Const::MISS.

◆ setOffset() [2/2]

int WXP::NameConv::setOffset ( int  val)
inline

Sets the time offset between file times

Referenced by set().

◆ setOutput()

int NameConv::setOutput ( bool  val)

Sets whether the file is an output file or not. If output, cannot search for latest file.

Parameters
valWhether output file

Referenced by WXP::Filename::setOutput().

◆ setPath()

int NameConv::setPath ( const char *  str)

Sets the path

Parameters
strPath string

References WXP::StrLib::equal(), and WXP::String::set().

Referenced by WXP::Filename::setPath().


The documentation for this class was generated from the following files: