openvrml::node_impl_util::node_type_impl< Node > Class Template Reference

A template for concrete node_types. More...

#include <openvrml/node_impl_util.h>

Inheritance diagram for openvrml::node_impl_util::node_type_impl< Node >:

List of all members.


Classes

class  event_emitter_ptr
 Concrete pointer-to-member wrapper. More...
class  event_listener_ptr
 Concrete pointer-to-member wrapper. More...
class  field_ptr
 Concrete pointer-to-member wrapper. More...

Public Types

typedef boost::shared_ptr
< ptr_to_polymorphic_mem
< openvrml::field_value, Node > > 
field_ptr_ptr
 A shared_ptr to a pointer-to-member wrapper template.
typedef boost::shared_ptr
< ptr_to_polymorphic_mem
< openvrml::event_listener,
Node > > 
event_listener_ptr_ptr
 A shared_ptr to a pointer-to-member wrapper template.
typedef boost::shared_ptr
< ptr_to_polymorphic_mem
< openvrml::event_emitter,
Node > > 
event_emitter_ptr_ptr
 A shared_ptr to a pointer-to-member wrapper template.

Public Member Functions

 node_type_impl (const openvrml::node_metatype &metatype, const std::string &id)
 Construct.
virtual ~node_type_impl () throw ()
 Destroy.
void add_eventin (openvrml::field_value::type_id type, const std::string &id, const event_listener_ptr_ptr &event_listener) throw ( std::invalid_argument , std::bad_alloc )
 Add an eventIn.
void add_eventout (openvrml::field_value::type_id type, const std::string &id, const event_emitter_ptr_ptr &event_emitter) throw ( std::invalid_argument , std::bad_alloc )
 Add an eventOut.
void add_exposedfield (openvrml::field_value::type_id type, const std::string &id, const event_listener_ptr_ptr &event_listener, const field_ptr_ptr &field, const event_emitter_ptr_ptr &event_emitter) throw ( std::invalid_argument , std::bad_alloc )
 Add an exposedField.
void add_field (openvrml::field_value::type_id type, const std::string &id, const field_ptr_ptr &field) throw ( std::invalid_argument , std::bad_alloc )
 Add a field.
virtual const
openvrml::field_value
field_value (const openvrml::node &node, const std::string &id) const throw ( openvrml::unsupported_interface )
 node's openvrml::field_value corresponding to the field identifier id.
virtual openvrml::event_listenerevent_listener (openvrml::node &node, const std::string &id) const throw ( openvrml::unsupported_interface )
 node's openvrml::event_listener corresponding to the eventIn identifier id.
virtual openvrml::event_emitterevent_emitter (openvrml::node &node, const std::string &id) const throw ( openvrml::unsupported_interface )
 node's openvrml::event_emitter corresponding to the eventOut identifier id.

Private Types

typedef std::map< std::string,
field_ptr_ptr
field_value_map_t
 Map of pointers to openvrml::field_value node members.
typedef std::map< std::string,
event_listener_ptr_ptr
event_listener_map_t
 Map of pointers to openvrml::event_listener node members.
typedef std::map< std::string,
event_emitter_ptr_ptr
event_emitter_map_t
 Map of pointers to openvrml::event_emitter node members.

Private Member Functions

virtual const
openvrml::node_interface_set
do_interfaces () const throw ()
 The set of node_interfaces supported by the node_type.
virtual const
boost::intrusive_ptr
< openvrml::node
do_create_node (const boost::shared_ptr< openvrml::scope > &scope, const openvrml::initial_value_map &initial_values) const throw ( openvrml::unsupported_interface , std::bad_cast , std::bad_alloc )
 Create a node instance.
const openvrml::field_valuedo_field_value (const Node &node, const std::string &id) const throw ( openvrml::unsupported_interface )
 node's openvrml::field_value corresponding to the field identifier id.
openvrml::event_listenerdo_event_listener (Node &node, const std::string &id) const throw ( openvrml::unsupported_interface )
 node's openvrml::event_listener corresponding to the eventIn identifier id.
openvrml::event_emitterdo_event_emitter (Node &node, const std::string &id) const throw ( openvrml::unsupported_interface )
 node's openvrml::event_emitter corresponding to the eventOut identifier id.

Private Attributes

openvrml::node_interface_set interfaces_
 The set of node_interfaces for the node_type.
field_value_map_t field_value_map
 Map of pointers to openvrml::field_value node members.
event_listener_map_t event_listener_map
 Map of pointers to openvrml::event_listener node members.
event_emitter_map_t event_emitter_map
 Map of pointers to openvrml::event_emitter node members.

Friends

class event_listener_base< Node >
 The event_listener_base class template accesses node_type_impl<Node>::event_listener_map.
