Classes | |
struct | compStdFileName |
Sort predicate for stdFileNames. More... | |
class | stdFileName |
Organize and analyze the name of a standard file name. More... | |
class | stdSubDir |
Manage a standard subdirectory. More... | |
Functions | |
template<class verboseT = XWC_DEFAULT_VERBOSITY> | |
mx::error_t | timestamp (std::string &tstamp, const tm &uttime, long ts_nsec) |
Get the filename timestamp from the breakdown for a time. | |
template<typename verboseT = XWC_DEFAULT_VERBOSITY> | |
mx::error_t | timestamp (std::string &tstamp, tm &uttime, time_t ts_sec, long ts_nsec) |
Get the filename timestamp and the breakdown for a time. | |
template<class verboseT = XWC_DEFAULT_VERBOSITY> | |
mx::error_t | timestamp (std::string &tstamp, time_t ts_sec, long ts_nsec) |
Get the filename timestamp for a time. | |
template<class verboseT = XWC_DEFAULT_VERBOSITY> | |
mx::error_t | fileTimeRelPath (std::string &tstamp, std::string &relPath, time_t ts_sec, long ts_nsec) |
Get the timestamp and the relative path based on a time. | |
template<class verboseT = XWC_DEFAULT_VERBOSITY> | |
mx::error_t | fileTimeRelPath (std::string &fileName, std::string &relPath, const std::string &devName, const std::string &ext, time_t ts_sec, long ts_nsec) |
Construct the filename and full relative path based on a time and a device name and extension. | |
template<class verboseT = XWC_DEFAULT_VERBOSITY> | |
mx::error_t | parseTimestamp (std::string &YYYY, std::string &MM, std::string &DD, std::string &hh, std::string &mm, std::string &ss, std::string &nn, const std::string &tstamp) |
Parse a standard XWCTk timestamp string. | |
template<class verboseT = XWC_DEFAULT_VERBOSITY> | |
mx::error_t | parseFilePath (std::string &devName, std::string &YYYY, std::string &MM, std::string &DD, std::string &hh, std::string &mm, std::string &ss, std::string &nn, const std::string &fname) |
Parse a standard XWCTk timestamp filepath. | |
mx::error_t MagAOX::file::fileTimeRelPath | ( | std::string & | fileName, |
std::string & | relPath, | ||
const std::string & | devName, | ||
const std::string & | ext, | ||
time_t | ts_sec, | ||
long | ts_nsec | ||
) |
Construct the filename and full relative path based on a time and a device name and extension.
Fills in the fileName string with the timestamp encoded as
* devName_YYYYMMDDHHMMSSNNNNNNNNN.ext *
and the relPath
string with the format
* devName/YYYY_MM_DD *
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
nested | mx::excpetion if std::bad_alloc is thrown |
[out] | fileName | the resulting file name |
[out] | relPath | the resulting relative path |
[in] | devName | the device name part of the path. No '/'. |
[in] | ext | the extension part of the filename. No . . |
[in] | ts_sec | the unix time second |
[in] | ts_nsec | the nanosecond |
Definition at line 287 of file fileTimes.hpp.
References fileTimeRelPath().
mx::error_t MagAOX::file::fileTimeRelPath | ( | std::string & | tstamp, |
std::string & | relPath, | ||
time_t | ts_sec, | ||
long | ts_nsec | ||
) |
Get the timestamp and the relative path based on a time.
Fills in the tstamp
string with the timestamp encoded as
* YYYYMMDDHHMMSSNNNNNNNNN *
and the relPath
string with the format
* yyyy_mm_dd *
[out] | tstamp | |
[out] | relPath | |
[in] | ts_sec | the unix time second |
[in] | ts_nsec | the nanosecond |
Definition at line 209 of file fileTimes.hpp.
References fileTimeRelPath().
Referenced by MagAOX::logger::logFileRaw< verboseT >::createFile(), libXWCTest::loggerTest::logMapTest::createTestPaths(), MagAOX::app::streamWriter::doEncode(), fileTimeRelPath(), fileTimeRelPath(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), and libXWCTest::fileTest::fileTimesTest::TEST_CASE().
mx::error_t MagAOX::file::parseFilePath | ( | std::string & | devName, |
std::string & | YYYY, | ||
std::string & | MM, | ||
std::string & | DD, | ||
std::string & | hh, | ||
std::string & | mm, | ||
std::string & | ss, | ||
std::string & | nn, | ||
const std::string & | fname | ||
) |
Parse a standard XWCTk timestamp filepath.
Extracts the device name and the date components. The only restriction on the input \fname is that it be at least 23 characters long. In this case it contains only the timestamp.
No validity checks are done on the components (i.e. no check that the timestamp is all numeric, no check on device name format).
Examples of valid inputs are:
device_20241121063300000000000.txt
/path/to/device_20241121063300000000000.txt
20241121063300000000000
[out] | devName | the device name |
[out] | YYYY | the 4 digit year |
[out] | MM | the 2 digit month |
[out] | DD | the 2 digit day |
[out] | hh | the 2 digit hour |
[out] | mm | the 2 digit minute |
[out] | ss | the 2 digit second |
[out] | nn | the 9 digit nanosecond |
[in] | fname | the filename, which can include a path |
Definition at line 430 of file fileTimes.hpp.
References parseFilePath().
Referenced by logdump::execute(), MagAOX::file::stdFileName< verboseT >::fullName(), parseFilePath(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), and libXWCTest::fileTest::fileTimesTest::TEST_CASE().
mx::error_t MagAOX::file::parseTimestamp | ( | std::string & | YYYY, |
std::string & | MM, | ||
std::string & | DD, | ||
std::string & | hh, | ||
std::string & | mm, | ||
std::string & | ss, | ||
std::string & | nn, | ||
const std::string & | tstamp | ||
) |
Parse a standard XWCTk timestamp string.
Extracts the date components.
The input must be exactly 23 characters long.
No validity checks are done on the components.
nested | mx::exception if std::bad_alloc is thrown |
[out] | YYYY | the 4 digit year |
[out] | MM | the 2 digit month |
[out] | DD | the 2 digit day |
[out] | hh | the 2 digit hour |
[out] | mm | the 2 digit minute |
[out] | ss | the 2 digit second |
[out] | nn | the 9 digit nanosecond |
[in] | tstamp | the 23-digit timestamp |
Definition at line 352 of file fileTimes.hpp.
References parseTimestamp().
Referenced by parseTimestamp(), and libXWCTest::fileTest::fileTimesTest::TEST_CASE().
mx::error_t MagAOX::file::timestamp | ( | std::string & | tstamp, |
const tm & | uttime, | ||
long | ts_nsec | ||
) |
Get the filename timestamp from the breakdown for a time.
Fills in the tstamp
string with the timestamp encoded as
* YYYYMMDDHHMMSSNNNNNNNNN *
[out] | tstamp | the timestamp string |
[in] | uttime | the broken down time |
[in] | ts_nsec | the nanosecond |
Definition at line 44 of file fileTimes.hpp.
References timestamp().
Referenced by libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), libXWCTest::fileTest::fileTimesTest::TEST_CASE(), timestamp(), timestamp(), and timestamp().
mx::error_t MagAOX::file::timestamp | ( | std::string & | tstamp, |
time_t | ts_sec, | ||
long | ts_nsec | ||
) |
Get the filename timestamp for a time.
Fills in the tstamp
string with the timestamp encoded as
* YYYYMMDDHHMMSSNNNNNNNNN *
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[out] | tstamp | the timestamp string |
[in] | ts_sec | the unix time second |
[in] | ts_nsec | the nanosecond |
Definition at line 172 of file fileTimes.hpp.
References timestamp().
mx::error_t MagAOX::file::timestamp | ( | std::string & | tstamp, |
tm & | uttime, | ||
time_t | ts_sec, | ||
long | ts_nsec | ||
) |
Get the filename timestamp and the breakdown for a time.
Fills in the tstamp
string with the timestamp encoded as
* YYYYMMDDHHMMSSNNNNNNNNN *
and the broken down tm
structure uttime
[out] | tstamp | the timestamp string |
[out] | uttime | the broken down time |
[in] | ts_sec | the unix time second |
[in] | ts_nsec | the nanosecond |
Definition at line 115 of file fileTimes.hpp.
References timestamp().