casa
$Rev:20696$
|
#include <Casarc.h>
Classes | |
class | meta_entry_ |
Public Types | |
typedef std::map< std::string, std::string >::const_iterator | iterator |
Public Member Functions | |
void | put (const std::string &keyword, const std::string &value) |
adds the keyword->value mapping | |
std::string | get (const std::string &keyword) |
retrieves the mapping for keyword (or "" if the mapping is not defined) | |
bool | get (const std::string &keyword, std::string &value) |
retrieves the mapping for keyword in value (and returns true if the mapping is defined or false otherwise) | |
size_t | size () const |
const std::string & | path () const |
path to the file that this Casarc mirrors... | |
iterator | begin () |
iterator | end () |
Static Public Member Functions | |
static Casarc & | instance () |
return default casarc file, e.g. | |
static void | setDefaultPath (const std::string &path) |
set and clear the default casarc path (to something other than ~/.casarc) | |
static void | clearDefaultPath () |
static Casarc & | instance (const std::string &path) |
return a casarc object attached to a particular file | |
static const std::list< Casarc * > & | list () |
return the list of rcfiles that have been loaded | |
Private Types | |
enum | lock_mode { READ, READ_WRITE, WRITE, APPEND } |
Private Member Functions | |
void | close (int) |
int | lock (lock_mode mode) |
returns a file descriptor or -1 on error... | |
void | unlock (int fd) |
void | sync () |
double | current_modification_time (struct stat &buf) |
void | read_file () |
Casarc (const std::string &path) | |
path is the path to the .casarc (or .aipsrc file) | |
~Casarc () | |
Static Private Member Functions | |
static void | startup () |
static void | shutdown () |
Private Attributes | |
char * | mapped_file |
off_t | mapped_file_size |
std::list< int > | stale_fds |
std::list< pid_t > | have_lock |
std::string | filename |
double | timestamp |
std::map< std::string, std::string > | rcmap |
std::map< std::string, meta_entry_ > | rcmetamap |
this is broken off separate from the rcmap to allow the rcmap to be used for iteration by users of this class... | |
ino_t | inode |
Static Private Attributes | |
static std::map< ino_t, Casarc * > * | rcfiles |
singleton Casarcs, (inode->casarc) | |
static std::map< std::string, Casarc * > * | filenames |
static std::list< Casarc * > * | rclist |
static std::string * | default_path |
static bool | initialized |
Friends | |
class | CasarcCleanup |
typedef std::map<std::string,std::string>::const_iterator casa::Casarc::iterator |
enum casa::Casarc::lock_mode [private] |
casa::Casarc::Casarc | ( | const std::string & | path | ) | [private] |
path is the path to the .casarc (or .aipsrc file)
casa::Casarc::~Casarc | ( | ) | [inline, private] |
static void casa::Casarc::clearDefaultPath | ( | ) | [static] |
void casa::Casarc::close | ( | int | ) | [private] |
double casa::Casarc::current_modification_time | ( | struct stat & | buf | ) | [private] |
std::string casa::Casarc::get | ( | const std::string & | keyword | ) |
retrieves the mapping for keyword (or "" if the mapping is not defined)
bool casa::Casarc::get | ( | const std::string & | keyword, |
std::string & | value | ||
) |
retrieves the mapping for keyword in value (and returns true if the mapping is defined or false otherwise)
static Casarc& casa::Casarc::instance | ( | ) | [static] |
return default casarc file, e.g.
~/.casarc
static Casarc& casa::Casarc::instance | ( | const std::string & | path | ) | [static] |
return a casarc object attached to a particular file
static const std::list<Casarc*>& casa::Casarc::list | ( | ) | [static] |
return the list of rcfiles that have been loaded
int casa::Casarc::lock | ( | lock_mode | mode | ) | [private] |
returns a file descriptor or -1 on error...
const std::string& casa::Casarc::path | ( | ) | const [inline] |
void casa::Casarc::put | ( | const std::string & | keyword, |
const std::string & | value | ||
) |
adds the keyword->value mapping
void casa::Casarc::read_file | ( | ) | [private] |
static void casa::Casarc::setDefaultPath | ( | const std::string & | path | ) | [static] |
set and clear the default casarc path (to something other than ~/.casarc)
static void casa::Casarc::shutdown | ( | ) | [static, private] |
Referenced by casa::CasarcCleanup::~CasarcCleanup().
size_t casa::Casarc::size | ( | ) | const |
static void casa::Casarc::startup | ( | ) | [static, private] |
void casa::Casarc::sync | ( | ) | [private] |
void casa::Casarc::unlock | ( | int | fd | ) | [private] |
friend class CasarcCleanup [friend] |
std::string* casa::Casarc::default_path [static, private] |
std::string casa::Casarc::filename [private] |
std::map<std::string,Casarc*>* casa::Casarc::filenames [static, private] |
std::list<pid_t> casa::Casarc::have_lock [private] |
bool casa::Casarc::initialized [static, private] |
ino_t casa::Casarc::inode [private] |
char* casa::Casarc::mapped_file [private] |
off_t casa::Casarc::mapped_file_size [private] |
std::map<ino_t,Casarc*>* casa::Casarc::rcfiles [static, private] |
std::list<Casarc*>* casa::Casarc::rclist [static, private] |
std::map<std::string,std::string> casa::Casarc::rcmap [private] |
std::map<std::string,meta_entry_> casa::Casarc::rcmetamap [private] |
std::list<int> casa::Casarc::stale_fds [private] |
double casa::Casarc::timestamp [private] |