IMP logo
IMP Reference Guide  2.14.0
The Integrative Modeling Platform
comparison_macros.h File Reference

Various general useful macros for IMP. More...

#include <IMP/kernel_config.h>
#include "warning_macros.h"
+ Include dependency graph for 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

Various general useful macros for IMP.

Copyright 2007-2020 IMP Inventors. All rights reserved.

Definition in file comparison_macros.h.

Macro Definition Documentation

#define IMP_COMPARE_ONE (   vara,
  varb 
)

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

Definition at line 218 of file comparison_macros.h.

#define IMP_COMPARISONS (   Name)

Implement comparison in a class using a compare function.

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

Definition at line 27 of file comparison_macros.h.

#define IMP_COMPARISONS_1 (   Name,
  field 
)

Implement comparison in a class using field as the variable to compare.

Parameters
[in]Namethe name of the class
[in]fieldthe first field to compare on

Definition at line 33 of file comparison_macros.h.

#define IMP_COMPARISONS_2 (   Name,
  f0,
  f1 
)

Implement comparison in a class using field as the variable to compare.

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 comparison_macros.h.

#define IMP_COMPARISONS_3 (   Name,
  f0,
  f1,
  f2 
)

Implement comparison in a class using field as the variable to compare.

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 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 203 of file comparison_macros.h.