IMP logo
IMP Reference Guide  develop.2640aaee5c,2019/11/13
The Integrative Modeling Platform
utility_macros.h File Reference

Various general useful macros for IMP. More...

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

Go to the source code of this file.

Macros

#define IMP_COPY_CONSTRUCTOR(Name, Base)
 Use a copy_from method to create a copy constructor and operator=. More...
 
#define IMP_EXPAND_AND_STRINGIFY(x)   IMP_STRINGIFY(x)
 
#define IMP_UNIQUE_PTR
 Smart pointer to retain sole ownership of an object through a pointer. More...
 

Detailed Description

Various general useful macros for IMP.

Copyright 2007-2019 IMP Inventors. All rights reserved.

Definition in file utility_macros.h.

Macro Definition Documentation

#define IMP_COPY_CONSTRUCTOR (   Name,
  Base 
)

Use a copy_from method to create a copy constructor and operator=.

This macro is there to aid with classes which require a custom copy constructor. It simply forwards operator= and the copy constructor to a method copy_from() which should do the copying.

You should think very hard before implementing a class which requires a custom copy constructor as it is easy to get wrong and you can easily wrap most resources with RAII objects (Wikipedia entry).

Definition at line 25 of file utility_macros.h.

#define IMP_UNIQUE_PTR

Smart pointer to retain sole ownership of an object through a pointer.

In C++11 mode, this is std::unique_ptr; otherwise, it is std::auto_ptr. Note that these two classes do not have exactly the same interfaces, so you must be careful to use IMP_UNIQUE_PTR only in cases where the two classes behave in the same way (e.g. you cannot copy a unique_ptr, but you can copy an auto_ptr; unique_ptr works with arrays and can be stored in STL containers, unlike auto_ptr).

Definition at line 43 of file utility_macros.h.