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
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
lsst::pex.policy::PolicySource Class Referenceabstract

an abstract class representing a source of serialized Policy parameter data. This might be a file or a stream; sub-classes handle the different possibilities. This class can determine which format the data is in (which may involve reading the first few characters) and load it into a Policy. More...

#include <PolicySource.h>

Inheritance diagram for lsst::pex.policy::PolicySource:
lsst::daf::base::Citizen lsst::pex.policy::PolicyFile lsst::pex.policy::PolicyString lsst::pex.policy::DefaultPolicyFile lsst::pex.policy::UrnPolicyFile

Public Member Functions

 PolicySource (SupportedFormats::Ptr fmts=defaultFormats)
 
virtual ~PolicySource ()
 
virtual const std::string & getFormatName ()=0
 
virtual void load (Policy &policy) const =0
 
virtual void load (Policy &policy)=0
 
- Public Member Functions inherited from lsst::daf::base::Citizen
 Citizen (const std::type_info &)
 
 Citizen (Citizen const &)
 
 ~Citizen ()
 
Citizenoperator= (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...
 

Static Public Attributes

static SupportedFormats::Ptr defaultFormats
 

Protected Attributes

SupportedFormats::Ptr _formats
 

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)
 
- 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...
 

Detailed Description

an abstract class representing a source of serialized Policy parameter data. This might be a file or a stream; sub-classes handle the different possibilities. This class can determine which format the data is in (which may involve reading the first few characters) and load it into a Policy.

Definition at line 53 of file PolicySource.h.

Constructor & Destructor Documentation

lsst::pex.policy::PolicySource::PolicySource ( SupportedFormats::Ptr  fmts = defaultFormats)
inline

create a Policy file that points a file with given path.

Parameters
fmtsthe list of formats to support

Definition at line 60 of file PolicySource.h.

61  : lsst::daf::base::Citizen(typeid(this)), _formats(fmts)
62  {
63  if (defaultFormats->size() == 0)
65  }
static SupportedFormats::Ptr defaultFormats
Definition: PolicySource.h:135
static void initDefaultFormats(SupportedFormats &sf)
SupportedFormats::Ptr _formats
Definition: PolicySource.h:142
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
lsst::pex.policy::PolicySource::~PolicySource ( )
virtual

destroy the source

Definition at line 35 of file PolicySource.cc.

35 { }

Member Function Documentation

virtual const std::string& lsst::pex.policy::PolicySource::getFormatName ( )
pure virtual

identifiers for the different supported formatsUnknown and unsupported XML format Policy authoring format (PAF) Supported format but unknown determine the format that the data is stored in and return its format type identifier. Note that UNKNOWN will be returned if the format is supported–that is, the data can be read into a Policy object–but otherwise does not have a defined type identifier defined. This may cause the first few records of the source to be read.

Exceptions
IOErrorif an error occurs while reading the first few characters of the source stream. 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.
IOErrorif an error occurs while reading the first few characters of the source stream.

Implemented in lsst::pex.policy::PolicyFile, and lsst::pex.policy::PolicyString.

virtual void lsst::pex.policy::PolicySource::load ( Policy policy) const
pure virtual

load the data from this Policy source into a Policy object

Parameters
policythe policy object to load the data into
Exceptions
ParserExceptionif an error occurs while parsing the data
IOErrorif an I/O error occurs while reading from the source stream.

Implemented in lsst::pex.policy::PolicyFile, lsst::pex.policy::DefaultPolicyFile, and lsst::pex.policy::PolicyString.

virtual void lsst::pex.policy::PolicySource::load ( Policy policy)
pure virtual

load the data from this Policy source into a Policy object

Parameters
policythe policy object to load the data into
Exceptions
ParserExceptionif an error occurs while parsing the data
IOErrorif an I/O error occurs while reading from the source stream.

Implemented in lsst::pex.policy::PolicyFile, and lsst::pex.policy::PolicyString.

Member Data Documentation

SupportedFormats::Ptr lsst::pex.policy::PolicySource::_formats
protected

Definition at line 142 of file PolicySource.h.

SupportedFormats::Ptr lsst::pex.policy::PolicySource::defaultFormats
static

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.


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