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

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.
- Public Member Functions inherited from openvrml::node_impl_util::abstract_node_type
virtual ~abstract_node_type ()=0 throw ()
 Destroy.
- Public Member Functions inherited from openvrml::node_type
virtual ~node_type ()=0 throw ()
 Destructor.
const node_metatypemetatype () const throw ()
 The class object associated with the node_type.
const std::string & id () const throw ()
 The name of the node_type.
const node_interface_setinterfaces () const throw ()
 Get the set of interfaces for the node_type.
const boost::intrusive_ptr< nodecreate_node (const boost::shared_ptr< scope > &scope, const initial_value_map &initial_values=initial_value_map()) const throw ( unsupported_interface , std::bad_cast , std::bad_alloc )
 Create a new node with this node_type.

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

Additional Inherited Members

- Protected Member Functions inherited from openvrml::node_impl_util::abstract_node_type
 abstract_node_type (const openvrml::node_metatype &metatype, const std::string &id)
 Construct.

Detailed Description

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

A template for concrete node_types.

Template Parameters
Nodea 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.

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 
)

Construct.

Parameters
[in]metatypethe node_metatype.
[in]idthe node_type identifier.
template<typename Node >
openvrml::node_impl_util::node_type_impl< Node >::~node_type_impl ( ) throw ()
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)
static

Make a field_ptr_ptr to a field member of a node.

Template Parameters
FieldMembera field_value member of Node.
DeducedNodethe 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_mema 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)
static

Make an event_listener_ptr_ptr to a field member of a node.

Template Parameters
EventListenerMemberan event_listener member of Node.
DeducedNodethe 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_mema 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)
static

Make an event_emitter_ptr_ptr to a field member of a node.

Template Parameters
EventEmitterMemberan event_emitter member of Node.
DeducedNodethe 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_mema 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 )

Add an eventIn.

Template Parameters
EventListenerMemberthe type of the event_listener member.
DeducedNodethe deduced type of the node of which the event listener is a member.
Parameters
[in]typethe field value type.
[in]idthe eventIn identifier.
[in]event_listenerthe openvrml::event_listener associated with the eventIn.
Exceptions
std::invalid_argumentif an interface with a conflicting id has already been added to the node_type.
std::bad_allocif 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 )

Add an eventOut.

Template Parameters
EventEmitterMemberthe type of the event_emitter member.
DeducedNodethe deduced type of the node of which the event emitter is a member.
Parameters
[in]typethe field value type.
[in]idthe eventOut identifier.
[in]event_emitterthe openvrml::event_emitter associated with the eventOut.
Exceptions
std::invalid_argumentif an interface with a conflicting id has already been added to the node_type.
std::bad_allocif 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 )

Add an exposedField.

Template Parameters
EventEmitterMemberthe type of the event_emitter member.
FieldMemberthe type of the field member.
EventListenerMemberthe type of the event_listener member.
DeducedNodethe deduced type of the node of which the event emitter is a member.
Parameters
[in]typethe field value type.
[in]idthe exposedField identifier.
[in]event_listenerthe openvrml::event_listener associated with the exposedField.
[in]fieldthe openvrml::field_value associated with the exposedField.
[in]event_emitterthe openvrml::event_emitter associated with the exposedField.
Exceptions
std::invalid_argumentif an interface with a conflicting id has already been added to the node_type.
std::bad_allocif 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 )

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

Template Parameters
ExposedfieldMemberthe type of the exposedfield member.
DeducedNodethe deduced type of the node of which the event emitter is a member.
Parameters
[in]typethe field value type.
[in]idthe exposedField identifier.
[in]exposedfieldthe member associated with the exposedField.
Exceptions
std::invalid_argumentif an interface with a conflicting id has already been added to the node_type.
std::bad_allocif 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 )

Add a field.

Template Parameters
FieldMemberthe type of the field member.
DeducedNodethe deduced type of the node of which the event emitter is a member.
Parameters
[in]typethe field value type.
[in]idthe field identifier.
[in]fieldthe openvrml::field_value associated with the field.
Exceptions
std::invalid_argumentif an interface with a conflicting id has already been added to the node_type.
std::bad_allocif 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 )
virtual

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

Delegates to node_type_impl<Node>::do_field_value.

Parameters
[in]nodethe openvrml::node for which to return the openvrml::field_value.
[in]idfield identifier.
Returns
node's openvrml::field_value corresponding to the field identifier id.
Exceptions
openvrml::unsupported_interfaceif 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 )
virtual

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

Delegates to node_type_impl<Node>::do_event_listener.

Parameters
[in]nodethe openvrml::node for which to return the openvrml::event_listener.
[in]ideventIn identifier.
Returns
node's openvrml::event_listener corresponding to the eventIn identifier id.
Exceptions
openvrml::unsupported_interfaceif 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 )
virtual

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

Delegates to node_type_impl<Node>::do_event_emitter.

Parameters
[in]nodethe openvrml::node for which to return the openvrml::event_emitter.
[in]ideventOut identifier.
Returns
node's openvrml::event_emitter corresponding to the eventOut identifier id.
Exceptions
openvrml::unsupported_interfaceif 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 ()
privatevirtual

The set of node_interfaces supported by the node_type.

Returns
the set of node_interfaces supported by the 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 )
privatevirtual

Create a node instance.

Parameters
[in]scopethe scope the new node will belong to.
[in]initial_valuesinitial values for the new node's fields.
Returns
a new node instance.
Exceptions
openvrml::unsupported_interfaceif a field identifier in initial_values does not correspond to a field for the node_type.
std::bad_castif a field value type in initial_values is incorrect for the corresponding field for the node_type.
std::bad_allocif 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 )
private

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

Parameters
[in]nodethe node for which to return the openvrml::field_value.
[in]idfield identifier.
Returns
node's openvrml::field_value corresponding to the field identifier id.
Exceptions
openvrml::unsupported_interfaceif 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 )
private

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

Parameters
[in]nodethe openvrml::node for which to return the openvrml::event_listener.
[in]ideventIn identifier.
Returns
node's openvrml::event_listener corresponding to the eventIn identifier id.
Exceptions
openvrml::unsupported_interfaceif 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 )
private

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

Delegates to node_type_impl<Node>::do_event_emitter.

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