summaryrefslogtreecommitdiff
path: root/TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp')
-rw-r--r--TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp335
1 files changed, 218 insertions, 117 deletions
diff --git a/TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp b/TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp
index 23d438499d6..c4a74028a82 100644
--- a/TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp
+++ b/TAO/tests/Portable_Interceptors/Benchmark/interceptors.cpp
@@ -2,7 +2,9 @@
#include "interceptors.h"
-ACE_RCSID(Benchmark, interceptors, "$Id$")
+ACE_RCSID (Benchmark,
+ interceptors,
+ "$Id$")
const CORBA::ULong request_ctx_id = 0xdead;
//const CORBA::ULong reply_ctx_id = 0xbeef; // Never used.
@@ -49,18 +51,23 @@ Vault_Client_Request_Interceptor::send_poll (
void
Vault_Client_Request_Interceptor::send_request (
PortableInterceptor::ClientRequestInfo_ptr ri
- TAO_ENV_ARG_DECL_NOT_USED)
+ TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
- if (ACE_OS::strcmp (ri->operation (), "authenticate") == 0)
+ TAO_ENV_ARG_DEFN;
+
+ CORBA::String_var op = ri->operation (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ if (ACE_OS::strcmp (op.in (), "authenticate") == 0)
{
- // MAke the context to send the context to the target
+ // Make the context to send the context to the target.
IOP::ServiceContext sc;
sc.context_id = request_ctx_id;
- const char passwd [20] = "root123";
- CORBA::ULong string_len = ACE_OS::strlen (passwd) + 1;
+ const char passwd[] = "root123";
+ CORBA::ULong string_len = sizeof (passwd) + 1;
CORBA::Octet *buf = 0;
ACE_NEW (buf,
CORBA::Octet [string_len]);
@@ -69,30 +76,43 @@ Vault_Client_Request_Interceptor::send_request (
sc.context_data.replace (string_len, string_len, buf, 1);
// Add this context to the service context list.
- ri->add_request_service_context (sc, 0);
+ ri->add_request_service_context (sc, 0, ACE_TRY_ENV);
+ ACE_CHECK;
}
- if (ACE_OS::strcmp (ri->operation (), "update_records") == 0)
+ if (ACE_OS::strcmp (op.in (), "update_records") == 0)
{
- Dynamic::ParameterList paramlist = *(ri->arguments ());
+ Dynamic::ParameterList_var paramlist =
+ ri->arguments (ACE_TRY_ENV);
+ ACE_CHECK;
+
Test_Interceptors::Secure_Vault::Record *record;
CORBA::Long id;
- paramlist[0].argument >>= id;
- paramlist[1].argument >>= record;
+ CORBA::ULong i = 0; // index -- explicitly used to avoid
+ // overloaded operator ambiguity.
+ paramlist[i++].argument >>= id;
+ paramlist[i].argument >>= record;
}
}
void
Vault_Client_Request_Interceptor::receive_reply (
PortableInterceptor::ClientRequestInfo_ptr ri
- TAO_ENV_ARG_DECL_NOT_USED)
+ TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- if (ACE_OS::strcmp (ri->operation (), "update_records") == 0)
+ TAO_ENV_ARG_DEFN;
+
+ CORBA::String_var op = ri->operation (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ if (ACE_OS::strcmp (op.in (), "update_records") == 0)
{
CORBA::Long result;
- CORBA_Any result_any = *(ri->result ());
- result_any >>= result;
+ CORBA::Any_var result_any = ri->result (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ (result_any.in ()) >>= result;
}
}
@@ -108,14 +128,14 @@ Vault_Client_Request_Interceptor::receive_other (
void
Vault_Client_Request_Interceptor::receive_exception (
- PortableInterceptor::ClientRequestInfo_ptr rinfo
+ PortableInterceptor::ClientRequestInfo_ptr ri
TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
TAO_ENV_ARG_DEFN;
- CORBA::Any_var any = rinfo->received_exception (ACE_TRY_ENV);
+ CORBA::Any_var any = ri->received_exception (ACE_TRY_ENV);
ACE_CHECK;
CORBA::TypeCode_var tc = any->type ();
@@ -124,11 +144,14 @@ Vault_Client_Request_Interceptor::receive_exception (
ACE_CHECK;
CORBA::String_var exception_id =
- rinfo->received_exception_id (ACE_TRY_ENV);
+ ri->received_exception_id (ACE_TRY_ENV);
+ ACE_CHECK;
if (ACE_OS::strcmp (id, exception_id.in ()) != 0)
- ACE_ERROR ((LM_ERROR, "Mismatched exception ids %s != %s\n",
- id, exception_id.in ()));
+ ACE_ERROR ((LM_ERROR,
+ "Mismatched exception IDs: %s != %s\n",
+ id,
+ exception_id.in ()));
}
@@ -163,6 +186,16 @@ Vault_Server_Request_Interceptor::name (TAO_ENV_SINGLE_ARG_DECL_NOT_USED)
}
void
+Vault_Server_Request_Interceptor::receive_request_service_contexts (
+ PortableInterceptor::ServerRequestInfo_ptr
+ TAO_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+{
+ // Do nothing
+}
+
+void
Vault_Server_Request_Interceptor::receive_request (
PortableInterceptor::ServerRequestInfo_ptr ri
TAO_ENV_ARG_DECL)
@@ -171,52 +204,57 @@ Vault_Server_Request_Interceptor::receive_request (
{
TAO_ENV_ARG_DEFN;
- if (ACE_OS::strcmp (ri->operation (), "authenticate") == 0)
- {
+ CORBA::String_var op = ri->operation (ACE_TRY_ENV);
+ ACE_CHECK;
- IOP::ServiceId id = request_ctx_id;
- IOP::ServiceContext *sc = ri->get_request_service_context (id);
+ if (ACE_OS::strcmp (op.in (), "authenticate") == 0)
+ {
+ IOP::ServiceId id = request_ctx_id;
+ IOP::ServiceContext_var sc =
+ ri->get_request_service_context (id, ACE_TRY_ENV);
+ ACE_CHECK;
- if (sc == 0)
- ACE_THROW (CORBA::NO_MEMORY ());
+ const char *buf =
+ ACE_reinterpret_cast (const char *,
+ sc->context_data.get_buffer ());
- const char *buf = ACE_reinterpret_cast (const char *,
- sc->context_data.get_buffer ());
- if (ACE_OS::strcmp (buf, "root123") != 0)
- ACE_THROW (CORBA::NO_PERMISSION ());
+ if (ACE_OS::strcmp (buf, "root123") != 0)
+ ACE_THROW (CORBA::NO_PERMISSION ());
}
- if (ACE_OS::strcmp (ri->operation (), "update_records") == 0)
+ if (ACE_OS::strcmp (op.in (), "update_records") == 0)
{
- Dynamic::ParameterList paramlist = *(ri->arguments ());
+ Dynamic::ParameterList_var paramlist =
+ ri->arguments (ACE_TRY_ENV);
+ ACE_CHECK;
+
Test_Interceptors::Secure_Vault::Record *record;
CORBA::Long id;
- paramlist[0].argument >>= id;
- paramlist[1].argument >>= record;
+ CORBA::ULong i = 0; // index -- explicitly used to avoid
+ // overloaded operator ambiguity.
+ paramlist[i++].argument >>= id;
+ paramlist[i].argument >>= record;
}
}
void
-Vault_Server_Request_Interceptor::receive_request_service_contexts (
- PortableInterceptor::ServerRequestInfo_ptr
- TAO_ENV_ARG_DECL_NOT_USED)
- ACE_THROW_SPEC ((CORBA::SystemException,
- PortableInterceptor::ForwardRequest))
-{
- // Do nothing
-}
-
-void
Vault_Server_Request_Interceptor::send_reply (
PortableInterceptor::ServerRequestInfo_ptr ri
- TAO_ENV_ARG_DECL_NOT_USED)
+ TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
- if (ACE_OS::strcmp (ri->operation (), "update_records") == 0)
+ TAO_ENV_ARG_DEFN;
+
+ CORBA::String_var op = ri->operation (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ if (ACE_OS::strcmp (op.in (), "update_records") == 0)
{
CORBA::Long result;
- CORBA_Any result_any = *(ri->result ());
- result_any >>= result;
+ CORBA::Any_var result_any = ri->result (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ (result_any.in ()) >>= result;
}
}
@@ -286,25 +324,31 @@ Vault_Client_Request_Context_Interceptor::send_poll (
void
Vault_Client_Request_Context_Interceptor::send_request (
PortableInterceptor::ClientRequestInfo_ptr ri
- TAO_ENV_ARG_DECL_NOT_USED)
+ TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
+ TAO_ENV_ARG_DEFN;
+
// MAke the context to send the context to the target
IOP::ServiceContext sc;
sc.context_id = request_ctx_id;
- const char passwd [20] = "root123";
- CORBA::ULong string_len = ACE_OS::strlen (passwd) + 1;
+ const char passwd[] = "root123";
+ CORBA::ULong string_len = sizeof (passwd) + 1;
CORBA::Octet *buf = 0;
- ACE_NEW (buf,
- CORBA::Octet [string_len]);
+ ACE_NEW_THROW_EX (buf,
+ CORBA::Octet [string_len],
+ CORBA::NO_MEMORY ());
+ ACE_CHECK;
+
ACE_OS::strcpy (ACE_reinterpret_cast (char *, buf), passwd);
sc.context_data.replace (string_len, string_len, buf, 1);
// Add this context to the service context list.
- ri->add_request_service_context (sc, 0);
+ ri->add_request_service_context (sc, 0, ACE_TRY_ENV);
+ ACE_CHECK;
}
void
@@ -328,14 +372,14 @@ Vault_Client_Request_Context_Interceptor::receive_reply (
void
Vault_Client_Request_Context_Interceptor::receive_exception (
- PortableInterceptor::ClientRequestInfo_ptr rinfo
+ PortableInterceptor::ClientRequestInfo_ptr ri
TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
TAO_ENV_ARG_DEFN;
- CORBA::Any_var any = rinfo->received_exception (ACE_TRY_ENV);
+ CORBA::Any_var any = ri->received_exception (ACE_TRY_ENV);
ACE_CHECK;
CORBA::TypeCode_var tc = any->type ();
@@ -344,11 +388,14 @@ Vault_Client_Request_Context_Interceptor::receive_exception (
ACE_CHECK;
CORBA::String_var exception_id =
- rinfo->received_exception_id (ACE_TRY_ENV);
+ ri->received_exception_id (ACE_TRY_ENV);
+ ACE_CHECK;
if (ACE_OS::strcmp (id, exception_id.in ()) != 0)
- ACE_ERROR ((LM_ERROR, "Mismatched exception ids %s != %s\n",
- id, exception_id.in ()));
+ ACE_ERROR ((LM_ERROR,
+ "Mismatched exception IDs %s != %s\n",
+ id,
+ exception_id.in ()));
}
@@ -384,6 +431,16 @@ Vault_Server_Request_Context_Interceptor::name (
}
void
+Vault_Server_Request_Context_Interceptor::receive_request_service_contexts(
+ PortableInterceptor::ServerRequestInfo_ptr
+ TAO_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
+{
+ // Do nothing
+}
+
+void
Vault_Server_Request_Context_Interceptor::receive_request (
PortableInterceptor::ServerRequestInfo_ptr ri
TAO_ENV_ARG_DECL)
@@ -393,28 +450,18 @@ Vault_Server_Request_Context_Interceptor::receive_request (
TAO_ENV_ARG_DEFN;
IOP::ServiceId id = request_ctx_id;
- IOP::ServiceContext *sc = ri->get_request_service_context (id);
-
- if (sc == 0)
- ACE_THROW (CORBA::NO_MEMORY ());
+ IOP::ServiceContext_var sc =
+ ri->get_request_service_context (id, ACE_TRY_ENV);
+ ACE_CHECK;
const char *buf = ACE_reinterpret_cast (const char *,
sc->context_data.get_buffer ());
+
if (ACE_OS::strcmp (buf, "root123") !=0)
ACE_THROW (CORBA::NO_PERMISSION ());
}
void
-Vault_Server_Request_Context_Interceptor::receive_request_service_contexts(
- PortableInterceptor::ServerRequestInfo_ptr
- TAO_ENV_ARG_DECL_NOT_USED)
- ACE_THROW_SPEC ((CORBA::SystemException,
- PortableInterceptor::ForwardRequest))
-{
- // Do nothing
-}
-
-void
Vault_Server_Request_Context_Interceptor::send_reply (
PortableInterceptor::ServerRequestInfo_ptr
TAO_ENV_ARG_DECL_NOT_USED)
@@ -487,46 +534,71 @@ Vault_Client_Request_Dynamic_Interceptor::send_poll (
void
Vault_Client_Request_Dynamic_Interceptor::send_request (
PortableInterceptor::ClientRequestInfo_ptr ri
- TAO_ENV_ARG_DECL_NOT_USED)
+ TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
- if (ACE_OS::strcmp (ri->operation (), "authenticate") == 0)
+ TAO_ENV_ARG_DEFN;
+
+ CORBA::String_var op = ri->operation (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ if (ACE_OS::strcmp (op.in (), "authenticate") == 0)
{
- Dynamic::ParameterList paramlist = *(ri->arguments ());
+ Dynamic::ParameterList_var paramlist =
+ ri->arguments (ACE_TRY_ENV);
+ ACE_CHECK;
+
const char *user;
- paramlist[0].argument >>= user;
+ CORBA::ULong i = 0; // index -- explicitly used to avoid
+ // overloaded operator ambiguity.
+ paramlist[i].argument >>= user;
}
- if (ACE_OS::strcmp (ri->operation (), "update_records") == 0)
+ if (ACE_OS::strcmp (op.in (), "update_records") == 0)
{
- Dynamic::ParameterList paramlist = *(ri->arguments ());
+ Dynamic::ParameterList_var paramlist =
+ ri->arguments (ACE_TRY_CHECK);
+ ACE_CHECK;
+
Test_Interceptors::Secure_Vault::Record *record;
CORBA::Long id;
- paramlist[0].argument >>= id;
- paramlist[1].argument >>= record;
+ CORBA::ULong i = 0; // index -- explicitly used to avoid
+ // overloaded operator ambiguity.
+ paramlist[i++].argument >>= id;
+ paramlist[i].argument >>= record;
}
}
void
Vault_Client_Request_Dynamic_Interceptor::receive_reply (
PortableInterceptor::ClientRequestInfo_ptr ri
- TAO_ENV_ARG_DECL_NOT_USED)
+ TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ TAO_ENV_ARG_DEFN;
- if (ACE_OS::strcmp (ri->operation (), "ready") == 0)
+ CORBA::String_var op = ri->operation (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ if (ACE_OS::strcmp (op.in (), "ready") == 0)
{
CORBA::Short result;
- CORBA_Any result_any = *(ri->result ());
- result_any >>= result;
+
+ CORBA::Any_var result_any = ri->result (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ (result_any.in ()) >>= result;
}
- if (ACE_OS::strcmp (ri->operation (), "update_records") == 0)
+ if (ACE_OS::strcmp (op.in (), "update_records") == 0)
{
CORBA::Long result;
- CORBA_Any result_any = *(ri->result ());
- result_any >>= result;
+
+ CORBA::Any_var result_any = ri->result (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ (result_any.in ()) >>= result;
}
}
@@ -542,14 +614,14 @@ Vault_Client_Request_Dynamic_Interceptor::receive_other (
void
Vault_Client_Request_Dynamic_Interceptor::receive_exception (
- PortableInterceptor::ClientRequestInfo_ptr rinfo
+ PortableInterceptor::ClientRequestInfo_ptr ri
TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
TAO_ENV_ARG_DEFN;
- CORBA::Any_var any = rinfo->received_exception (ACE_TRY_ENV);
+ CORBA::Any_var any = ri->received_exception (ACE_TRY_ENV);
ACE_CHECK;
CORBA::TypeCode_var tc = any->type ();
@@ -558,11 +630,14 @@ Vault_Client_Request_Dynamic_Interceptor::receive_exception (
ACE_CHECK;
CORBA::String_var exception_id =
- rinfo->received_exception_id (ACE_TRY_ENV);
+ ri->received_exception_id (ACE_TRY_ENV);
+ ACE_CHECK;
if (ACE_OS::strcmp (id, exception_id.in ()) != 0)
- ACE_ERROR ((LM_ERROR, "Mismatched exception ids %s != %s\n",
- id, exception_id.in ()));
+ ACE_ERROR ((LM_ERROR,
+ "Mismatched exception IDs %s != %s\n",
+ id,
+ exception_id.in ()));
}
@@ -600,24 +675,39 @@ Vault_Server_Request_Dynamic_Interceptor::name (
void
Vault_Server_Request_Dynamic_Interceptor::receive_request (
PortableInterceptor::ServerRequestInfo_ptr ri
- TAO_ENV_ARG_DECL_NOT_USED)
+ TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
- if (ACE_OS::strcmp (ri->operation (), "authenticate") == 0)
+ TAO_ENV_ARG_DEFN;
+
+ CORBA::String_var op = ri->operation (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ if (ACE_OS::strcmp (op.in (), "authenticate") == 0)
{
- Dynamic::ParameterList paramlist = *(ri->arguments ());
+ Dynamic::ParameterList_var paramlist =
+ ri->arguments (ACE_TRY_ENV);
+ ACE_CHECK;
+
const char *user;
- paramlist[0].argument >>= user;
+ CORBA::ULong i = 0; // index -- explicitly used to avoid
+ // overloaded operator ambiguity.
+ paramlist[i].argument >>= user;
}
- if (ACE_OS::strcmp (ri->operation (), "update_records") == 0)
+ if (ACE_OS::strcmp (op.in (), "update_records") == 0)
{
- Dynamic::ParameterList paramlist = *(ri->arguments ());
+ Dynamic::ParameterList_var paramlist =
+ ri->arguments (ACE_TRY_ENV);
+ ACE_CHECK;
+
Test_Interceptors::Secure_Vault::Record *record;
CORBA::Long id;
- paramlist[0].argument >>= id;
- paramlist[1].argument >>= record;
+ CORBA::ULong i = 0; // index -- explicitly used to avoid
+ // overloaded operator ambiguity.
+ paramlist[i++].argument >>= id;
+ paramlist[i].argument >>= record;
}
}
@@ -634,22 +724,30 @@ Vault_Server_Request_Dynamic_Interceptor::receive_request_service_contexts(
void
Vault_Server_Request_Dynamic_Interceptor::send_reply (
PortableInterceptor::ServerRequestInfo_ptr ri
- TAO_ENV_ARG_DECL_NOT_USED)
+ TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
+ TAO_ENV_ARG_DEFN;
- if (ACE_OS::strcmp (ri->operation (), "ready") == 0)
+ CORBA::String_var op = ri->operation (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ if (ACE_OS::strcmp (op.in (), "ready") == 0)
{
CORBA::Short result;
- CORBA_Any result_any = *(ri->result ());
- result_any >>= result;
+ CORBA::Any_var result_any = ri->result (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ (result_any.in ()) >>= result;
}
- if (ACE_OS::strcmp (ri->operation (), "update_records") == 0)
+ if (ACE_OS::strcmp (op.in (), "update_records") == 0)
{
CORBA::Long result;
- CORBA_Any result_any = *(ri->result ());
- result_any >>= result;
+ CORBA::Any_var result_any = ri->result (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ (result_any.in ()) >>= result;
}
}
@@ -664,10 +762,10 @@ Vault_Server_Request_Dynamic_Interceptor::send_exception (
void
Vault_Server_Request_Dynamic_Interceptor::send_other (
- PortableInterceptor::ServerRequestInfo_ptr
- TAO_ENV_ARG_DECL_NOT_USED)
- ACE_THROW_SPEC ((CORBA::SystemException,
- PortableInterceptor::ForwardRequest))
+ PortableInterceptor::ServerRequestInfo_ptr
+ TAO_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ PortableInterceptor::ForwardRequest))
{
// Do Nothing
}
@@ -744,14 +842,14 @@ Vault_Client_Request_NOOP_Interceptor::receive_reply (
void
Vault_Client_Request_NOOP_Interceptor::receive_exception (
- PortableInterceptor::ClientRequestInfo_ptr rinfo
+ PortableInterceptor::ClientRequestInfo_ptr ri
TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableInterceptor::ForwardRequest))
{
TAO_ENV_ARG_DEFN;
- CORBA::Any_var any = rinfo->received_exception (ACE_TRY_ENV);
+ CORBA::Any_var any = ri->received_exception (ACE_TRY_ENV);
ACE_CHECK;
CORBA::TypeCode_var tc = any->type ();
@@ -760,11 +858,14 @@ Vault_Client_Request_NOOP_Interceptor::receive_exception (
ACE_CHECK;
CORBA::String_var exception_id =
- rinfo->received_exception_id (ACE_TRY_ENV);
+ ri->received_exception_id (ACE_TRY_ENV);
+ ACE_CHECK;
if (ACE_OS::strcmp (id, exception_id.in ()) != 0)
- ACE_ERROR ((LM_ERROR, "Mismatched exception ids %s != %s\n",
- id, exception_id.in ()));
+ ACE_ERROR ((LM_ERROR,
+ "Mismatched exception IDs %s != %s\n",
+ id,
+ exception_id.in ()));
}