# H3DNetworkingUtils::RemoteNodeField< TheNode, MultiFieldType, fld > Class Template Reference

The RemoteNodeField is an abstract base class which provides the ability to can send updates of a given MField of a given Node across a network. More...

`#include <H3DNetworkingUtils/RemoteNodeField.h>`

Inheritance diagram for H3DNetworkingUtils::RemoteNodeField< TheNode, MultiFieldType, fld >:

List of all members.

## Public Member Functions
| RemoteNodeField ()
| Constructor.
## Public Attributes
auto_ptr< SFTheNode > | theNode
| The node to which values are applied access type: inputOutput basic type: SFNode default value:.
auto_ptr< SFSender > | indexToBeSent
| Supplies the index of a single value to be sent access type: inputOutput basic type: SFInt32 default value: 0.01.
auto_ptr< MFSender > | indiciesToBeSent
| Supplies the indicies of a multiple values to be sent access type: inputOutput basic type: SFFloat default value: 0.01.
auto_ptr< SFSendAll > | sendAll
| Triggers all values to be sent access type: inputOutput basic type: SFFloat default value: 0.01.
## Static Public Attributes
static H3D::H3DNodeDatabase | database
| X3D interface.
## Protected Member Functions
virtual void | setSendOnChange (bool val)
| This class always sends on change.
virtual void | writeField ()
| Write a indexToBeSent index field to socket.
virtual void | writeSField (unsigned int index)
| Write a single index field to socket.
virtual void | writeMField (const std::vector< int > &indicies)
| Write an array index field to socket.
virtual void | writeWholeArray ()
| Write array field to socket.
virtual void | writeValue (typename MultiFieldType::value_type const &val)
| Write value to socket.
virtual MultiFieldType::value_type | readVal ()
| Read value from socket.
virtual void | readValue ()
| read value(s) in from socket to temporary storage.
virtual void | checkForChange ()
| Called from the collider in the graphics loop to check for any changes in the received field and to update the field appropriately.
## Static Protected Attributes
static const int | WHOLE_ARRAY = 0
| Indicates to send whole array.
static const int | SINGLE_VALUE = 1
| Indicates to send single value.
static const int | MULTI_VALUE = 2
| Indicates to several values from array.
## Classes
class | MFSender
| Sends all values in input routed field. More...
class | SFSendAll
| Sends all values. More...
class | SFSender
| Takes the index of the value in the field and sends the index plus the associated value. More...

## Detailed Description

### template<class TheNode, class MultiFieldType, auto_ptr< MultiFieldType > TheNode::* fld>
class H3DNetworkingUtils::RemoteNodeField< TheNode, MultiFieldType, fld >

The RemoteNodeField is an abstract base class which provides the ability to can send updates of a given MField of a given Node across a network.

It differs from classes such as RemoteSFVec3f in that it does not remotely route a field to a field, but instead holds a reference to a particular node that contains the field to be modified. The reason for this is to make it efficient for multi valued (array) fields, such as MFVec3f. To be efficient, it needs to be able to send only the values that have changed. A simple routing of the field only passes the information that something in the value array has changed, not which particular values.

There are 3 mechanisms which trigger a send: 1. Each time the indexToBeSent gets an event, it sends that index and the corresponding value from the Node's field. 2. Each time the indiciesToBeSent gets an event, it sends those indicies and the corresponding values from the Node's field. 3. If sendAll gets an event, it sends the whole Nodes's field. This mechanism can be used if all values need to be sent , or if the size of the field has changed.

Each time an index and value is received, it sets the indexed value on the Node's field. Note that the X3D interface is created in inheriting classes.
Examples:

- RemoteNodeFieldServer.x3d
- RemoteNodeFieldClient.x3d

## Member Function Documentation

template<class TheNode, class MultiFieldType, auto_ptr< MultiFieldType > TheNode::* fld>

void RemoteNodeField::checkForChange | ( |  | ) | `[inline, protected, virtual]`

Called from the collider in the graphics loop to check for any changes in the received field and to update the field appropriately.

Implements H3DNetworkingUtils::RemoteField.

References H3DNetworkingUtils::RemoteNodeField< TheNode, MultiFieldType, fld >::theNode.

The documentation for this class was generated from the following files:

- RemoteNodeField.h
- RemoteNodeField.cpp