Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Service_Context_Handler_Registry.cpp
blob550056efe2e72eccae06298a07b0604bd13c582e
1 #include "tao/Service_Context_Handler_Registry.h"
2 #include "tao/TAO_Server_Request.h"
3 #include "tao/Service_Context_Handler.h"
5 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
7 int
8 TAO_Service_Context_Registry::process_service_contexts (
9 IOP::ServiceContextList &sc,
10 TAO_Transport& transport,
11 TAO_ServerRequest *request)
13 for (CORBA::ULong index = 0;
14 index != sc.length ();
15 ++index)
17 IOP::ServiceContext const & context = sc[index];
19 iterator handler_iter = this->registry_.find (context.context_id);
21 if (handler_iter != registry_.end ())
23 return handler_iter->second->process_service_context (transport, context, request);
26 return 0;
29 int
30 TAO_Service_Context_Registry::generate_service_context (
31 TAO_Stub *stub,
32 TAO_Transport& transport,
33 TAO_Operation_Details &opdetails,
34 TAO_Target_Specification &spec,
35 TAO_OutputCDR &msg)
37 int result = 0;
38 for (Table::iterator x = this->registry_.begin ();
39 x != this->registry_.end ();
40 ++x)
42 if ((*x).second->generate_service_context (
43 stub, transport, opdetails, spec, msg) == -1)
45 result = -1;
49 return result;
52 TAO_Service_Context_Registry::~TAO_Service_Context_Registry ()
54 for (Table::iterator x = this->registry_.begin ();
55 x != this->registry_.end ();
56 ++x)
58 delete (*x).second;
62 int
63 TAO_Service_Context_Registry::bind (
64 IOP::ServiceId id,
65 TAO_Service_Context_Handler* handler)
67 value_type const value =
68 std::make_pair (key_type (id), data_type (handler));
70 std::pair<iterator, bool> result = this->registry_.insert (value);
72 return (result.second ? 0 : 1);
75 TAO_Service_Context_Handler*
76 TAO_Service_Context_Registry::operator[] (IOP::ServiceId id)
78 return registry_[id];
81 TAO_END_VERSIONED_NAMESPACE_DECL