9 #ifndef IMPBASE_OBJECT_MACROS_H
10 #define IMPBASE_OBJECT_MACROS_H
11 #include <IMP/base/base_config.h>
25 #define IMP_OBJECT_METHODS(Name) \
27 virtual std::string get_type_name() const IMP_OVERRIDE { return #Name; } \
28 virtual ::IMP::base::VersionInfo get_version_info() const IMP_OVERRIDE { \
29 return ::IMP::base::VersionInfo(get_module_name(), get_module_version()); \
31 IMP_REF_COUNTED_INLINE_DESTRUCTOR(Name, IMP::base::Object::_on_destruction();)
34 #define IMP_OBJECT_INLINE(Name, show, destructor) \
36 IMPBASE_DEPRECATED_MACRO(2.1, "Use IMP_OBJECT_METHODS() instead."); \
37 virtual std::string get_type_name() const IMP_OVERRIDE { return #Name; } \
38 virtual ::IMP::base::VersionInfo get_version_info() const IMP_OVERRIDE { \
39 return ::IMP::base::VersionInfo(get_module_name(), get_module_version()); \
41 IMP_REF_COUNTED_INLINE_DESTRUCTOR(Name, \
43 IMP::base::Object::_on_destruction(); \
45 } catch (const std::exception & \
47 IMP_LOG_VARIABLE(e); \
48 IMP_WARN("Caught exception " << e.what() << " in destructor."); \
52 #define IMP_OBJECT_NO_WARNING(Name) \
54 virtual std::string get_type_name() const IMP_OVERRIDE { return #Name; } \
55 virtual ::IMP::base::VersionInfo get_version_info() const IMP_OVERRIDE { \
56 return ::IMP::base::VersionInfo(get_module_name(), get_module_version()); \
58 void do_show(std::ostream &out) const; \
59 IMP_REF_COUNTED_INLINE_DESTRUCTOR(Name, IMP::base::Object::_on_destruction();)
62 #define IMP_OBJECT(Name) \
64 IMPBASE_DEPRECATED_MACRO(2.1, "Use IMP_OBJECT_METHODS() instead."); \
65 IMP_OBJECT_NO_WARNING(Name)
68 #define IMP_OBJECT_2(Name) \
69 IMP_DEPRECATED_MACRO(2.0, "Use IMP_OBJECT_METHODS() macro") \
70 IMP_OBJECT_METHODS(Name)
77 #define IMP_OBJECTS(Name, PluralName) \
79 typedef IMP::base::Vector<IMP::base::Pointer<Name> > PluralName;
84 typedef IMP::base::Vector<IMP::base::WeakPointer<Name> > PluralName##Temp;
86 #define IMP_GENERIC_OBJECT(Name, lcname, targument, carguments, cparguments) \
87 typedef Generic##Name<targument> Name; \
88 template <class targument> \
89 Generic##Name<targument> *create_##lcname carguments { \
90 return new Generic##Name<targument> cparguments; \
100 #define IMP_NEW(Typename, varname, args) \
101 IMP::base::Pointer<Typename> varname(new Typename args)
Various general useful macros for IMP.
A nullptr-initialized pointer to an IMP Object.
Logging and error reporting support.
A class for storing lists of IMP items.
Various general useful macros for IMP.
A nullptr-initialized pointer to an Object.