IMP  2.1.0
The Integrative Modeling Platform
base/comparison_macros.h File Reference

Various general useful macros for IMP. More...

#include <IMP/base/base_config.h>
#include "warning_macros.h"
+ Include dependency graph for base/comparison_macros.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IMP_COMPARE_ONE(vara, varb)
 
#define IMP_SAFE_BOOL(Name, expr)
 

Comparisons

Helper macros for implementing comparisons in terms of either member variables or a member compare function. All of the <,>,== etc are implemented for both C++ and Python.

#define IMP_COMPARISONS(Name)
 Implement comparison in a class using a compare function. More...
 
#define IMP_COMPARISONS_1(Name, field)
 Implement comparison in a class using field as the variable to compare. More...
 
#define IMP_COMPARISONS_2(Name, f0, f1)
 Implement comparison in a class using field as the variable to compare. More...
 
#define IMP_COMPARISONS_3(Name, f0, f1, f2)
 Implement comparison in a class using field as the variable to compare. More...
 

Detailed Description

Copyright 2007-2013 IMP Inventors. All rights reserved.

Definition in file base/comparison_macros.h.

Macro Definition Documentation

#define IMP_COMPARE_ONE (   vara,
  varb 
)

Compare one value and return -1 or 1 as appriate. If they are equal, control returns to the current scope.

Definition at line 217 of file base/comparison_macros.h.

#define IMP_COMPARISONS (   Name)

The compare function should take a const Name & and return -1, 0, 1 as appropriate.

Definition at line 27 of file base/comparison_macros.h.

#define IMP_COMPARISONS_1 (   Name,
  field 
)
Parameters
[in]Namethe name of the class
[in]fieldthe first field to compare on

Definition at line 33 of file base/comparison_macros.h.

#define IMP_COMPARISONS_2 (   Name,
  f0,
  f1 
)
Parameters
[in]Namethe name of the class
[in]f0the first field to compare on
[in]f1the second field to compare on

Definition at line 40 of file base/comparison_macros.h.

#define IMP_COMPARISONS_3 (   Name,
  f0,
  f1,
  f2 
)
Parameters
[in]Namethe name of the class
[in]f0the first field to compare on
[in]f1the second field to compare on
[in]f2the third field to compare on

Definition at line 48 of file base/comparison_macros.h.

#define IMP_SAFE_BOOL (   Name,
  expr 
)

Implement the safe bool idiom in a class. The expression must evaluate to a boolean.

Definition at line 202 of file base/comparison_macros.h.