lsst.pex.policy  17.0+9
Public Member Functions | Protected Attributes | List of all members
lsst::pex::policy::paf::PAFWriter Class Reference

An abstract interface for writing policy data to streams. More...

#include <PAFWriter.h>

Inheritance diagram for lsst::pex::policy::paf::PAFWriter:
lsst::pex::policy::PolicyWriter

Public Member Functions

 PAFWriter (std::ostream *out=0)
 create a writer attached to an output stream More...
 
 PAFWriter (std::ostream *out, const std::string indent)
 create a writer attached to an output stream More...
 
virtual ~PAFWriter ()
 delete this writer More...
 
virtual void write (const Policy &policy, bool doDecl=false)
 write the contents of a policy the attached stream. More...
 
void close ()
 close the output stream. More...
 
std::string toString ()
 return the written data as a string. More...
 
 PAFWriter (const std::string &file)
 create a writer attached to an output file More...
 
 PAFWriter (const char *file)
 create a writer attached to an output file More...
 
virtual void writeBools (const std::string &name, const Policy::BoolArray &values)
 write an array of property values with a given name More...
 
virtual void writeInts (const std::string &name, const Policy::IntArray &values)
 write an array of property values with a given name More...
 
virtual void writeDoubles (const std::string &name, const Policy::DoubleArray &values)
 write an array of property values with a given name More...
 
virtual void writeStrings (const std::string &name, const Policy::StringArray &values)
 write an array of property values with a given name More...
 
virtual void writePolicies (const std::string &name, const Policy::PolicyPtrArray &values)
 write an array of property values with a given name More...
 
virtual void writeFiles (const std::string &name, const Policy::FilePtrArray &values)
 write an array of property values with a given name More...
 
virtual void writeBool (const std::string &name, bool value)
 write the given property out as policy data More...
 
virtual void writeInt (const std::string &name, int value)
 write the given property out as policy data More...
 
virtual void writeDouble (const std::string &name, double value)
 write the given property out as policy data More...
 
virtual void writeString (const std::string &name, const std::string &value)
 write the given property out as policy data More...
 
virtual void writePolicy (const std::string &name, const Policy &value)
 write the given property out as policy data More...
 
virtual void writeFile (const std::string &name, const PolicyFile &value)
 write the given property out as policy data More...
 

Protected Attributes

std::string _indent
 the indentation string More...
 
std::ostream_os
 the output stream. More...
 

Detailed Description

An abstract interface for writing policy data to streams.

Definition at line 44 of file PAFWriter.h.

Constructor & Destructor Documentation

◆ PAFWriter() [1/4]

lsst::pex::policy::paf::PAFWriter::PAFWriter ( std::ostream out = 0)
inlineexplicit

create a writer attached to an output stream

Parameters
outthe output stream to write data to

Definition at line 51 of file PAFWriter.h.

◆ PAFWriter() [2/4]

lsst::pex::policy::paf::PAFWriter::PAFWriter ( std::ostream out,
const std::string  indent 
)
inline

create a writer attached to an output stream

Parameters
outthe output stream to write data to
indenta string (of spaces) to used as indentation for each line printed out.

Definition at line 60 of file PAFWriter.h.

◆ PAFWriter() [3/4]

lsst::pex::policy::paf::PAFWriter::PAFWriter ( const std::string file)
inlineexplicit

create a writer attached to an output file

Parameters
filethe output file

Definition at line 69 of file PAFWriter.h.

◆ PAFWriter() [4/4]

lsst::pex::policy::paf::PAFWriter::PAFWriter ( const char *  file)
inlineexplicit

create a writer attached to an output file

Parameters
filethe output file

Definition at line 71 of file PAFWriter.h.

◆ ~PAFWriter()

virtual lsst::pex::policy::paf::PAFWriter::~PAFWriter ( )
virtual

delete this writer

Member Function Documentation

◆ close()

void lsst::pex::policy::PolicyWriter::close ( )
inherited

close the output stream.

This has no effect if the attached stream is not a file stream.

◆ toString()

std::string lsst::pex::policy::PolicyWriter::toString ( )
inherited

return the written data as a string.

This string will be non-empty only if this class was was instantiated without an attached stream.

