lsst.pex.policy
15.0+20
|
a representation of a string containing Policy parameter data More...
#include <PolicyString.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 | |
PolicyString (const std::string &data, const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a PolicyString that's wrapped around a given string. More... | |
PolicyString (const SupportedFormats::Ptr &fmts=defaultFormats) | |
create a "null" Policy formed from an empty string. More... | |
const std::string & | getData () const |
return the wrapped policy data as a string More... | |
std::string | repr () const |
void | markPersistent (void) |
memId | getId () const |
void | serialize (Archive &, unsigned int const) |
virtual const std::string & | getFormatName () |
return the name of the format that the data is stored in. More... | |
const std::string & | getFormatName () const |
return the name of the format that the data is stored in. More... | |
virtual void | load (Policy &policy) |
load the data from this Policy source into a Policy object More... | |
void | load (Policy &policy) const |
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 boost::regex | SPACE_RE |
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 | |
std::string | _data |
the policy data More... | |
SupportedFormats::Ptr | _formats |
a representation of a string containing Policy parameter data
This class facilitates reading data from a string. This class is especially useful for supporting string I/O from Python. The data is encoded in a supported format (just like the contents of a policy file).
Definition at line 52 of file PolicyString.h.
|
explicit |
create a PolicyString that's wrapped around a given string.
data | 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::PolicyString::PolicyString | ( | const SupportedFormats::Ptr & | fmts = defaultFormats | ) |
create a "null" Policy formed from an empty string.
fmts | a SupportedFormats object to use. An instance encapsulates a configured set of known formats. |
|
inline |
return the wrapped policy data as a string
Definition at line 75 of file PolicyString.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 |
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. |
Definition at line 88 of file PolicyString.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.
|
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 102 of file PolicyString.h.
|
protected |
the policy data
Definition at line 118 of file PolicyString.h.
|
protectedinherited |
Definition at line 142 of file PolicySource.h.
|
static |
reg-exp for an empty line
Definition at line 108 of file PolicyString.h.
|
static |
reg-exp for the start of a comment
reg-exp for a Policy content identifier, "<?cfg [format] [content] ?>"
Definition at line 112 of file PolicyString.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 107 of file PolicyString.h.