The NodePtr class provides automatic reference-counting for Node pointers. More...
#include <lavabdd.h>
Public Member Functions | |
NodePtr (Node *node) | |
Constructor. It is not explicit so Node* values (such as NULL) will be converted automatically. | |
~NodePtr () | |
Destructor. | |
NodePtr (const NodePtr &other) | |
Copy constructor. | |
NodePtr & | operator= (const NodePtr &other) |
Assignment operator. | |
Node & | operator* () const |
Pointer dereference. Throws std::logic_error on NULL access. | |
Node * | operator-> () const |
Pointer member access operator. Throws std::logic_error on NULL access. | |
Node * | get_ptr () const |
Returns the encapsulated pointer. You should not use this unless you know what you're doing. Wrong use of this will mess up reference counting. | |
bool | operator== (const NodePtr &other) const |
Pointer equality. | |
bool | operator!= (const NodePtr &other) const |
Pointer inequality. | |
bool | operator< (const NodePtr &other) const |
Less than comparison on pointers. Allows the use of set<NodePtr>. | |
operator bool () const | |
Conversion to bool. Returns true iff encapsulated pointer is non-NULL. | |
void | nullify () |
Releases the encapsulated pointer and sets it to NULL. | |
void | grab (Node *node) |
Releases the current encapsulated pointer and grabs a new one. |
The NodePtr class provides automatic reference-counting for Node pointers.
It encapsulates a Node* variable and can be used exactly as such, thanks to the overloaded operator definitions.