summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp
diff options
context:
space:
mode:
authornaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-31 23:17:58 +0000
committernaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-31 23:17:58 +0000
commitbf7c6eed6bfff6ffbf4f28809a0b9031e492e123 (patch)
treed65e282fbf3232635b7f6e8e4f1628dab8b39a94 /TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp
parentb6f7377616988bc10dd543cd970120843ae2c65b (diff)
downloadATCD-bf7c6eed6bfff6ffbf4f28809a0b9031e492e123.tar.gz
Tue Aug 31 18:07:35 1999 Nagarajan Surendran <naga@cs.wustl.edu>
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp')
-rw-r--r--TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp248
1 files changed, 248 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp b/TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp
new file mode 100644
index 00000000000..77dc2ecea13
--- /dev/null
+++ b/TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp
@@ -0,0 +1,248 @@
+//$Id$
+
+#ifndef TAO_AV_FLOWS_T_C
+#define TAO_AV_FLOWS_T_C
+
+#include "Flows_T.h"
+
+
+// ------------------------------------------------------------
+// TAO_FDev
+// ------------------------------------------------------------
+
+// default constructor
+template <class T_Producer, class T_Consumer>
+TAO_FDev<T_Producer, T_Consumer>::TAO_FDev (void)
+{
+}
+
+template <class T_Producer, class T_Consumer>
+TAO_FDev<T_Producer, T_Consumer>::TAO_FDev (const char *flowname)
+ :flowname_ (flowname)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::Any flowname_any;
+ flowname_any <<= flowname;
+ this->define_property ("Flow",
+ flowname_any,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"TAO_FDev::TAO_FDev");
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+}
+
+template <class T_Producer, class T_Consumer>
+TAO_FDev<T_Producer, T_Consumer>::~TAO_FDev (void)
+{
+ //no-op
+}
+
+template <class T_Producer, class T_Consumer>
+const char *
+TAO_FDev<T_Producer, T_Consumer>::flowname (void)
+{
+ return this->flowname_.in ();
+}
+
+template <class T_Producer, class T_Consumer>
+void
+TAO_FDev<T_Producer, T_Consumer>::flowname (const char *flow_name)
+{
+ ACE_DECLARE_NEW_CORBA_ENV;
+ ACE_TRY
+ {
+ CORBA::Any flowname_any;
+ flowname_any <<= flow_name;
+ this->define_property ("Flow",
+ flowname_any,
+ ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"TAO_FDev::flowname");
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ this->flowname_ = flow_name;
+}
+
+template <class T_Producer, class T_Consumer>
+AVStreams::FlowProducer_ptr
+TAO_FDev<T_Producer, T_Consumer>::create_producer (AVStreams::FlowConnection_ptr the_requester,
+ AVStreams::QoS & the_qos,
+ CORBA::Boolean_out met_qos,
+ char *& named_fdev,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ AVStreams::streamOpFailed,
+ AVStreams::streamOpDenied,
+ AVStreams::notSupported,
+ AVStreams::QoSRequestFailed))
+{
+ // call the bridge method.
+ return this->make_producer (the_requester,
+ the_qos,
+ met_qos,
+ named_fdev,
+ ACE_TRY_ENV);
+}
+
+template <class T_Producer, class T_Consumer>
+// hook for the applications to override the creation process.
+AVStreams::FlowProducer_ptr
+TAO_FDev<T_Producer, T_Consumer>::make_producer (AVStreams::FlowConnection_ptr /* the_requester */,
+ AVStreams::QoS & /* the_qos */,
+ CORBA::Boolean_out /* met_qos */,
+ char *& /* named_fdev */,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ AVStreams::FlowProducer_ptr producer = AVStreams::FlowProducer::_nil ();
+ ACE_TRY
+ {
+ // Activate the producer implementation under the Root POA.
+ T_Producer *producer_i;
+ ACE_NEW_RETURN (producer_i,
+ T_Producer,
+ 0);
+ this->producer_list_.insert_tail (producer_i);
+ producer = producer_i->_this (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"TAO_FDev::make_producer");
+ return producer;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (producer);
+ return producer;
+}
+
+template <class T_Producer, class T_Consumer>
+// hook for the applications to override the consumer creation.
+AVStreams::FlowConsumer_ptr
+TAO_FDev<T_Producer, T_Consumer>::make_consumer (AVStreams::FlowConnection_ptr /* the_requester */,
+ AVStreams::QoS & /* the_qos */,
+ CORBA::Boolean_out /* met_qos */,
+ char *& /* named_fdev */,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ AVStreams::FlowConsumer_ptr consumer = AVStreams::FlowConsumer::_nil ();
+ ACE_TRY
+ {
+ // Activate the consumer implementation under the Root POA.
+ T_Consumer *consumer_i;
+ ACE_NEW_RETURN (consumer_i,
+ T_Consumer,
+ 0);
+ this->consumer_list_.insert_tail (consumer_i);
+ consumer = consumer_i->_this (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"TAO_FDev::make_consumer");
+ return consumer;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (consumer);
+ return consumer;
+}
+
+template <class T_Producer, class T_Consumer>
+AVStreams::FlowConsumer_ptr
+TAO_FDev<T_Producer, T_Consumer>::create_consumer (AVStreams::FlowConnection_ptr the_requester,
+ AVStreams::QoS & the_qos,
+ CORBA::Boolean_out met_qos,
+ char *& named_fdev,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ AVStreams::streamOpFailed,
+ AVStreams::streamOpDenied,
+ AVStreams::notSupported,
+ AVStreams::QoSRequestFailed))
+{
+ return this->make_consumer (the_requester,
+ the_qos,
+ met_qos,
+ named_fdev,
+ ACE_TRY_ENV);
+}
+
+template <class T_Producer, class T_Consumer>
+// not implemented yet.
+AVStreams::FlowConnection_ptr
+TAO_FDev<T_Producer, T_Consumer>::bind (AVStreams::FDev_ptr peer_device,
+ AVStreams::QoS & the_qos,
+ CORBA::Boolean_out is_met,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ AVStreams::streamOpFailed,
+ AVStreams::QoSRequestFailed))
+{
+ ACE_UNUSED_ARG (peer_device);
+ ACE_UNUSED_ARG (the_qos);
+ ACE_UNUSED_ARG (is_met);
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+ return 0;
+}
+
+template <class T_Producer, class T_Consumer>
+// multicast is not supported yet.
+AVStreams::FlowConnection_ptr
+TAO_FDev<T_Producer, T_Consumer>::bind_mcast (AVStreams::FDev_ptr first_peer,
+ AVStreams::QoS & the_qos,
+ CORBA::Boolean_out is_met,
+ CORBA::Environment &ACE_TRY_ENV)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ AVStreams::streamOpFailed,
+ AVStreams::QoSRequestFailed))
+{
+ ACE_UNUSED_ARG (first_peer);
+ ACE_UNUSED_ARG (the_qos);
+ ACE_UNUSED_ARG (is_met);
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+ return 0;
+}
+
+template <class T_Producer, class T_Consumer>
+void
+TAO_FDev<T_Producer, T_Consumer>::destroy (AVStreams::FlowEndPoint_ptr /* the_ep */,
+ const char * /* fdev_name */,
+ CORBA::Environment &/*ACE_TRY_ENV*/)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ AVStreams::notSupported))
+{
+ // @@ Shouldn't the parameters be made use of!
+ // Destroy/delete all the producers and consumers.
+ PRODUCER_LIST_ITERATOR producer_list_iterator (this->producer_list_);
+ TAO_FlowProducer *producer_i = 0;
+
+ while ((producer_i = producer_list_iterator.next ()) != 0)
+ {
+ deactivate_servant (producer_i);
+ delete producer_i;
+ }
+
+ CONSUMER_LIST_ITERATOR consumer_list_iterator (this->consumer_list_);
+ TAO_FlowConsumer *consumer_i = 0;
+
+ while ((consumer_i = consumer_list_iterator.next ()) != 0)
+ {
+ deactivate_servant (producer_i);
+ delete consumer_i;
+ }
+ int result = deactivate_servant (this);
+ if (result < 0)
+ if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_StreamEndPoint::destroy failed\n"));
+}
+
+#endif /* TAO_AV_FLOWS_T_C */