API
 
Loading...
Searching...
No Matches
MagAOX::file::stdSubDir< verboseT > Class Template Reference

Manage a standard subdirectory. More...

#include <stdSubDir.hpp>

Collaboration diagram for MagAOX::file::stdSubDir< verboseT >:
Collaboration graph

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.
 

Detailed Description

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
class MagAOX::file::stdSubDir< verboseT >

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.

Constructor & Destructor Documentation

◆ stdSubDir() [1/4]

template<typename verboseT >
MagAOX::file::stdSubDir< verboseT >::stdSubDir ( )

Default c'tor.

Definition at line 186 of file stdSubDir.hpp.

◆ stdSubDir() [2/4]

template<typename verboseT >
MagAOX::file::stdSubDir< verboseT >::stdSubDir ( const std::chrono::sys_days &  sysday)
explicit

Construct from std::sys_days.

On success, sets m_valid=true

On error, sets m_valid=false

Parameters
[in]sysdayThe new year

Definition at line 192 of file stdSubDir.hpp.

◆ stdSubDir() [3/4]

template<typename verboseT >
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

Parameters
[in]yearThe new year
[in]monthThe new month
[in]dayThe new day

Definition at line 220 of file stdSubDir.hpp.

◆ stdSubDir() [4/4]

template<typename verboseT >
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

Parameters
[in]subdirThe string of format YYYY_MM_DD

Definition at line 226 of file stdSubDir.hpp.

Member Function Documentation

◆ addDay()

◆ day()

template<typename verboseT >
unsigned int MagAOX::file::stdSubDir< verboseT >::day ( mx::error_t *  errc = nullptr) const

Get the current value of m_day.

Returns
the current value of m_day if valid
std::numeric_limits<unsigned int>::max() if invalid
Parameters
[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().

◆ followingSubdir()

template<typename verboseT >
stdSubDir< verboseT > MagAOX::file::stdSubDir< verboseT >::followingSubdir ( mx::error_t *  errc = nullptr)

Get the following day's subdirectory.

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

◆ invalidate()

template<typename verboseT >
void MagAOX::file::stdSubDir< verboseT >::invalidate ( )

Invalidate this instance.

Definition at line 863 of file stdSubDir.hpp.

◆ month()

template<typename verboseT >
unsigned int MagAOX::file::stdSubDir< verboseT >::month ( mx::error_t *  errc = nullptr) const

Get the current value of m_month.

Returns
the current value of m_month if valid
std::numeric_limits<unsigned int>::max() if invalid
Parameters
[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().

◆ operator!=()

template<typename verboseT >
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.

◆ operator<()

template<typename verboseT >
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.

◆ operator<=()

template<typename verboseT >
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.

◆ operator==()

template<typename verboseT >
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.

◆ operator>()

template<typename verboseT >
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.

◆ operator>=()

template<typename verboseT >
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.

◆ path() [1/2]

◆ path() [2/2]

template<typename verboseT >
std::string MagAOX::file::stdSubDir< verboseT >::path ( mx::error_t *  errc = nullptr) const

Get the current value of m_subDir.

Returns
the current value of m_subDir if valid and path construction succeeds
empty string "" if invalid or path construction fails
Parameters
[in]errc[optional] error code set during path creation

Definition at line 377 of file stdSubDir.hpp.

Referenced by audibleAlerts.personality.Recording::__eq__().

◆ previousSubdir()

template<typename verboseT >
stdSubDir< verboseT > MagAOX::file::stdSubDir< verboseT >::previousSubdir ( mx::error_t *  errc = nullptr)

Get the previous day's subdirectory.

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

◆ subDay()

template<typename verboseT >
mx::error_t MagAOX::file::stdSubDir< verboseT >::subDay ( )

◆ valid()

◆ year()

template<typename verboseT >
int MagAOX::file::stdSubDir< verboseT >::year ( mx::error_t *  errc = nullptr) const

Get the current value of m_year.

Returns
the current value of m_year if valid
std::numeric_limits<int>::max() if invalid
Parameters
[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().

◆ ymd()

template<typename verboseT >
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

Parameters
[in]yearThe new year
[in]monthThe new month
[in]dayThe new day

Definition at line 232 of file stdSubDir.hpp.

Referenced by libXWCTest::fileTest::stdSubDirTest::TEST_CASE().

Member Data Documentation

◆ m_path

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
std::string MagAOX::file::stdSubDir< verboseT >::m_path
mutableprotected

The path string. Only constructed on demand.

Definition at line 43 of file stdSubDir.hpp.

◆ m_pathMade

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
bool MagAOX::file::stdSubDir< verboseT >::m_pathMade { false }
mutableprotected

Whether or not the path string has been constructed.

Definition at line 41 of file stdSubDir.hpp.

◆ m_sysday

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
std::chrono::sys_days MagAOX::file::stdSubDir< verboseT >::m_sysday
protected

◆ m_valid

template<typename verboseT = XWC_DEFAULT_VERBOSITY>
bool MagAOX::file::stdSubDir< verboseT >::m_valid { false }
protected

Whether or not the components are valid.

Definition at line 45 of file stdSubDir.hpp.


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