17 #ifndef SERIALBOX_CORE_FRONTEND_STELLA_UTILITY_H 18 #define SERIALBOX_CORE_FRONTEND_STELLA_UTILITY_H 24 #include <boost/format.hpp> 25 #include <boost/make_shared.hpp> 26 #include <boost/shared_ptr.hpp> 37 template <
typename... Args>
41 int unroll[]{0, (f % std::forward<Args>(args), 0)...};
42 static_cast<void>(unroll);
45 exception.Init(boost::str(f));
49 template <
class StringType>
50 inline TypeID TypeNameToTypeID(StringType&& name) {
52 return TypeID::Boolean;
53 else if(name ==
"int")
55 else if(name ==
"float")
56 return TypeID::Float32;
57 else if(name ==
"double")
58 return TypeID::Float64;
59 throw Exception(
"unsupported type: %s", name);
62 inline std::string TypeIDToTypeName(
TypeID typeID) {
78 boost::shared_ptr<T> make_shared_ptr(std::shared_ptr<T>& ptr) {
79 return boost::shared_ptr<T>(ptr.get(), [ptr](T*)
mutable { ptr.reset(); });
83 std::shared_ptr<T> make_shared_ptr(boost::shared_ptr<T>& ptr) {
84 return std::shared_ptr<T>(ptr.get(), [ptr](T*)
mutable { ptr.reset(); });
Namespace of the STELLA frontend.
Namespace of the serialbox library.
TypeID
Type-id of types recognized by serialbox.
static std::string toString(TypeID id)
Convert to string.
#define SERIALBOX_ATTRIBUTE_NORETURN
Mark a method as "no return".