39 # define __attribute__(x) 50 #include <boost/serialization/nvp.hpp> 51 #include <boost/serialization/shared_ptr.hpp> 52 #include <boost/serialization/vector.hpp> 66 auto _log =
LOG_GET(
"daf.persistence.PropertySetFormatter");
73 using boost::serialization::make_nvp;
79 dafPersist::PropertySetFormatter::registration(
"PropertySet",
86 dafPersist::PropertySetFormatter::PropertySetFormatter(
100 LOGLS_TRACE(_log,
"PropertySetFormatter write start");
107 LOGLS_TRACE(_log,
"PropertySetFormatter write BoostStorage");
111 LOGLS_TRACE(_log,
"PropertySetFormatter write end");
115 LOGLS_TRACE(_log,
"PropertySetFormatter write XmlStorage");
119 LOGLS_TRACE(_log,
"PropertySetFormatter write end");
123 LOGLS_TRACE(_log,
"PropertySetFormatter write DbStorage");
127 std::string itemName = additionalData->getAsString(
"itemName");
130 if (_policy && _policy->exists(itemName)) {
131 itemPolicy = _policy->getPolicy(itemName);
132 if (itemPolicy->exists(
"TableName")) {
133 tableName = itemPolicy->getString(
"TableName");
139 if (itemPolicy && itemPolicy->exists(
"KeyList")) {
141 itemPolicy->getStringArray(
"KeyList"));
142 for (pexPolicy::Policy::StringArray::const_iterator it =
143 array.begin(); it != array.end(); ++it) {
152 it != list.
end(); ++it) {
153 std::string::size_type split = it->find(
'=');
156 if (split == std::string::npos) {
160 colName = it->
substr(0, split);
161 key = it->
substr(split + 1);
171 if (type ==
typeid(
bool)) {
174 else if (type ==
typeid(
char)) {
177 else if (type ==
typeid(
short)) {
180 else if (type ==
typeid(
int)) {
183 else if (type ==
typeid(
long)) {
186 else if (type ==
typeid(
long long)) {
187 db->
setColumn<
long long>(colName, ps->
get<
long long>(key));
189 else if (type ==
typeid(
float)) {
192 else if (type ==
typeid(
double)) {
205 " in PropertySetFormatter write");
209 LOGLS_TRACE(_log,
"PropertySetFormatter write end");
218 LOGLS_TRACE(_log,
"PropertySetFormatter read start");
221 LOGLS_TRACE(_log,
"PropertySetFormatter read BoostStorage");
225 LOGLS_TRACE(_log,
"PropertySetFormatter read end");
229 LOGLS_TRACE(_log,
"PropertySetFormatter read XmlStorage");
233 LOGLS_TRACE(_log,
"PropertySetFormatter read end");
std::shared_ptr< Policy > Ptr
std::shared_ptr< PropertySet > Ptr
Class for XML file storage.
Interface for DbStorage class.
void setColumn(std::string const &columnName, T const &value)
Set the value to insert in a given column.
T get(std::string const &name) const
std::vector< std::string > paramNames(bool topLevelOnly=true) const
virtual boost::archive::text_iarchive & getIArchive(void)
Get a boost::serialization archive suitable for input.
virtual boost::archive::xml_iarchive & getIArchive(void)
Get a boost::serialization XML archive suitable for input.
Class for database storage.
Interface for XmlStorage class.
#define LOGLS_TRACE(logger, message)
std::vector< std::string > StringArray
bool exists(std::string const &name) const
virtual void insertRow(void)
Insert the row.
#define LSST_EXCEPT(type,...)
virtual boost::archive::text_oarchive & getOArchive(void)
Get a boost::serialization archive suitable for output.
virtual boost::archive::xml_oarchive & getOArchive(void)
Get a boost::serialization XML archive suitable for output.
Class for boost::serialization storage.
Interface for LogicalLocation class.
virtual void setTableForInsert(std::string const &tableName)
Set the table to insert rows into.
std::type_info const & typeOf(std::string const &name) const
virtual void setColumnToNull(std::string const &columnName)
Set a given column to NULL.
Interface for BoostStorage class.