1 #ifndef PI_PROPERTIES_NETCDFHEADER_SERIALIZER 2 #define PI_PROPERTIES_NETCDFHEADER_SERIALIZER 5 #include <boost/lexical_cast.hpp> 9 #define DIMENSION_VAR 1 10 #define DIMENSION_ARRAY 2 92 retval = nc_redef(ncid);
94 log(
Error) <<
"Could not enter define mode in NetcdfHeaderMarshaller, error "<< retval <<endlog();
111 log(
Info) <<
"Serializer still in progress" <<endlog();
113 retval = nc_enddef(ncid);
115 log(
Error) <<
"Could not leave define mode, error" << retval <<endlog();
121 std::string oldpref = prefix;
132 nameless_counter = 0;
142 std::string sname = composeName(v->
getName());
147 retval = nc_def_var(ncid, sname.c_str(), NC_BYTE,
DIMENSION_VAR,
150 log(
Error) <<
"Could not create variable " << sname <<
", error " << retval <<endlog();
152 log(
Info) <<
"Variable "<< sname <<
" successfully created" <<endlog();
162 std::string sname = composeName(v->
getName());
167 retval = nc_def_var(ncid, sname.c_str(), NC_SHORT,
DIMENSION_VAR,
170 log(
Error) <<
"Could not create variable " << sname <<
", error " << retval <<endlog();
172 log(
Info) <<
"Variable "<< sname <<
" successfully created" <<endlog();
182 std::string sname = composeName(v->
getName());
187 retval = nc_def_var(ncid, sname.c_str(), NC_INT,
DIMENSION_VAR,
190 log(
Error) <<
"Could not create variable " << sname <<
", error " << retval <<endlog();
192 log(
Info) <<
"Variable "<< sname <<
" successfully created" <<endlog();
202 std::string sname = composeName(v->
getName());
207 retval = nc_def_var(ncid, sname.c_str(), NC_FLOAT,
DIMENSION_VAR,
210 log(
Error) <<
"Could not create variable " << sname <<
", error " << retval <<endlog();
212 log(
Info) <<
"Variable "<< sname <<
" successfully created" <<endlog();
222 std::string sname = composeName(v->
getName());
227 retval = nc_def_var(ncid, sname.c_str(), NC_DOUBLE,
DIMENSION_VAR,
231 log(
Error) <<
"Could not create variable " << sname <<
", error " << retval <<endlog();
233 log(
Info) <<
"Variable "<< sname <<
" successfully created" <<endlog();
244 std::string dim_name = v->getName().c_str();
246 const char *dimname = dim_name.c_str();
248 const char *name = v->getName().c_str();
254 retval = nc_def_dim(ncid, dimname, v->rvalue().size(), &var_dim);
256 log(
Error) <<
"Could not create new dimension for "<< dimname <<
", error "<< retval <<endlog();
265 log(
Error) <<
"Could not create " << name <<
", error " << retval <<endlog();
267 log(
Info) <<
"Variable "<< name <<
" successfully created" <<endlog();
272 std::string last_name;
274 if( propertyName.empty() ) {
276 last_name = boost::lexical_cast<std::string>( nameless_counter );
279 nameless_counter = 0;
280 last_name = propertyName;
282 if ( prefix.empty() )
285 return prefix +
"." + last_name;
const_reference_t rvalue() const
Properties & getProperties()
Properties::const_iterator const_iterator
const std::string & getName() const
void serialize(Archive &a, RTT::ConnPolicy &c, unsigned int)