Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

HAPI::Node Class Reference

Inheritance diagram for HAPI::Node:

HAPI::ContinuousChanceNode HAPI::DiscreteChanceNode HAPI::DiscreteDecisionNode HAPI::InstanceNode HAPI::UtilityNode HAPI::BooleanDCNode HAPI::IntervalDCNode HAPI::LabelledDCNode HAPI::NumberedDCNode HAPI::BooleanDDNode HAPI::IntervalDDNode HAPI::LabelledDDNode HAPI::NumberedDDNode List of all members.

Detailed Description

Nodes are one of the fundamental objects used in the construction of Bayesian belief networks and influence diagrams.

All nodes need a Domain* as argument, that is, the domain must exist before nodes can be created into it.


Public Member Functions

virtual ~Node () throw ()
 Delete Node.

std::string getAttribute (const std::string &key) const
 Return the value associated with key in the attribute list for this node.

virtual Category getCategory () const=0
 Return the node category.

virtual Kind getKind () const=0
 Return the node kind.

DomaingetDomain () const
 Return the Domain this Node belongs to.

JunctionTreegetJunctionTree () const
 Return the JunctionTree to which this node belongs.

std::string getLabel () const
 Get the label of this node.

ModelgetModel () const
 Return the Model of this Node.

std::string getName ()
 Retrieve the name of this Node.

std::pair< long, long > getPosition () const
 Return the position of the node.

void * getUserData () const
 Return the value stored within the user data slot of this node.

Constraint getEdgeConstraint (Node *bNode) const
 Retrieve the learning constraint specified for the edge.

void setEdgeConstraint (Node *bNode, Constraint C)
 Specify constraint for the edge.

void generateTable ()
 Generate the conditional probability table for this node, as it is specified by the model (i.e., the expressions).

AttributeList getAttributes () const
 Returns a vector of attributes associated with this Node.

void setAttribute (const std::string &key, const std::string &value)
 Insert the key/value pair in the attribute list for this node.

void setLabel (const char *label)
 Set the node label.

void setLabel (const std::string &label)
 Set the node label.

void setName (const char *name)
 Create a copy of name and assign it to this node.

void setName (const std::string &name)
 Create a copy of name and assign it to this node.

void setPosition (long x, long y)
 Set the position of the node.

void setPosition (const std::pair< long, long > &pos)
 Set the position of the node.

void setUserData (void *data)
 The Hugin API provides a data slot within each Node object.

DomaingetHomeDomain () const
 Get the Domain in which this node is placed.

ClassgetHomeClass () const
 Get the class in which this node is placed.

void addToInputs ()
 Add this Node to the list of input nodes in this Class.

void addToOutputs ()
 Add this Node to the list of output nodes in this Class.

void removeFromInputs ()
 Remove this Node from the list of input nodes in the Class.

void removeFromOutputs ()
 Remove this Node from the list of output nodes in the Class.

Node * getInstance () const
 Returns the InstanceNode containing this (cloned) output node.

Node * getMaster () const
 Returns the "master" of this (cloned) output Node of an InstanceNode (i.e., the Node cloned to get this output Node).

NodeList getSource () const
 Returns a NodeList of Class nodes that identifies this Domain node.


Constructor & Destructor Documentation

virtual HAPI::Node::~Node  )  throw () [virtual]
 

Delete Node.

The node is deleted from its domain. If the domain was compiled, the corresponding compiled structure is deleted. All references and pointers to the node become invalid.


Member Function Documentation

void HAPI::Node::addToInputs  ) 
 

Add this Node to the list of input nodes in this Class.

I.e., make this Node an input node.

void HAPI::Node::addToOutputs  ) 
 

Add this Node to the list of output nodes in this Class.

I.e., make this Node an output node.

void HAPI::Node::generateTable  ) 
 

Generate the conditional probability table for this node, as it is specified by the model (i.e., the expressions).

If one or more expressions are illegal in one way or the other, an expression is thrown.

std::string HAPI::Node::getAttribute const std::string &  key  )  const
 

Return the value associated with key in the attribute list for this node.

Returns:
Standard C++ Library string containing the attribute value.

virtual Category HAPI::Node::getCategory  )  const [pure virtual]
 

Return the node category.

Returns:
Category

Implemented in HAPI::DiscreteChanceNode, HAPI::ContinuousChanceNode, HAPI::DiscreteDecisionNode, HAPI::UtilityNode, and HAPI::InstanceNode.

Domain* HAPI::Node::getDomain  )  const
 

Return the Domain this Node belongs to.

This Node must reside in an existing Hugin domain.

Returns:
Domain* - A reference to the Domain where this Node resides.

Domain* HAPI::Node::getHomeDomain  )  const
 

Get the Domain in which this node is placed.

This function is equivalent to getDomain, and is only here for consistency with getHomeClass.

Node* HAPI::Node::getInstance  )  const
 

Returns the InstanceNode containing this (cloned) output node.

