CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::FileData Class Reference

#include <FileData.hh>

Detailed Description

Interface class to check and/or store path and last_write_time of file on disk. Used to determine if files have been updated or deleted.

Definition at line 9 of file FileData.hh.

Public Member Functions

 FileData (std::string const &_path, std::time_t _timestamp)
 Construct with path and explicit timestamp. More...
 
 FileData (std::string const &_path)
 Construct with path, timestamp is set if file exists at path. More...
 
 FileData ()
 default constructor More...
 
std::string const & path () const
 return stored path More...
 
std::time_t timestamp () const
 return stored timestamp. Timestamp corresponds to last_write_time of file timestamp defaults to 0 if file does not exist. More...
 
bool up_to_date () const
 checks timestamp of file at path. Returns true if last_write_time of file matches timestamp returns false otherwise, or if file doesn't exist and stored timestamp is not zero (indicated file has been deleted) More...
 
bool empty () const
 Returns true if path is empty. More...
 
bool exists () const
 checks path for existing file. Does not alter stored timestamp More...
 
void refresh ()
 Updates timestamp using stored path. More...
 
bool operator== (FileData const &other) const
 returns true if other FileData has same stored path and timestamp More...
 

Private Attributes

std::string m_path
 
std::time_t m_timestamp
 

Constructor & Destructor Documentation

◆ FileData() [1/3]

CASM::FileData::FileData ( std::string const &  _path,
std::time_t  _timestamp 
)
inline

Construct with path and explicit timestamp.

Definition at line 12 of file FileData.hh.

◆ FileData() [2/3]

CASM::FileData::FileData ( std::string const &  _path)
inline

Construct with path, timestamp is set if file exists at path.

Definition at line 16 of file FileData.hh.

◆ FileData() [3/3]

CASM::FileData::FileData ( )
inline

default constructor

Definition at line 21 of file FileData.hh.

Member Function Documentation

◆ empty()

bool CASM::FileData::empty ( ) const
inline

Returns true if path is empty.

Definition at line 36 of file FileData.hh.

◆ exists()

bool CASM::FileData::exists ( ) const

checks path for existing file. Does not alter stored timestamp

Definition at line 9 of file FileData.cc.

◆ operator==()

bool CASM::FileData::operator== ( FileData const &  other) const
inline

returns true if other FileData has same stored path and timestamp

Definition at line 45 of file FileData.hh.

◆ path()

std::string const& CASM::FileData::path ( ) const
inline

return stored path

Definition at line 24 of file FileData.hh.

◆ refresh()

void CASM::FileData::refresh ( )

Updates timestamp using stored path.

Definition at line 11 of file FileData.cc.

◆ timestamp()

std::time_t CASM::FileData::timestamp ( ) const
inline

return stored timestamp. Timestamp corresponds to last_write_time of file timestamp defaults to 0 if file does not exist.

Definition at line 28 of file FileData.hh.

◆ up_to_date()

bool CASM::FileData::up_to_date ( ) const
inline

checks timestamp of file at path. Returns true if last_write_time of file matches timestamp returns false otherwise, or if file doesn't exist and stored timestamp is not zero (indicated file has been deleted)

Definition at line 33 of file FileData.hh.

Member Data Documentation

◆ m_path

std::string CASM::FileData::m_path
private

Definition at line 51 of file FileData.hh.

◆ m_timestamp

std::time_t CASM::FileData::m_timestamp
private

Definition at line 52 of file FileData.hh.


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