TAO_CEC_DynamicImplementationServer Class Reference

#include <CEC_DynamicImplementation.h>

Collaboration diagram for TAO_CEC_DynamicImplementationServer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_CEC_DynamicImplementationServer (PortableServer::POA_ptr poa, TAO_CEC_TypedProxyPushConsumer *typed_pp_consumer, TAO_CEC_TypedEventChannel *typed_event_channel)
virtual ~TAO_CEC_DynamicImplementationServer (void)
virtual void invoke (CORBA::ServerRequest_ptr request)
virtual CORBA::RepositoryId _primary_interface (const PortableServer::ObjectId &oid, PortableServer::POA_ptr poa)
virtual PortableServer::POA_ptr _default_POA (void)
virtual void is_a (CORBA::ServerRequest_ptr request)

Private Attributes

PortableServer::POA_var poa_
TAO_CEC_TypedProxyPushConsumertyped_pp_consumer_
TAO_CEC_TypedEventChanneltyped_event_channel_
CORBA::RepositoryId repository_id_

Detailed Description

Definition at line 26 of file CEC_DynamicImplementation.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_CEC_DynamicImplementationServer::TAO_CEC_DynamicImplementationServer ( PortableServer::POA_ptr  poa,
TAO_CEC_TypedProxyPushConsumer typed_pp_consumer,
TAO_CEC_TypedEventChannel typed_event_channel 
)

Definition at line 9 of file CEC_DynamicImplementation.inl.

