X3D libraries
The libraries to work with X3D dataset

x3d::Cone Class Reference

Cone class definition automatically generated by html-to-header v1.0. More...

#include <objects.h>

Inheritance diagram for x3d::Cone:

Inheritance graph
[legend]
Collaboration diagram for x3d::Cone:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Cone ()
virtual bool FieldHasDefaultValue (field_t name) const
 Test to know whether a field is currently set to its default value.
SFBool get_bottom () const
SFFloat get_bottomRadius () const
SFFloat get_height () const
SFBool get_side () const
SFBool get_solid () const
virtual field_t GetDefaultContainerField () const
 Get the name of the default container (SFNode or MFNode) for children nodes.
virtual const char * GetDefaultContainerFieldName () const
 Get the name of the default container (SFNode or MFNode) for children nodes.
virtual bool GetFieldByIndex (int idx, FieldInfo *info) const
 Get the content of a field using its index.
virtual bool GetFieldByName (field_t name, FieldInfo *info) const
 Get the content of a field using its name.
virtual int GetFieldCount () const
 Get the number of fields available at this level.
virtual bool GetFieldDefault (field_t name, FieldInfo *info) const
 Get the default value of a field.
virtual const char * GetNodeName () const
 Get the textual name of a node.
virtual field_t GetNodeType (int idx=0) const
 Get the type of a node.
virtual int GetTypeCount () const
 Get the number of types a node represents at its top-level.
virtual bool IsNodeType (field_t type) const
 Test whether a node is of a certain type.
void set_bottom (const SFBool &bottom)
void set_bottomRadius (const SFFloat &bottomRadius)
void set_height (const SFFloat &height)
void set_side (const SFBool &side)
void set_solid (const SFBool &solid)
virtual bool SetFieldByName (field_t name, const void *data)
 Set the value of a field using its numeric name.
virtual ~Cone ()

Protected Attributes

SFBool f_bottom
SFFloat f_bottomRadius
SFFloat f_height
SFBool f_side
SFBool f_solid

Detailed Description

Cone class definition automatically generated by html-to-header v1.0.

This class was automatically generated using the definition available in this modified X3D abstract: Cone


Constructor & Destructor Documentation

x3d::Cone::Cone  ) 
 

virtual x3d::Cone::~Cone  )  [virtual]
 


Member Function Documentation

virtual bool x3d::Cone::FieldHasDefaultValue field_t  name  )  const [virtual]
 

Test to know whether a field is currently set to its default value.

This function searches the specified field and test to know whether it is currently set to its default value. This is useful whenever saving to an XML file or some other format to avoid saving fields which are anyway set to their defaults. Also, the rendering process can make use of this to avoid changing the environment if it is not necessary.

Note:
A required field (i.e. marked as #REQUIRED in the DTD) does not have a default value and thus this function will always return false for these fields.
Parameters:
[in] name The name of the field to query in numeric form
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::X3DGeometryNode.

SFBool x3d::Cone::get_bottom  )  const [inline]
 

SFFloat x3d::Cone::get_bottomRadius  )  const [inline]
 

SFFloat x3d::Cone::get_height  )  const [inline]
 

SFBool x3d::Cone::get_side  )  const [inline]
 

SFBool x3d::Cone::get_solid  )  const [inline]
 

virtual field_t x3d::Cone::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::X3DGeometryNode.

virtual const char* x3d::Cone::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::X3DGeometryNode.

virtual bool x3d::Cone::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::X3DGeometryNode.

virtual bool x3d::Cone::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::X3DGeometryNode.

virtual int x3d::Cone::GetFieldCount void   )  const [virtual]
 

Get the number of fields available at this level.

This function returns the total number of fields this node supports. This can be used with a for() loop to query all the fields. It is also used internally to determine how to decrement the index to call the super class GetFieldByIndex() function.

In user defined types you need to call your super class GetFieldCount() and add the number of fields you offer:

 MyClass:GetFieldCount()
 {
        return X3DChildNode::GetFieldCount() + 5;
 }

Returns:
the total number of fields in this node and all its super classes
See also:
bool SFNode::GetFieldByIndex(int idx, FieldInfo *info) const; field_t GetField(const char *name);

Reimplemented from x3d::X3DGeometryNode.

virtual bool x3d::Cone::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::X3DGeometryNode.

virtual const char* x3d::Cone::GetNodeName void   )  const [virtual]
 

Get the textual name of a node.

The textual name of the node. This is also the name of the C++ class. it is used to load and save files in XML and VRML.

Returns:
a constant string (do not modify!)
See also:
field_t SFNode::GetNodeType(int idx) const;

Reimplemented from x3d::X3DGeometryNode.

virtual field_t x3d::Cone::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::X3DGeometryNode.

virtual int x3d::Cone::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::X3DGeometryNode.

virtual bool x3d::Cone::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.

 if(node->IsNodeType(FLD_TYPE_SCRIPT)) HandleScript(); 

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::X3DGeometryNode.

void x3d::Cone::set_bottom const SFBool bottom  )  [inline]
 

void x3d::Cone::set_bottomRadius const SFFloat bottomRadius  )  [inline]
 

void x3d::Cone::set_height const SFFloat height  )  [inline]
 

void x3d::Cone::set_side const SFBool side  )  [inline]
 

void x3d::Cone::set_solid const SFBool solid  )  [inline]
 

virtual bool x3d::Cone::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::X3DGeometryNode.


Member Data Documentation

SFBool x3d::Cone::f_bottom [protected]
 

SFFloat x3d::Cone::f_bottomRadius [protected]
 

SFFloat x3d::Cone::f_height [protected]
 

SFBool x3d::Cone::f_side [protected]
 

SFBool x3d::Cone::f_solid [protected]
 


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