21 #include <boost/range.hpp> 39 template<
class FACTOR,
class DERIVEDCONDITIONAL>
52 typedef boost::iterator_range<typename FACTOR::const_iterator>
Frontals;
55 typedef boost::iterator_range<typename FACTOR::const_iterator>
Parents;
72 void print(
const std::string& s =
"Conditional",
const KeyFormatter& formatter = DefaultKeyFormatter)
const;
75 bool equals(
const This& c,
double tol = 1e-9)
const;
92 return asFactor().front();
94 throw std::invalid_argument(
"Requested Conditional::firstFrontalKey from a conditional with zero frontal keys");
104 typename FACTOR::const_iterator
beginFrontals()
const {
return asFactor().begin(); }
113 typename FACTOR::const_iterator
endParents()
const {
return asFactor().end(); }
132 typename FACTOR::iterator
endParents() {
return asFactor().end(); }
136 FACTOR& asFactor() {
return static_cast<FACTOR&>(static_cast<DERIVEDCONDITIONAL&>(*
this)); }
139 const FACTOR& asFactor()
const {
return static_cast<const FACTOR&>(static_cast<const DERIVEDCONDITIONAL&>(*
this)); }
142 friend class boost::serialization::access;
143 template<
class ARCHIVE>
144 void serialize(ARCHIVE & ar,
const unsigned int ) {
FACTOR::iterator beginParents()
Mutable iterator pointing to the first parent key.
Definition: Conditional.h:129
FACTOR::const_iterator endParents() const
Iterator pointing past the last parent key.
Definition: Conditional.h:113
FACTOR::iterator endParents()
Mutable iterator pointing past the last parent key.
Definition: Conditional.h:132
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
void print(const std::string &s="Conditional", const KeyFormatter &formatter=DefaultKeyFormatter) const
print with optional formatter
Definition: Conditional-inst.h:29
size_t & nrFrontals()
Mutable version of nrFrontals.
Definition: Conditional.h:120
boost::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:33
TODO: Update comments.
Definition: Conditional.h:40
Conditional(size_t nrFrontals)
Constructor.
Definition: Conditional.h:65
bool equals(const This &c, double tol=1e-9) const
check equality
Definition: Conditional-inst.h:42
boost::iterator_range< typename FACTOR::const_iterator > Parents
View of the separator keys (call parents())
Definition: Conditional.h:55
size_t nrFrontals() const
return the number of frontals
Definition: Conditional.h:84
boost::iterator_range< typename FACTOR::const_iterator > Frontals
View of the frontal keys (call frontals())
Definition: Conditional.h:52
size_t nrParents() const
return the number of parents
Definition: Conditional.h:87
Frontals frontals() const
return a view of the frontal keys
Definition: Conditional.h:98
FACTOR::const_iterator endFrontals() const
Iterator pointing past the last frontal key.
Definition: Conditional.h:107
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
FACTOR::iterator beginFrontals()
Mutable iterator pointing to first frontal key.
Definition: Conditional.h:123
Parents parents() const
return a view of the parent keys
Definition: Conditional.h:101
size_t nrFrontals_
The first nrFrontal variables are frontal and the rest are parents.
Definition: Conditional.h:44
FACTOR::iterator endFrontals()
Mutable iterator pointing past the last frontal key.
Definition: Conditional.h:126
FACTOR::const_iterator beginParents() const
Iterator pointing to the first parent key.
Definition: Conditional.h:110
Conditional()
Empty Constructor to make serialization possible.
Definition: Conditional.h:62
Key firstFrontalKey() const
Convenience function to get the first frontal key.
Definition: Conditional.h:90
FACTOR::const_iterator beginFrontals() const
Iterator pointing to first frontal key.
Definition: Conditional.h:104