36 #include "Identifiable.hpp"
41 #include <boost/serialization/extended_type_info.hpp>
42 #include <boost/serialization/extended_type_info_typeid.hpp>
43 #include <boost/serialization/extended_type_info_no_rtti.hpp>
44 #include <boost/serialization/type_info_implementation.hpp>
45 #include "Warnings.hpp"
50 std::string::iterator end_pos = std::remove(identifier.begin(), identifier.end(),
' ');
51 identifier.erase(end_pos, identifier.end());
54 const std::string s_pack =
"pack<void(";
55 std::string::size_type i = identifier.find(s_pack);
56 if (i != identifier.npos)
58 identifier.erase(i, s_pack.length());
62 const std::string s_open =
"<";
63 const std::string s_dash =
"-";
64 i = identifier.find(s_open);
65 if (i != identifier.npos)
67 identifier.replace(i, s_open.length(), s_dash);
71 const std::string s_comma =
",";
72 i = identifier.find(s_comma);
73 while (i != identifier.npos)
75 identifier.replace(i, s_comma.length(), s_dash);
76 i = identifier.find(s_comma, i);
80 const std::string s_end =
">)>::type";
81 i = identifier.find(s_end);
82 if (i != identifier.npos)
84 identifier.erase(i, s_end.length());
97 #if BOOST_VERSION >= 103700
98 const boost::serialization::extended_type_info* p_type_info =
99 boost::serialization::type_info_implementation<Identifiable>::type::get_const_instance().get_derived_extended_type_info(*
this);
100 if(p_type_info!=
nullptr)
102 id = p_type_info->get_key();
106 WARN_ONCE_ONLY(
"Unable to determine the class type. If you are using C++ serialization may not be set up correctly. \n If you are using Python this behaviour is expected.");
107 id =
"UnknownClass-ReflectionFailed";
110 id = boost::serialization::type_info_implementation<Identifiable>::type::get_derived_extended_type_info(*this)->get_key();
std::string TidyTemplatedExportIdentifier(std::string identifier) const
std::string GetIdentifier() const