IMP logo
IMP Reference Guide  develop.d97d4ead1f,2024/11/21
The Integrative Modeling Platform
comparison_macros.h File Reference

Helper macros for implementing comparisons of IMP objects. 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

Helper macros for implementing comparisons of IMP objects.

Copyright 2007-2022 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.