Panda3D
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions
DataNode Class Reference

The fundamental type of node for the data graph. More...

#include "dataNode.h"

Inheritance diagram for DataNode:
PandaNode TypedWritable Namable LinkedListNode ReferenceCount TypedObject MemoryBase MemoryBase MemoryBase AnalogNode AwMouseAndKeyboard ButtonNode ButtonThrower DialNode MouseAndKeyboard MouseInterfaceNode MouseRecorder MouseWatcher RocketInputHandler TrackerNode Transform2SG VirtualMouse

List of all members.

Classes

class  DataConnection
class  WireDef

Public Member Functions

 DataNode (const string &name)
virtual TypeHandle force_init_type ()
int get_num_inputs () const
 Returns the number of different inputs that have been defined for this node using define_input().
int get_num_outputs () const
 Returns the number of different outputs that have been defined for this node using define_output().
virtual TypeHandle get_type () const
virtual PandaNodemake_copy () const
 Returns a newly-allocated Node that is a shallow copy of this one.
void transmit_data (DataGraphTraverser *trav, const DataNodeTransmit inputs[], DataNodeTransmit &output)
 Collects the data from all of the parent nodes and puts it into one DataNodeTransmit object, for processing; calls do_transmit_data() to read all the inputs and put the result into the indicated output.
void write_connections (ostream &out) const
 Writes to the indicated ostream a list of all the connections currently showing between this DataNode and its parent(s).
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file.
void write_inputs (ostream &out) const
 Writes to the indicated ostream a list of all the inputs this DataNode might expect to receive.
void write_outputs (ostream &out) const
 Writes to the indicated ostream a list of all the outputs this DataNode might generate.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()

Protected Member Functions

 DataNode (const DataNode &copy)
int define_input (const string &name, TypeHandle data_type)
 Adds a new input wire with the given name and the indicated data type.
int define_output (const string &name, TypeHandle data_type)
 Adds a new output wire with the given name and the indicated data type.
virtual void do_transmit_data (DataGraphTraverser *trav, const DataNodeTransmit &input, DataNodeTransmit &output)
 The virtual implementation of transmit_data().
void fillin (DatagramIterator &scan, BamReader *manager)
 This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new Lens.
virtual void parents_changed ()
 Called after a scene graph update that either adds or remove parents from this node, this just provides a hook for derived PandaNode objects that need to update themselves based on the set of parents the node has.

Detailed Description

The fundamental type of node for the data graph.

The DataNode class is itself primarily intended as an abstract class; it defines no inputs and no outputs. Most kinds of data nodes will derive from this to specify the inputs and outputs in the constructor.

DataNode does not attempt to cycle its data with a PipelineCycler. The data graph is intended to be used only within a single thread.

Definition at line 64 of file dataNode.h.


Member Function Documentation

int DataNode::define_input ( const string &  name,
TypeHandle  data_type 
) [protected]

Adds a new input wire with the given name and the indicated data type.

The data type should be the TypeHandle for some type that derives from TypedReferenceCount, e.g. EventStoreInt, EventStoreDouble, or some fancier data type like Texture.

If there is already an input wire defined with the indicated name, its type is changed.

The return value is the index into the "input" parameter to do_transmit_data() that can be used to access the input data.

Definition at line 186 of file dataNode.cxx.

int DataNode::define_output ( const string &  name,
TypeHandle  data_type 
) [protected]

Adds a new output wire with the given name and the indicated data type.

The data type should be the TypeHandle for some type that derives from TypedReferenceCount, e.g. EventStoreInt, EventStoreDouble, or some fancier data type like Texture.

If there is already an output wire defined with the indicated name, its type is changed.

The return value is the index into the "output" parameter to do_transmit_data() where the output data should be stored.

Definition at line 225 of file dataNode.cxx.

void DataNode::do_transmit_data ( DataGraphTraverser trav,
const DataNodeTransmit input,
DataNodeTransmit output 
) [protected, virtual]

The virtual implementation of transmit_data().

This function receives an array of input parameters and should generate an array of output parameters. The input parameters may be accessed with the index numbers returned by the define_input() calls that were made earlier (presumably in the constructor); likewise, the output parameters should be set with the index numbers returned by the define_output() calls.

Reimplemented in MouseWatcher, DriveInterface, Trackball, ButtonThrower, AnalogNode, ButtonNode, MouseAndKeyboard, TrackerNode, DialNode, VirtualMouse, MouseRecorder, MouseSubregion, RocketInputHandler, Transform2SG, and AwMouseAndKeyboard.

Definition at line 275 of file dataNode.cxx.

Referenced by transmit_data().

void DataNode::fillin ( DatagramIterator scan,
BamReader manager 
) [protected, virtual]

This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new Lens.

Reimplemented from PandaNode.

Reimplemented in MouseRecorder.

Definition at line 359 of file dataNode.cxx.

int DataNode::get_num_inputs ( ) const [inline]

Returns the number of different inputs that have been defined for this node using define_input().

This indicates the size of the DataNodeTransmit object that should be passed to do_transmit_data().

Definition at line 48 of file dataNode.I.

Referenced by transmit_data().

int DataNode::get_num_outputs ( ) const [inline]

Returns the number of different outputs that have been defined for this node using define_output().

This indicates the size of the DataNodeTransmit object that should be passed to do_transmit_data().

Definition at line 61 of file dataNode.I.

Referenced by DriveInterface::force_dgraph().

PandaNode * DataNode::make_copy ( ) const [virtual]

Returns a newly-allocated Node that is a shallow copy of this one.

It will be a different Node pointer, but its internal data may or may not be shared with that of the original Node.

Reimplemented from PandaNode.

Definition at line 31 of file dataNode.cxx.

void DataNode::parents_changed ( ) [protected, virtual]

Called after a scene graph update that either adds or remove parents from this node, this just provides a hook for derived PandaNode objects that need to update themselves based on the set of parents the node has.

Reimplemented from PandaNode.

Definition at line 256 of file dataNode.cxx.

void DataNode::transmit_data ( DataGraphTraverser trav,
const DataNodeTransmit  inputs[],
DataNodeTransmit output 
)

Collects the data from all of the parent nodes and puts it into one DataNodeTransmit object, for processing; calls do_transmit_data() to read all the inputs and put the result into the indicated output.

Definition at line 44 of file dataNode.cxx.

References do_transmit_data(), DataNodeTransmit::get_data(), get_num_inputs(), DataNodeTransmit::has_data(), EventParameter::is_empty(), DataNodeTransmit::reserve(), and DataNodeTransmit::set_data().

void DataNode::write_connections ( ostream &  out) const

Writes to the indicated ostream a list of all the connections currently showing between this DataNode and its parent(s).

Definition at line 145 of file dataNode.cxx.

References PandaNode::get_num_parents(), and PandaNode::get_parent().

void DataNode::write_datagram ( BamWriter manager,
Datagram dg 
) [virtual]

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from PandaNode.

Reimplemented in MouseRecorder.

Definition at line 347 of file dataNode.cxx.

void DataNode::write_inputs ( ostream &  out) const

Writes to the indicated ostream a list of all the inputs this DataNode might expect to receive.

Definition at line 112 of file dataNode.cxx.

void DataNode::write_outputs ( ostream &  out) const

Writes to the indicated ostream a list of all the outputs this DataNode might generate.

Definition at line 128 of file dataNode.cxx.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations