CNodeCounter.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_diagram_CNodeCounter_h_
#define polybori_diagram_CNodeCounter_h_
// include basic definitions
#include <polybori/pbori_defs.h>
BEGIN_NAMESPACE_PBORI
template<class NaviType>
class CNodeCounter {
typedef CNodeCounter self;
public:
typedef NaviType navigator;
typedef typename NaviType::size_type size_type;
CNodeCounter(): m_visited() {}
CNodeCounter(const self& rhs): m_visited(rhs.m_visited) {}
~CNodeCounter() {}
size_type operator()(navigator navi) {
if (navi.isConstant() || m_visited.count(navi))
return 0;
m_visited.insert(navi);
return (1 + operator()(navi.thenBranch()) + operator()(navi.elseBranch()));
}
private:
std::set<navigator> m_visited;
};
END_NAMESPACE_PBORI
#endif /* polybori_diagram_CNodeCounter_h_ */
polybori::CNodeCounter::navigator
NaviType navigator
Definition: CNodeCounter.h:34
END_NAMESPACE_PBORI
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
polybori::CNodeCounter::CNodeCounter
CNodeCounter(const self &rhs)
Definition: CNodeCounter.h:38
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::CNodeCounter::operator()
size_type operator()(navigator navi)
Definition: CNodeCounter.h:42
polybori::CNodeCounter::size_type
NaviType::size_type size_type
Definition: CNodeCounter.h:35
polybori::CNodeCounter::~CNodeCounter
~CNodeCounter()
Definition: CNodeCounter.h:40
pbori_defs.h
polybori::CNodeCounter::CNodeCounter
CNodeCounter()
Definition: CNodeCounter.h:37
polybori::CNodeCounter
This class defines CNodeCounter.
Definition: CNodeCounter.h:30