9 #ifndef IMPBASE_OBJECT_H
10 #define IMPBASE_OBJECT_H
12 #include <IMP/base/base_config.h>
13 #include <IMP/base/base_config.h>
26 #include <boost/scoped_array.hpp>
28 #if !defined(IMP_HAS_CHECKS)
29 #error "IMP_HAS_CHECKS not defined, something is broken"
31 #if !defined(IMP_NONE)
32 #error "IMP_NONE not defined, something is broken"
34 #if !defined(IMP_HAS_LOG)
35 #error "IMP_HAS_LOG not defined, something is broken"
37 #if !defined(IMP_SILENT)
38 #error "IMP_SILENT not defined, something is broken"
41 IMPBASE_BEGIN_NAMESPACE
108 boost::scoped_array<char> quoted_name_;
110 static unsigned int live_objects_;
113 #if IMP_HAS_LOG != IMP_NONE
117 #if IMP_HAS_CHECKS >= IMP_USAGE
119 mutable bool was_owned_;
123 #if IMP_HAS_CHECKS >= IMP_INTERNAL
124 static void add_live_object(
Object* o);
125 static void remove_live_object(
Object* o);
128 void initialize(std::string name);
184 const std::string& get_name()
const {
return name_; }
185 void set_name(std::string name);
186 virtual std::string get_type_name()
const {
return "unknown object type"; }
194 void set_was_used(
bool tf)
const;
200 std::string get_string()
const {
201 std::ostringstream oss;
207 void ref()
const { ++count_; }
209 void release()
const;
210 const char* get_quoted_name_c_string()
const {
return quoted_name_.get(); }
213 void _on_destruction();
216 bool get_is_valid()
const;
218 unsigned int get_ref_count()
const {
return count_; }
220 static unsigned int get_number_of_live_objects() {
return live_objects_; }
221 bool get_is_shared()
const {
return count_ > 1; }
222 #endif // IMP_DOXYGEN
234 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
236 IMP_CHECK_VARIABLE(l);
237 #if IMP_HAS_CHECKS != IMP_NONE
243 #if IMP_HAS_LOG == IMP_SILENT
250 #if IMP_HAS_CHECKS == IMP_NONE
257 inline void Object::set_was_used(
bool tf)
const {
258 IMP_CHECK_VARIABLE(tf);
259 #if IMP_HAS_CHECKS >= IMP_USAGE
264 inline bool Object::get_is_valid()
const {
265 #if IMP_HAS_CHECKS == IMP_NONE
268 return static_cast<int>(check_value_) == 111111111;
273 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
279 ShowFull(Object* o) {
280 std::ostringstream oss;
284 const std::string& get_string()
const {
return showed_; }
286 inline std::ostream& operator<<(std::ostream& o,
const ShowFull& sf) {
287 o << sf.get_string();
291 IMPBASE_END_NAMESPACE
Various general useful macros for IMP.
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.
#define IMP_HASHABLE_INLINE(name, hashret)
void set_check_level(CheckLevel tf)
Control runtime checks in the code.
#define IMP_SHOWABLE(Name)
Exception definitions and assertions.
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.
Various general useful macros for IMP.
int compare(const VectorD< D > &a, const VectorD< D > &b)
lexicographic comparison of two vectors
Various general useful macros for IMP.
Various general useful macros for IMP.
Common base class for heavy weight IMP objects.
Version and module information for Objects.
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
virtual void do_destroy()
CheckLevel get_check_level()
Get the current audit mode.
Version and authorship of IMP objects.
Various general useful macros for IMP.