Manage a standard subdirectory. More...
#include <stdSubDir.hpp>

Public Member Functions | |
| stdSubDir () | |
| Default c'tor. | |
| stdSubDir (const std::chrono::sys_days &sysday) | |
| Construct from std::sys_days. | |
| stdSubDir (int year, unsigned month, unsigned day) | |
| Construct from components. | |
| stdSubDir (const std::string &subdir) | |
| Construct from a string. | |
| mx::error_t | ymd (int year, unsigned month, unsigned day) |
| Setup from components. | |
| mx::error_t | path (const std::string &subdir) |
| Set the subdirectory. | |
| std::string | path (mx::error_t *errc=nullptr) const |
| Get the current value of m_subDir. | |
| int | year (mx::error_t *errc=nullptr) const |
| Get the current value of m_year. | |
| unsigned int | month (mx::error_t *errc=nullptr) const |
| Get the current value of m_month. | |
| unsigned int | day (mx::error_t *errc=nullptr) const |
| Get the current value of m_day. | |
| bool | valid () const |
| Get the current value of m_valid. | |
| mx::error_t | addDay () |
| Add a day to this subdirectory. | |
| mx::error_t | subDay () |
| Subtract a day from this subdirectory. | |
| stdSubDir | previousSubdir (mx::error_t *errc=nullptr) |
| Get the previous day's subdirectory. | |
| stdSubDir | followingSubdir (mx::error_t *errc=nullptr) |
| Get the following day's subdirectory. | |
| bool | operator== (const stdSubDir &comp) const |
| Compare two subdirectories for equality by timestamp. | |
| bool | operator!= (const stdSubDir &comp) const |
| Compare two subdirectories for inequality by timestamp. | |
| bool | operator< (const stdSubDir &comp) const |
| Compare two subdirectories for less-than by timestamp. | |
| bool | operator<= (const stdSubDir &comp) const |
| Compare two subdirectories for less-than-or-equal by timestamp. | |
| bool | operator> (const stdSubDir &comp) const |
| Compare two subdirectories for greater-than by timestamp. | |
| bool | operator>= (const stdSubDir &comp) const |
| Compare two subdirectories for greater-than-or-equal by timestamp. | |
| void | invalidate () |
| Invalidate this instance. | |
Protected Attributes | |
| std::chrono::sys_days | m_sysday |
| System time representation of the date of this sub directory. | |
| bool | m_pathMade { false } |
| Whether or not the path string has been constructed. | |
| std::string | m_path |
| The path string. Only constructed on demand. | |
| bool | m_valid { false } |
| Whether or not the components are valid. | |
Manage a standard subdirectory.
MagAO-X data storage subdirectories have the format YYYY_MM_DD This class provides parsing and date arithmetic.
Definition at line 35 of file stdSubDir.hpp.
| MagAOX::file::stdSubDir< verboseT >::stdSubDir | ( | ) |
Default c'tor.
Definition at line 186 of file stdSubDir.hpp.
|
explicit |
Construct from std::sys_days.
On success, sets m_valid=true
On error, sets m_valid=false
| [in] | sysday | The new year |
Definition at line 192 of file stdSubDir.hpp.
| MagAOX::file::stdSubDir< verboseT >::stdSubDir | ( | int | year, |
| unsigned | month, | ||
| unsigned | day | ||
| ) |
Construct from components.
On success, sets m_valid=true
On error, sets m_valid=false
| [in] | year | The new year |
| [in] | month | The new month |
| [in] | day | The new day |
Definition at line 220 of file stdSubDir.hpp.
| MagAOX::file::stdSubDir< verboseT >::stdSubDir | ( | const std::string & | subdir | ) |
Construct from a string.
On success, sets m_valid=true
On error, sets m_valid=false
| [in] | subdir | The string of format YYYY_MM_DD |
Definition at line 226 of file stdSubDir.hpp.
| mx::error_t MagAOX::file::stdSubDir< verboseT >::addDay | ( | ) |
Add a day to this subdirectory.
Definition at line 606 of file stdSubDir.hpp.
Referenced by MagAOX::file::stdSubDir< verboseT >::followingSubdir(), MagAOX::logger::logMap< verboseT >::loadAppToFileMap(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), and libXWCTest::fileTest::stdSubDirTest::TEST_CASE().
| unsigned int MagAOX::file::stdSubDir< verboseT >::day | ( | mx::error_t * | errc = nullptr | ) | const |
Get the current value of m_day.
| [in] | errc | [optional] error code set during path creation |
Definition at line 548 of file stdSubDir.hpp.
Referenced by libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), and libXWCTest::fileTest::stdSubDirTest::TEST_CASE().
| stdSubDir< verboseT > MagAOX::file::stdSubDir< verboseT >::followingSubdir | ( | mx::error_t * | errc = nullptr | ) |
Get the following day's subdirectory.
| [in] | errc | [optional] error code set during path creation |
Definition at line 755 of file stdSubDir.hpp.
References MagAOX::file::stdSubDir< verboseT >::addDay(), MagAOX::file::stdSubDir< verboseT >::path(), and MagAOX::file::stdSubDir< verboseT >::valid().
Referenced by libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), and libXWCTest::fileTest::stdSubDirTest::TEST_CASE().
| void MagAOX::file::stdSubDir< verboseT >::invalidate | ( | ) |
Invalidate this instance.
Definition at line 863 of file stdSubDir.hpp.
| unsigned int MagAOX::file::stdSubDir< verboseT >::month | ( | mx::error_t * | errc = nullptr | ) | const |
Get the current value of m_month.
| [in] | errc | [optional] error code set during path creation |
Definition at line 496 of file stdSubDir.hpp.
Referenced by libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), and libXWCTest::fileTest::stdSubDirTest::TEST_CASE().
| bool MagAOX::file::stdSubDir< verboseT >::operator!= | ( | const stdSubDir< verboseT > & | comp | ) | const |
Compare two subdirectories for inequality by timestamp.
Two subdirectories are equal if and only if their timestamps are equal
Definition at line 833 of file stdSubDir.hpp.
References MagAOX::file::stdSubDir< verboseT >::m_sysday.
| bool MagAOX::file::stdSubDir< verboseT >::operator< | ( | const stdSubDir< verboseT > & | comp | ) | const |
Compare two subdirectories for less-than by timestamp.
A subdirectory is less than if and only if its timestamp is less-than
Definition at line 839 of file stdSubDir.hpp.
References MagAOX::file::stdSubDir< verboseT >::m_sysday.
| bool MagAOX::file::stdSubDir< verboseT >::operator<= | ( | const stdSubDir< verboseT > & | comp | ) | const |
Compare two subdirectories for less-than-or-equal by timestamp.
A subdirectory is less than or equal if and only if its timestamp is less-than-or-equal
Definition at line 845 of file stdSubDir.hpp.
References MagAOX::file::stdSubDir< verboseT >::m_sysday.
| bool MagAOX::file::stdSubDir< verboseT >::operator== | ( | const stdSubDir< verboseT > & | comp | ) | const |
Compare two subdirectories for equality by timestamp.
Two subdirectories are equal if and only if their timestamps are equal
Definition at line 827 of file stdSubDir.hpp.
References MagAOX::file::stdSubDir< verboseT >::m_sysday.
| bool MagAOX::file::stdSubDir< verboseT >::operator> | ( | const stdSubDir< verboseT > & | comp | ) | const |
Compare two subdirectories for greater-than by timestamp.
A subdirectory is greater than if and only if its timestamp is greater-than
Definition at line 851 of file stdSubDir.hpp.
References MagAOX::file::stdSubDir< verboseT >::m_sysday.
| bool MagAOX::file::stdSubDir< verboseT >::operator>= | ( | const stdSubDir< verboseT > & | comp | ) | const |
Compare two subdirectories for greater-than-or-equal by timestamp.
A subdirectory is greater than if and only if its timestamp is greater-than-or-equal
Definition at line 857 of file stdSubDir.hpp.
References MagAOX::file::stdSubDir< verboseT >::m_sysday.
| mx::error_t MagAOX::file::stdSubDir< verboseT >::path | ( | const std::string & | subdir | ) |
Set the subdirectory.
Parses the string and sets the time point
Definition at line 270 of file stdSubDir.hpp.
Referenced by audibleAlerts.personality.Recording::__eq__(), MagAOX::file::stdSubDir< verboseT >::followingSubdir(), MagAOX::logger::logMap< verboseT >::loadAppToFileMap(), MagAOX::file::stdSubDir< verboseT >::previousSubdir(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), and libXWCTest::fileTest::stdSubDirTest::TEST_CASE().
| std::string MagAOX::file::stdSubDir< verboseT >::path | ( | mx::error_t * | errc = nullptr | ) | const |
Get the current value of m_subDir.
| [in] | errc | [optional] error code set during path creation |
Definition at line 377 of file stdSubDir.hpp.
Referenced by audibleAlerts.personality.Recording::__eq__().
| stdSubDir< verboseT > MagAOX::file::stdSubDir< verboseT >::previousSubdir | ( | mx::error_t * | errc = nullptr | ) |
Get the previous day's subdirectory.
| [in] | errc | [optional] error code set during path creation |
Definition at line 683 of file stdSubDir.hpp.
References MagAOX::file::stdSubDir< verboseT >::path(), MagAOX::file::stdSubDir< verboseT >::subDay(), and MagAOX::file::stdSubDir< verboseT >::valid().
Referenced by libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), and libXWCTest::fileTest::stdSubDirTest::TEST_CASE().
| mx::error_t MagAOX::file::stdSubDir< verboseT >::subDay | ( | ) |
Subtract a day from this subdirectory.
Definition at line 644 of file stdSubDir.hpp.
Referenced by MagAOX::logger::logMap< verboseT >::loadAppToFileMap(), MagAOX::file::stdSubDir< verboseT >::previousSubdir(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), and libXWCTest::fileTest::stdSubDirTest::TEST_CASE().
| bool MagAOX::file::stdSubDir< verboseT >::valid | ( | ) | const |
Get the current value of m_valid.
Definition at line 600 of file stdSubDir.hpp.
Referenced by MagAOX::file::stdSubDir< verboseT >::followingSubdir(), MagAOX::file::stdSubDir< verboseT >::previousSubdir(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), and libXWCTest::fileTest::stdSubDirTest::TEST_CASE().
| int MagAOX::file::stdSubDir< verboseT >::year | ( | mx::error_t * | errc = nullptr | ) | const |
Get the current value of m_year.
| [in] | errc | [optional] error code set during path creation |
Definition at line 443 of file stdSubDir.hpp.
Referenced by libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), libXWCTest::fileTest::stdSubDirTest::TEST_CASE(), and libXWCTest::fileTest::stdSubDirTest::TEST_CASE().
| mx::error_t MagAOX::file::stdSubDir< verboseT >::ymd | ( | int | year, |
| unsigned | month, | ||
| unsigned | day | ||
| ) |
Setup from components.
On success, sets m_valid=true
On error, sets m_valid=false
| [in] | year | The new year |
| [in] | month | The new month |
| [in] | day | The new day |
Definition at line 232 of file stdSubDir.hpp.
Referenced by libXWCTest::fileTest::stdSubDirTest::TEST_CASE().
|
mutableprotected |
The path string. Only constructed on demand.
Definition at line 43 of file stdSubDir.hpp.
|
mutableprotected |
Whether or not the path string has been constructed.
Definition at line 41 of file stdSubDir.hpp.
|
protected |
System time representation of the date of this sub directory.
Definition at line 39 of file stdSubDir.hpp.
Referenced by MagAOX::file::stdSubDir< verboseT >::operator!=(), MagAOX::file::stdSubDir< verboseT >::operator<(), MagAOX::file::stdSubDir< verboseT >::operator<=(), MagAOX::file::stdSubDir< verboseT >::operator==(), MagAOX::file::stdSubDir< verboseT >::operator>(), and MagAOX::file::stdSubDir< verboseT >::operator>=().
|
protected |
Whether or not the components are valid.
Definition at line 45 of file stdSubDir.hpp.