| Home | Download | Screen shots | Discussion | Documentation |
|---|
#include <openvrml/scope.h>
scope class keeps track of defined nodes and prototypes.
PROTO definitions add node_types to the namespace. PROTO implementations are a separate node_type namespace and require that any nested PROTOs not be available outside the PROTO implementation. PROTOs defined outside the current namespace are available.
Public Member Functions | |
| scope (const std::string &id, const boost::shared_ptr< const scope > &parent=boost::shared_ptr< scope >()) | |
| Construct. | |
| const std::string & | id () const throw () |
scope identifier. | |
| const boost::shared_ptr< const scope > & | parent () const throw () |
The parent scope. | |
| const std::pair< boost::shared_ptr< node_type >, bool > | add_type (const boost::shared_ptr< node_type > &type) throw ( std::bad_alloc ) |
Add a node_type. | |
| const boost::shared_ptr< node_type > & | find_type (const std::string &id) const |
Find a node_type, given a type name. Returns 0 if no node_type named id is defined for the scope. | |
| const boost::shared_ptr< node_type > & | first_type () const |
The first node_type in the scope. | |
| node * | find_node (const std::string &id) const |
Find the node in the scope with node::id id. | |
Private Attributes | |
| std::list< boost::shared_ptr< node_type > > | node_type_list |
List of node_types in the scope. | |
| std::map< std::string, node * > | named_node_map |
Map of the named nodes in the scope. | |
| const std::string | id_ |
scope identifier. | |
| const boost::shared_ptr< const scope > | parent_ |
The parent scope; null if the scope is a root scope. | |
Friends | |
| class | node |
node identifiers are stored in the scope, so node needs special privilege to access them. | |
Related Functions | |
| (Note that these are not member functions.) | |
| const std::string | path (const scope &s) throw(std::bad_alloc) |
| openvrml::scope::scope | ( | const std::string & | id, | |
| const boost::shared_ptr< const scope > & | parent = boost::shared_ptr<scope>() | |||
| ) | [explicit] |
Construct.
| [in] | id | the identifier for the scope. |
| [in] | parent | the parent scope. |
scope, id should be the URI of the world. For child scopes, id should be the name of the PROTO to which the scope corresponds.
| const std::string & openvrml::scope::id | ( | ) | const throw () |
scope identifier.
scope identifier. | const boost::shared_ptr< const openvrml::scope > & openvrml::scope::parent | ( | ) | const throw () |
The parent scope.
scope; or null if the scope is a root scope. | const std::pair< boost::shared_ptr< openvrml::node_type >, bool > openvrml::scope::add_type | ( | const boost::shared_ptr< node_type > & | type | ) | throw ( std::bad_alloc ) |
Add a node_type.
Print an error message if the argument type is already defined.
| [in] | type | a node_type. |
node_type whose node_type::id is the same as that of type. The second element is a boolean value. If the second element is true, type was successfully added to the scope and the first element is the same as type. If the second element is false, type was not added to the scope and the first element is a node_type that already exists in the scope.| std::bad_alloc | if memory allocation fails. |
type is not null. | const boost::shared_ptr< openvrml::node_type > & openvrml::scope::find_type | ( | const std::string & | id | ) | const |
| const boost::shared_ptr< openvrml::node_type > & openvrml::scope::first_type | ( | ) | const |
| openvrml::node * openvrml::scope::find_node | ( | const std::string & | id | ) | const |
openvrml::scope::node [friend] |
node identifiers are stored in the scope, so node needs special privilege to access them.
| const std::string path | ( | const scope & | s | ) | throw(std::bad_alloc) [related] |
| [in] | s | a scope. |
scope.
std::list< boost::shared_ptr< openvrml::node_type > > openvrml::scope::node_type_list [private] |
List of node_types in the scope.
std::map< std::string, openvrml::node * > openvrml::scope::named_node_map [private] |
Map of the named nodes in the scope.
const std::string openvrml::scope::id_ [private] |
scope identifier.
For internal use only.
const boost::shared_ptr< const openvrml::scope > openvrml::scope::parent_ [private] |
The parent scope; null if the scope is a root scope.
For internal use only.