class event_emitter_base< Node >
 The event_emitter_base class template accesses node_type_impl<Node>::event_emitter_map.

Detailed Description

template<typename Node>
class openvrml::node_impl_util::node_type_impl< Node >

A template for concrete node_types.

Template Parameters:
Node a concrete node type.

Member Typedef Documentation

A shared_ptr to a pointer-to-member wrapper template.

A shared_ptr to a pointer-to-member wrapper template.

A shared_ptr to a pointer-to-member wrapper template.

template<typename Node >
std::map< std::string, openvrml::node_impl_util::node_type_impl< Node >::field_ptr_ptr > openvrml::node_impl_util::node_type_impl< Node >::field_value_map_t [private]

Map of pointers to openvrml::field_value node members.

template<typename Node >
std::map< std::string, openvrml::node_impl_util::node_type_impl< Node >::event_listener_ptr_ptr > openvrml::node_impl_util::node_type_impl< Node >::event_listener_map_t [private]

Map of pointers to openvrml::event_listener node members.

template<typename Node >
std::map< std::string, openvrml::node_impl_util::node_type_impl< Node >::event_emitter_ptr_ptr > openvrml::node_impl_util::node_type_impl< Node >::event_emitter_map_t [private]

Map of pointers to openvrml::event_emitter node members.


Constructor & Destructor Documentation

template<typename Node >
openvrml::node_impl_util::node_type_impl< Node >::node_type_impl ( const openvrml::node_metatype metatype,
const std::string &  id 
) [inline]

Construct.

Parameters:
[in] metatype the node_metatype.
[in] id the node_type identifier.

template<typename Node >
openvrml::node_impl_util::node_type_impl< Node >::~node_type_impl (  )  throw () [inline, virtual]

Destroy.


Member Function Documentation

template<typename Node >
void openvrml::node_impl_util::node_type_impl< Node >::add_eventin ( openvrml::field_value::type_id  type,
const std::string &  id,
const event_listener_ptr_ptr event_listener 
) throw ( std::invalid_argument , std::bad_alloc ) [inline]

Add an eventIn.

Parameters:
[in] type the field value type.
[in] id the eventIn identifier.
[in] event_listener the openvrml::event_listener associated with the eventIn.
Exceptions:
std::invalid_argument if an interface with a conflicting id has already been added to the node_type.
std::bad_alloc if memory allocation fails.

template<typename Node >
void openvrml::node_impl_util::node_type_impl< Node >::add_eventout ( openvrml::field_value::type_id  type,
const std::string &  id,
const event_emitter_ptr_ptr event_emitter 
) throw ( std::invalid_argument , std::bad_alloc ) [inline]

Add an eventOut.

Parameters:
[in] type the field value type.
[in] id the eventOut identifier.
[in] event_emitter the openvrml::event_emitter associated with the eventOut.
Exceptions:
std::invalid_argument if an interface with a conflicting id has already been added to the node_type.
std::bad_alloc if memory allocation fails.

template<typename Node >
void openvrml::node_impl_util::node_type_impl< Node >::add_exposedfield ( openvrml::field_value::type_id  type,
const std::string &  id,
const event_listener_ptr_ptr event_listener,
const field_ptr_ptr field,
const event_emitter_ptr_ptr event_emitter 
) throw ( std::invalid_argument , std::bad_alloc ) [inline]

Add an exposedField.

Parameters:
[in] type the field value type.
[in] id the exposedField identifier.
[in] event_listener the openvrml::event_listener associated with the exposedField.
[in] field the openvrml::field_value associated with the exposedField.
[in] event_emitter the openvrml::event_emitter associated with the exposedField.
Exceptions:
std::invalid_argument if an interface with a conflicting id has already been added to the node_type.
std::bad_alloc if memory allocation fails.

template<typename Node >
void openvrml::node_impl_util::node_type_impl< Node >::add_field ( openvrml::field_value::type_id  type,
const std::string &  id,
const field_ptr_ptr field 
) throw ( std::invalid_argument , std::bad_alloc ) [inline]

Add a field.

Parameters:
[in] type the field value type.
[in] id the field identifier.
[in] field the openvrml::field_value associated with the field.
Exceptions:
std::invalid_argument if an interface with a conflicting id has already been added to the node_type.
std::bad_alloc if memory allocation fails.

template<typename Node >
const openvrml::field_value & openvrml::node_impl_util::node_type_impl< Node >::field_value ( const openvrml::node node,
const std::string &  id 
) const throw ( openvrml::unsupported_interface ) [inline, virtual]

node's openvrml::field_value corresponding to the field identifier id.

Delegates to node_type_impl<Node>::do_field_value.

Parameters:
[in] node the openvrml::node for which to return the openvrml::field_value.
[in] id field identifier.
Returns:
node's openvrml::field_value corresponding to the field identifier id.
Exceptions:
openvrml::unsupported_interface if node has no field id.

