#include <AVStreams_i.h>
Collaboration diagram for TAO_MMDevice:

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_ |
Definition at line 700 of file AVStreams_i.h.
|
|
Definition at line 779 of file AVStreams_i.h. |
|
|
Definition at line 781 of file AVStreams_i.h. |
|
|
Definition at line 780 of file AVStreams_i.h. |
|
|
Constructor.
Definition at line 708 of file AVStreams_i.h.
00708 {MMDEVICE_A = 0,MMDEVICE_B = 1};
|
|
|
Definition at line 2896 of file AVStreams_i.cpp.
02897 : endpoint_strategy_ (endpoint_strategy), 02898 flow_count_ (0), 02899 flow_num_ (0), 02900 stream_ctrl_ (0) 02901 { 02902 } |
|
|
Destructor.
Definition at line 3309 of file AVStreams_i.cpp. References stream_ctrl_.
03310 {
03311 delete this->stream_ctrl_;
03312 }
|
|
|
Not supported in the light profile, raises notsupported.
Definition at line 3214 of file AVStreams_i.cpp. References ACE_CString, add_fdev_i(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::bind(), fdev_map_, CORBA::is_nil(), and CORBA::string_dup().
03215 {
03216 CORBA::String_var flow_name;
03217 AVStreams::FDev_var fdev;
03218 try
03219 {
03220 CORBA::Any_ptr flow_name_any;
03221 fdev = AVStreams::FDev::_narrow (fdev_obj);
03222
03223 if (CORBA::is_nil (fdev.in ()))
03224 return 0;
03225
03226
03227 flow_name_any = fdev->get_property_value ("Flow");
03228
03229 const char *tmp;
03230 *flow_name_any >>= tmp;
03231 flow_name = CORBA::string_dup (tmp);
03232 }
03233 catch (const CORBA::Exception&)
03234 {
03235 flow_name =
03236 this->add_fdev_i (fdev.in ());
03237 }
03238
03239
03240 // Add it to the sequence of flowNames supported.
03241 // put the flowname and the fdev in a hashtable.
03242 ACE_CString fdev_name_key ( flow_name.in () );
03243
03244
03245 if ( (this->fdev_map_.bind (fdev_name_key, fdev )) != 0)
03246 throw AVStreams::streamOpFailed ();
03247 // increment the flow count.
03248 this->flow_count_++;
03249 this->flows_.length (this->flow_count_);
03250 this->flows_ [this->flow_count_-1] = flow_name;
03251 // define/modify the "Flows" property.
03252 CORBA::Any flows_any;
03253 flows_any <<= this->flows_;
03254 try
03255 {
03256 this->define_property ("Flows",
03257 flows_any);
03258 }
03259 catch (const CORBA::Exception& ex)
03260 {
03261 ex._tao_print_exception ("TAO_MMDevice::add_fdev");
03262 return 0;
03263 }
03264 return flow_name._retn ();
03265 }
|
|
|
Helper method to implement add_fdev().
Definition at line 3187 of file AVStreams_i.cpp. References ACE_NEW_RETURN, and ACE_OS::sprintf(). Referenced by add_fdev().
03188 {
03189 char* tmp;
03190 ACE_NEW_RETURN (tmp,
03191 char[64],
03192 0);
03193 CORBA::String_var flow_name = tmp;
03194
03195 try
03196 {
03197 // exception implies the flow name is not defined and is system
03198 // generated.
03199 ACE_OS::sprintf (tmp, "flow%d", flow_num_++);
03200 CORBA::Any flowname_any;
03201 flowname_any <<= flow_name.in ();
03202 fdev->define_property ("Flow", flowname_any);
03203 }
03204 catch (const CORBA::Exception& ex)
03205 {
03206 ex._tao_print_exception ("TAO_MMDevice::add_fdev");
03207 return 0;
03208 }
03209 return flow_name._retn ();
03210 }
|
|
||||||||||||||||||||
|
Can be used to request the MMDevice to create a new StreamCtrl, and call bind_devs on it Definition at line 2907 of file AVStreams_i.cpp. References ACE_NEW_RETURN, TAO_StreamCtrl::bind_devs(), AVStreams::flowSpec, stream_ctrl_, and AVStreams::streamQoS.
02911 {
02912 AVStreams::StreamCtrl_ptr streamctrl (AVStreams::StreamCtrl::_nil ());
02913 try
02914 {
02915 ACE_UNUSED_ARG (is_met);
02916 ACE_NEW_RETURN (this->stream_ctrl_,
02917 TAO_StreamCtrl,
02918 0);
02919 AVStreams::MMDevice_var mmdevice = this->_this ();
02920 this->stream_ctrl_->bind_devs (peer_device,
02921 mmdevice.in (),
02922 the_qos,
02923 the_spec);
02924 streamctrl = this->stream_ctrl_->_this ();
02925 }
02926 catch (const CORBA::Exception& ex)
02927 {
02928 ex._tao_print_exception ("TAO_MMDevice::bind");
02929 return streamctrl;
02930 }
02931 return streamctrl;
02932 }
|
|
||||||||||||||||||||
|
Multicast bind.
Definition at line 2936 of file AVStreams_i.cpp. References AVStreams::flowSpec, and AVStreams::streamQoS.
02940 {
02941 ACE_UNUSED_ARG (first_peer);
02942 ACE_UNUSED_ARG (the_qos);
02943 ACE_UNUSED_ARG (is_met);
02944 ACE_UNUSED_ARG (the_spec);
02945
02946 return 0;
02947 }
|
|
||||||||||||||||||||||||||||
|
Called by StreamCtrl to create a "A" type streamandpoint and vdev.
Definition at line 3120 of file AVStreams_i.cpp. References ACE_ASSERT, create_A_B(), AVStreams::flowSpec, MMDEVICE_A, and AVStreams::streamQoS.
03126 {
03127 AVStreams::StreamEndPoint_A_ptr sep_a = 0;
03128 AVStreams::StreamEndPoint_var sep;
03129 try
03130 {
03131 sep = this->create_A_B (MMDEVICE_A, streamctrl, the_vdev, stream_qos, met_qos, named_vdev, flow_spec);
03132 sep_a = AVStreams::StreamEndPoint_A::_narrow (sep.in());
03133
03134 ACE_ASSERT( !CORBA::is_nil( sep_a ) );
03135 }
03136 catch (const CORBA::Exception& ex)
03137 {
03138 ex._tao_print_exception ("TAO_MMDevice::create_A");
03139 return sep_a;
03140 }
03141
03142 return sep_a;
03143 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 2950 of file AVStreams_i.cpp. References ACE_CString, ACE_DEBUG, ACE_ERROR_RETURN, ACE_NEW_RETURN, TAO_AV_Endpoint_Strategy::create_A(), TAO_AV_Endpoint_Strategy::create_B(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::current_size(), TAO_FlowSpec_Entry::direction(), endpoint_strategy_, fdev_map_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::find(), TAO_FlowSpec_Entry::flowname(), AVStreams::flowSpec, TAO_AV_QoS::get_flow_qos(), CORBA::is_nil(), LM_DEBUG, LM_ERROR, MMDEVICE_A, MMDEVICE_B, TAO_Forward_FlowSpec_Entry::parse(), ACE_OS::printf(), AVStreams::streamQoS, and TAO_debug_level. Referenced by create_A(), and create_B().
02957 {
02958 AVStreams::StreamEndPoint_A_ptr sep_a (AVStreams::StreamEndPoint_A::_nil ());
02959 AVStreams::StreamEndPoint_B_ptr sep_b (AVStreams::StreamEndPoint_B::_nil ());
02960 AVStreams::StreamEndPoint_ptr sep (AVStreams::StreamEndPoint::_nil ());
02961 try
02962 {
02963 switch (type)
02964 {
02965 case MMDEVICE_A:
02966 {
02967 if (this->endpoint_strategy_->create_A (sep_a,
02968 the_vdev) == -1)
02969 ACE_ERROR_RETURN ((LM_ERROR,
02970 "TAO_MMDevice::create_A_B (%P|%t) - "
02971 "error in create_A\n"),
02972 0);
02973 sep = sep_a;
02974 }
02975 break;
02976 case MMDEVICE_B:
02977 {
02978 if (this->endpoint_strategy_->create_B (sep_b,
02979 the_vdev) == -1)
02980 ACE_ERROR_RETURN ((LM_ERROR,
02981 "TAO_MMDevice::create_A_B (%P|%t) - "
02982 "error in create_B\n"),
02983 0);
02984 sep = sep_b;
02985 }
02986 break;
02987 default:
02988 break;
02989 }
02990 if (this->fdev_map_.current_size () > 0)
02991 {
02992 TAO_AV_QoS qos (the_qos);
02993 // create flowendpoints from the FDevs.
02994 for (u_int i=0;i<flow_spec.length ();i++)
02995 {
02996 TAO_Forward_FlowSpec_Entry forward_entry;
02997 forward_entry.parse (flow_spec[i]);
02998 ACE_CString flow_key (forward_entry.flowname ());
02999 AVStreams::FDev_var flow_dev;
03000 AVStreams::FlowConnection_var flowconnection;
03001 try
03002 {
03003 // Get the flowconnection for this flow.
03004 //static int blah = 0; if(blah == 1){blah=0; abort();}else{blah=1;}
03005 CORBA::Object_var flowconnection_obj =
03006 streamctrl->get_flow_connection (forward_entry.flowname ());
03007 ACE_OS::printf("successfully called get_flow_connection\n");
03008 if (!CORBA::is_nil (flowconnection_obj.in ()))
03009 {
03010 flowconnection = AVStreams::FlowConnection::_narrow (flowconnection_obj.in ());
03011 }
03012 }
03013 catch (const AVStreams::noSuchFlow&)
03014 {
03015 TAO_FlowConnection *flowConnection;
03016 ACE_NEW_RETURN (flowConnection,
03017 TAO_FlowConnection,
03018 0);
03019 flowconnection = flowConnection->_this ();
03020 streamctrl->set_flow_connection (forward_entry.flowname(),
03021 flowconnection.in ());
03022 }
03023 catch (const CORBA::Exception& ex)
03024 {
03025 //if (TAO_debug_level >= 0)
03026 ex._tao_print_exception (
03027 "TAO_MMDevice::create_a::get_flow_connection");
03028 }
03029
03030 int result = this->fdev_map_.find (flow_key, flow_dev);
03031 if (result < 0)
03032 ACE_ERROR_RETURN ((LM_ERROR, "(%N,%l) fdev_map::find failed\n"), 0);
03033
03034 CORBA::String_var named_fdev;
03035 AVStreams::FlowEndPoint_var flow_endpoint;
03036 AVStreams::QoS flow_qos;
03037 result = qos.get_flow_qos (forward_entry.flowname (), flow_qos);
03038 if (result < 0)
03039 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "(%N,%l) get_flow_qos failed for %s\n", forward_entry.flowname ()));
03040 switch (forward_entry.direction ())
03041 {
03042 case TAO_FlowSpec_Entry::TAO_AV_DIR_IN:
03043 {
03044 switch (type)
03045 {
03046 case MMDEVICE_A:
03047 {
03048 // In implies flow is from A to B and
03049 // hence A is the producer for this flow and B is the consumer for this flow.
03050 // We have to create a producer from the FDev for this flow.
03051 flow_endpoint =
03052 flow_dev->create_producer (flowconnection.in (),
03053 flow_qos,
03054 met_qos,
03055 named_fdev.inout ());
03056 }
03057 break;
03058 case MMDEVICE_B:
03059 {
03060 flow_endpoint =
03061 flow_dev->create_consumer (flowconnection.in (),
03062 flow_qos,
03063 met_qos,
03064 named_fdev.inout ());
03065 }
03066 break;
03067 }
03068 }
03069 break;
03070 case TAO_FlowSpec_Entry::TAO_AV_DIR_OUT:
03071 {
03072 switch (type)
03073 {
03074 case MMDEVICE_A:
03075 {
03076 // OUT implies flow is from B to A and
03077 // hence B is the producer for this flow and A is the consumer for this flow.
03078 // We have to create a consumer from the FDev for this flow.
03079 flow_endpoint =
03080 flow_dev->create_consumer (flowconnection.in (),
03081 flow_qos,
03082 met_qos,
03083 named_fdev.inout ());
03084 }
03085 break;
03086 case MMDEVICE_B:
03087 {
03088 // In implies flow is from A to B and
03089 // hence A is the producer for this flow and B is the consumer for this flow.
03090 // We have to create a producer from the FDev for this flow.
03091 flow_endpoint =
03092 flow_dev->create_producer (flowconnection.in (),
03093 flow_qos,
03094 met_qos,
03095 named_fdev.inout ());
03096 }
03097 break;
03098 }
03099 }
03100 break;
03101 default:
03102 break;
03103 }
03104 CORBA::Any flowname_any;
03105 flowname_any <<= forward_entry.flowname ();
03106 flow_endpoint->define_property ("FlowName", flowname_any);
03107 sep->add_fep (flow_endpoint.in ());
03108 }
03109 }
03110 }
03111 catch (const CORBA::Exception& ex)
03112 {
03113 ex._tao_print_exception ("TAO_MMDevice::create_A");
03114 return sep;
03115 }
03116 return sep;
03117 }
|
|
||||||||||||||||||||||||||||
|
Called by StreamCtrl to create a "B" type streamandpoint and vdev.
Definition at line 3147 of file AVStreams_i.cpp. References ACE_ASSERT, create_A_B(), AVStreams::flowSpec, MMDEVICE_B, and AVStreams::streamQoS.
03153 {
03154 AVStreams::StreamEndPoint_B_ptr sep_b = AVStreams::StreamEndPoint_B::_nil ();
03155 AVStreams::StreamEndPoint_var sep;
03156
03157 try
03158 {
03159 sep = this->create_A_B (MMDEVICE_B, streamctrl, the_vdev, stream_qos, met_qos, named_vdev, flow_spec);
03160 sep_b = AVStreams::StreamEndPoint_B::_narrow (sep.in());
03161
03162 ACE_ASSERT ( !CORBA::is_nil( sep_b ) );
03163 }
03164 catch (const CORBA::Exception& ex)
03165 {
03166 ex._tao_print_exception ("TAO_MMDevice::create_B");
03167 return sep_b;
03168 }
03169 return sep_b;
03170 }
|
|
||||||||||||
|
Remove the StreamEndPoint and the related vdev.
Definition at line 3175 of file AVStreams_i.cpp. References ACE_DEBUG, TAO_AV_Core::deactivate_servant(), LM_DEBUG, and TAO_debug_level.
03177 {
03178 // Remove self from POA. Because of reference counting, the POA
03179 // will automatically delete the servant when all pending requests
03180 // on this servant are complete.
03181 int result = TAO_AV_Core::deactivate_servant (this);
03182 if (result < 0)
03183 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_MMDevice::destroy failed\n"));
03184 }
|
|
|
Not supported in the light profile, raises notsupported.
Definition at line 3269 of file AVStreams_i.cpp. References ACE_CString, fdev_map_, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::find().
03270 {
03271
03272 ACE_CString fdev_name_key (flow_name);
03273 AVStreams::FDev_var fdev_entry;
03274 if (this->fdev_map_.find (fdev_name_key, fdev_entry) == 0)
03275 return fdev_entry._retn() ;
03276 return 0;
03277 }
|
|
|
Not supported in the light profile, raises notsupported.
Definition at line 3281 of file AVStreams_i.cpp. References ACE_CString, fdev_map_, AVStreams::flowSpec, ACE_OS::strcmp(), and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::unbind().
03282 {
03283 try
03284 {
03285 ACE_CString fdev_name_key (flow_name);
03286 AVStreams::FDev_var fdev_entry;
03287 // Remove the fep from the hash table.
03288 if (this->fdev_map_.unbind (fdev_name_key, fdev_entry)!= 0)
03289 throw AVStreams::streamOpFailed ();
03290
03291 AVStreams::flowSpec new_flows (this->flows_.length ());
03292 for (u_int i=0, j=0 ; i <this->flows_.length (); i++)
03293 if (ACE_OS::strcmp (flow_name, this->flows_[i]) != 0)
03294 new_flows[j++] = this->flows_[i];
03295
03296 CORBA::Any flows;
03297 flows <<= new_flows;
03298 this->flows_ = new_flows;
03299 this->define_property ("Flows",
03300 flows);
03301 }
03302 catch (const CORBA::Exception& ex)
03303 {
03304 ex._tao_print_exception ("TAO_MMDevice::remove_fdev");
03305 }
03306 }
|
|
|
Definition at line 770 of file AVStreams_i.h. Referenced by create_A_B(). |
|
|
hash table for the flownames and its corresponding flowEndpoint reference. Definition at line 785 of file AVStreams_i.h. Referenced by add_fdev(), create_A_B(), get_fdev(), and remove_fdev(). |
|
|
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. |
|
|
current flow number used for system generation of flow names.
Definition at line 777 of file AVStreams_i.h. |
|
|
sequence of supported flow names.
Definition at line 788 of file AVStreams_i.h. |
|
|
Definition at line 790 of file AVStreams_i.h. Referenced by bind(), and ~TAO_MMDevice(). |
1.3.6