H3D API
2.4.1
|
#include <H3D/Field.h>
Classes | |
struct | Event |
The Event struct encapsulates an event in the field network. More... | |
class | FieldAccessError |
Exception thrown when performing actions that conflict with the field's access type. More... | |
Public Types | |
enum | AccessType { INITIALIZE_ONLY , OUTPUT_ONLY , INPUT_ONLY , INPUT_OUTPUT } |
The different access types that a field can have. More... | |
Public Member Functions | |
Field () | |
Constructor. | |
virtual | ~Field () |
Destructor. | |
virtual void | checkFieldType (Field *f, int index) |
Check that a given input field is of the correct type. More... | |
void | setName (string _name) |
Sets local the name of the field. Will be used in error reporting. | |
string | getName () |
Gets the name of the field. | |
string | getFullName () |
Get the full name of the field including the name of the owner node if it exists (ownername.fieldname). More... | |
virtual string | getTypeName () |
Returns a string name for this field type. | |
virtual X3DTypes::X3DType | getX3DType () |
Returns the X3DType of the field. | |
virtual void | route (Field *, int id=0) |
Set up a route from this field to the field given as argument. More... | |
virtual void | routeNoEvent (Field *, int id=0) |
Set up a route from this field to the field given as argument. More... | |
virtual void | unroute (Field *) |
Remove the route from this field to the field given as argument. | |
virtual Field * | replaceRoute (Field *f, unsigned int i, int id=0) |
Replace the i:th route to f with a route from this field. More... | |
virtual Field * | replaceRouteNoEvent (Field *f, unsigned int i, int id=0) |
Replace the i:th route to f with a route from this field. More... | |
template<class F > | |
void | route (H3DUniquePtr< F > &f, int id=0) |
Set up a route from this field to the field residing in the H3DUniquePtr given as argument. More... | |
template<class F > | |
void | routeNoEvent (H3DUniquePtr< F > &f, int id=0) |
Set up a route from this field to the field residing in the H3DUniquePtr given as argument. More... | |
template<class F > | |
void | unroute (H3DUniquePtr< F > &f) |
Remove the route from this field to the field residing in the H3DUniquePtr given as argument. | |
void | unrouteAll () |
Remove all the routes from this field. | |
virtual void | upToDate () |
Check that the field is up-to-date, if not update() is called to make it up-to-date. | |
bool | isUpToDate () |
Returns true if the field is up to date, i.e. More... | |
virtual void | touch () |
Generates an event from this field. | |
Node * | getOwner () |
Get the Node that contains this field. | |
void | setOwner (Node *n) |
Set the Node that contains this field. | |
void | setAccessType (AccessType _access_type) |
Set the access type of the field. | |
AccessType | getAccessType () |
Get the access type of the field. | |
bool | routesTo (Field *f) |
Returns true if this field is routed to the field given as argument. | |
bool | hasRouteFrom (Field *f) |
Returns true if the field given as argument is routed to this field. | |
const FieldVector & | getRoutesIn () |
Get the Fields that are routed to this Field. | |
const FieldSet & | getRoutesOut () |
Get the Fields this Field is routed to. | |
const Event & | getLatestEvent () |
Get the latest event. | |
void | setAccessCheck (bool on) |
Set access type checking on or off. More... | |
bool | isAccessCheckOn () |
Returns true if checking of access types is on. | |
Static Public Member Functions | |
static string | classTypeName () |
Returns a string name for this field type. More... | |
Protected Member Functions | |
virtual void | startEvent () |
Start a new event from this field. More... | |
virtual void | propagateEvent (Event e) |
Propagates an event to all Fields we are routed to. More... | |
virtual void | routeFrom (Field *, int id) |
Set up a route to this field from the field given as argument. | |
virtual void | unrouteFrom (Field *) |
Remove the route to this field from the field given as argument. | |
virtual Field * | replaceRouteFrom (Field *f, unsigned int i, int id) |
Replace the i:th route to this field with the field given as argument. | |
virtual void | update () |
This function will be called to update the field if it has a pending event when the upToDate() function is called. | |
void | checkAccessTypeRoute (Field *f, int id) |
Check the access type is correct for performing a route from this field to f. More... | |
void | checkAccessTypeRouteFrom (Field *f, int id) |
Check the access type is correct for performing a route from f to this field. More... | |
void | checkAccessTypeGet (int id) |
Check the access type is valid for getting the value of a field. More... | |
void | checkAccessTypeSet (int id) |
Check the access type is valid for changing the value of a field. More... | |
int | ownerId () |
Gets the id of the owner node, -1 if no owner. | |
bool | isProgramSetting () |
Returns true if this field is part of program settings fields. More... | |
void | markProgramSetting (bool used_as_setting) |
Set it this field is used by program settings fields in scene or not. | |
Protected Attributes | |
string | name |
The name of the field. | |
bool | event_lock |
If true, stops events from being propagated. More... | |
bool | update_lock |
If true, stops the update() function from being called in the upToDate() function. | |
FieldSet | routes_out |
The Fields that this field is routed to. | |
FieldVector | routes_in |
The Field that are routed to this field. | |
Event | event |
The last event that happened. | |
Node * | owner |
The node that contain this field. More... | |
AccessType | access_type |
The type of access to the field. | |
bool | access_check_on |
If true, access type checks will be done when getting/setting values and setting up routes. More... | |
The Field class.
The different access types that a field can have.
Enumerator | |
---|---|
INITIALIZE_ONLY | The value of the field can only be changed before the Node that is the owner of the field has been initialized. If no owner exists it works as an INPUT_OUTPUT field. |
OUTPUT_ONLY | The value of the field can only read, not set. Only the Node that is the owner of the field can change its value by providing its id to the setValue() function. Also only the owner can set up routes to the field. If no owner exists it works as an INPUT_OUTPUT field. |
INPUT_ONLY | The value of the field can only set, not read. Only the Node that is the owner of the field can read its value by providing its id to the getValue() function. Also only the owner can set up routes from the field. If no owner exists it works as an INPUT_OUTPUT field. |
INPUT_OUTPUT | No restrictions on access to the field values or routes. |
|
protected |
Check the access type is valid for getting the value of a field.
FieldAccessError | if the field has the wrong access type. |
Referenced by H3D::MFieldBase< Type, VectorClass, BaseField >::back(), H3D::MFieldBase< Type, VectorClass, BaseField >::begin(), H3D::MFieldBase< Type, VectorClass, BaseField >::end(), H3D::MFieldBase< Type, VectorClass, BaseField >::front(), H3D::MField< Type >::getValueByIndex(), H3D::MFieldBase< Type, VectorClass, BaseField >::operator[](), H3D::MFieldBase< Type, VectorClass, BaseField >::rbegin(), H3D::MFieldBase< Type, VectorClass, BaseField >::rend(), and H3D::MFieldBase< Type, VectorClass, BaseField >::swap().
|
protected |
Check the access type is correct for performing a route from this field to f.
FieldAccessError | if the field has the wrong access type. |
|
protected |
Check the access type is correct for performing a route from f to this field.
FieldAccessError | if the field has the wrong access type. |
|
protected |
Check the access type is valid for changing the value of a field.
FieldAccessError | if the field has the wrong access type. |
Referenced by H3D::MFieldBase< Type, VectorClass, BaseField >::clear(), H3D::MField< Type >::erase(), H3D::MField< Type >::insert(), H3D::MFieldBase< Type, VectorClass, BaseField >::pop_back(), H3D::MFieldBase< Type, VectorClass, BaseField >::push_back(), H3D::MFieldBase< Type, VectorClass, BaseField >::resize(), H3D::MField< Type >::setValue(), H3D::MFieldBase< Type, VectorClass, BaseField >::setValueFromVoidPtr(), and H3D::MFieldBase< Type, VectorClass, BaseField >::swap().
|
virtual |
Check that a given input field is of the correct type.
Needed for TypedField.
f | The field to check the type for |
index | The index of the field in the routes_in member. |
Reimplemented in H3D::TypedField< ParsableMField, void, AnyNumber< MFieldBase< Type, std::vector< Type >, ParsableMField > > >, H3D::TypedField< X3DTexture3DNode::SFImage, Types< MFString, MFImageLoader > >, H3D::TypedField< X3DTexture3DNode::SFImage, MFTexture2DNode >, H3D::TypedField< H3D::X3DTexture2DNode::SFImage, H3D::Types< SFFunctionNode, SFFunctionNode, SFFunctionNode, SFFunctionNode > >, H3D::TypedField< Field, void, AnyNumber< SFNode > >, H3D::TypedField< ParsableField, void, AnyNumber< SField< Type > > >, H3D::TypedField< Field, SFFloat >, H3D::TypedField< X3DTexture2DNode::SFImage, Types< SFFloat, SFFloat, SFInt32, SFFloat, SFInt32, SFInt32, SFInt32, SFString, SFBool > >, H3D::TypedField< H3DBoundedObject::SFBound, TypedSFNode< X3DCoordinateNode > >, H3D::TypedField< X3DTexture2DNode::SFImage, Types< SFFunctionNode, SFColorRGBA, SFColorRGBA, SFVec2f, SFVec2f, SFInt32, SFInt32 > >, H3D::TypedField< X3DTexture3DNode::SFImage, Types< SFFloat, SFFloat, SFInt32, SFFloat, SFInt32, SFInt32, SFInt32, SFInt32, SFString, SFBool > >, H3D::TypedField< SField< HAPI::ParsedFunction * >, Types< SFString, SFString > >, and H3D::TypedField< X3DTexture2DNode::SFImage, Types< MFString, MFImageLoader > >.
|
inlinestatic |
Returns a string name for this field type.
Must have a static version in order to give relevant error messages in TypedField.
string Field::getFullName | ( | ) |
Get the full name of the field including the name of the owner node if it exists (ownername.fieldname).
Referenced by H3D::TypedField< BaseField, RequiredArgTypes, OptionalArgTypes >::checkFieldType(), H3D::MField< Type >::getValueByIndex(), and ~Field().
|
inlineprotected |
Returns true if this field is part of program settings fields.
in scene.
|
inline |
Returns true if the field is up to date, i.e.
it has not pending events.
|
protectedvirtual |
Propagates an event to all Fields we are routed to.
event.ptr &&
Reimplemented in H3D::EventCollectingField< Field >, H3D::AutoUpdate< TypedSFNodeObject< H3DImageObject > >, H3D::AutoUpdate< Field >, H3D::X3DSoundSourceNode::ALSoundBuffer, and H3D::H3DDisplayListObject::DisplayList.
Referenced by H3D::H3DDisplayListObject::DisplayList::propagateEvent(), and H3D::X3DSoundSourceNode::ALSoundBuffer::propagateEvent().
Replace the i:th route to f with a route from this field.
An event will be generated to that field.
Replace the i:th route to f with a route from this field.
No event will be generated to that field.
|
virtual |
Set up a route from this field to the field given as argument.
An event will be generated to that field.
Referenced by H3D::ComposedShader::addField(), H3D::PackagedShader::addField(), H3D::ShaderProgram::addField(), and H3D::X3DPrototypeInstance::connectField().
|
inline |
Set up a route from this field to the field residing in the H3DUniquePtr given as argument.
An event will be generated to that field.
|
virtual |
Set up a route from this field to the field given as argument.
No event will be generated to that field.
Referenced by H3D::X3DPrototypeInstance::connectField().
|
inline |
Set up a route from this field to the field residing in the H3DUniquePtr given as argument.
No event will be generated to that field.
|
inline |
Set access type checking on or off.
Access types is checked when getting/setting values and setting up routes.
Referenced by H3D::Script::addField(), and H3D::X3DPrototypeInstance::connectField().
|
protectedvirtual |
Start a new event from this field.
Any pending events from incoming routes will be removed, so that the current value is the value of the field.
Referenced by H3D::MFieldBase< Type, VectorClass, BaseField >::clear(), H3D::MField< Type >::erase(), H3D::MField< Type >::insert(), H3D::MFieldBase< Type, VectorClass, BaseField >::pop_back(), H3D::MFieldBase< Type, VectorClass, BaseField >::push_back(), H3D::MFieldBase< Type, VectorClass, BaseField >::resize(), H3D::MField< Type >::setValue(), H3D::MFieldBase< Type, VectorClass, BaseField >::setValueFromVoidPtr(), and H3D::MFieldBase< Type, VectorClass, BaseField >::swap().
|
protected |
If true, access type checks will be done when getting/setting values and setting up routes.
If false, everything will be allowed.
|
protected |
If true, stops events from being propagated.
This is used to prevent event propagation to go around in circles in an infinite loop.
|
protected |
The node that contain this field.
NULL if it is a stand alone field.
Referenced by H3D::IndexedLineSet::DisplayList::callList(), H3D::LineSet::DisplayList::callList(), H3D::PointSet::DisplayList::callList(), H3D::X3DComposedGeometryNode::DisplayList::callList(), getFullName(), ownerId(), setOwner(), H3D::GeneralFunction::SFFunctionObject::update(), and H3D::H3DDisplayListObject::DisplayList::update().