x3d::ProximitySensor Class ReferenceProximitySensor class definition automatically generated by html-to-header v1.0.
More...
#include <objects.h>
Inheritance diagram for x3d::ProximitySensor:
[legend]Collaboration diagram for x3d::ProximitySensor:
[legend]List of all members.
Detailed Description
ProximitySensor class definition automatically generated by html-to-header v1.0.
This class was automatically generated using the definition available in this modified X3D abstract: ProximitySensor
Constructor & Destructor Documentation
x3d::ProximitySensor::ProximitySensor |
( |
|
) |
|
|
virtual x3d::ProximitySensor::~ProximitySensor |
( |
|
) |
[virtual] |
|
Member Function Documentation
virtual bool x3d::ProximitySensor::FieldHasDefaultValue |
( |
field_t |
name |
) |
const [virtual] |
|
SFVec3f& x3d::ProximitySensor::get_centerOfRotation_changed |
( |
|
) |
const [inline] |
|
SFRotation& x3d::ProximitySensor::get_orientation_changed |
( |
|
) |
const [inline] |
|
SFVec3f& x3d::ProximitySensor::get_position_changed |
( |
|
) |
const [inline] |
|
virtual field_t x3d::ProximitySensor::GetDefaultContainerField |
( |
void |
|
) |
const [virtual] |
|
|
Get the name of the default container (SFNode or MFNode) for children nodes.
This function returns the numeric name of the container field to use for children which are not given a specific place to be saved to. This is mainly for I/O purposes, whenever you are loading a file, you usually need to know where to save a new node in its parent.
Each node has a default field name where it is supposed to be saved in its parent node. Many nodes will return "children".
If no name is specified, this function returns FLD_INVALID. This means a saved node must specified the name of the container field otherwise the child cannot be saved in the parent.
- Returns:
- a field_t with the name of the field in which to save this node in its parent node
- See also:
- const char *SFNodeGetDefaultContainerFieldName(void) const;
Reimplemented from x3d::X3DEnvironmentalSensorNode. |
virtual const char* x3d::ProximitySensor::GetDefaultContainerFieldName |
( |
void |
|
) |
const [virtual] |
|
|
Get the name of the default container (SFNode or MFNode) for children nodes.
This function returns the textual name of the container field to use for children which do not have a specific place to be. This is mainly for I/O purposes, whenever you are loading a file, you usually need to know where to save a new node in its parent.
Each node has a default field name where it is supposed to be saved in its parent node. Many nodes will return "children".
If no name is specified, this function returns a null pointer. This means a saved node must specified the name of the container field otherwise the child cannot be saved in the parent.
If all you need is the numeric name, use the GetDefaultContainerFieldName() instead, it will be a lot faster.
- Returns:
- the name of the container field as a static const string an empty string or a null pointer
- See also:
- field_t SFNode::GetDefaultContainerField(void) const;
Reimplemented from x3d::X3DEnvironmentalSensorNode. |
virtual bool x3d::ProximitySensor::GetFieldByIndex |
( |
int |
idx, |
|
|
FieldInfo * |
info |
|
) |
const [virtual] |
|
|
Get the content of a field using its index.
This function searches the specified field at the specified index and returns a pointer to its content, its type and its name in the provided info parameter.
This is used to enumerate all the fields of a node. The index starts at 0 and increases until the function returns false.
- Warning:
- Note that you can then read and write in the field. It is not adviced that you write in the field unless you know exactly what you are doing. You should instead use the set_ and get_ functions to read and write fields. This generic function is provided mainly for I/O operations.
- Note:
- The info are not modified if no field is found at the specified index.
- Parameters:
-
[in] | idx | The index of the field to query |
[in,out] | info | The structure where the information about the field is saved |
- Returns:
- true if the field was found, false when the index is out of range
- See also:
- bool SFNode::GetFieldByName(field_t name, FieldInfo *info) const; int SFNode::GetFieldCount(void) const; field_t GetField(const char *name);
Reimplemented from x3d::X3DEnvironmentalSensorNode. |
virtual bool x3d::ProximitySensor::GetFieldByName |
( |
field_t |
name, |
|
|
FieldInfo * |
info |
|
) |
const [virtual] |
|
|
Get the content of a field using its name.
This function searches the specified field and returns a pointer to its content, its type and its name in the provided info parameter.
- Warning:
- Note that you can then read and write in the field. It is not adviced that you write in the field unless you know exactly what you are doing. You should instead use the set_ and get_ functions to read and write fields. This generic function is provided mainly for I/O operations.
- Parameters:
-
[in] | name | The name of the field to query in numeric form |
[in,out] | info | The structure where the information about the field is saved |
- Returns:
- true if the field was found
- See also:
- bool SFNode::GetFieldByIndex(int idx, FieldInfo *info) const; field_t GetField(const char *name);
Reimplemented from x3d::X3DEnvironmentalSensorNode. |
virtual int x3d::ProximitySensor::GetFieldCount |
( |
void |
|
) |
const [virtual] |
|
virtual bool x3d::ProximitySensor::GetFieldDefault |
( |
field_t |
name, |
|
|
FieldInfo * |
info |
|
) |
const [virtual] |
|
|
Get the default value of a field.
Ask the node to return the default value of a field. It can be used to reset the field to that value or compare with the current value to know whether it is the default.
Note that to compare the current value of a field to its default, you should use the FieldHasDefaultValue() function instead (it is much more efficient and it compares all the different types for you.)
The returned value is the same as what you get when calling the GetFieldByName() or GetFieldByIndex() functions.
- Note:
- A required field (i.e. marked as #REQUIRED in the DTD) does not have a default value. This function will therefore return false for these fields.
- Warning:
- The returned FieldInfo will point to a static constant variable with the default value. The f_data pointer of the FieldInfo is unfortunately not set as a constant since once in a while you want to be able to modify the content of a field (especially MFNode's). However, modifying the default will either fail with a bus error/segmentation fault or you will lose access to the true default. Note that objects will still be initialized with the proper default and the FieldHasDefaultValue() will still work properly since each function has its own copy of the default values.
- Parameters:
-
[in] | name | The name of the field to get the default of |
[in,out] | info | A FieldInfo structure pointer where the default value is saved. |
- Returns:
- true if the field could be found and has a default value.
- See also:
- bool SFNode::GetFieldByName(field_t name, FieldInfo *info) const; bool SFNode::GetFieldByIndex(int idx, FieldInfo *info) const; bool SFNode::FieldHasDefaultValue(field_t name) const field_t GetField(const char *name);
Reimplemented from x3d::X3DEnvironmentalSensorNode. |
virtual const char* x3d::ProximitySensor::GetNodeName |
( |
void |
|
) |
const [virtual] |
|
virtual field_t x3d::ProximitySensor::GetNodeType |
( |
int |
idx = 0 |
) |
const [virtual] |
|
|
Get the type of a node.
Get the type (such as FLD_TYPE_SCRIPT) of a node. The index can be used in order to query all the types. With index 0, only the top-most type is returned. Once all the types have been returned, the function returns FLD_INVALID.
The following example checks whether a node is of type grouping. Note that it is faster to use IsNodeType() in this case unless you want to test for several types.
for(;;) {
field_t t = node->GetNodeType();
if(t == FLD_INVALID) return ERROR;
if(t == FLD_GROUPING) return VALID;
}
- Parameters:
-
[in] | idx | the index of the node of which we want to get the type |
- Returns:
- a field_t with the corresponding node type
- See also:
- bool SFNode::IsNodeType(field_t type) const;
Reimplemented from x3d::X3DEnvironmentalSensorNode. |
virtual int x3d::ProximitySensor::GetTypeCount |
( |
void |
|
) |
const [virtual] |
|
|
Get the number of types a node represents at its top-level.
In order for the GetNodeType() function to work properly, we need to have a way to know how many types may be handled at a given level. This function is used for that purpose to decrement the index properly when calling a different level.
- Returns:
- a field_t with the corresponding node type
- See also:
- bool SFNode::IsNodeType(field_t type) const;
Reimplemented from x3d::X3DEnvironmentalSensorNode. |
virtual bool x3d::ProximitySensor::IsNodeType |
( |
field_t |
type |
) |
const [virtual] |
|
|
Test whether a node is of a certain type.
Nodes inherit of different classes. To know whether a node is derived of a specific class you can use dynamic_cast<typename>(node) where typename is the name of the derived class. This can be rather slow since the textual name is used to find the proper pointer. So if you do not need the pointer afterward, you should instead use this function. It will go through all the classes, but it only has to compare one integer to know whether it is of that class or not.
- Parameters:
-
[in] | type | one of the FLD_TYPE_... enumeration or a user registered type |
- Returns:
- true whenever the node is of that type
- See also:
- field_t SFNode::GetNodeType(int idx) const;
Reimplemented from x3d::X3DEnvironmentalSensorNode. |
void x3d::ProximitySensor::set_centerOfRotation_changed |
( |
const SFVec3f & |
centerOfRotation_changed |
) |
[inline] |
|
void x3d::ProximitySensor::set_orientation_changed |
( |
const SFRotation & |
orientation_changed |
) |
[inline] |
|
void x3d::ProximitySensor::set_position_changed |
( |
const SFVec3f & |
position_changed |
) |
[inline] |
|
virtual bool x3d::ProximitySensor::SetFieldByName |
( |
field_t |
name, |
|
|
const void * |
data |
|
) |
[virtual] |
|
|
Set the value of a field using its numeric name.
This function is mainly to be used by I/O operations to change the value of a field from the value found in an input stream.
For other purposes, it is strongly advise that you make use of the get_ and set_ functions of the given class.
Also, if you are not sure about the datatype of a field, it is better to use the other SetFieldByName() function which will automatically determine the type of the field and set it accordingly.
- Attention:
- Enumeration fields are managed differently depending on the function that you use. This one will make that field look like an SFString. The data pointer is expected to point to an SFString or it will crash. Internally, the string will be transformed to the corresponding enumeration value. Note that if the field name is valid, but the enumeration name is not, then the function also returns false.
- Note:
- You cannot set a node in a parent node using this function.
- Parameters:
-
[in] | name | The name of the field to set. |
[in] | data | A pointer to the data to copy in the specified field. It MUST be of the right type of the system may crash. This is the same pointer as found the FieldInfo.f_data.f_any variable member. |
- Returns:
- true when a field of the specified name was found and set to the value defined by data
- Bug:
- At this time, the data pointer is of type void* and there is therfore no way for sure to know whether the pointer passed is of the type expected by the field. This should be fine since this function is mainly to be used by I/O processes and no specialized code which can handle the fields using the proper get_ and set_ functions.
- See also:
- field_t SFNode::SetFieldByName(const char *name, const char *data);
Reimplemented from x3d::X3DEnvironmentalSensorNode. |
Member Data Documentation
The documentation for this class was generated from the following file:
|