◆ write()

virtual void lsst::pex::policy::PolicyWriter::write ( const Policy policy,
bool  doDecl = false 
)
virtualinherited

write the contents of a policy the attached stream.

Each top-level parameter will be recursively printed.

Parameters
policythe policy data to write
doDeclif true, precede the data with the appropriate file format type.

◆ writeBool()

virtual void lsst::pex::policy::PolicyWriter::writeBool ( const std::string name,
bool  value 
)
virtualinherited

write the given property out as policy data

Parameters
namethe name to save the property as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuethe value to save under that name.

◆ writeBools()

virtual void lsst::pex::policy::paf::PAFWriter::writeBools ( const std::string name,
const Policy::BoolArray values 
)
virtual

write an array of property values with a given name

Parameters
namethe name to save the values as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuesthe values to save under that name.

Implements lsst::pex::policy::PolicyWriter.

◆ writeDouble()

virtual void lsst::pex::policy::PolicyWriter::writeDouble ( const std::string name,
double  value 
)
virtualinherited

write the given property out as policy data

Parameters
namethe name to save the property as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuethe value to save under that name.

◆ writeDoubles()

virtual void lsst::pex::policy::paf::PAFWriter::writeDoubles ( const std::string name,
const Policy::DoubleArray values 
)
virtual

write an array of property values with a given name

Parameters
namethe name to save the values as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuesthe values to save under that name.

Implements lsst::pex::policy::PolicyWriter.

◆ writeFile()

virtual void lsst::pex::policy::PolicyWriter::writeFile ( const std::string name,
const PolicyFile value 
)
virtualinherited

write the given property out as policy data

Parameters
namethe name to save the property as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuethe value to save under that name.

◆ writeFiles()

virtual void lsst::pex::policy::paf::PAFWriter::writeFiles ( const std::string name,
const Policy::FilePtrArray values 
)
virtual

write an array of property values with a given name

Parameters
namethe name to save the values as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuesthe values to save under that name.

Implements lsst::pex::policy::PolicyWriter.

◆ writeInt()

virtual void lsst::pex::policy::PolicyWriter::writeInt ( const std::string name,
int  value 
)
virtualinherited

write the given property out as policy data

Parameters
namethe name to save the property as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuethe value to save under that name.

◆ writeInts()

virtual void lsst::pex::policy::paf::PAFWriter::writeInts ( const std::string name,
const Policy::IntArray values 
)
virtual

write an array of property values with a given name

Parameters
namethe name to save the values as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuesthe values to save under that name.

Implements lsst::pex::policy::PolicyWriter.

◆ writePolicies()

virtual void lsst::pex::policy::paf::PAFWriter::writePolicies ( const std::string name,
const Policy::PolicyPtrArray values 
)
virtual

write an array of property values with a given name

Parameters
namethe name to save the values as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuesthe values to save under that name.

Implements lsst::pex::policy::PolicyWriter.

◆ writePolicy()

virtual void lsst::pex::policy::PolicyWriter::writePolicy ( const std::string name,
const Policy value 
)
virtualinherited

write the given property out as policy data

Parameters
namethe name to save the property as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuethe value to save under that name.

◆ writeString()

virtual void lsst::pex::policy::PolicyWriter::writeString ( const std::string name,
const std::string value 
)
virtualinherited

write the given property out as policy data

Parameters
namethe name to save the property as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuethe value to save under that name.

◆ writeStrings()

virtual void lsst::pex::policy::paf::PAFWriter::writeStrings ( const std::string name,
const Policy::StringArray values 
)
virtual

write an array of property values with a given name

Parameters
namethe name to save the values as. This may be a hierarchical name; however, an implementation is not guaranteed to support it. If it cannot, it should raise an exception.
valuesthe values to save under that name.

Implements lsst::pex::policy::PolicyWriter.

Member Data Documentation

◆ _indent

std::string lsst::pex::policy::paf::PAFWriter::_indent
protected

the indentation string

Definition at line 108 of file PAFWriter.h.

◆ _os

std::ostream* lsst::pex::policy::PolicyWriter::_os
protectedinherited

the output stream.

This should always be non-null.

Definition at line 141 of file PolicyWriter.h.


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