9 #ifndef IMPKERNEL_OBJECT_MACROS_H
10 #define IMPKERNEL_OBJECT_MACROS_H
11 #include <IMP/kernel_config.h>
25 #define IMP_OBJECT_METHODS(Name) \
27 virtual std::string get_type_name() const override { return #Name; } \
28 virtual ::IMP::VersionInfo get_version_info() const override { \
29 return ::IMP::VersionInfo(get_module_name(), get_module_version()); \
33 virtual ~Name() { IMP::Object::_on_destruction(); } \
44 #define IMP_OBJECTS(Name, PluralName) \
46 typedef IMP::Vector<IMP::Pointer<Name> > PluralName; \
48 typedef IMP::Vector<IMP::WeakPointer<Name> > PluralName##Temp;
60 #define IMP_GENERIC_OBJECT(Name, lcname, targument, carguments, cparguments) \
61 typedef Generic##Name<targument> Name; \
62 template <class targument> \
63 Generic##Name<targument> *create_##lcname carguments { \
64 return new Generic##Name<targument> cparguments; \
74 #define IMP_NEW(Typename, varname, args) \
75 IMP::Pointer<Typename> varname(new Typename args)
95 #define IMP_OBJECT_SERIALIZE_DECL(Name) \
97 static bool dummy_serialize_init_; \
98 static void save_cereal(Object *o, cereal::BinaryOutputArchive &ar) { \
99 Name *cast = dynamic_cast<Name *>(o); \
100 if (!cast) { std::cerr << "bad cast" << std::endl; } \
103 static Object *load_cereal(cereal::BinaryInputArchive &ar) { \
104 std::unique_ptr<Name> p(new Name()); \
106 return p.release(); \
114 #define IMP_OBJECT_SERIALIZE_IMPL(Name) \
115 bool Name::dummy_serialize_init_ = Object::register_serialize( \
116 typeid(Name), #Name, Name::save_cereal, Name::load_cereal);
Macros to help with reference counting.
A class to change and restore log state.
Helper macros for writing doxygen documentation.
A weak pointer to an Object or RefCountedObject.
A class for storing lists of IMP items.
A nullptr-initialized pointer to an IMP Object.