LSSTApplications
10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
|
a representation of a file containing Policy parameter data. More...
#include <PolicyFile.h>
Public Member Functions | |
PolicyFile (const SupportedFormats::Ptr &fmts=defaultFormats) | |
const std::string | getPath () const |
bool | exists () const |
virtual const std::string & | getFormatName () |
const std::string & | getFormatName () const |
PolicyFile (const std::string &filepath, const SupportedFormats::Ptr &fmts=defaultFormats) | |
PolicyFile (const char *filepath, const SupportedFormats::Ptr &fmts=defaultFormats) | |
PolicyFile (const boost::filesystem::path &filepath, const SupportedFormats::Ptr &fmts=defaultFormats) | |
PolicyFile (const std::string &filepath, const PolicyParserFactory::Ptr &parserFactory) | |
PolicyFile (const boost::filesystem::path &filepath, const PolicyParserFactory::Ptr &parserFactory) | |
PolicyFile (const std::string &filepath, const boost::filesystem::path &reposDir, const SupportedFormats::Ptr &fmts=defaultFormats) | |
PolicyFile (const boost::filesystem::path &filepath, const boost::filesystem::path &reposDir, const SupportedFormats::Ptr &fmts=defaultFormats) | |
PolicyFile (const std::string &filepath, const boost::filesystem::path &reposDir, const PolicyParserFactory::Ptr &parserFactory) | |
PolicyFile (const boost::filesystem::path &filepath, const boost::filesystem::path &reposDir, const PolicyParserFactory::Ptr &parserFactory) | |
virtual void | load (Policy &policy) const |
virtual void | load (Policy &policy) |
Public Member Functions inherited from lsst::pex.policy::PolicySource | |
PolicySource (SupportedFormats::Ptr fmts=defaultFormats) | |
virtual | ~PolicySource () |
Public Member Functions inherited from lsst::daf::base::Citizen | |
Citizen (const std::type_info &) | |
Citizen (Citizen const &) | |
~Citizen () | |
Citizen & | operator= (Citizen const &) |
std::string | repr () const |
Return a string representation of a Citizen. More... | |
void | markPersistent (void) |
Mark a Citizen as persistent and not destroyed until process end. More... | |
memId | getId () const |
Return the Citizen's ID. More... | |
Public Member Functions inherited from lsst::daf::base::Persistable | |
Persistable (void) | |
virtual | ~Persistable (void) |
template<class Archive > | |
void | serialize (Archive &, unsigned int const) |
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 Public Attributes inherited from lsst::pex.policy::PolicySource | |
static SupportedFormats::Ptr | defaultFormats |
Protected Attributes | |
boost::filesystem::path | _file |
Protected Attributes inherited from lsst::pex.policy::PolicySource | |
SupportedFormats::Ptr | _formats |
Private Member Functions | |
const std::string & | cacheName (const std::string &name) |
Private Attributes | |
std::string | _format |
PolicyParserFactory::Ptr | _pfact |
Additional Inherited Members | |
Public Types inherited from lsst::daf::base::Citizen | |
enum | { magicSentinel = 0xdeadbeef } |
typedef unsigned long | memId |
Type of the block's ID. More... | |
typedef memId(* | memNewCallback )(const memId cid) |
A function used to register a callback. More... | |
typedef memId(* | memCallback )(const Citizen *ptr) |
Public Types inherited from lsst::daf::base::Persistable | |
typedef boost::shared_ptr < Persistable > | Ptr |
Static Public Member Functions inherited from lsst::daf::base::Citizen | |
static bool | hasBeenCorrupted () |
Check all allocated blocks for corruption. More... | |
static memId | getNextMemId () |
Return the memId of the next object to be allocated. More... | |
static int | init () |
Called once when the memory system is being initialised. More... | |
static int | census (int, memId startingMemId=0) |
How many active Citizens are there? More... | |
static void | census (std::ostream &stream, memId startingMemId=0) |
Print a list of all active Citizens to stream, sorted by ID. More... | |
static const std::vector < const Citizen * > * | census () |
Return a (newly allocated) std::vector of active Citizens sorted by ID. More... | |
static memId | setNewCallbackId (memId id) |
Call the NewCallback when block is allocated. More... | |
static memId | setDeleteCallbackId (memId id) |
Call the current DeleteCallback when block is deleted. More... | |
static memNewCallback | setNewCallback (memNewCallback func) |
Set the NewCallback function. More... | |
static memCallback | setDeleteCallback (memCallback func) |
Set the DeleteCallback function. More... | |
static memCallback | setCorruptionCallback (memCallback func) |
Set the CorruptionCallback function. More... | |
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. |
|
inlineprivate |
Definition at line 229 of file PolicyFile.h.
|
inline |
|
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 |
|
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.
|
private |
Definition at line 234 of file PolicyFile.h.
|
private |
Definition at line 235 of file PolicyFile.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.
|
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.