IMP logo
IMP Reference Guide  2.20.1
The Integrative Modeling Platform
ref_counted_macros.h File Reference

Macros to help with reference counting. More...

#include <IMP/kernel_config.h>
#include "utility_macros.h"
+ Include dependency graph for ref_counted_macros.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IMP_REF_COUNTED_DESTRUCTOR(Name)
 Set up destructor for a ref counted object. More...
 
#define IMP_REF_COUNTED_INLINE_DESTRUCTOR(Name, destructor)
 
#define IMP_REF_COUNTED_NONTRIVIAL_DESTRUCTOR(Name)
 

Detailed Description

Macros to help with reference counting.

Copyright 2007-2022 IMP Inventors. All rights reserved.

Definition in file ref_counted_macros.h.

Macro Definition Documentation

#define IMP_REF_COUNTED_DESTRUCTOR (   Name)

Set up destructor for a ref counted object.

This macro defines a virtual destructor for a ref counted object. Ideally, the destructor would be defined private, so that the object cannot be declared on the stack and so must be ref counted, but in practice this breaks usage of the object with SWIG, some older compilers, C++11 smart pointers (e.g. std::unique_ptr, std::shared_ptr), and serialization, so a public destructor is used.

See Also
IMP_REF_COUNTED_NONTRIVIAL_DESTRUCTOR()

Definition at line 25 of file ref_counted_macros.h.

#define IMP_REF_COUNTED_INLINE_DESTRUCTOR (   Name,
  destructor 
)

Like IMP_REF_COUNTED_DESTRUCTOR(), but the destructor is declared inline.

Definition at line 35 of file ref_counted_macros.h.

#define IMP_REF_COUNTED_NONTRIVIAL_DESTRUCTOR (   Name)

Like IMP_REF_COUNTED_DESTRUCTOR(), but the destructor is only declared, not defined.

Definition at line 30 of file ref_counted_macros.h.