VariableBlock.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_factories_VariableBlock_h_
#define polybori_factories_VariableBlock_h_
// include basic definitions
#include <polybori/pbori_defs.h>
#include <polybori/factories/VariableFactory.h>
BEGIN_NAMESPACE_PBORI
class VariableIndexException{
};
class VariableBlock:
protected VariableFactory{
typedef VariableBlock self;
public:
typedef VariableFactory base;
typedef base::value_type var_type;
typedef var_type::ring_type ring_type;
typedef var_type::idx_type idx_type;
VariableBlock(idx_type size, idx_type start_index, idx_type offset,
bool reverse, const ring_type& ring):
base(ring),
m_start_index(start_index),
m_last (start_index + size - 1), m_offset(offset), m_reverse(reverse) { }
VariableBlock(const self& rhs):
base(rhs),
m_start_index(rhs.m_start_index),
m_last(rhs.m_last), m_offset(rhs.m_offset), m_reverse(rhs.m_reverse) { }
~VariableBlock() {}
var_type operator()(idx_type i){
if PBORI_UNLIKELY( (i > m_last) || (i < m_start_index) ){
throw VariableIndexException();
}
return
base::operator()(m_offset + (m_reverse? m_last - i: i - m_start_index));
}
protected:
const idx_type m_start_index;
const idx_type m_last;
const idx_type m_offset;
const bool m_reverse;
};
END_NAMESPACE_PBORI
#endif /* polybori_factories_VariableBlock_h_*/
END_NAMESPACE_PBORI
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
polybori::VariableBlock::ring_type
var_type::ring_type ring_type
Definition: VariableBlock.h:45
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::VariableBlock::m_offset
const idx_type m_offset
Definition: VariableBlock.h:76
polybori::VariableFactory
This base class VariableFactory is used for currying variable constructors with a BoolePolyRing...
Definition: VariableFactory.h:33
polybori::VariableIndexException
Definition: VariableBlock.h:25
polybori::VariableBlock::VariableBlock
VariableBlock(idx_type size, idx_type start_index, idx_type offset, bool reverse, const ring_type &ring)
Construct block.
Definition: VariableBlock.h:49
polybori::BoolePolyRing
This class reinterprets decicion diagram managers as Boolean polynomial rings, adds an ordering and v...
Definition: BoolePolyRing.h:40
polybori::VariableBlock::operator()
var_type operator()(idx_type i)
We may easily.
Definition: VariableBlock.h:65
polybori::VariableBlock
This class defines a VariableBlock.
Definition: VariableBlock.h:35
polybori::VariableBlock::~VariableBlock
~VariableBlock()
Destructor.
Definition: VariableBlock.h:62
polybori::VariableBlock::m_start_index
const idx_type m_start_index
Definition: VariableBlock.h:74
pbori_defs.h
polybori::VariableBlock::m_reverse
const bool m_reverse
Definition: VariableBlock.h:77
polybori::VariableBlock::idx_type
var_type::idx_type idx_type
Definition: VariableBlock.h:46
polybori::VariableBlock::VariableBlock
VariableBlock(const self &rhs)
Copy constructor.
Definition: VariableBlock.h:56
polybori::VariableBlock::m_last
const idx_type m_last
Definition: VariableBlock.h:75
polybori::VariableBlock::base
VariableFactory base
Definition: VariableBlock.h:42
VariableFactory.h
polybori::groebner::idx_type
polybori::CTypes::idx_type idx_type
Definition: groebner_defs.h:44
polybori::VariableBlock::var_type
base::value_type var_type
Definition: VariableBlock.h:43
PBORI_UNLIKELY
#define PBORI_UNLIKELY(expression)
Definition: pbori_defs.h:59
polybori::BooleVariable
This class is just a wrapper for using variables from cudd's decicion diagram.
Definition: BooleVariable.h:39