00012   :  poa_ (PortableServer::POA::_duplicate (poa)),
00013      typed_pp_consumer_ (typed_pp_consumer),
00014      typed_event_channel_ (typed_event_channel),
00015      repository_id_ (CORBA::string_dup (typed_event_channel->supported_interface () ))
00016 {
00017 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_CEC_DynamicImplementationServer::~TAO_CEC_DynamicImplementationServer ( void   )  [virtual]

Definition at line 18 of file CEC_DynamicImplementation.cpp.

00019 {
00020 }


Member Function Documentation

PortableServer::POA_ptr TAO_CEC_DynamicImplementationServer::_default_POA ( void   )  [virtual]

Definition at line 74 of file CEC_DynamicImplementation.cpp.

00075 {
00076   return PortableServer::POA::_duplicate (this->poa_.in ());
00077 }

CORBA::RepositoryId TAO_CEC_DynamicImplementationServer::_primary_interface ( const PortableServer::ObjectId oid,
PortableServer::POA_ptr  poa 
) [virtual]

Definition at line 67 of file CEC_DynamicImplementation.cpp.

References repository_id_, and CORBA::string_dup().

00069 {
00070   return CORBA::string_dup (repository_id_);
00071 }

void TAO_CEC_DynamicImplementationServer::invoke ( CORBA::ServerRequest_ptr  request  )  [virtual]

Definition at line 24 of file CEC_DynamicImplementation.cpp.

References ACE_DEBUG, ACE_TEXT(), TAO_CEC_TypedEventChannel::create_list(), TAO_CEC_TypedEventChannel::create_operation_list(), TAO_CEC_TypedEventChannel::find_from_ifr_cache(), TAO_CEC_TypedProxyPushConsumer::invoke(), is_a(), LM_DEBUG, ACE_OS::strcmp(), TAO_debug_level, typed_event_channel_, and typed_pp_consumer_.

00025 {
00026   // Trap the _is_a request
00027   if (ACE_OS::strcmp ("_is_a", request->operation () ) == 0)
00028     {
00029       this->is_a (request);
00030     }
00031   else
00032     {
00033       CORBA::NVList_ptr list;
00034 
00035       // Get the operation paramter information from the IFR cache.
00036       TAO_CEC_Operation_Params *oper_params =
00037         this->typed_event_channel_->find_from_ifr_cache (request->operation () );
00038 
00039       if (oper_params == 0)
00040         {
00041           if (TAO_debug_level >= 10)
00042             {
00043               ACE_DEBUG ((LM_DEBUG,
00044                           ACE_TEXT ("***** Operation not found in IFR cache *****\n")));
00045             }
00046 
00047           this->typed_event_channel_->create_list (0, list);
00048         }
00049       else
00050         {
00051           // Populate the NVList from the parameter information.
00052           this->typed_event_channel_->create_operation_list (oper_params, list);
00053 
00054           // Get the operation arguments. This ahould demarshal correctly.
00055           request->arguments (list);
00056 
00057           // Populate the TypedEvent with the list and operation name.
00058           TAO_CEC_TypedEvent typed_event (list, request->operation () );
00059 
00060           // Pass the TypedEvent to the TypedProxyPushConsumer
00061           this->typed_pp_consumer_->invoke (typed_event);
00062         }
00063     }
00064 }

void TAO_CEC_DynamicImplementationServer::is_a ( CORBA::ServerRequest_ptr  request  )  [virtual]

Definition at line 80 of file CEC_DynamicImplementation.cpp.

References ACE_DEBUG, ACE_TEXT(), TAO_CEC_TypedEventChannel::create_list(), LM_DEBUG, TAO_CEC_TypedEventChannel::number_of_base_interfaces(), ACE_OS::strcmp(), TAO_debug_level, and typed_event_channel_.

Referenced by invoke().

00081 {
00082   CORBA::NVList_ptr list;
00083 
00084   this->typed_event_channel_->create_list (0, list);
00085 
00086   CORBA::Any any_1;
00087   any_1._tao_set_typecode(CORBA::_tc_string);
00088 
00089   list->add_value ("value",
00090                    any_1,
00091                    CORBA::ARG_IN);
00092 
00093   request->arguments (list);
00094 
00095   CORBA::NamedValue_ptr nv = list->item (0);
00096 
00097   CORBA::Any_ptr ap = nv->value ();
00098   const char *value;
00099   *ap >>= value;
00100 
00101   if (TAO_debug_level >= 10)
00102     {
00103       ACE_DEBUG ((LM_DEBUG,
00104                   ACE_TEXT ("***** TAO_CEC_DynamicImplementationServer::is_a called with value %s *****\n"),
00105                   value));
00106     }
00107 
00108   const char *object_id =
00109     CORBA::_tc_Object->id ();
00110 
00111   if (TAO_debug_level >= 10)
00112     {
00113       ACE_DEBUG ((LM_DEBUG,
00114                   ACE_TEXT ("***** is_a using Server's RepositoryId %s *****\n"),
00115                   this->repository_id_));
00116       ACE_DEBUG ((LM_DEBUG,
00117                   ACE_TEXT ("***** is_a using base interface %s *****\n"),
00118                   object_id));
00119     }
00120 
00121   CORBA::Boolean result = 0;
00122   if (ACE_OS::strcmp (value, this->repository_id_) == 0
00123       || ACE_OS::strcmp (value, object_id) == 0)
00124     {
00125       result = 1;
00126     }
00127   else
00128     {
00129       CORBA::ULong num = this->typed_event_channel_->number_of_base_interfaces ();
00130       for (CORBA::ULong base=0; base<num; base++)
00131         {
00132           if (TAO_debug_level >= 10)
00133             {
00134               ACE_DEBUG ((LM_DEBUG,
00135                           ACE_TEXT ("***** is_a using base interface %s *****\n"),
00136                           this->typed_event_channel_->base_interfaces (base) ));
00137             }
00138 
00139           if (ACE_OS::strcmp (value, this->typed_event_channel_->base_interfaces (base) ) == 0)
00140             {
00141               result = 1;
00142             }
00143         }
00144     }
00145 
00146   if (TAO_debug_level >= 10)
00147     {
00148       ACE_DEBUG ((LM_DEBUG,
00149                   ACE_TEXT ("***** is_a returning %d *****\n"),
00150                   result));
00151     }
00152 
00153   CORBA::Any result_any;
00154   CORBA::Any::from_boolean from_boolean (result);
00155   result_any <<= from_boolean;
00156 
00157   request->set_result (result_any);
00158 }


Member Data Documentation

PortableServer::POA_var TAO_CEC_DynamicImplementationServer::poa_ [private]

Definition at line 58 of file CEC_DynamicImplementation.h.

CORBA::RepositoryId TAO_CEC_DynamicImplementationServer::repository_id_ [private]

Definition at line 67 of file CEC_DynamicImplementation.h.

Referenced by _primary_interface().

TAO_CEC_TypedEventChannel* TAO_CEC_DynamicImplementationServer::typed_event_channel_ [private]

Definition at line 64 of file CEC_DynamicImplementation.h.

Referenced by invoke(), and is_a().

TAO_CEC_TypedProxyPushConsumer* TAO_CEC_DynamicImplementationServer::typed_pp_consumer_ [private]

Definition at line 61 of file CEC_DynamicImplementation.h.

Referenced by invoke().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:44:58 2010 for TAO_CosEvent by  doxygen 1.4.7