#include <stdexcept>
#include <string>
#include <boost/lexical_cast.hpp>
+#include <boost/serialization/extended_type_info.hpp>
#include "config.h"
{}
};
+struct error_name_too_long : public std::runtime_error
+{
+ error_name_too_long(const std::string &name)
+ : std::runtime_error("symbol name '" + name + "' too long for serialization ("
+ + boost::lexical_cast<std::string>(name.length()) + ">"
+ + boost::lexical_cast<std::string>(BOOST_SERIALIZATION_MAX_KEY_SIZE-1) + ")")
+ {}
+};
+
//! get type by id
/*!
\return type name or empty string on error
std::string ret_classname() const
{
- return name+mangled+"_res";
+ std::string result = name+mangled+"_res";
+ if (result.length() >= BOOST_SERIALIZATION_MAX_KEY_SIZE)
+ throw error_name_too_long(result);
+ return result;
}
std::string cmd_classname() const
{
- return name+mangled+"_cmd";
+ std::string result = name+mangled+"_cmd";
+ if (result.length() >= BOOST_SERIALIZATION_MAX_KEY_SIZE)
+ throw error_name_too_long(result);
+ return result;
}
bool hasReturn() const {return !ret_type.isVoid();}
};