Implements openvrml::node_impl_util::abstract_node_type.

template<typename Node >
openvrml::event_listener & openvrml::node_impl_util::node_type_impl< Node >::event_listener ( openvrml::node node,
const std::string &  id 
) const throw ( openvrml::unsupported_interface ) [inline, virtual]

node's openvrml::event_listener corresponding to the eventIn identifier id.

Delegates to node_type_impl<Node>::do_event_listener.

Parameters:
[in] node the openvrml::node for which to return the openvrml::event_listener.
[in] id eventIn identifier.
Returns:
node's openvrml::event_listener corresponding to the eventIn identifier id.
Exceptions:
openvrml::unsupported_interface if node has no eventIn id.

Implements openvrml::node_impl_util::abstract_node_type.

template<typename Node >
openvrml::event_emitter & openvrml::node_impl_util::node_type_impl< Node >::event_emitter ( openvrml::node node,
const std::string &  id 
) const throw ( openvrml::unsupported_interface ) [inline, virtual]

node's openvrml::event_emitter corresponding to the eventOut identifier id.

Delegates to node_type_impl<Node>::do_event_emitter.

Parameters:
[in] node the openvrml::node for which to return the openvrml::event_emitter.
[in] id eventOut identifier.
Returns:
node's openvrml::event_emitter corresponding to the eventOut identifier id.
Exceptions:
openvrml::unsupported_interface if node has no eventOut id.

Implements openvrml::node_impl_util::abstract_node_type.

template<typename Node >
const openvrml::node_interface_set & openvrml::node_impl_util::node_type_impl< Node >::do_interfaces (  )  const throw () [inline, private, virtual]

The set of node_interfaces supported by the node_type.

Returns:
the set of node_interfaces supported by the node_type.

Implements openvrml::node_type.

template<typename Node >
const boost::intrusive_ptr< openvrml::node > openvrml::node_impl_util::node_type_impl< Node >::do_create_node ( const boost::shared_ptr< openvrml::scope > &  scope,
const openvrml::initial_value_map initial_values 
) const throw ( openvrml::unsupported_interface , std::bad_cast , std::bad_alloc ) [inline, private, virtual]

Create a node instance.

Parameters:
[in] scope the scope the new node will belong to.
[in] initial_values initial values for the new node's fields.
Returns:
a new node instance.
Exceptions:
openvrml::unsupported_interface if a field identifier in initial_values does not correspond to a field for the node_type.
std::bad_cast if a field value type in initial_values is incorrect for the corresponding field for the node_type.
std::bad_alloc if memory allocation fails.

template<typename Node >
const openvrml::field_value & openvrml::node_impl_util::node_type_impl< Node >::do_field_value ( const Node &  node,
const std::string &  id 
) const throw ( openvrml::unsupported_interface ) [inline, private]

node's openvrml::field_value corresponding to the field identifier id.

Parameters:
[in] node the node for which to return the openvrml::field_value.
[in] id field identifier.
Returns:
node's openvrml::field_value corresponding to the field identifier id.
Exceptions:
openvrml::unsupported_interface if node has no field id.

template<typename Node >
openvrml::event_listener & openvrml::node_impl_util::node_type_impl< Node >::do_event_listener ( Node &  node,
const std::string &  id 
) const throw ( openvrml::unsupported_interface ) [inline, private]

node's openvrml::event_listener corresponding to the eventIn identifier id.

Parameters:
[in] node the openvrml::node for which to return the openvrml::event_listener.
[in] id eventIn identifier.
Returns:
node's openvrml::event_listener corresponding to the eventIn identifier id.
Exceptions:
openvrml::unsupported_interface if node has no eventIn id.

template<typename Node >
openvrml::event_emitter & openvrml::node_impl_util::node_type_impl< Node >::do_event_emitter ( Node &  node,
const std::string &  id 
) const throw ( openvrml::unsupported_interface ) [inline, private]

node's openvrml::event_emitter corresponding to the eventOut identifier id.

Delegates to node_type_impl<Node>::do_event_emitter.

Parameters:
[in] node the openvrml::node for which to return the openvrml::event_emitter.
[in] id eventOut identifier.
Returns:
node's openvrml::event_emitter corresponding to the eventOut identifier id.
Exceptions:
openvrml::unsupported_interface if node has no eventOut id.


Friends And Related Function Documentation

template<typename Node >
class openvrml::node_impl_util::node_type_impl< Node >::event_listener_base [friend]

template<typename Node >
class openvrml::node_impl_util::node_type_impl< Node >::event_emitter_base [friend]


Member Data Documentation

The set of node_interfaces for the node_type.

Map of pointers to openvrml::field_value node members.

Map of pointers to openvrml::event_emitter node members.