# H3DNetworkingUtils::RemoteSF< S > Class Template Reference

The RemoteSF class is a template class which is a node containing a single field which sends and receives its value to/from another the field of another RemoteSF<S> node running on another application on another host. More...

`#include <H3DNetworkingUtils/RemoteSF.h>`

Inheritance diagram for H3DNetworkingUtils::RemoteSF< S >:

List of all members.

## Public Member Functions
virtual void | initialize ()
| Initialize.
## Public Attributes
auto_ptr< SFSender > | toBeSent
| The value to be sent Value will be sent when it changes or on a timer, depending on the value of the containing server or client's periodicSend field access type: inputOnly basic type: S default value:.
auto_ptr< BufferedSField< S > > | received
| The value received from the network This needs to be a BufferedSField field because it gets changed in a thread that is not the graphics thread, and also may need to be buffered access type: outputOnly basic type: S default value:.
## Static Public Attributes
static H3D::H3DNodeDatabase | database
| The X3D interface.
## Protected Member Functions
| RemoteSF (H3D::X3DTypes::X3DType t, H3D::Inst< SFSender > _toBeSent=0, H3D::Inst< BufferedSField< S > > _received=0)
| Constructor is protected so that it can not explicitly be called: rather it should be implicely called from an inheriting class's constructor.
virtual | ~RemoteSF ()
| Destructor.
virtual void | setSendOnChange (bool val)
| Start or stop the field being sent each time it is changed.
virtual void | checkForChange ()
| Called from traverseSG in the graphics loop to check for any changes in the received field and to update the field appropriately.
void | writeField ()
| Write a field to the packet.
virtual void | writeValue (const typename S::value_type &val)=0
| Must be supplied for specific instantiations, to send the correct parts of the value.
double | readDouble ()
| Read a double from the socket or packet.
H3D::H3DFloat | readH3DFloat ()
| Read a H3DFloat from the socket or packet.
void | writeDouble (const double &val)
| Write a double to the socket or packet.
void | writeH3DFloat (const H3D::H3DFloat &val)
| Write a H3DFloat to the socket or packet.
## Classes
class | SFSender
| Sends the field value across the network. More...

## Detailed Description

### template<class S>
class H3DNetworkingUtils::RemoteSF< S >

The RemoteSF class is a template class which is a node containing a single field which sends and receives its value to/from another the field of another RemoteSF<S> node running on another application on another host.

This node operates in stand-alone mode as a member of a RemoteClient or RemoteServer remoteFields field. It is, however, an abstract class. In order to work, the inheriting classes, RemoteSFVec3f, RemoteSFBool, RemoteSFRotation, need to be instantiated. They only differ from each other in the work that they do in reading and writing values.
Examples:

- RemoteMFTestServer.x3d
- RemoteMFTestClient.x3d

## Constructor & Destructor Documentation

template<class S>

H3DNetworkingUtils::RemoteSF< S >::RemoteSF | ( | H3D::X3DTypes::X3DType | t,
|  | H3D::Inst< SFSender > | _toBeSent = `0`,
|  | H3D::Inst< BufferedSField< S > > | _received = `0` |
| ) |  |  | `[protected]`

Constructor is protected so that it can not explicitly be called: rather it should be implicely called from an inheriting class's constructor.

This is since it is an abstract class.

## Member Function Documentation

template<class S>

void RemoteSF::initialize | ( |  | ) | `[inline, virtual]`

Initialize.

Can't do this as we can't put in the 'typename S::value_type' namespace RemoteSFInternals { FIELDDB_ELEMENT( RemoteSF<typename S::value_type>, toBeSent, INPUT_ONLY ); FIELDDB_ELEMENT( RemoteSF<typename S::value_type>, received, OUTPUT_ONLY ); }.

Reimplemented from H3DNetworkingUtils::RemoteField.

References H3DNetworkingUtils::RemoteField::bufferStrategy, and H3DNetworkingUtils::RemoteSF< S >::received.

template<class S>

virtual void H3DNetworkingUtils::RemoteSF< S >::checkForChange | ( |  | ) | `[inline, protected, virtual]`

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

Alternatively called from a dummy force function in the haptics loop to check for any changes in the received field and to update the field appropriately.

Implements H3DNetworkingUtils::RemoteField.

template<class S>

virtual void H3DNetworkingUtils::RemoteSF< S >::writeValue | ( | const typename S::value_type & | val | ) | `[protected, pure virtual]`

Must be supplied for specific instantiations, to send the correct parts of the value.

Referenced by H3DNetworkingUtils::RemoteSF< S >::writeField().

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

- RemoteSF.h
- RemoteSF.cpp