pbori_order.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_orderings_pbori_order_h_
#define polybori_orderings_pbori_order_h_
// include basic definitions
#include <polybori/pbori_defs.h>
// Get infrastructure for dynamic orderings
#include "COrderingBase.h"
// get all available orderings
#include <polybori/LexOrder.h>
#include <polybori/DegLexOrder.h>
#include <polybori/DegRevLexAscOrder.h>
#include <polybori/BlockDegLexOrder.h>
#include <polybori/BlockDegRevLexAscOrder.h>
BEGIN_NAMESPACE_PBORI
inline boost::shared_ptr<COrderingBase>
get_ordering(CTypes::ordercode_type order) {
typedef boost::shared_ptr<COrderingBase> order_ptr;
if(order == CTypes::lp)
return order_ptr(new LexOrder);
else if(order == CTypes::dlex)
return order_ptr(new DegLexOrder);
else if(order == CTypes::dp_asc)
return order_ptr(new DegRevLexAscOrder);
else if(order == CTypes::block_dlex)
return order_ptr(new BlockDegLexOrder);
else if(order == CTypes::block_dp_asc)
return order_ptr(new BlockDegRevLexAscOrder);
// default is lex order
return order_ptr(new LexOrder);
}
template <class LhsType, class RhsType, class BinaryPredicate>
class lex_compare_predicate:
public std::binary_function<LhsType, RhsType, bool> {
public:
lex_compare_predicate(const BinaryPredicate& comp):
m_comp(comp) {}
bool operator()(const LhsType& lhs, const RhsType& rhs) const {
return std::lexicographical_compare(lhs.begin(), lhs.end(),
rhs.begin(), rhs.end(), m_comp);
}
private:
BinaryPredicate m_comp;
};
END_NAMESPACE_PBORI
#endif
END_NAMESPACE_PBORI
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
polybori::BlockDegRevLexAscOrder
This class defines ordering related functions.
Definition: BlockDegRevLexAscOrder.h:33
DegRevLexAscOrder.h
DegLexOrder.h
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::DegRevLexAscOrder
This class defines ordering related functions.
Definition: DegRevLexAscOrder.h:33
polybori::dlex
Definition: embed.h:58
LexOrder.h
polybori::lex_compare_predicate::operator()
bool operator()(const LhsType &lhs, const RhsType &rhs) const
Functor operation.
Definition: pbori_order.h:65
polybori::lex_compare_predicate::lex_compare_predicate
lex_compare_predicate(const BinaryPredicate &comp)
Constructor.
Definition: pbori_order.h:61
pbori_defs.h
polybori::lp
Definition: embed.h:57
polybori::get_ordering
boost::shared_ptr< COrderingBase > get_ordering(CTypes::ordercode_type order)
Definition: pbori_order.h:34
COrderingBase.h
polybori::dp_asc
Definition: embed.h:59
polybori::LexOrder
This class defines ordering related functions.
Definition: LexOrder.h:33
polybori::block_dlex
Definition: embed.h:60
polybori::DegLexOrder
This class defines ordering related functions.
Definition: DegLexOrder.h:33
polybori::block_dp_asc
Definition: embed.h:61
BlockDegLexOrder.h
polybori::lex_compare_predicate
defines lexicographic comparison functor
Definition: pbori_order.h:56
BlockDegRevLexAscOrder.h
polybori::BlockDegLexOrder
This class defines ordering related functions.
Definition: BlockDegLexOrder.h:32
polybori::CAuxTypes::ordercode_type
int ordercode_type
Type for ordering codes.
Definition: pbori_defs.h:240