H3D API  2.4.1
Protected Member Functions | List of all members
H3D::TypedField< BaseField, RequiredArgTypes, OptionalArgTypes > Class Template Reference

A template modifier class for adding type checking on the routes to any Field class. More...

#include <H3D/TypedField.h>

Inheritance diagram for H3D::TypedField< BaseField, RequiredArgTypes, OptionalArgTypes >:
Inheritance graph

Protected Member Functions

void checkFieldType (Field *f, int index)
 Function for checking that a field is of a correct type given type specification according to the TypedField template arguments. More...
 
void checkTemplateArguments ()
 Function for checking that a field given TypedField type specification is valid. More...
 

Detailed Description

template<class BaseField, class RequiredArgTypes, class OptionalArgTypes = void>
class H3D::TypedField< BaseField, RequiredArgTypes, OptionalArgTypes >

A template modifier class for adding type checking on the routes to any Field class.

Parameters
BaseFieldThe Field type base class.
RequiredArgTypesThe types of the routes that are required to be there. If these routes are not present when the update() function is called then an exception is thrown. The types can be specified with the Types and Any templates. The Types template specifies a list of types and the Any template defines the type to be any of the types given in it. void can be used to specify that there are no required routes.
OptionalArgTypesTypes of optional routes. These do not have to be there in order for the field to be able to update. In addition to the templates Any and Types used for RequiredArgTypes the template AnyNumber can be used to specify that any number of the route types specified in the template are valid. void can be used to specify that there are no required routes.
Examples:
TypedField< SFInt32, SFInt32 > defines an SFInt32 field that requires one and only one SFInt32 field routed to it.
TypedField< MFFloat, void, AnyNumber<SFFloat> > defines an MFFloat that can have any number of SFFloat fields routed to it.
TypedField< SFInt32, Types< SFFloat, SFFloat >, Types< Any< SFInt32, MFInt32 > > > defines a SFInt32 field that requires two SFFloat routes and can optionally have an extra SFInt32 or MFInt32 route.

<>

Member Function Documentation

◆ checkFieldType()

template<class BaseField , class RequiredArgTypes , class OptionalArgTypes = void>
void H3D::TypedField< BaseField, RequiredArgTypes, OptionalArgTypes >::checkFieldType ( Field f,
int  index 
)
inlineprotected

Function for checking that a field is of a correct type given type specification according to the TypedField template arguments.

Parameters
fThe field to check the type of
indexThe index of the field in the template type list.
Exceptions
TypedFieldCheck::InvalidType

Reimplemented in H3D::TypedField< SField< HAPI::ParsedFunction * >, Types< SFString, SFString > >.

References H3D::Field::getFullName(), and H3DUtil::Exception::H3DException::message.

◆ checkTemplateArguments()

template<class BaseField , class RequiredArgTypes , class OptionalArgTypes = void>
void H3D::TypedField< BaseField, RequiredArgTypes, OptionalArgTypes >::checkTemplateArguments ( )
inlineprotected

Function for checking that a field given TypedField type specification is valid.

Exceptions
TypedFieldCheck::InvalidTemplateArguments

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