home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
2.5.0
The Integrative Modeling Platform
IMP Manual
Reference Guide
Modules
Classes
Examples
include
IMP
utility_macros.h
Go to the documentation of this file.
1
/**
2
* \file IMP/utility_macros.h
3
* \brief Various general useful macros for IMP.
4
*
5
* Copyright 2007-2015 IMP Inventors. All rights reserved.
6
*
7
*/
8
9
#ifndef IMPKERNEL_UTILITY_MACROS_H
10
#define IMPKERNEL_UTILITY_MACROS_H
11
#include <IMP/kernel_config.h>
12
#include <
IMP/deprecation_macros.h
>
13
14
//! Use a copy_from method to create a copy constructor and operator=
15
/** This macro is there to aid with classes which require a custom
16
copy constructor. It simply forwards \c operator= and the copy
17
constructor to a method \c copy_from() which should do the copying.
18
19
You should think very hard before implementing a class which
20
requires a custom copy constructor as it is easy to get wrong
21
and you can easily wrap most resources with RAII objects
22
(\external{http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization,
23
Wikipedia entry}).
24
*/
25
#define IMP_COPY_CONSTRUCTOR(Name, Base) \
26
Name(const Name& o) : Base() { copy_from(o); } \
27
IMP_NO_SWIG(Name& operator=(const Name& o) { \
28
copy_from(o); \
29
return *this; \
30
}) IMP_REQUIRE_SEMICOLON_CLASS(copy)
31
32
#define IMP_EXPAND_AND_STRINGIFY(x) IMP_STRINGIFY(x)
33
34
#endif
/* IMPKERNEL_UTILITY_MACROS_H */
deprecation_macros.h
Control display of deprecation information.