mirror of
https://github.com/USCiLab/cereal.git
synced 2025-09-21 20:59:31 +02:00
parent
f27eb02caf
commit
10b7f7a00f
2
Makefile
2
Makefile
@ -1,4 +1,4 @@
|
||||
CPPFLAGS=-std=c++11 -I./include -Wall -Werror -g -Wextra -Wshadow
|
||||
CPPFLAGS=-std=c++11 -I./include -Wall -Werror -g -Wextra -Wshadow -pedantic
|
||||
CXX=g++
|
||||
COVERAGE_OUTPUT=out
|
||||
|
||||
|
@ -148,7 +148,7 @@ namespace cereal
|
||||
} // namespace cereal
|
||||
|
||||
// register archives for polymorphic support
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::BinaryOutputArchive);
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::BinaryInputArchive);
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::BinaryOutputArchive)
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::BinaryInputArchive)
|
||||
|
||||
#endif // CEREAL_ARCHIVES_BINARY_HPP_
|
||||
|
@ -765,7 +765,7 @@ namespace cereal
|
||||
} // namespace cereal
|
||||
|
||||
// register archives for polymorphic support
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::JSONInputArchive);
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::JSONOutputArchive);
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::JSONInputArchive)
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::JSONOutputArchive)
|
||||
|
||||
#endif // CEREAL_ARCHIVES_JSON_HPP_
|
||||
|
@ -228,7 +228,7 @@ namespace cereal
|
||||
} // namespace cereal
|
||||
|
||||
// register archives for polymorphic support
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::PortableBinaryOutputArchive);
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::PortableBinaryInputArchive);
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::PortableBinaryOutputArchive)
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::PortableBinaryInputArchive)
|
||||
|
||||
#endif // CEREAL_ARCHIVES_PORTABLE_BINARY_HPP_
|
||||
|
@ -778,7 +778,7 @@ namespace cereal
|
||||
} // namespace cereal
|
||||
|
||||
// register archives for polymorphic support
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::XMLOutputArchive);
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::XMLInputArchive);
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::XMLOutputArchive)
|
||||
CEREAL_REGISTER_ARCHIVE(cereal::XMLInputArchive)
|
||||
|
||||
#endif // CEREAL_ARCHIVES_XML_HPP_
|
||||
|
@ -340,7 +340,7 @@ namespace cereal
|
||||
|
||||
See the documentation for the other functions to try and understand this */
|
||||
template <class T>
|
||||
void instantiate_polymorphic_binding( T*, int, adl_tag ) {};
|
||||
void instantiate_polymorphic_binding( T*, int, adl_tag ) {}
|
||||
} // namespace detail
|
||||
} // namespace cereal
|
||||
|
||||
|
@ -60,7 +60,7 @@ namespace cereal
|
||||
}; \
|
||||
} /* end namespace detail */ \
|
||||
template <class T, class A> \
|
||||
struct has_member_##name : std::integral_constant<bool, detail::has_member_##name##_impl<T, A>::value> {};
|
||||
struct has_member_##name : std::integral_constant<bool, detail::has_member_##name##_impl<T, A>::value> {}
|
||||
|
||||
//! Creates a test for whether a non const non-member function exists
|
||||
/*! This creates a class derived from std::integral_constant that will be true if
|
||||
@ -79,7 +79,7 @@ namespace cereal
|
||||
}; \
|
||||
} /* end namespace detail */ \
|
||||
template <class T, class A> \
|
||||
struct has_non_member_##name : std::integral_constant<bool, detail::has_non_member_##name##_impl<T, A>::value> {};
|
||||
struct has_non_member_##name : std::integral_constant<bool, detail::has_non_member_##name##_impl<T, A>::value> {}
|
||||
|
||||
//! Creates a test for whether a non const member function exists with a version parameter
|
||||
/*! This creates a class derived from std::integral_constant that will be true if
|
||||
@ -98,7 +98,7 @@ namespace cereal
|
||||
}; \
|
||||
} /* end namespace detail */ \
|
||||
template <class T, class A> \
|
||||
struct has_member_versioned_##name : std::integral_constant<bool, detail::has_member_versioned_##name##_impl<T, A>::value> {};
|
||||
struct has_member_versioned_##name : std::integral_constant<bool, detail::has_member_versioned_##name##_impl<T, A>::value> {}
|
||||
|
||||
//! Creates a test for whether a non const non-member function exists with a version parameter
|
||||
/*! This creates a class derived from std::integral_constant that will be true if
|
||||
@ -117,7 +117,7 @@ namespace cereal
|
||||
}; \
|
||||
} /* end namespace detail */ \
|
||||
template <class T, class A> \
|
||||
struct has_non_member_versioned_##name : std::integral_constant<bool, detail::has_non_member_versioned_##name##_impl<T, A>::value> {};
|
||||
struct has_non_member_versioned_##name : std::integral_constant<bool, detail::has_non_member_versioned_##name##_impl<T, A>::value> {}
|
||||
|
||||
// ######################################################################
|
||||
// Member load_and_allocate
|
||||
|
@ -68,7 +68,7 @@
|
||||
static CONSTEXPR char const * name() { return #T; }; \
|
||||
}; \
|
||||
} } /* end namespaces */ \
|
||||
CEREAL_BIND_TO_ARCHIVES(T);
|
||||
CEREAL_BIND_TO_ARCHIVES(T)
|
||||
|
||||
//! Registers a polymorphic type with cereal, giving it a
|
||||
//! user defined name
|
||||
@ -83,7 +83,7 @@
|
||||
struct binding_name<T> \
|
||||
{ static CONSTEXPR char const * name() { return Name; }; }; \
|
||||
} } /* end namespaces */ \
|
||||
CEREAL_BIND_TO_ARCHIVES(T);
|
||||
CEREAL_BIND_TO_ARCHIVES(T)
|
||||
|
||||
namespace cereal
|
||||
{
|
||||
|
@ -289,7 +289,7 @@ struct PoDStructCereal
|
||||
void serialize( Archive & ar )
|
||||
{
|
||||
ar(a, b, c, d);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
struct PoDStructBoost
|
||||
@ -303,7 +303,7 @@ struct PoDStructBoost
|
||||
void serialize( Archive & ar, const unsigned int /*version*/ )
|
||||
{
|
||||
ar & a & b & c & d;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
struct PoDChildCereal : virtual PoDStructCereal
|
||||
@ -317,7 +317,7 @@ struct PoDChildCereal : virtual PoDStructCereal
|
||||
void serialize( Archive & ar )
|
||||
{
|
||||
ar( cereal::virtual_base_class<PoDStructCereal>(this), v );
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
struct PoDChildBoost : virtual PoDStructBoost
|
||||
@ -332,7 +332,7 @@ struct PoDChildBoost : virtual PoDStructBoost
|
||||
{
|
||||
ar & boost::serialization::base_object<PoDStructBoost>(*this);
|
||||
ar & v;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
int main()
|
||||
|
10
sandbox.cpp
10
sandbox.cpp
@ -104,7 +104,7 @@ namespace cereal
|
||||
template <class Archive> struct specialize<Archive, Derived, cereal::specialization::member_load_save> {};
|
||||
}
|
||||
|
||||
CEREAL_REGISTER_TYPE(Derived);
|
||||
CEREAL_REGISTER_TYPE(Derived)
|
||||
|
||||
// ###################################
|
||||
struct Test1
|
||||
@ -235,7 +235,7 @@ struct EmptyStruct
|
||||
void serialize(Archive &)
|
||||
{
|
||||
std::cout << "Side effects!" << std::endl;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
struct NonEmptyStruct
|
||||
@ -776,7 +776,7 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
|
||||
CEREAL_CLASS_VERSION(BoostTransitionMS, 1);
|
||||
CEREAL_CLASS_VERSION(BoostTransitionSplit, 2);
|
||||
CEREAL_CLASS_VERSION(BoostTransitionNMS, 3);
|
||||
CEREAL_CLASS_VERSION(BoostTransitionMS, 1)
|
||||
CEREAL_CLASS_VERSION(BoostTransitionSplit, 2)
|
||||
CEREAL_CLASS_VERSION(BoostTransitionNMS, 3)
|
||||
// keep the other at default version (0)
|
||||
|
@ -73,7 +73,7 @@ struct MyType : public Base
|
||||
ar( cereal::base_class<Base>( this ) );
|
||||
}
|
||||
};
|
||||
CEREAL_REGISTER_TYPE(MyType);
|
||||
CEREAL_REGISTER_TYPE(MyType)
|
||||
|
||||
struct YourType : public Base
|
||||
{
|
||||
@ -97,7 +97,7 @@ struct YourType : public Base
|
||||
ar( x );
|
||||
}
|
||||
};
|
||||
CEREAL_REGISTER_TYPE(YourType);
|
||||
CEREAL_REGISTER_TYPE(YourType)
|
||||
|
||||
struct OurBase
|
||||
{
|
||||
@ -159,7 +159,7 @@ struct TestType
|
||||
void serialize( Archive & ar )
|
||||
{
|
||||
ar( x );
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
namespace cereal
|
||||
@ -180,7 +180,7 @@ struct BBB : AAA
|
||||
void serialize( Archive & ) {}
|
||||
};
|
||||
|
||||
CEREAL_REGISTER_TYPE(BBB);
|
||||
CEREAL_REGISTER_TYPE(BBB)
|
||||
|
||||
template <class T> void nop(T&&) {}
|
||||
|
||||
@ -202,7 +202,7 @@ int main()
|
||||
//oarchive(ptr3);
|
||||
//oarchive(ptr4);
|
||||
//oarchive(ptr5);
|
||||
|
||||
|
||||
|
||||
//std::shared_ptr<AAA> a = std::make_shared<BBB>();
|
||||
//oarchive(a);
|
||||
|
@ -2816,7 +2816,7 @@ std::ostream& operator<<(std::ostream& os, PolyDerived const & s)
|
||||
return os;
|
||||
}
|
||||
|
||||
CEREAL_REGISTER_TYPE(PolyDerived);
|
||||
CEREAL_REGISTER_TYPE(PolyDerived)
|
||||
|
||||
template <class IArchive, class OArchive>
|
||||
void test_polymorphic()
|
||||
|
Loading…
x
Reference in New Issue
Block a user