lsst.pex.policy
14.0-1-g4b114ac+15
|
a representation of a file containing Policy parameter data. More...
#include <PolicyFile.h>
Public Types | |
typedef unsigned long | memId |
typedef memId(* | memNewCallback) (const memId cid) |
typedef memId(* | memCallback) (const Citizen *ptr) |
typedef std::shared_ptr< Persistable > | Ptr |
Public Member Functions | |
PolicyFile (const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a "null" Policy file that points to an unspecified file. More... | |
const std::string | getPath () const |
return the file path as a string More... | |
bool | exists () const |
return true if the file exists. More... | |
virtual const std::string & | getFormatName () |
return the name of the format that the data is stored in. More... | |
const std::string & | getFormatName () const |
std::string | repr () const |
void | markPersistent (void) |
memId | getId () const |
void | serialize (Archive &, unsigned int const) |
PolicyFile (const std::string &filepath, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a Policy file that points a file with given path. More... | |
PolicyFile (const char *filepath, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a Policy file that points a file with given path. More... | |
PolicyFile (const boost::filesystem::path &filepath, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a Policy file that points a file with given path. More... | |
PolicyFile (const std::string &filepath, const PolicyParserFactory::Ptr &parserFactory) | |
create a Policy file that points a file with given path. More... | |
PolicyFile (const boost::filesystem::path &filepath, const PolicyParserFactory::Ptr &parserFactory) | |
create a Policy file that points a file with given path. More... | |
PolicyFile (const std::string &filepath, const boost::filesystem::path &reposDir, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a Policy file that points a file with given path in a policy file repository. More... | |
PolicyFile (const boost::filesystem::path &filepath, const boost::filesystem::path &reposDir, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a Policy file that points a file with given path in a policy file repository. More... | |
PolicyFile (const std::string &filepath, const boost::filesystem::path &reposDir, const PolicyParserFactory::Ptr &parserFactory) | |
create a Policy file that points a file with given path in a policy file repository. More... | |
PolicyFile (const boost::filesystem::path &filepath, const boost::filesystem::path &reposDir, const PolicyParserFactory::Ptr &parserFactory) | |
create a Policy file that points a file with given path in a policy file repository. More... | |
virtual void | load (Policy &policy) const |
load the data from this Policy source into a Policy object More... | |
virtual void | load (Policy &policy) |
load the data from this Policy source into a Policy object More... | |
Static Public Member Functions | |
static bool | hasBeenCorrupted () |
static memId | getNextMemId () |
static int | init () |
static int | census (int, memId startingMemId=0) |
static void | census (std::ostream &stream, memId startingMemId=0) |
static const std::vector< const Citizen *> * | census () |
static int | census (int, memId startingMemId=0) |
static void | census (std::ostream &stream, memId startingMemId=0) |
static const std::vector< const Citizen *> * | census () |
static memId | setNewCallbackId (memId id) |
static memId | setNewCallbackId (memId id) |
static memId | setDeleteCallbackId (memId id) |
static memId | setDeleteCallbackId (memId id) |
static memNewCallback | setNewCallback (memNewCallback func) |
static memCallback | setDeleteCallback (memCallback func) |
static memCallback | setCorruptionCallback (memCallback func) |
Public Attributes | |
magicSentinel | |
Static Public Attributes | |
static const std::string | EXT_PAF |
static const std::string | EXT_XML |
the PAF file extension, ".paf" More... | |
static const boost::regex | SPACE_RE |
the XML file extension, ".xml" More... | |
static const boost::regex | COMMENT |
reg-exp for an empty line More... | |
static const boost::regex | CONTENTID |
reg-exp for the start of a comment More... | |
static SupportedFormats::Ptr | defaultFormats |
returns true if the given string containing a content identifier indicates that it contains dictionary data. More... | |
Protected Attributes | |
boost::filesystem::path | _file |
the path to the underlying policy file More... | |
SupportedFormats::Ptr | _formats |
a representation of a file containing Policy parameter data.
When this class represents a file that actually exists on disk, then it can determine which format it is in and load its contents into a Policy.
Definition at line 58 of file PolicyFile.h.
|
explicit |
create a Policy file that points a file with given path.
Typically, one need only provide a file path; this class will determine the type automatically using the default set of supported formats. If you want to control what formats (and the particular parsers) to allow, you can provide your own SupportedFormats instance. To force interpretation as a particular format, you can a PolicyParserFactory instance in lieu of a SupportedFormats (see PolicyFile(const std::string&, const SupportedFormats::Ptr&) ).
filepath | the path to the file, either as a string or a boost::filesystem::path instance |
fmts | a SupportedFormats object to use. An instance encapsulates a configured set of known formats. |
|
explicit |
create a Policy file that points a file with given path.
Typically, one need only provide a file path; this class will determine the type automatically using the default set of supported formats. If you want to control what formats (and the particular parsers) to allow, you can provide your own SupportedFormats instance. To force interpretation as a particular format, you can a PolicyParserFactory instance in lieu of a SupportedFormats (see PolicyFile(const std::string&, const SupportedFormats::Ptr&) ).
filepath | the path to the file, either as a string or a boost::filesystem::path instance |
fmts | a SupportedFormats object to use. An instance encapsulates a configured set of known formats. |
|
explicit |
create a Policy file that points a file with given path.
Typically, one need only provide a file path; this class will determine the type automatically using the default set of supported formats. If you want to control what formats (and the particular parsers) to allow, you can provide your own SupportedFormats instance. To force interpretation as a particular format, you can a PolicyParserFactory instance in lieu of a SupportedFormats (see PolicyFile(const std::string&, const SupportedFormats::Ptr&) ).
filepath | the path to the file, either as a string or a boost::filesystem::path instance |
fmts | a SupportedFormats object to use. An instance encapsulates a configured set of known formats. |
lsst::pex::policy::PolicyFile::PolicyFile | ( | const std::string & | filepath, |
const PolicyParserFactory::Ptr & | parserFactory | ||
) |
create a Policy file that points a file with given path.
These constructors allow you to force interpretation as a particular format by passing in the PolicyParserFactory to use.
filepath | the path to the file, either as a string or a boost::filesystem::path instance |
parserFactory | a PolicyParserFactory implementation to be used in parsing the file, assuming a particular format. |
lsst::pex::policy::PolicyFile::PolicyFile | ( | const boost::filesystem::path & | filepath, |
const PolicyParserFactory::Ptr & | parserFactory | ||
) |
create a Policy file that points a file with given path.
These constructors allow you to force interpretation as a particular format by passing in the PolicyParserFactory to use.
filepath | the path to the file, either as a string or a boost::filesystem::path instance |
parserFactory | a PolicyParserFactory implementation to be used in parsing the file, assuming a particular format. |
lsst::pex::policy::PolicyFile::PolicyFile | ( | const std::string & | filepath, |
const boost::filesystem::path & | reposDir, | ||
const SupportedFormats::Ptr & | fmts = defaultFormats |
||
) |
create a Policy file that points a file with given path in a policy file repository.
Typically, one need only provide a file path; this class will determine the type automatically using the default set of supported formats. If you want to control what formats (and the particular parsers) to allow, you can provide your own SupportedFormats instance. To force interpretation as a particular format, you can a PolicyParserFactory instance in lieu of a SupportedFormats (see PolicyFile(const std::string&, const SupportedFormats::Ptr&) ).
filepath | the path to the file, either as a string or a boost::filesystem::path instance |
reposDir | the policy repository directory to assume. If filepath is a relative path, then the full path to the file will be relative to this repository directory. |
fmts | a SupportedFormats object to use. An instance encapsulates a configured set of known formats. |
lsst::pex::policy::PolicyFile::PolicyFile | ( | const boost::filesystem::path & | filepath, |
const boost::filesystem::path & | reposDir, | ||
const SupportedFormats::Ptr & | fmts = defaultFormats |
||
) |
create a Policy file that points a file with given path in a policy file repository.
Typically, one need only provide a file path; this class will determine the type automatically using the default set of supported formats. If you want to control what formats (and the particular parsers) to allow, you can provide your own SupportedFormats instance. To force interpretation as a particular format, you can a PolicyParserFactory instance in lieu of a SupportedFormats (see PolicyFile(const std::string&, const SupportedFormats::Ptr&) ).
filepath | the path to the file, either as a string or a boost::filesystem::path instance |
reposDir | the policy repository directory to assume. If filepath is a relative path, then the full path to the file will be relative to this repository directory. |
fmts | a SupportedFormats object to use. An instance encapsulates a configured set of known formats. |
lsst::pex::policy::PolicyFile::PolicyFile | ( | const std::string & | filepath, |
const boost::filesystem::path & | reposDir, | ||
const PolicyParserFactory::Ptr & | parserFactory | ||
) |
create a Policy file that points a file with given path in a policy file repository.
These constructors allow you to force interpretation as a particular format by passing in the PolicyParserFactory to use.
filepath | the path to the file, either as a string or a boost::filesystem::path instance |
reposDir | the policy repository directory to assume. If filepath is a relative path, then the full path to the file will be relative to this repository directory. |
parserFactory | a PolicyParserFactory implementation to be used in parsing the file, assuming a particular format. |
lsst::pex::policy::PolicyFile::PolicyFile | ( | const boost::filesystem::path & | filepath, |
const boost::filesystem::path & | reposDir, | ||
const PolicyParserFactory::Ptr & | parserFactory | ||
) |
create a Policy file that points a file with given path in a policy file repository.
These constructors allow you to force interpretation as a particular format by passing in the PolicyParserFactory to use.
filepath | the path to the file, either as a string or a boost::filesystem::path instance |
reposDir | the policy repository directory to assume. If filepath is a relative path, then the full path to the file will be relative to this repository directory. |
parserFactory | a PolicyParserFactory implementation to be used in parsing the file, assuming a particular format. |
lsst::pex::policy::PolicyFile::PolicyFile | ( | const SupportedFormats::Ptr & | fmts = defaultFormats | ) |
create a "null" Policy file that points to an unspecified file.
fmts | a SupportedFormats object to use. An instance encapsulates a configured set of known formats. |
|
inline |
return true if the file exists.
Definition at line 181 of file PolicyFile.h.
|
virtual |
return the name of the format that the data is stored in.
This may cause the first few records of the source to be read. In this implementation, once the format is definitely determined, the format name is cached internally, preventing re-determination on the next call to this function.
IOError | if an error occurs while reading the first few characters of the source stream. |
Implements lsst::pex::policy::PolicySource.
|
inline |
Definition at line 193 of file PolicyFile.h.
|
inline |
return the file path as a string
Definition at line 176 of file PolicyFile.h.
|
virtual |
load the data from this Policy source into a Policy object
policy | the policy object to load the data into |
ParserException | if an error occurs while parsing the data |
IOError | if an I/O error occurs while reading from the source stream. |
Implements lsst::pex::policy::PolicySource.
Reimplemented in lsst::pex::policy::DefaultPolicyFile.
|
inlinevirtual |
load the data from this Policy source into a Policy object
policy | the policy object to load the data into |
ParserException | if an error occurs while parsing the data |
IOError | if an I/O error occurs while reading from the source stream. |
Implements lsst::pex::policy::PolicySource.
Definition at line 206 of file PolicyFile.h.
|
protected |
the path to the underlying policy file
Definition at line 226 of file PolicyFile.h.
|
protectedinherited |
Definition at line 142 of file PolicySource.h.
|
static |
reg-exp for an empty line
Definition at line 215 of file PolicyFile.h.
|
static |
reg-exp for the start of a comment
reg-exp for a Policy content identifier, "<?cfg [format] [content] ?>"
Definition at line 220 of file PolicyFile.h.
|
staticinherited |
returns true if the given string containing a content identifier indicates that it contains dictionary data.
Dictionary data has a content id of "<?cfg ... dictionary ?>" (where ... indicates the format); policy data has an id of "<?cfg ... policy ?>". a default set of formats
Definition at line 135 of file PolicySource.h.
|
static |
Definition at line 211 of file PolicyFile.h.
|
static |
the PAF file extension, ".paf"
Definition at line 212 of file PolicyFile.h.
|
static |
the XML file extension, ".xml"
Definition at line 214 of file PolicyFile.h.