WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
WXP::Filename Class Reference

This class creates filenames. More...

#include "../include/Filename.h"

Public Member Functions

int initParam ()
int init ()
 Filename (const char *nameconv, const char *str)
 Filename (const char *nameconv, Date &rdate)
 Filename (const char *filename)
 Filename ()
 ~Filename ()
int set (const char *nameconv, const char *str)
int set (const char *nameconv, Date &rdate)
int set (const char *filename)
bool isSet ()
int setNameConv (const char *nameconv)
int setPath (const char *path)
int setDate (Date &rdate)
int getDate (Date &rdate)
DateVal getDateval ()
int getOffset ()
int setFixDate (DateVal &rdate)
int setFixDate (const char *str)
int setType (const char *rtype)
const char * getType ()
int setForeTime (int time)
int getForeTime ()
int setKey (char ch, const char *str)
const char * getExt ()
const char * getKey (char ch)
int setName (const char *rname)
const char * getName ()
const char * getName (int ind)
int setHeader (const char *rname)
const char * getHeader ()
bool validHeader ()
int addOutPath (const char *path)
bool isFixed ()
int setNumFiles (int val)
int setNumFiles (const char *str)
int getNumFiles ()
int getNumType ()
int setOutput (bool val)
int setLateLimit (int val)
int setLateDate (Date rdate)
int setBaseDate (Date &rdate)
int checkFile (const char *file)
int setFile (Date &rdate)
int setFile (Date &rdate, const char *param)
int setFile (const char *file)
int setFile ()
bool exist ()
int setFile (int ind)
int listFile ()
int print ()
int printConv ()

Static Public Attributes

static const int UNK = 0
static const int HOURS = 1
static const int FILES = 2

Detailed Description

This class creates filenames.

Author
Dan Vietor

Constructor & Destructor Documentation

◆ Filename() [1/4]

Filename::Filename ( const char * nameconv,
const char * str )

Constructor. Sets the filenames given a name convention and file parameter string

Parameters
nameconvName convention tag
strFile parameter string such as "la" for latest or time number.

References init(), and set().

◆ Filename() [2/4]

Filename::Filename ( const char * nameconv,
Date & rdate )

Constructor. Sets the filename given and name convention and date

Parameters
nameconvName convention string to use
rdateDate values to set filename with

References init(), and set().

◆ Filename() [3/4]

Filename::Filename ( const char * filename)

Constructor. Sets a specific filename to be used.

Parameters
filenameThe filename to use

References init(), and set().

◆ Filename() [4/4]

Filename::Filename ( )

Constructor. Initializes class data

References init().

◆ ~Filename()

Filename::~Filename ( )

Destructor.

Member Function Documentation

◆ checkFile()

◆ getDate()

int Filename::getDate ( Date & rdate)

Gets the current date used in the filename

Return values
rdateThe output date class

Referenced by WXP::GridCont::draw(), WXP::RadMask::getGrids(), WXP::MosFile::open(), WXP::ProfFile::open(), WXP::WarnFile::open(), WXP::WatchFile::open(), and WXP::MdrImage::readFile().

◆ getDateval()

DateVal Filename::getDateval ( )

Gets the current date used in the filename

Returns
The DateVal class with date values

Referenced by WXP::GribFile::open().

◆ getHeader()

const char * Filename::getHeader ( )

Gets the header filename

Returns
The header filename string

Referenced by WXP::GribFile::open().

◆ getName() [1/2]

◆ getName() [2/2]

const char * Filename::getName ( int ind)

Gets the filename from the stored filenames

Parameters
indThe index of the filename in the array
Returns
The file name string

◆ getNumFiles()

int Filename::getNumFiles ( )

Gets the number of files used in a series

Returns
Number of files

◆ getType()

const char * Filename::getType ( )

Gets the file type

Returns
File type

Referenced by WXP::SatFile::SatFile().

◆ init()

int Filename::init ( )

Initializes class data

References UNK.

Referenced by Filename(), Filename(), Filename(), and Filename().

◆ initParam()

int Filename::initParam ( )

Initializes parameters

◆ listFile()

int Filename::listFile ( )

Produces a list of available files based on the name convention.

References WXP::FileTool::exist(), WXP::String::get(), WXP::FileTool::getPath(), WXP::String::length(), WXP::FileTool::numPath(), and WXP::Wxp::outMessage().

Referenced by setFile().

◆ print()

int Filename::print ( )

Prints class values to standard output

References FILES, HOURS, and WXP::StrLib::valid().

◆ set() [1/3]

int Filename::set ( const char * filename)

Sets a specific filename to use

Parameters
filenameThe file name

References WXP::Date::set().

◆ set() [2/3]

int Filename::set ( const char * nameconv,
const char * str )

Sets the filenames given a name convention and file parameter string

Parameters
nameconvName convention tag
strFile parameter string such as "la" for latest or time number.

References WXP::StrLib::copy(), WXP::FileTool::exist(), WXP::NameConvFile::getDate(), WXP::NameConvFile::getFilename(), and WXP::NameConvFile::getHdrFilename().

