58 : _myos(new
std::ofstream(file.c_str(), append ?
std::ios_base::app
62 _myos->exceptions(std::ofstream::failbit | std::ofstream::badbit);
67 if (_myos)
delete _myos;
76 if (ss)
return ss->
str();
96 (*_os) <<
"#<?cfg paf policy ?>" <<
std::endl;
99 Policy::StringArray::const_iterator ni;
100 for(ni=names.begin(); ni != names.end(); ++ni) {
103 if (tp ==
typeid(
bool)) {
104 writeBools(*ni, policy.getBoolArray(*ni));
106 else if (tp ==
typeid(
int)) {
107 writeInts(*ni, policy.getIntArray(*ni));
109 else if (tp ==
typeid(
double)) {
110 writeDoubles(*ni, policy.getDoubleArray(*ni));
113 writeStrings(*ni, policy.getStringArray(*ni));
116 writePolicies(*ni, policy.getPolicyArray(*ni));
119 writeFiles(*ni, policy.getFileArray(*ni));
125 catch (NameNotFound&) {
127 writeString(*ni,
"<missing data>");
136 writeBools(name, vals);
142 writeInts(name, vals);
148 writeDoubles(name, vals);
156 writeStrings(name, vals);
162 writePolicies(name, vals);
166 const PolicyFile& value)
170 writeFiles(name, vals);
static std::type_info const & typeOfT()
Get type info for the specified class.
virtual void write(const Policy &policy, bool doDecl=false)
write the contents of a policy the attached stream.
definition of the PolicyFile class
std::vector< std::string > StringArray
virtual void writeBool(const std::string &name, bool value)
write the given property out as policy data
the definition of the PolicyWriter class
virtual void writeDouble(const std::string &name, double value)
write the given property out as policy data
std::shared_ptr< FrameSet > append(FrameSet const &first, FrameSet const &second)
Construct a FrameSet that performs two transformations in series.
std::shared_ptr< PolicyFile > FilePtr
std::string toString()
return the written data as a string.
A base class for image defects.
virtual void writeString(const std::string &name, const std::string &value)
write the given property out as policy data
std::shared_ptr< Policy > Ptr
Reports errors in the logical structure of the program.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
PolicyWriter(std::ostream *out=0)
create a writer attached to an output stream.
virtual ~PolicyWriter()
delete this writer
Class for storing generic metadata.
Base class for all persistable classes.
void close()
close the output stream.
virtual void writePolicy(const std::string &name, const Policy &value)
write the given property out as policy data
virtual void writeInt(const std::string &name, int value)
write the given property out as policy data
virtual void writeFile(const std::string &name, const PolicyFile &value)
write the given property out as policy data