IMP  2.0.1
The Integrative Modeling Platform
utility_macros.h File Reference

Various general useful macros for IMP. More...

#include <IMP/base/base_config.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_INTERNAL_METHOD(return_value, name, arguments, const_or_not, body)
 
#define IMP_PROTECTED_CONSTRUCTOR(Name, arguments, body)   IMP_PROTECTED_CONSTRUCTOR_DECL(protected, Name, arguments, body)
 Use this when declaring constructors protected. More...
 
#define IMP_PROTECTED_CONSTRUCTOR_DECL(protection, Name, arguments, body)
 
#define IMP_PROTECTED_DESTRUCTOR(Name, arguments, body)   IMP_PROTECTED_DESTRUCTOR_DECL(protected, Name, arguments, body)
 Use this when declaring destructors protected. More...
 
#define IMP_PROTECTED_DESTRUCTOR_DECL(protection, Name, arguments, body)
 
#define IMP_PROTECTED_METHOD(return_value, name, arguments, const_or_not, body)
 Use this when declaring methods protected. More...
 
#define IMP_PROTECTED_METHOD_DECL(protection, return_value, name, arguments, const_or_not, body)
 

Detailed Description

Copyright 2007-2013 IMP Inventors. All rights reserved.

Definition in file utility_macros.h.

Macro Definition Documentation

#define IMP_COPY_CONSTRUCTOR (   Name,
  Base 
)

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 custructor as it is easy to get wrong and you can easily wrap most resources with RAII objects (wikipedia entry).

Definition at line 24 of file utility_macros.h.

#define IMP_INTERNAL_METHOD (   return_value,
  name,
  arguments,
  const_or_not,
  body 
)

Use this to declare a method that should be hidden from swig and the docs, but can't be private so some reason or another. Not something you should do often.

Definition at line 73 of file utility_macros.h.

#define IMP_PROTECTED_CONSTRUCTOR (   Name,
  arguments,
  body 
)    IMP_PROTECTED_CONSTRUCTOR_DECL(protected, Name, arguments, body)

Using this macro instead of just protected: ensures that protected constructors are available for use in Python as well as in C++.

Definition at line 57 of file utility_macros.h.

#define IMP_PROTECTED_CONSTRUCTOR_DECL (   protection,
  Name,
  arguments,
  body 
)
Value:
protection: \
Name arguments body

Definition at line 34 of file utility_macros.h.

#define IMP_PROTECTED_DESTRUCTOR (   Name,
  arguments,
  body 
)    IMP_PROTECTED_DESTRUCTOR_DECL(protected, Name, arguments, body)

Using this macro instead of just protected: ensures that protected constructors are available for use in Python as well as in C++.

Note
These destructors are virtual destructors. Most classes that use this have virtual methods.

Definition at line 66 of file utility_macros.h.

#define IMP_PROTECTED_DESTRUCTOR_DECL (   protection,
  Name,
  arguments,
  body 
)
Value:
protection: \
virtual ~Name arguments body

Definition at line 38 of file utility_macros.h.

#define IMP_PROTECTED_METHOD (   return_value,
  name,
  arguments,
  const_or_not,
  body 
)
Value:
IMP_PROTECTED_METHOD_DECL(protected, return_value, name, arguments,\
const_or_not, body)

Using this macro instead of just protected: ensures that protected methods are available for use in Python as well as in C++. The methods are made availabe in python with an _ prefix to denote that they are protected.

Definition at line 48 of file utility_macros.h.

#define IMP_PROTECTED_METHOD_DECL (   protection,
  return_value,
  name,
  arguments,
  const_or_not,
  body 
)
Value:
protection: \
return_value name arguments const_or_not body

Definition at line 29 of file utility_macros.h.