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
233 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
235 IMP_CHECK_VARIABLE(l);
236 #if IMP_HAS_CHECKS != IMP_NONE
242 #if IMP_HAS_LOG == IMP_SILENT
249 #if IMP_HAS_CHECKS == IMP_NONE
256 inline void Object::set_was_used(
bool tf)
const {
257 IMP_CHECK_VARIABLE(tf);
258 #if IMP_HAS_CHECKS >= IMP_USAGE
263 inline bool Object::get_is_valid()
const {
264 #if IMP_HAS_CHECKS == IMP_NONE
267 return static_cast<int>(check_value_) == 111111111;
272 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
278 ShowFull(Object* o) {
279 std::ostringstream oss;
283 const std::string& get_string()
const {
return showed_; }
285 inline std::ostream& operator<<(std::ostream& o,
const ShowFull& sf) {
286 o << sf.get_string();
290 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.
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.