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.
template<typename EventListenerMember , typename DeducedNode >
void add_eventin (openvrml::field_value::type_id type, const std::string &id, EventListenerMember DeducedNode::*event_listener) throw ( std::invalid_argument , std::bad_alloc )
 Add an eventIn.
template<typename EventEmitterMember , typename DeducedNode >
void add_eventout (openvrml::field_value::type_id type, const std::string &id, EventEmitterMember DeducedNode::*event_emitter) throw ( std::invalid_argument , std::bad_alloc )
 Add an eventOut.
template<typename EventListenerMember , typename FieldMember , typename EventEmitterMember , typename DeducedNode >
void add_exposedfield (openvrml::field_value::type_id type, const std::string &id, EventListenerMember DeducedNode::*event_listener, FieldMember DeducedNode::*field, EventEmitterMember DeducedNode::*event_emitter) throw ( std::invalid_argument , std::bad_alloc )
 Add an exposedField.
template<typename ExposedfieldMember , typename DeducedNode >
void add_exposedfield (openvrml::field_value::type_id type, const std::string &id, ExposedfieldMember DeducedNode::*exposedfield) throw ( std::invalid_argument , std::bad_alloc )
template<typename FieldMember , typename DeducedNode >
void add_field (openvrml::field_value::type_id type, const std::string &id, FieldMember DeducedNode::*exposedfield) 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.
template<typename EventListenerMember , typename DeducedNode >
void add_eventout (const openvrml::field_value::type_id type, const std::string &id, EventListenerMember DeducedNode::*event_emitter) throw ( std::invalid_argument , std::bad_alloc )

Static Public Member Functions

template<typename FieldMember , typename DeducedNode >
static const field_ptr_ptr make_field_ptr_ptr (FieldMember DeducedNode::*ptr_to_mem)
 Make a field_ptr_ptr to a field member of a node.
template<typename EventListenerMember , typename DeducedNode >
static const event_listener_ptr_ptr make_event_listener_ptr_ptr (EventListenerMember DeducedNode::*ptr_to_mem)
 Make an event_listener_ptr_ptr to a field member of a node.
template<typename EventEmitterMember , typename DeducedNode >
static const event_emitter_ptr_ptr make_event_emitter_ptr_ptr (EventEmitterMember DeducedNode::*ptr_to_mem)
 Make an event_emitter_ptr_ptr to a field member of a node.

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 >
template<typename FieldMember , typename DeducedNode >
const node_type_impl< Node >::field_ptr_ptr openvrml::node_impl_util::node_type_impl< Node >::make_field_ptr_ptr ( FieldMember DeducedNode::*  ptr_to_mem  )  [inline, static]

Make a field_ptr_ptr to a field member of a node.

Template Parameters:
FieldMember a field_value member of Node.
DeducedNode the deduced type of the node may differ from its actual concrete type in the contexts in which this function is used. We static_cast to the actual type.
Parameters:
[in] ptr_to_mem a pointer to an openvrml::field_value member.
Returns:
a field_ptr_ptr to ptr_to_mem.

template<typename Node >
template<typename EventListenerMember , typename DeducedNode >
const node_type_impl< Node >::event_listener_ptr_ptr openvrml::node_impl_util::node_type_impl< Node >::make_event_listener_ptr_ptr ( EventListenerMember DeducedNode::*  ptr_to_mem  )  [inline, static]

Make an event_listener_ptr_ptr to a field member of a node.

Template Parameters:
EventListenerMember an event_listener member of Node.
DeducedNode the deduced type of the node may differ from its actual concrete type in the contexts in which this function is used. We static_cast to the actual type.
Parameters:
[in] ptr_to_mem a pointer to an openvrml::event_listener member.
Returns:
a event_listener_ptr_ptr to ptr_to_mem.

template<typename Node >
template<typename EventEmitterMember , typename DeducedNode >
const node_type_impl< Node >::event_emitter_ptr_ptr openvrml::node_impl_util::node_type_impl< Node >::make_event_emitter_ptr_ptr ( EventEmitterMember DeducedNode::*  ptr_to_mem  )  [inline, static]

Make an event_emitter_ptr_ptr to a field member of a node.

Template Parameters:
EventEmitterMember an event_emitter member of Node.
DeducedNode the deduced type of the node may differ from its actual concrete type in the contexts in which this function is used. We static_cast to the actual type.
Parameters:
[in] ptr_to_mem a pointer to an openvrml::event_emitter member.
Returns:
a event_emitter_ptr_ptr to ptr_to_mem.

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

Add an eventIn.

Template Parameters:
EventListenerMember the type of the event_listener member.
DeducedNode the deduced type of the node of which the event listener is a member.
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 >
template<typename EventEmitterMember , typename DeducedNode >
void openvrml::node_impl_util::node_type_impl< Node >::add_eventout ( openvrml::field_value::type_id  type,
const std::string &  id,
EventEmitterMember DeducedNode::*  event_emitter 
) throw ( std::invalid_argument , std::bad_alloc ) [inline]

Add an eventOut.

Template Parameters:
EventEmitterMember the type of the event_emitter member.
DeducedNode the deduced type of the node of which the event emitter is a member.
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 >
template<typename EventListenerMember , typename FieldMember , typename EventEmitterMember , typename DeducedNode >
void openvrml::node_impl_util::node_type_impl< Node >::add_exposedfield ( openvrml::field_value::type_id  type,
const std::string &  id,
EventListenerMember DeducedNode::*  event_listener,
FieldMember DeducedNode::*  field,
EventEmitterMember DeducedNode::*  event_emitter 
) throw ( std::invalid_argument , std::bad_alloc ) [inline]

Add an exposedField.

Template Parameters:
EventEmitterMember the type of the event_emitter member.
FieldMember the type of the field member.
EventListenerMember the type of the event_listener member.
DeducedNode the deduced type of the node of which the event emitter is a member.
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 >
template<typename ExposedfieldMember , typename DeducedNode >
void openvrml::node_impl_util::node_type_impl< Node >::add_exposedfield ( openvrml::field_value::type_id  type,
const std::string &  id,
ExposedfieldMember DeducedNode::*  exposedfield 
) throw ( std::invalid_argument , std::bad_alloc ) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Template Parameters:
ExposedfieldMember the type of the exposedfield member.
DeducedNode the deduced type of the node of which the event emitter is a member.
Parameters:
[in] type the field value type.
[in] id the exposedField identifier.
[in] exposedfield the member 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 >
template<typename FieldMember , typename DeducedNode >
void openvrml::node_impl_util::node_type_impl< Node >::add_field ( openvrml::field_value::type_id  type,
const std::string &  id,
FieldMember DeducedNode::*  field 
) throw ( std::invalid_argument , std::bad_alloc ) [inline]

Add a field.

Template Parameters:
FieldMember the type of the field member.
DeducedNode the deduced type of the node of which the event emitter is a member.
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.