[Serialization, XML] - how to get info "where am i?" in serialization helper (encoding is not recursive)?
i use an external XML format for configuration of CORBA (MICO) data and
managed to align that with boost::serialization
(To not write my own encoder/decoder and to minimize efforts for my
module, in case the customer wants more CORBA objects/methods in future.
Actually i think it would be a good options to let generate the
boost::serialitzation helper file directly by MICO idl compiler.)
OK, for this now i have to check, that the (external, non by
boost::serialization generated) XML image is _actually_ compliant with
C/C++ data structures - especially for dynamic sized data. That is also
covered now, the checks do fine.
But what i didn't manage is to get the _location_ of error in the XML
file - in case there is an error.
I tried use an make_nvp_wrapper:
class MakeNVPPathConcat
{
std::string org;
public:
static std::string make_nvp_path_; // TODO: make private, use
accessor
MakeNVPPathConcat(std::string name) { org = make_nvp_path_;
make_nvp_path_ += (make_nvp_path_.empty())? "" : "::";
make_nvp_path_ += name;
}
~MakeNVPPathConcat() { make_nvp_path_ = org;
}
};
namespace boost {
namespace serialization {
/************************************************
*
* boost::serialization::make_nvp(...) wrapper
*
************************************************/
template<class T>
inline
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
const
#endif
boost::serialization::nvp<T> make_nvp_wrapper (const char *
name, T & t )
{
std::string strName ( name );
MakeNVPPathConcat makeNVPPathConcat( strName );
return boost::serialization::make_nvp<T>( name, t );
}
} // namespace serialization
} // namespace boost
Then using the ( i hoped ) recursively concatenated path information
e.g. here:
template
Frank Bergemann wrote:
i use an external XML format for configuration of CORBA (MICO) data and managed to align that with boost::serialization (To not write my own encoder/decoder and to minimize efforts for my module, in case the customer wants more CORBA objects/methods in future. Actually i think it would be a good options to let generate the boost::serialitzation helper file directly by MICO idl compiler.)
What is the boost::serialitzation helper file? Oh maybe its what i called a wrapper
OK, for this now i have to check, that the (external, non by boost::serialization generated) XML image is _actually_ compliant with C/C++ data structures - especially for dynamic sized data. That is also covered now, the checks do fine.
How much time/effort did it take to do this?
But what i didn't manage is to get the _location_ of error in the XML file - in case there is an error.
Hmmm - location as ? point to the line/character? current name? or ?
opsc_hlr :2204 084723:D:### invoked for <value> opsc_hlr :2204 084723:D:### c'tor opsc_hlr :2204 084723:D:### done for <value> opsc_hlr :2204 084723:D:### d'tor
So there is no recursion(???).
Is there another way to get a "where am i" information within a serialize (load/save) helper?
make_...wrapper is not recurssive, save/load are. I would derive from xml_?archive and override the save(NVP(T)..) and/or load(NVP...) to capture/whatever the tags as they are read/writting. Don't forget to call the original save/load. Robert Ramey
participants (2)
-
Frank Bergemann
-
Robert Ramey