2 //=============================================================================
4 * @file Connection_Manager.h
6 * This is a helper class that allows the senders bind to multiple
7 * receivers and receivers to bind to senders. It also lets the
8 * senders and receivers disconnect streams.
10 * @author Yamuna Krishnamurthy <yamuna@cs.wustl.edu>
12 //=============================================================================
15 #ifndef CONNECTION_MANAGER_H
16 #define CONNECTION_MANAGER_H
18 #include "orbsvcs/Naming/Naming_Client.h"
19 #include "orbsvcs/AV/AVStreams_i.h"
20 #include "orbsvcs/AV/Protocol_Factory.h"
21 #include "tao/PortableServer/PortableServer.h"
24 * @class Connection_Manager
26 * @brief Defines the Connection Manager.
28 * This is a helper class that allows the senders bind to
29 * multiple receivers and receivers to bind to senders. It also
30 * lets the senders and receivers disconnect streams.
32 class Connection_Manager
36 Connection_Manager ();
39 ~Connection_Manager ();
41 /// Initialize this class.
42 int init (CORBA::ORB_ptr orb
);
44 /// Method that binds the sender to the Naming Service and retrieves
45 /// the references of any registered receivers.
46 void bind_to_receivers (const ACE_CString
&sender_name
,
47 AVStreams::MMDevice_ptr sender
);
49 /// Connect to the receivers that we found.
50 void connect_to_receivers ();
52 /// Bind receiver to the sender.
53 void bind_to_sender (const ACE_CString
&sender_name
,
54 const ACE_CString
&receiver_name
,
55 AVStreams::MMDevice_ptr receiver
);
57 /// Connect to the sender that we found.
58 void connect_to_sender ();
60 /// Destroy streams associated with <flowname>.
61 void destroy (const ACE_CString
&flowname
);
63 /// Unbind the sender from the Naming Service
64 void unbind_sender (const ACE_CString
&sender_name
,
65 AVStreams::MMDevice_ptr sender_mmdevice
) ;
67 /// Unbind the Receiver from the Naming Service
68 void unbind_receiver (const ACE_CString
&sender_name
,
69 const ACE_CString
&receiver_name
,
70 AVStreams::MMDevice_ptr receiver_mmdevice
);
72 /// Add new streamctrl.
73 void add_streamctrl (const ACE_CString
&flowname
,
74 TAO_StreamEndPoint
*endpoint
);
77 typedef ACE_Hash_Map_Manager
<ACE_CString
,
78 AVStreams::MMDevice_var
,
82 // Map of protocol objects.
83 typedef ACE_Hash_Map_Manager
<ACE_CString
,
84 TAO_AV_Protocol_Object
*,
89 typedef ACE_Hash_Map_Manager
<ACE_CString
,
90 AVStreams::StreamCtrl_var
,
95 Receivers
&receivers ();
96 Protocol_Objects
&protocol_objects ();
97 StreamCtrls
&streamctrls ();
100 void find_receivers ();
102 void add_to_receivers (CosNaming::BindingList
&binding_list
);
104 /// The Naming Service client.
105 TAO_Naming_Client naming_client_
;
108 Receivers receivers_
;
109 Protocol_Objects protocol_objects_
;
110 StreamCtrls streamctrls_
;
113 ACE_CString sender_name_
;
116 AVStreams::MMDevice_var sender_
;
119 CosNaming::NamingContext_var sender_context_
;
122 ACE_CString receiver_name_
;
125 AVStreams::MMDevice_var receiver_
;
128 CosNaming::NamingContext_var receiver_context_
;
131 #endif /*CONNECTION_MANAGER_H*/