9 #ifndef IMPBASE_DECLARE_OBJECT_H
10 #define IMPBASE_DECLARE_OBJECT_H
12 #include <IMP/base/base_config.h>
13 #include <IMP/base/base_config.h>
16 #include <boost/static_assert.hpp>
17 #include <boost/type_traits.hpp>
28 #include <boost/scoped_array.hpp>
30 #if !defined(IMP_HAS_CHECKS)
31 #error "IMP_HAS_CHECKS not defined, something is broken"
33 #if !defined(IMP_NONE)
34 #error "IMP_NONE not defined, something is broken"
36 #if !defined(IMP_HAS_LOG)
37 #error "IMP_HAS_LOG not defined, something is broken"
39 #if !defined(IMP_SILENT)
40 #error "IMP_SILENT not defined, something is broken"
50 template <
class R,
class E>
58 IMPBASE_BEGIN_NAMESPACE
125 boost::scoped_array<char> quoted_name_;
127 static unsigned int live_objects_;
136 #if IMP_HAS_LOG != IMP_NONE
140 #if IMP_HAS_CHECKS >= IMP_USAGE
142 mutable bool was_owned_;
146 #if IMP_HAS_CHECKS >= IMP_INTERNAL
147 static void add_live_object(
Object* o);
148 static void remove_live_object(
Object* o);
151 void initialize(std::string name);
171 IMPBASE_DEPRECATED_FUNCTION_DECL(2.1)
211 const std::string& get_name()
const {
return name_; }
212 void set_name(std::string name);
213 virtual std::string get_type_name()
const {
return "unknown object type"; }
221 void set_was_used(
bool tf)
const;
225 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
226 const char* get_quoted_name_c_string()
const {
return quoted_name_.get(); }
230 void _debugger_show()
const {
show(std::cout); }
233 std::string get_string()
const {
234 std::ostringstream oss;
239 void _on_destruction();
242 bool get_is_valid()
const;
244 unsigned int get_ref_count()
const {
return count_; }
246 static unsigned int get_number_of_live_objects() {
return live_objects_; }
247 bool get_is_shared()
const {
return count_ > 1; }
248 #endif // IMP_DOXYGEN
259 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
261 IMP_CHECK_VARIABLE(l);
262 #if IMP_HAS_CHECKS != IMP_NONE
268 #if IMP_HAS_LOG == IMP_SILENT
275 #if IMP_HAS_CHECKS == IMP_NONE
282 inline void Object::set_was_used(
bool tf)
const {
283 IMP_CHECK_VARIABLE(tf);
284 #if IMP_HAS_CHECKS >= IMP_USAGE
289 inline bool Object::get_is_valid()
const {
290 #if IMP_HAS_CHECKS == IMP_NONE
293 return static_cast<int>(check_value_) == 111111111;
298 IMPBASE_END_NAMESPACE
CheckLevel
Specify the level of runtime checks performed.
LogLevel
The log levels supported by IMP.
void set_log_level(LogLevel l)
Set the current global log level.
void set_check_level(CheckLevel tf)
Control runtime checks in the code.
Various general useful macros for IMP.
#define IMP_HASHABLE_INLINE(name, hashret)
LogLevel get_log_level()
Get the currently active global log level.
virtual void clear_caches()
virtual VersionInfo get_version_info() const
Get information about the module and version of the object.
#define IMP_SHOWABLE(Name)
int compare(const VectorD< D > &a, const VectorD< D > &b)
lexicographic comparison of two vectors
Version and authorship of IMP objects.
Various general useful macros for IMP.
Various general useful macros for IMP.
#define IMP_REF_COUNTED_NONTRIVIAL_DESTRUCTOR(Name)
Various general useful macros for IMP.
Common base class for heavy weight IMP objects.
Exception definitions and assertions.
Version and module information for Objects.
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
virtual void do_destroy()
Various general useful macros for IMP.
CheckLevel get_check_level()
Get the current audit mode.