Serialize a PropertySet to a Boost archive. Handles text or XML archives, input or output.
120 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Serializing non-PropertySet");
122 ar & make_nvp(
"base",
123 boost::serialization::base_object<dafBase::Persistable>(*ps));
125 std::vector<std::string> names;
127 if (Archive::is_saving::value) {
129 nNames = names.size();
131 ar & make_nvp(
"nitems", nNames);
135 for (
size_t i = 0; i < nNames; ++i) {
136 if (Archive::is_saving::value) {
138 std::type_info
const&
id(ps->
typeOf(name));
140 if (
id ==
typeid(
bool)) type =
'b';
141 else if (
id ==
typeid(
char)) type =
'c';
142 else if (
id ==
typeid(
signed char)) type =
'y';
143 else if (
id ==
typeid(
unsigned char)) type =
'C';
144 else if (
id ==
typeid(
short)) type =
'w';
145 else if (
id ==
typeid(
unsigned short)) type =
'W';
146 else if (
id ==
typeid(
int)) type =
'i';
147 else if (
id ==
typeid(
unsigned int)) type =
'I';
148 else if (
id ==
typeid(
long)) type =
'l';
149 else if (
id ==
typeid(
unsigned long)) type =
'L';
150 else if (
id ==
typeid(
long long)) type =
'x';
151 else if (
id ==
typeid(
unsigned long long)) type =
'X';
152 else if (
id ==
typeid(
float)) type =
'f';
153 else if (
id ==
typeid(
double)) type =
'd';
154 else if (
id ==
typeid(std::string)) type =
's';
158 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
160 ": Unknown type in PropertySet serialize");
164 ar & make_nvp(
"name", name);
165 ar & make_nvp(
"type", type);
167 case 'b': serializeItem<Archive, bool>(ar,
name, ps);
break;
168 case 'c': serializeItem<Archive, char>(ar,
name, ps);
break;
169 case 'y': serializeItem<Archive, signed char>(ar,
name, ps);
break;
170 case 'C': serializeItem<Archive, unsigned char>(ar,
name, ps);
break;
171 case 'w': serializeItem<Archive, short>(ar,
name, ps);
break;
172 case 'W': serializeItem<Archive, unsigned short>(ar,
name, ps);
break;
173 case 'i': serializeItem<Archive, int>(ar,
name, ps);
break;
174 case 'I': serializeItem<Archive, unsigned int>(ar,
name, ps);
break;
175 case 'l': serializeItem<Archive, long>(ar,
name, ps);
break;
176 case 'L': serializeItem<Archive, unsigned long>(ar,
name, ps);
break;
177 case 'x': serializeItem<Archive, long long>(ar,
name, ps);
break;
178 case 'X': serializeItem<Archive, unsigned long long>(ar,
name, ps);
break;
179 case 'f': serializeItem<Archive, float>(ar,
name, ps);
break;
180 case 'd': serializeItem<Archive, double>(ar,
name, ps);
break;
181 case 's': serializeItem<Archive, std::string>(ar,
name, ps);
break;
182 case 'T': serializeDateTime<Archive>(ar,
name, ps);
break;
183 case 'p': serializeItem<Archive, dafBase::Persistable::Ptr>(ar,
name, ps);
break;
185 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
186 std::string(
"Unknown type reading PropertySet") +
187 type +
", name = " + name);
std::vector< std::string > paramNames(bool topLevelOnly=true) const
Class for handling dates/times, including MJD, UTC, and TAI.
table::Key< std::string > name
boost::shared_ptr< Persistable > Ptr
#define LSST_EXCEPT(type,...)
std::type_info const & typeOf(std::string const &name) const
Class for storing generic metadata.