Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / tests / AVStreams / Component_Switching / Connection_Manager.h
blob8668d308985a400dc8b2bd0be0905484c925655d
2 //=============================================================================
3 /**
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"
23 /**
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
34 public:
35 /// Constructor
36 Connection_Manager ();
38 /// Destructor
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);
76 // Map of receivers.
77 typedef ACE_Hash_Map_Manager<ACE_CString,
78 AVStreams::MMDevice_var,
79 ACE_Null_Mutex>
80 Receivers;
82 // Map of protocol objects.
83 typedef ACE_Hash_Map_Manager<ACE_CString,
84 TAO_AV_Protocol_Object *,
85 ACE_Null_Mutex>
86 Protocol_Objects;
88 // Map of streamctrl.
89 typedef ACE_Hash_Map_Manager<ACE_CString,
90 AVStreams::StreamCtrl_var,
91 ACE_Null_Mutex>
92 StreamCtrls;
94 // Map accessors.
95 Receivers &receivers ();
96 Protocol_Objects &protocol_objects ();
97 StreamCtrls &streamctrls ();
99 protected:
100 void find_receivers ();
102 void add_to_receivers (CosNaming::BindingList &binding_list);
104 /// The Naming Service client.
105 TAO_Naming_Client naming_client_;
107 // The maps.
108 Receivers receivers_;
109 Protocol_Objects protocol_objects_;
110 StreamCtrls streamctrls_;
112 // Sender name.
113 ACE_CString sender_name_;
115 // Sender device.
116 AVStreams::MMDevice_var sender_;
118 // Sender context.
119 CosNaming::NamingContext_var sender_context_;
121 // Receiver name.
122 ACE_CString receiver_name_;
124 // Receiver device.
125 AVStreams::MMDevice_var receiver_;
127 // Receiver context.
128 CosNaming::NamingContext_var receiver_context_;
131 #endif /*CONNECTION_MANAGER_H*/