Referenced by Filename(), Filename(), and Filename().

◆ set() [3/3]

int Filename::set ( const char * nameconv,
Date & rdate )

Sets the filename given and name convention and date

Parameters
nameconvName convention string to use
rdateDate values to set filename with

References WXP::StrLib::copy(), WXP::NameConvFile::getDate(), WXP::NameConvFile::getFilename(), and WXP::NameConvFile::getHdrFilename().

◆ setBaseDate()

int Filename::setBaseDate ( Date & rdate)

Sets the name convention base date

Return values
rdateOutput date class

References WXP::Date::fix().

◆ setDate()

int Filename::setDate ( Date & rdate)

Sets the filename given a date (name convention already set).

Parameters
rdateDate values to set filename from

◆ setFile() [1/4]

int Filename::setFile ( )

Sets the filename, checks for existence and prompts user if not specified through resources.

Parameters
promptThe filename prompt

References checkFile(), WXP::StrLib::equal(), WXP::FileTool::exist(), WXP::Wxp::exit(), FILES, WXP::NameConvFile::getDate(), WXP::NameConvFile::getFilename(), WXP::NameConvFile::getHdrFilename(), WXP::StrLib::index(), listFile(), and WXP::Wxp::NOERR.

◆ setFile() [2/4]

int Filename::setFile ( const char * filename)

Sets the filename by querying a set of resources

Parameters
filenameOptional filename

References checkFile(), FILES, WXP::NameConvFile::getDate(), WXP::NameConvFile::getFilename(), WXP::NameConvFile::getHdrFilename(), WXP::StrLib::index(), setNumFiles(), and WXP::StrLib::valid().

◆ setFile() [3/4]

int Filename::setFile ( Date & rdate)

Sets the filename given a date (name convention already set).

Parameters
rdateDate values to set filename from

References WXP::FileTool::exist(), WXP::NameConvFile::getDate(), WXP::NameConvFile::getFilename(), WXP::NameConvFile::getHdrFilename(), WXP::Date::getSeconds(), and WXP::Const::MISS.

Referenced by WXP::GridVect::draw(), WXP::RadMask::getGrids(), and WXP::NidsPlot::setFilename().

◆ setFile() [4/4]

int Filename::setFile ( int ind)

Sets the filename based on an offset from current time. This is meant for series of files.

Parameters
indIndex multiplied by the time offset.
Returns
1=within number of files, 0=beyond number of files

References WXP::Date::addSeconds(), FILES, WXP::NameConvFile::getDate(), WXP::NameConvFile::getFilename(), and WXP::NameConvFile::getHdrFilename().

◆ setFixDate() [1/2]

int Filename::setFixDate ( const char * str)

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

Parameters
strSet date for files

◆ setFixDate() [2/2]

int Filename::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

◆ setHeader()

int Filename::setHeader ( const char * rname)

Sets the header filename

Parameters
rnameThe heade file name

◆ setLateDate()

int Filename::setLateDate ( Date rdate)

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

Parameters
rdateBase date for latest files

◆ setLateLimit()

int Filename::setLateLimit ( int val)

Sets the number of times to look back to find the latest file.

Parameters
valThe number of offset times.

◆ setName()

int Filename::setName ( const char * rname)

Sets the specific filename

Parameters
rnameThe file name

Referenced by WXP::GridVect::draw().

◆ setNameConv()

int Filename::setNameConv ( const char * nameconv)

Sets the name convention

Parameters
nameconvName convention string

References WXP::StrLib::copy().

Referenced by WXP::HodoPlot::draw(), WXP::SoundPlot::draw(), and WXP::RadMask::getGrids().

◆ setNumFiles() [1/2]

int Filename::setNumFiles ( const char * str)

Sets the number of files in a series

Parameters
strString containing series parameters

References WXP::Const::MISS, WXP::Wxp::outDebug(), and WXP::StrLib::valid().

◆ setNumFiles() [2/2]

int Filename::setNumFiles ( int val)

Sets the number of files in a series

Parameters
valNumber of files

Referenced by setFile().

◆ setOutput()

int Filename::setOutput ( bool val)

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

Parameters
valWhether output file

◆ setPath()

int Filename::setPath ( const char * str)

Sets the file path

Parameters
strUser defined file path

◆ setType()

int Filename::setType ( const char * rtype)

Sets the file type parameter

Parameters
rtypeFile type

References WXP::StrLib::copy().

◆ validHeader()

bool Filename::validHeader ( )

Returns if the header filename has a valid string in it.

Returns
True if header filename valid

Referenced by WXP::GribFile::open().

Member Data Documentation

◆ FILES

const int WXP::Filename::FILES = 2
static

Multiple files by list of files

Referenced by WXP::SatPlot::draw(), print(), setFile(), setFile(), and setFile().

◆ HOURS

const int WXP::Filename::HOURS = 1
static

Multiple files by time

Referenced by print().

◆ UNK

const int WXP::Filename::UNK = 0
static

Multiple files by time

Referenced by init().


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