PolyBoRi
pbori_order.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
13 //*****************************************************************************
14 
15 #ifndef polybori_orderings_pbori_order_h_
16 #define polybori_orderings_pbori_order_h_
17 
18 // include basic definitions
19 #include <polybori/pbori_defs.h>
20 
21 // Get infrastructure for dynamic orderings
22 #include "COrderingBase.h"
23 
24 // get all available orderings
25 #include <polybori/LexOrder.h>
26 #include <polybori/DegLexOrder.h>
30 
32 
33 inline boost::shared_ptr<COrderingBase>
35  typedef boost::shared_ptr<COrderingBase> order_ptr;
36 
37  if(order == CTypes::lp)
38  return order_ptr(new LexOrder);
39  else if(order == CTypes::dlex)
40  return order_ptr(new DegLexOrder);
41  else if(order == CTypes::dp_asc)
42  return order_ptr(new DegRevLexAscOrder);
43  else if(order == CTypes::block_dlex)
44  return order_ptr(new BlockDegLexOrder);
45  else if(order == CTypes::block_dp_asc)
46  return order_ptr(new BlockDegRevLexAscOrder);
47 
48  // default is lex order
49  return order_ptr(new LexOrder);
50 }
51 
52 
55 template <class LhsType, class RhsType, class BinaryPredicate>
57  public std::binary_function<LhsType, RhsType, bool> {
58 public:
59 
61  lex_compare_predicate(const BinaryPredicate& comp):
62  m_comp(comp) {}
63 
65  bool operator()(const LhsType& lhs, const RhsType& rhs) const {
66  return std::lexicographical_compare(lhs.begin(), lhs.end(),
67  rhs.begin(), rhs.end(), m_comp);
68  }
69 
70 private:
71  BinaryPredicate m_comp;
72 };
73 
75 
76 #endif
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
This class defines ordering related functions.
Definition: BlockDegRevLexAscOrder.h:33
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
This class defines ordering related functions.
Definition: DegRevLexAscOrder.h:33
Definition: embed.h:58
bool operator()(const LhsType &lhs, const RhsType &rhs) const
Functor operation.
Definition: pbori_order.h:65
lex_compare_predicate(const BinaryPredicate &comp)
Constructor.
Definition: pbori_order.h:61
Definition: embed.h:57
boost::shared_ptr< COrderingBase > get_ordering(CTypes::ordercode_type order)
Definition: pbori_order.h:34
Definition: embed.h:59
This class defines ordering related functions.
Definition: LexOrder.h:33
Definition: embed.h:60
This class defines ordering related functions.
Definition: DegLexOrder.h:33
Definition: embed.h:61
defines lexicographic comparison functor
Definition: pbori_order.h:56
This class defines ordering related functions.
Definition: BlockDegLexOrder.h:32
int ordercode_type
Type for ordering codes.
Definition: pbori_defs.h:240