summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-02-13 02:48:38 +0000
committersumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-02-13 02:48:38 +0000
commitdc8c1a21f136c68c216481d79a2530dc6f78514a (patch)
tree255c605b8f1c60f5a9384af72ad3586b80e3977d
parentb36bc5a058970d09e31caee01450c4b9c0bcd60f (diff)
downloadATCD-dc8c1a21f136c68c216481d79a2530dc6f78514a.tar.gz
*** empty log message ***
-rw-r--r--TAO/orbsvcs/orbsvcs/AVStreams_i.cpp59
-rw-r--r--TAO/orbsvcs/tests/AVStreams/client.cpp51
-rw-r--r--TAO/orbsvcs/tests/AVStreams/client.h49
-rw-r--r--TAO/orbsvcs/tests/AVStreams/server.cpp87
4 files changed, 157 insertions, 89 deletions
diff --git a/TAO/orbsvcs/orbsvcs/AVStreams_i.cpp b/TAO/orbsvcs/orbsvcs/AVStreams_i.cpp
index 750c1c2a9f8..512a2c13c33 100644
--- a/TAO/orbsvcs/orbsvcs/AVStreams_i.cpp
+++ b/TAO/orbsvcs/orbsvcs/AVStreams_i.cpp
@@ -109,7 +109,8 @@ TAO_Basic_StreamCtrl::set_flow_connection (const char *flow_name,
// TAO_StreamCtrl
// ----------------------------------------------------------------------
-TAO_StreamCtrl::TAO_StreamCtrl (void)
+TAO_StreamCtrl::TAO_StreamCtrl (CORBA::ORB_var orb)
+ : orb_ (orb)
{
}
@@ -138,19 +139,20 @@ TAO_StreamCtrl::bind_devs (AVStreams::MMDevice_ptr a_party,
// Request a_party to create the endpoint and vdev
CORBA::Boolean met_qos;
- CORBA::String named_vdev;
- flowSpec the_spec;
+ CORBA::String_var named_vdev (CORBA::string_alloc (1024));
this->stream_endpoint_a_ =
a_party-> create_A (this->_this (env),
this->vdev_a_.out (),
the_qos,
met_qos,
- named_vdev,
- the_spec,
+ named_vdev.inout (),
+ the_flows,
env);
TAO_CHECK_ENV_RETURN (env, 0);
+
+
ACE_DEBUG ((LM_DEBUG,
"\n(%P|%t) TAO_StreamCtrl::create_A: succeeded"));
@@ -161,14 +163,25 @@ TAO_StreamCtrl::bind_devs (AVStreams::MMDevice_ptr a_party,
this->vdev_b_.out (),
the_qos,
met_qos,
- named_vdev,
- the_spec,
+ named_vdev.inout (),
+ the_flows,
env);
TAO_CHECK_ENV_RETURN (env, 0);
ACE_DEBUG ((LM_DEBUG,
"\n(%P|%t) TAO_StreamCtrl::create_B: succeeded"));
+ ACE_DEBUG ((LM_DEBUG,
+ "\nstream_endpoint_b_ = %s",
+ this->orb_->object_to_string (this->stream_endpoint_b_,
+ env)));
+ TAO_CHECK_ENV_RETURN (env, 0);
+ // Now connect the streams together
+ this->stream_endpoint_a_->connect (this->stream_endpoint_b_,
+ the_qos,
+ the_flows,
+ env);
+ TAO_CHECK_ENV_RETURN (env, 0);
return 1;
}
@@ -179,7 +192,15 @@ TAO_StreamCtrl::bind (AVStreams::StreamEndPoint_A_ptr a_party,
const AVStreams::flowSpec &the_flows,
CORBA::Environment &env)
{
- return 0;
+ this->stream_endpoint_a_ = a_party;
+ this->stream_endpoint_b_ = b_party;
+ // Now connect the streams together
+ this->stream_endpoint_a_->connect (this->stream_endpoint_b_,
+ the_qos,
+ the_flows,
+ env);
+ TAO_CHECK_ENV_RETURN (env, 0);
+ return 1;
}
void
@@ -244,6 +265,15 @@ TAO_StreamEndPoint::request_connection (AVStreams::StreamEndPoint_ptr initiator,
AVStreams::flowSpec &the_spec,
CORBA::Environment &env)
{
+ ACE_DEBUG ((LM_DEBUG, "\n(%P|%t) TAO_StreamEndPoint::request_connection called"));
+ ACE_DEBUG ((LM_DEBUG,
+ "\n(%P|%t) TAO_StreamEndPoint::request_connection: "
+ "flowspec has length = %d"
+ "and the strings are:",
+ the_spec.length ()));
+ for (int i = 0; i < the_spec.length (); i++)
+ ACE_DEBUG ((LM_DEBUG,
+ the_spec [i]));
return 0;
}
@@ -363,6 +393,8 @@ TAO_StreamEndPoint_A::~TAO_StreamEndPoint_A (void)
TAO_StreamEndPoint_B::TAO_StreamEndPoint_B (void)
{
+ ACE_DEBUG ((LM_DEBUG,
+ "\n(%P|%t) TAO_StreamEndPoint_B::TAO_StreamEndPoint_B: created"));
}
CORBA::Boolean
@@ -387,6 +419,8 @@ TAO_VDev::TAO_VDev (void)
"\n(%P|%t) TAO_VDev::TAO_VDev: created"));
}
+// StreamCtrl will call this to give us a reference to itself, and to
+// our peer vdev..
CORBA::Boolean
TAO_VDev::set_peer (AVStreams::StreamCtrl_ptr the_ctrl,
AVStreams::VDev_ptr the_peer_dev,
@@ -394,6 +428,8 @@ TAO_VDev::set_peer (AVStreams::StreamCtrl_ptr the_ctrl,
const AVStreams::flowSpec &the_spec,
CORBA::Environment &env)
{
+ this->streamctrl_var_ = the_ctrl;
+ this->peer_ = the_peer_dev;
return 0;
}
@@ -470,6 +506,7 @@ TAO_MMDevice::create_A (AVStreams::StreamCtrl_ptr the_requester,
(stream_endpoint_a->_this (env));
}
+// We have been asked to create a new stream_endpoint and a vdev.
AVStreams::StreamEndPoint_B_ptr
TAO_MMDevice::create_B (AVStreams::StreamCtrl_ptr the_requester,
AVStreams::VDev_out the_vdev,
@@ -487,7 +524,8 @@ TAO_MMDevice::create_B (AVStreams::StreamCtrl_ptr the_requester,
TAO_StreamEndPoint_B *stream_endpoint_b =
new TAO_StreamEndPoint_B;
- return AVStreams::StreamEndPoint_B::_duplicate (stream_endpoint_b->_this (env));
+ return AVStreams::StreamEndPoint_B::_duplicate
+ (stream_endpoint_b->_this (env));
}
// create a streamctrl which is colocated with me, use that streamctrl
@@ -546,6 +584,7 @@ TAO_MMDevice::destroy (AVStreams::StreamEndPoint_ptr the_ep,
{
}
+// need to throw notsupported exception
char *
TAO_MMDevice::add_fdev (CORBA::Object_ptr the_fdev,
CORBA::Environment &env)
@@ -553,6 +592,7 @@ TAO_MMDevice::add_fdev (CORBA::Object_ptr the_fdev,
return 0;
}
+// need to throw notsupported exception
CORBA::Object_ptr
TAO_MMDevice::get_fdev (const char *flow_name,
CORBA::Environment &env)
@@ -560,6 +600,7 @@ TAO_MMDevice::get_fdev (const char *flow_name,
return 0;
}
+// need to throw notsupported exception
void
TAO_MMDevice::remove_fdev (const char *flow_name,
CORBA::Environment &env)
diff --git a/TAO/orbsvcs/tests/AVStreams/client.cpp b/TAO/orbsvcs/tests/AVStreams/client.cpp
index 3b8c19ea0d5..a520a17d238 100644
--- a/TAO/orbsvcs/tests/AVStreams/client.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/client.cpp
@@ -44,16 +44,16 @@ Client::init (int argc,
TAO_CHECK_ENV_RETURN (env, 1);
// create the local streamctrl
- TAO_StreamCtrl *stream_ctrl = new TAO_StreamCtrl;
+ TAO_StreamCtrl *stream_ctrl = new TAO_StreamCtrl (manager_.orb ());
this->stream_ctrl_ = stream_ctrl->_this (env);
TAO_CHECK_ENV_RETURN (env, 1);
// bind to a remote mmdevice, as supplied by argc argv
- // this->bind_to_remote_mmdevice (argc, argv, env);
+ this->bind_to_remote_mmdevice (argc, argv, env);
// create a local mmdevice for now..
- mmdevice_impl = new TAO_MMDevice;
- this->remote_mmdevice_ = mmdevice_impl->_this (env);
+ // mmdevice_impl = new TAO_MMDevice;
+ // this->remote_mmdevice_ = mmdevice_impl->_this (env);
TAO_CHECK_ENV_RETURN (env, 1);
}
@@ -62,12 +62,45 @@ Client::init (int argc,
int
Client::run (CORBA::Environment &env)
{
- AVStreams::streamQoS the_qos;
- AVStreams::flowSpec the_flows;
+ AVStreams::streamQoS_var the_qos (new AVStreams::streamQoS);
+ AVStreams::flowSpec_var the_flows (new AVStreams::flowSpec);
+
+ struct AVStreams::QoS qos_list;
+ qos_list.QoSType = CORBA::string_alloc (64);
+ qos_list.QoSParams = CORBA::string_alloc (64);
+ strcpy (qos_list.QoSType, "foo");
+ strcpy (qos_list.QoSParams, "bar");
+
+ the_qos->length (1);
+ the_qos [0] = qos_list;
+
+ const char *flow_list [] =
+ {
+ "alpha",
+ "beta",
+ "gamma"
+ };
+
+ CORBA::ULong len = sizeof (flow_list)/sizeof (char *);
+
+ // set the length of the sequence
+ the_flows->length (len);
+
+
+ // now set each individual element
+ for (CORBA::ULong i=0; i < the_flows->length (); i++)
+ {
+ // generate some arbitrary string to be filled into the ith location in
+ // the sequence
+ // char *str = gen->gen_string ();
+ //this->in_[i] = str;
+ the_flows [i] = flow_list [i];
+ }
+
this->stream_ctrl_->bind_devs (local_mmdevice_,
remote_mmdevice_,
- the_qos,
- the_flows,
+ the_qos.inout (),
+ the_flows.in (),
env);
TAO_CHECK_ENV_RETURN (env, 1);
return 0;
@@ -149,7 +182,7 @@ main (int argc, char **argv)
}
TAO_CATCHANY
{
- TAO_TRY_ENV.print_exception ("Cubit::init");
+ TAO_TRY_ENV.print_exception ("AVStreams: client");
return -1;
}
TAO_ENDTRY;
diff --git a/TAO/orbsvcs/tests/AVStreams/client.h b/TAO/orbsvcs/tests/AVStreams/client.h
new file mode 100644
index 00000000000..adec8d370e6
--- /dev/null
+++ b/TAO/orbsvcs/tests/AVStreams/client.h
@@ -0,0 +1,49 @@
+/* -*- C++ -*- */
+
+/* $Id$ */
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO/orbsvcs/tests/AVStreams
+//
+// = FILENAME
+// client.h
+//
+// = DESCRIPTION
+// Test client for the AVStreams demo
+//
+// = AUTHORS
+// Sumedh Mungee <sumedh@cs.wustl.edu>
+//
+// ============================================================================
+
+#if !defined (AVSTREAMS_CLIENT_H)
+#define AVSTREAMS_CLIENT_H
+
+#include "ace/Synch.h"
+#include "ace/Task.h"
+#include "ace/Thread_Manager.h"
+#include "orbsvcs/AVStreams_i.h"
+#include "ace/Get_Opt.h"
+#include "tao/tao_util.h"
+
+class Client
+{
+public:
+ Client (void);
+ int init (int argc,
+ char **argv,
+ CORBA::Environment &env);
+ int run (CORBA::Environment &env);
+protected:
+ int bind_to_remote_mmdevice (int argc,
+ char **argv,
+ CORBA::Environment &env);
+ TAO_ORB_Manager manager_;
+ AVStreams::MMDevice_var local_mmdevice_;
+ AVStreams::MMDevice_var remote_mmdevice_;
+ AVStreams::StreamCtrl_var stream_ctrl_;
+};
+
+#endif /* AVSTREAMS_CLIENT_H */
diff --git a/TAO/orbsvcs/tests/AVStreams/server.cpp b/TAO/orbsvcs/tests/AVStreams/server.cpp
index a4ebee43472..ac190ad6da0 100644
--- a/TAO/orbsvcs/tests/AVStreams/server.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/server.cpp
@@ -17,91 +17,36 @@
// ============================================================================
#include "orbsvcs/AVStreams_i.h"
+/* #include "tao/tao.h" */
+#include "tao/tao_util.h"
int
main (int argc, char ** argv)
{
TAO_TRY
{
- // Initialize the ORB
- CORBA::ORB_ptr orb = CORBA::ORB_init (argc,
- argv,
- 0,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Initialize the Object Adapter
- CORBA::Object_var poa_object =
- orb->resolve_initial_references ("RootPOA");
- if (CORBA::is_nil (poa_object.in ()))
- ACE_ERROR_RETURN ((LM_ERROR,
- " (%P|%t) Unable to initialize the POA.\n"),
- 1);
+ TAO_ORB_Manager m;
-
- PortableServer::POA_var root_poa =
- PortableServer::POA::_narrow (poa_object, TAO_TRY_ENV);
+ m.init (argc,
+ argv,
+ "avstreams_poa",
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
- PortableServer::POAManager_var poa_manager =
- root_poa->the_POAManager (TAO_TRY_ENV);
+ TAO_MMDevice *mmdevice_impl = new TAO_MMDevice;
TAO_CHECK_ENV;
-
- PortableServer::PolicyList policies (2);
- policies.length (2);
- policies[0] =
- root_poa->create_id_assignment_policy (PortableServer::USER_ID,
- TAO_TRY_ENV);
- policies[1] =
- root_poa->create_lifespan_policy (PortableServer::PERSISTENT,
- TAO_TRY_ENV);
- // We use a different POA, otherwise the user would have to
- // change the object key each time it invokes the server.
- PortableServer::POA_var good_poa =
- root_poa->create_POA ("RootPOA_is_BAD",
- poa_manager.in (),
- policies,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // create a streamctrl object
- TAO_Basic_StreamCtrl basic_stream_ctrl;
-
- PortableServer::ObjectId_var id =
- PortableServer::string_to_ObjectId ("Basic_StreamCtrl");
- good_poa->activate_object_with_id (id.in (),
- &basic_stream_ctrl,
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- // Stringify the objref we'll be implementing, and print it to
- // stdout. Someone will take that string and give it to a
- // client.
-
- CORBA::Object_var obj =
- good_poa->id_to_reference (id.in (), TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
- CORBA::String_var str =
- orb->object_to_string (obj.in (),
- TAO_TRY_ENV);
+ CORBA::String_var s;
+ s = m.activate ("mmdevice_b",
+ mmdevice_impl,
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
ACE_DEBUG ((LM_DEBUG,
- "The IOR is: <%s>\n", str.in ()));
-
- poa_manager->activate (TAO_TRY_ENV);
- TAO_CHECK_ENV;
+ "\nThe IOR is: <%s>\n",
+ s.in ()));
- // Handle requests for this object until we're killed, or one of
- // the methods asks us to exit.
- if (orb->run () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "run"), -1);
-
- root_poa->destroy (CORBA::B_TRUE,
- CORBA::B_TRUE,
- TAO_TRY_ENV);
+ m.run (TAO_TRY_ENV);
TAO_CHECK_ENV;
}
TAO_CATCH (CORBA::SystemException, sysex)
@@ -115,7 +60,7 @@ main (int argc, char ** argv)
return -1;
}
TAO_ENDTRY;
- ACE_DEBUG ((LM_DEBUG, "Server is terminating"));
+ ACE_DEBUG ((LM_DEBUG, "\nServer is terminating"));
return 0;
}