#ifndef AGGREGATE_NODE_H_
#define AGGREGATE_NODE_H_

#include <graph/DeterministicNode.h>

#include <vector>

/**
 * An aggregate Node copies its values directly from its parents.  As
 * the name suggests, an aggregate node can combine several smaller
 * nodes, but in fact the Aggregate node is very general and can take
 * subsets of the values of its parents.
 *
 * @short Aggregate Node
 */
class AggNode : public DeterministicNode {
  double const **_value_pointers;

  /* Forbid copying */
  AggNode(AggNode const &orig);
  AggNode &operator=(AggNode const &rhs);
 public:
  /**
   * Constructor.  
   *
   * @param dim Dimension of the Node.
   *
   * @param nodes Vector of parent Nodes of size
   * dim.length(). A node may appear several times in the
   * vector.
   *
   * @param offsets Vector of offsets of size dim.length().  The
   * offset denotes the element of the value vector to be copied
   * from the corresponding parent.
   */
  AggNode(Index const &dim, 
	  std::vector<Node*> nodes, 
	  std::vector<unsigned long> offsets);
  ~AggNode();

  /**
   * Copies values from parents.
   */
  void forwardSample();
};

AggNode *asAggregate(Node *node);
bool     isAggregate(Node const *node);

#endif /* AGGREGATE_NODE_H */


syntax highlighted by Code2HTML, v. 0.9.1