Implements a factory to create Endpoints and VDevs. More...
#include <AVStreams_i.h>
Public Types | |
enum | MMDevice_Type { MMDEVICE_A = 0, MMDEVICE_B = 1 } |
Constructor. More... | |
Public Member Functions | |
TAO_MMDevice (TAO_AV_Endpoint_Strategy *endpoint_strategy_) | |
virtual AVStreams::StreamEndPoint_ptr | create_A_B (MMDevice_Type type, AVStreams::StreamCtrl_ptr the_requester, AVStreams::VDev_out the_vdev, AVStreams::streamQoS &the_qos, CORBA::Boolean_out met_qos, char *&named_vdev, const AVStreams::flowSpec &the_spec) |
virtual AVStreams::StreamCtrl_ptr | bind (AVStreams::MMDevice_ptr peer_device, AVStreams::streamQoS &the_qos, CORBA::Boolean_out is_met, const AVStreams::flowSpec &the_spec) |
virtual AVStreams::StreamCtrl_ptr | bind_mcast (AVStreams::MMDevice_ptr first_peer, AVStreams::streamQoS &the_qos, CORBA::Boolean_out is_met, const AVStreams::flowSpec &the_spec) |
Multicast bind. | |
virtual AVStreams::StreamEndPoint_A_ptr | create_A (AVStreams::StreamCtrl_ptr the_requester, AVStreams::VDev_out the_vdev, AVStreams::streamQoS &the_qos, CORBA::Boolean_out met_qos, char *&named_vdev, const AVStreams::flowSpec &the_spec) |
Called by StreamCtrl to create a "A" type streamandpoint and vdev. | |
virtual AVStreams::StreamEndPoint_B_ptr | create_B (AVStreams::StreamCtrl_ptr the_requester, AVStreams::VDev_out the_vdev, AVStreams::streamQoS &the_qos, CORBA::Boolean_out met_qos, char *&named_vdev, const AVStreams::flowSpec &the_spec) |
Called by StreamCtrl to create a "B" type streamandpoint and vdev. | |
virtual void | destroy (AVStreams::StreamEndPoint_ptr the_ep, const char *vdev_name) |
Remove the StreamEndPoint and the related vdev. | |
virtual char * | add_fdev (CORBA::Object_ptr the_fdev) |
Not supported in the light profile, raises notsupported. | |
virtual CORBA::Object_ptr | get_fdev (const char *flow_name) |
Not supported in the light profile, raises notsupported. | |
virtual void | remove_fdev (const char *flow_name) |
Not supported in the light profile, raises notsupported. | |
virtual | ~TAO_MMDevice (void) |
Destructor. | |
Protected Types | |
typedef ACE_Hash_Map_Manager < ACE_CString, AVStreams::FDev_var, ACE_Null_Mutex > | FDev_Map |
typedef ACE_Hash_Map_Iterator < ACE_CString, AVStreams::FDev_var, ACE_Null_Mutex > | FDev_Map_Iterator |
typedef ACE_Hash_Map_Entry < ACE_CString, AVStreams::FDev_var > | FDev_Map_Entry |
Protected Member Functions | |
char * | add_fdev_i (AVStreams::FDev_ptr fdev) |
Helper method to implement add_fdev(). | |
Protected Attributes | |
TAO_AV_Endpoint_Strategy * | endpoint_strategy_ |
u_int | flow_count_ |
u_int | flow_num_ |
current flow number used for system generation of flow names. | |
FDev_Map | fdev_map_ |
AVStreams::flowSpec | flows_ |
sequence of supported flow names. | |
TAO_StreamCtrl * | stream_ctrl_ |
Implements a factory to create Endpoints and VDevs.
Definition at line 700 of file AVStreams_i.h.
typedef ACE_Hash_Map_Manager<ACE_CString,AVStreams::FDev_var,ACE_Null_Mutex> TAO_MMDevice::FDev_Map [protected] |
Definition at line 779 of file AVStreams_i.h.
typedef ACE_Hash_Map_Entry<ACE_CString,AVStreams::FDev_var> TAO_MMDevice::FDev_Map_Entry [protected] |
Definition at line 781 of file AVStreams_i.h.
typedef ACE_Hash_Map_Iterator<ACE_CString,AVStreams::FDev_var,ACE_Null_Mutex> TAO_MMDevice::FDev_Map_Iterator [protected] |
Definition at line 780 of file AVStreams_i.h.
TAO_MMDevice::TAO_MMDevice | ( | TAO_AV_Endpoint_Strategy * | endpoint_strategy_ | ) |
Definition at line 2929 of file AVStreams_i.cpp.
: endpoint_strategy_ (endpoint_strategy), flow_count_ (0), flow_num_ (0), stream_ctrl_ (0) { }
TAO_MMDevice::~TAO_MMDevice | ( | void | ) | [virtual] |
char * TAO_MMDevice::add_fdev | ( | CORBA::Object_ptr | the_fdev | ) | [virtual] |
Not supported in the light profile, raises notsupported.
Definition at line 3247 of file AVStreams_i.cpp.
{ CORBA::String_var flow_name; AVStreams::FDev_var fdev; try { CORBA::Any_ptr flow_name_any; fdev = AVStreams::FDev::_narrow (fdev_obj); if (CORBA::is_nil (fdev.in ())) return 0; flow_name_any = fdev->get_property_value ("Flow"); const char *tmp = 0; *flow_name_any >>= tmp; flow_name = CORBA::string_dup (tmp); } catch (const CORBA::Exception&) { flow_name = this->add_fdev_i (fdev.in ()); } // Add it to the sequence of flowNames supported. // put the flowname and the fdev in a hashtable. ACE_CString fdev_name_key ( flow_name.in () ); if ( (this->fdev_map_.bind (fdev_name_key, fdev )) != 0) throw AVStreams::streamOpFailed (); // increment the flow count. this->flow_count_++; this->flows_.length (this->flow_count_); this->flows_ [this->flow_count_-1] = flow_name; // define/modify the "Flows" property. CORBA::Any flows_any; flows_any <<= this->flows_; try { this->define_property ("Flows", flows_any); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("TAO_MMDevice::add_fdev"); return 0; } return flow_name._retn (); }
char * TAO_MMDevice::add_fdev_i | ( | AVStreams::FDev_ptr | fdev | ) | [protected] |
Helper method to implement add_fdev().
Definition at line 3220 of file AVStreams_i.cpp.
{ char* tmp; ACE_NEW_RETURN (tmp, char[64], 0); CORBA::String_var flow_name = tmp; try { // exception implies the flow name is not defined and is system // generated. ACE_OS::sprintf (tmp, "flow%d", flow_num_++); CORBA::Any flowname_any; flowname_any <<= flow_name.in (); fdev->define_property ("Flow", flowname_any); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("TAO_MMDevice::add_fdev"); return 0; } return flow_name._retn (); }
AVStreams::StreamCtrl_ptr TAO_MMDevice::bind | ( | AVStreams::MMDevice_ptr | peer_device, | |
AVStreams::streamQoS & | the_qos, | |||
CORBA::Boolean_out | is_met, | |||
const AVStreams::flowSpec & | the_spec | |||
) | [virtual] |
Can be used to request the MMDevice to create a new StreamCtrl, and call bind_devs on it
Definition at line 2940 of file AVStreams_i.cpp.
{ AVStreams::StreamCtrl_ptr streamctrl (AVStreams::StreamCtrl::_nil ()); try { ACE_UNUSED_ARG (is_met); ACE_NEW_RETURN (this->stream_ctrl_, TAO_StreamCtrl, 0); AVStreams::MMDevice_var mmdevice = this->_this (); this->stream_ctrl_->bind_devs (peer_device, mmdevice.in (), the_qos, the_spec); streamctrl = this->stream_ctrl_->_this (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("TAO_MMDevice::bind"); return streamctrl; } return streamctrl; }
AVStreams::StreamCtrl_ptr TAO_MMDevice::bind_mcast | ( | AVStreams::MMDevice_ptr | first_peer, | |
AVStreams::streamQoS & | the_qos, | |||
CORBA::Boolean_out | is_met, | |||
const AVStreams::flowSpec & | the_spec | |||
) | [virtual] |
Multicast bind.
Definition at line 2969 of file AVStreams_i.cpp.
{
ACE_UNUSED_ARG (first_peer);
ACE_UNUSED_ARG (the_qos);
ACE_UNUSED_ARG (is_met);
ACE_UNUSED_ARG (the_spec);
return 0;
}
AVStreams::StreamEndPoint_A_ptr TAO_MMDevice::create_A | ( | AVStreams::StreamCtrl_ptr | the_requester, | |
AVStreams::VDev_out | the_vdev, | |||
AVStreams::streamQoS & | the_qos, | |||
CORBA::Boolean_out | met_qos, | |||
char *& | named_vdev, | |||
const AVStreams::flowSpec & | the_spec | |||
) | [virtual] |
Called by StreamCtrl to create a "A" type streamandpoint and vdev.
Definition at line 3153 of file AVStreams_i.cpp.
{ AVStreams::StreamEndPoint_A_ptr sep_a = 0; AVStreams::StreamEndPoint_var sep; try { sep = this->create_A_B (MMDEVICE_A, streamctrl, the_vdev, stream_qos, met_qos, named_vdev, flow_spec); sep_a = AVStreams::StreamEndPoint_A::_narrow (sep.in()); ACE_ASSERT( !CORBA::is_nil( sep_a ) ); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("TAO_MMDevice::create_A"); return sep_a; } return sep_a; }
AVStreams::StreamEndPoint_ptr TAO_MMDevice::create_A_B | ( | MMDevice_Type | type, | |
AVStreams::StreamCtrl_ptr | the_requester, | |||
AVStreams::VDev_out | the_vdev, | |||
AVStreams::streamQoS & | the_qos, | |||
CORBA::Boolean_out | met_qos, | |||
char *& | named_vdev, | |||
const AVStreams::flowSpec & | the_spec | |||
) | [virtual] |
Definition at line 2983 of file AVStreams_i.cpp.
{ AVStreams::StreamEndPoint_A_ptr sep_a (AVStreams::StreamEndPoint_A::_nil ()); AVStreams::StreamEndPoint_B_ptr sep_b (AVStreams::StreamEndPoint_B::_nil ()); AVStreams::StreamEndPoint_ptr sep (AVStreams::StreamEndPoint::_nil ()); try { switch (type) { case MMDEVICE_A: { if (this->endpoint_strategy_->create_A (sep_a, the_vdev) == -1) ACE_ERROR_RETURN ((LM_ERROR, "TAO_MMDevice::create_A_B (%P|%t) - " "error in create_A\n"), 0); sep = sep_a; } break; case MMDEVICE_B: { if (this->endpoint_strategy_->create_B (sep_b, the_vdev) == -1) ACE_ERROR_RETURN ((LM_ERROR, "TAO_MMDevice::create_A_B (%P|%t) - " "error in create_B\n"), 0); sep = sep_b; } break; default: break; } if (this->fdev_map_.current_size () > 0) { TAO_AV_QoS qos (the_qos); // create flowendpoints from the FDevs. for (u_int i=0;i<flow_spec.length ();i++) { TAO_Forward_FlowSpec_Entry forward_entry; forward_entry.parse (flow_spec[i]); ACE_CString flow_key (forward_entry.flowname ()); AVStreams::FDev_var flow_dev; AVStreams::FlowConnection_var flowconnection; try { // Get the flowconnection for this flow. //static int blah = 0; if(blah == 1){blah=0; abort();}else{blah=1;} CORBA::Object_var flowconnection_obj = streamctrl->get_flow_connection (forward_entry.flowname ()); ACE_OS::printf("successfully called get_flow_connection\n"); if (!CORBA::is_nil (flowconnection_obj.in ())) { flowconnection = AVStreams::FlowConnection::_narrow (flowconnection_obj.in ()); } } catch (const AVStreams::noSuchFlow&) { TAO_FlowConnection *flowConnection; ACE_NEW_RETURN (flowConnection, TAO_FlowConnection, 0); flowconnection = flowConnection->_this (); streamctrl->set_flow_connection (forward_entry.flowname(), flowconnection.in ()); } catch (const CORBA::Exception& ex) { //if (TAO_debug_level >= 0) ex._tao_print_exception ( "TAO_MMDevice::create_a::get_flow_connection"); } int result = this->fdev_map_.find (flow_key, flow_dev); if (result < 0) ACE_ERROR_RETURN ((LM_ERROR, "(%N,%l) fdev_map::find failed\n"), 0); CORBA::String_var named_fdev; AVStreams::FlowEndPoint_var flow_endpoint; AVStreams::QoS flow_qos; result = qos.get_flow_qos (forward_entry.flowname (), flow_qos); if (result < 0) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "(%N,%l) get_flow_qos failed for %s\n", forward_entry.flowname ())); switch (forward_entry.direction ()) { case TAO_FlowSpec_Entry::TAO_AV_DIR_IN: { switch (type) { case MMDEVICE_A: { // In implies flow is from A to B and // hence A is the producer for this flow and B is the consumer for this flow. // We have to create a producer from the FDev for this flow. flow_endpoint = flow_dev->create_producer (flowconnection.in (), flow_qos, met_qos, named_fdev.inout ()); } break; case MMDEVICE_B: { flow_endpoint = flow_dev->create_consumer (flowconnection.in (), flow_qos, met_qos, named_fdev.inout ()); } break; } } break; case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT: { switch (type) { case MMDEVICE_A: { // OUT implies flow is from B to A and // hence B is the producer for this flow and A is the consumer for this flow. // We have to create a consumer from the FDev for this flow. flow_endpoint = flow_dev->create_consumer (flowconnection.in (), flow_qos, met_qos, named_fdev.inout ()); } break; case MMDEVICE_B: { // In implies flow is from A to B and // hence A is the producer for this flow and B is the consumer for this flow. // We have to create a producer from the FDev for this flow. flow_endpoint = flow_dev->create_producer (flowconnection.in (), flow_qos, met_qos, named_fdev.inout ()); } break; } } break; default: break; } CORBA::Any flowname_any; flowname_any <<= forward_entry.flowname (); flow_endpoint->define_property ("FlowName", flowname_any); sep->add_fep (flow_endpoint.in ()); } } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("TAO_MMDevice::create_A"); return sep; } return sep; }
AVStreams::StreamEndPoint_B_ptr TAO_MMDevice::create_B | ( | AVStreams::StreamCtrl_ptr | the_requester, | |
AVStreams::VDev_out | the_vdev, | |||
AVStreams::streamQoS & | the_qos, | |||
CORBA::Boolean_out | met_qos, | |||
char *& | named_vdev, | |||
const AVStreams::flowSpec & | the_spec | |||
) | [virtual] |
Called by StreamCtrl to create a "B" type streamandpoint and vdev.
Definition at line 3180 of file AVStreams_i.cpp.
{ AVStreams::StreamEndPoint_B_ptr sep_b = AVStreams::StreamEndPoint_B::_nil (); AVStreams::StreamEndPoint_var sep; try { sep = this->create_A_B (MMDEVICE_B, streamctrl, the_vdev, stream_qos, met_qos, named_vdev, flow_spec); sep_b = AVStreams::StreamEndPoint_B::_narrow (sep.in()); ACE_ASSERT ( !CORBA::is_nil( sep_b ) ); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("TAO_MMDevice::create_B"); return sep_b; } return sep_b; }
void TAO_MMDevice::destroy | ( | AVStreams::StreamEndPoint_ptr | the_ep, | |
const char * | vdev_name | |||
) | [virtual] |
Remove the StreamEndPoint and the related vdev.
Definition at line 3208 of file AVStreams_i.cpp.
{ // Remove self from POA. Because of reference counting, the POA // will automatically delete the servant when all pending requests // on this servant are complete. int result = TAO_AV_Core::deactivate_servant (this); if (result < 0) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_MMDevice::destroy failed\n")); }
CORBA::Object_ptr TAO_MMDevice::get_fdev | ( | const char * | flow_name | ) | [virtual] |
Not supported in the light profile, raises notsupported.
Definition at line 3302 of file AVStreams_i.cpp.
{ ACE_CString fdev_name_key (flow_name); AVStreams::FDev_var fdev_entry; if (this->fdev_map_.find (fdev_name_key, fdev_entry) == 0) return fdev_entry._retn() ; return 0; }
void TAO_MMDevice::remove_fdev | ( | const char * | flow_name | ) | [virtual] |
Not supported in the light profile, raises notsupported.
Definition at line 3314 of file AVStreams_i.cpp.
{ try { ACE_CString fdev_name_key (flow_name); AVStreams::FDev_var fdev_entry; // Remove the fep from the hash table. if (this->fdev_map_.unbind (fdev_name_key, fdev_entry)!= 0) throw AVStreams::streamOpFailed (); AVStreams::flowSpec new_flows (this->flows_.length ()); for (u_int i=0, j=0 ; i <this->flows_.length (); i++) if (ACE_OS::strcmp (flow_name, this->flows_[i]) != 0) new_flows[j++] = this->flows_[i]; CORBA::Any flows; flows <<= new_flows; this->flows_ = new_flows; this->define_property ("Flows", flows); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("TAO_MMDevice::remove_fdev"); } }
TAO_AV_Endpoint_Strategy* TAO_MMDevice::endpoint_strategy_ [protected] |
Definition at line 770 of file AVStreams_i.h.
FDev_Map TAO_MMDevice::fdev_map_ [protected] |
hash table for the flownames and its corresponding flowEndpoint reference.
Definition at line 785 of file AVStreams_i.h.
u_int TAO_MMDevice::flow_count_ [protected] |
Count of the number of flows in this MMDevice , used to generate unique names for the flows.
Definition at line 774 of file AVStreams_i.h.
u_int TAO_MMDevice::flow_num_ [protected] |
current flow number used for system generation of flow names.
Definition at line 777 of file AVStreams_i.h.
AVStreams::flowSpec TAO_MMDevice::flows_ [protected] |
sequence of supported flow names.
Definition at line 788 of file AVStreams_i.h.
TAO_StreamCtrl* TAO_MMDevice::stream_ctrl_ [protected] |
Definition at line 790 of file AVStreams_i.h.