Note that we clone all output nodes when we create an InstanceNode. This is done in order to make it possible to specify conditional probability tables involving output nodes from InstanceNode's.

Returns:
The InstanceNode containing this output clone.
See also:
InstanceNode

JunctionTree* HAPI::Node::getJunctionTree  )  const
 

Return the JunctionTree to which this node belongs.

Returns:
Reference to JunctionTree object.

virtual Kind HAPI::Node::getKind  )  const [pure virtual]
 

Return the node kind.

Returns:
Kind

Implemented in HAPI::DiscreteChanceNode, HAPI::ContinuousChanceNode, HAPI::DiscreteDecisionNode, HAPI::UtilityNode, and HAPI::InstanceNode.

std::string HAPI::Node::getLabel  )  const
 

Get the label of this node.

Returns:
Standard C++ Library string.

Node* HAPI::Node::getMaster  )  const
 

Returns the "master" of this (cloned) output Node of an InstanceNode (i.e., the Node cloned to get this output Node).

Note that "master" belongs to another Class object. Note also that we clone all output nodes when we create an InstanceNode. This is done in order to make it possible to specify conditional probability tables involving output nodes from InstanceNode's.

Returns:
The "master" of this output clone.

Model* HAPI::Node::getModel  )  const
 

Return the Model of this Node.

Returns:
Model

std::string HAPI::Node::getName  ) 
 

Retrieve the name of this Node.

If this node has not previously been assigned a name, a valid name will automatically be assigned.

Returns:
A Standard C++ Library string containing the name of this node.

std::pair<long, long> HAPI::Node::getPosition  )  const
 

Return the position of the node.

Returns:
Standard C++ Library pair<long,long>

NodeList HAPI::Node::getSource  )  const
 

Returns a NodeList of Class nodes that identifies this Domain node.

The createDomain method of the Class class unfolds an object-oriented (nested) specification of a Bayesian network or an influence diagram into a regular Domain object.

Nodes in this Domain which originates from nodes residing in nested sub-networks (via InstanceNodes) can be uniquely related to a sequence of InstanceNodes and an ordinary Node of the object-oriented network.

Returns:
An ordered NodeList with the InstanceNodes and the ordinary Node identifying the source of this Node that must belong to a Domain.

void* HAPI::Node::getUserData  )  const [inline]
 

Return the value stored within the user data slot of this node.

If the stored value is NULL, or if no value has been stored, NULL is returned. It is the responsibility of the application programmer to ensure that the data is valid, that pointers are accessed correctly, etc. Also note that when you delete a node, Hugin does not attempt to delete the data pointed to by the user data slot. It is the responsibility of the user.

Returns:
void* Pointer stored within the Node object as a reference to user data associated with this node.

void HAPI::Node::removeFromInputs  ) 
 

Remove this Node from the list of input nodes in the Class.

I.e., make this Node an ordinary node again.

void HAPI::Node::removeFromOutputs  ) 
 

Remove this Node from the list of output nodes in the Class.

I.e., make this Node an ordinary node again.

void HAPI::Node::setAttribute const std::string &  key,
const std::string &  value
 

Insert the key/value pair in the attribute list for this node.

If key is already defined, the value is updated. If no value is provided, the attribute is removed.

Parameters:
key A Standard C++ Library string.
value A Standard C++ Library string.

void HAPI::Node::setLabel const std::string &  label  ) 
 

Set the node label.

Parameters:
label std::string

void HAPI::Node::setLabel const char *  label  ) 
 

Set the node label.

Parameters:
label char*

void HAPI::Node::setName const std::string &  name  ) 
 

Create a copy of name and assign it to this node.

name must be a valid name, i.e., it must follow the rules that govern the validity of C identifiers, and no other node in the domain to which *this node belongs can have the same name.

Parameters:
name Standard C++ Library string containing the desired name of the node.

void HAPI::Node::setName const char *  name  ) 
 

Create a copy of name and assign it to this node.

name must be a valid name, i.e., it must follow the rules that govern the validity of C identifiers, and no other node in the domain to which *this node belongs can have the same name.

Parameters:
name A pointer to a zero-terminated string containing the desired name of the node.

void HAPI::Node::setPosition const std::pair< long, long > &  pos  ) 
 

Set the position of the node.

Parameters:
pos Standard C++ Library pair of longs.

void HAPI::Node::setPosition long  x,
long  y
 

Set the position of the node.

Parameters:
x The desired x coordinate of the node.
y The desired y coordinate of the node.

void HAPI::Node::setUserData void *  data  )  [inline]
 

The Hugin API provides a data slot within each Node object.

This data slot is for use exclusively by the user/application. This slot can hold a pointer to arbitrary data, such as a file, a display window, an input buffer from hardware sensors, etc. Please note that Hugin does not do anything to the user data. Data is not even copied. Only the pointer to the data is stored.

Parameters:
data Pointer to user-defined data associated with this node.


Copyright Hugin Expert A/S 1993-2004