From 3a34d45e17000b30d1667a84f148430522bec4fb Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Wed, 11 Oct 2023 14:13:31 -0400 Subject: [PATCH 01/57] Initial code --- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 36 +++++++++++++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 22 ++++++++++++ .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 13 +++++++ .../z_bmq/z_bmqt/z_bmqt_sessionoptions.h | 20 +++++++++++ 4 files changed, 91 insertions(+) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_session.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp new file mode 100644 index 000000000..5da164d29 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -0,0 +1,36 @@ +#include +#include +#include +#include + +typedef void* TimeInterval; + +namespace BloombergLP { + +namespace z_bmqa { + +int z_bmqa_session__create(z_bmqa_session* session , z_bmqt_SessionOptions* options) { + bmqt::SessionOptions* option_ptr = reinterpret_cast(options); + bmqa::Session* session_ptr = new bmqa::Session(*option_ptr); + + *session = reinterpret_cast(session_ptr); + return 0; +} + +int z_bmqa_session__start(z_bmqa_session* session, int64_t seconds, int nanoseconds) { + bmqa::Session* session_ptr = reinterpret_cast(session); + bsls::TimeInterval timeout(seconds, nanoseconds); + session_ptr->start(timeout); + return 0; +} + +int z_bmqa_session__stop(z_bmqa_session* session) { + bmqa::Session* session_ptr = reinterpret_cast(session); + session_ptr->stop(); + + return 0; +} + +} + +} diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h new file mode 100644 index 000000000..8415c92ff --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -0,0 +1,22 @@ +#ifndef INCLUDED_Z_BMQA_SESSION +#define INCLUDED_Z_BMQA_SESSION + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef void* z_bmqa_session; + +int z_bmqa_session__create(z_bmqa_session* session , z_bmqt_SessionOptions* options); + +int z_bmqa_session__start(z_bmqa_session* session, int64_t seconds, int nanoseconds); + +int z_bmqa_session__stop(z_bmqa_session* session); + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp new file mode 100644 index 000000000..dedbc6423 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -0,0 +1,13 @@ +#include +#include + + + +namespace BloomberLP { +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions* options) { + BloombergLP::bmqt::SessionOptions* options_ptr = new BloombergLP::bmqt::SessionOptions(); + *options = reinterpret_cast(options_ptr); + return 0; +} + +}; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h new file mode 100644 index 000000000..c8b403a07 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h @@ -0,0 +1,20 @@ +#ifndef INCLUDED_Z_BMQT_SESSIONOPTIONS +#define INCLUDED_Z_BMQT_SESSIONOPTIONS + +#if defined(__cplusplus) +extern "C" { +#endif + + + +typedef void* z_bmqt_SessionOptions; + +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions* options); + + + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file From 27ce71d6081ec6971ee571cb80d8c6e96d593d4f Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 20 Oct 2023 17:04:08 -0400 Subject: [PATCH 02/57] Added z_bmq to build configs --- src/groups/CMakeLists.txt | 1 + src/groups/z_bmq/CMakeLists.txt | 11 +++ src/groups/z_bmq/doc/z_bmq.txt | 63 ++++++++++++++++ src/groups/z_bmq/group/z_bmq.dep | 5 ++ src/groups/z_bmq/group/z_bmq.mem | 4 + src/groups/z_bmq/group/z_bmq.t.dep | 1 + src/groups/z_bmq/z_bmqa/package/z_bmqa.dep | 1 + src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 1 + src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 16 ++-- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 9 ++- src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp | 75 +++++++++++++++++++ src/groups/z_bmq/z_bmqt/package/z_bmqt.dep | 0 src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 1 + .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 17 +++-- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.h | 6 +- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp | 75 +++++++++++++++++++ 16 files changed, 265 insertions(+), 21 deletions(-) create mode 100644 src/groups/z_bmq/CMakeLists.txt create mode 100644 src/groups/z_bmq/doc/z_bmq.txt create mode 100644 src/groups/z_bmq/group/z_bmq.dep create mode 100644 src/groups/z_bmq/group/z_bmq.mem create mode 100644 src/groups/z_bmq/group/z_bmq.t.dep create mode 100644 src/groups/z_bmq/z_bmqa/package/z_bmqa.dep create mode 100644 src/groups/z_bmq/z_bmqa/package/z_bmqa.mem create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp create mode 100644 src/groups/z_bmq/z_bmqt/package/z_bmqt.dep create mode 100644 src/groups/z_bmq/z_bmqt/package/z_bmqt.mem create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp diff --git a/src/groups/CMakeLists.txt b/src/groups/CMakeLists.txt index be9ff6a99..fcbff14a0 100644 --- a/src/groups/CMakeLists.txt +++ b/src/groups/CMakeLists.txt @@ -4,3 +4,4 @@ add_subdirectory(mwc) add_subdirectory(bmq) add_subdirectory(mqb) +add_subdirectory(z_bmq) diff --git a/src/groups/z_bmq/CMakeLists.txt b/src/groups/z_bmq/CMakeLists.txt new file mode 100644 index 000000000..eb384990f --- /dev/null +++ b/src/groups/z_bmq/CMakeLists.txt @@ -0,0 +1,11 @@ +# bmq +# --- + + +# Add the libbmq group library only installing the public headers +add_library(z_bmq) + +target_compile_definitions(z_bmq PRIVATE "MWC_INTERNAL_USAGE") + +target_bmq_style_uor( z_bmq ) + diff --git a/src/groups/z_bmq/doc/z_bmq.txt b/src/groups/z_bmq/doc/z_bmq.txt new file mode 100644 index 000000000..abc7e2acd --- /dev/null +++ b/src/groups/z_bmq/doc/z_bmq.txt @@ -0,0 +1,63 @@ + bmq.txt + +@PURPOSE: Public SDK API for the BlazingMQ framework. + +@MNEMONIC: BlazingMQ (bmq) + +@DESCRIPTION: BlazingmQ (package group 'bmq') is a message-queue + framework allowing application developers to use reliable distributed queues. + + The 'bmqa' and 'bmqt' packages contain all components that constitute the + public API for BlazingmQ users to use. A client should only use the + components in these packages, and should not use any other package under the + 'bmq' package group since they are implementation components that may change + at any time. + +/Hierarchical Synopsis +/--------------------- +The 'bmq' group library currently has 5 packages forming 5 levels of physical +dependency. +.. + 5. bmqa + + 4. bmqimp + + 3. bmqp + + 2. bmqt + + 1. bmqscm +.. + +/Package Synopsis +/------------------ +: 'bmqa': +: Provide applications public API for the BlazingmQ SDK. +: +: 'bmqimp': +: [INTERNAL] Provide implementation for the API of the BlazingMQ SDK. +: +: 'bmqp': +: [INTERNAL] Provide BlazingMQ protocol definition, builders and parsers. +: +: 'bmqscm': +: Provide versioning information for library components in 'bmq'. +: +: 'bmqt': +: Provide value-semantic vocabulary types. + +/Package Overview +/---------------- + The following provides a brief overview of several of the packages within the + 'bmq' package group, arranged in alphabetical order. The descriptions here + are still very brief; see the respective Package Level documents for more + details and usage examples. + +/'bmqa' +/- - - + 'bmqa' provides the top-level public APIs application can use to interact with + BlazingMQ framework in their applications. + +/'bmqt' +/- - - + 'bmqt' provides value-semantic vocabulary types used in the {'bmqa'} APIs. diff --git a/src/groups/z_bmq/group/z_bmq.dep b/src/groups/z_bmq/group/z_bmq.dep new file mode 100644 index 000000000..41790551b --- /dev/null +++ b/src/groups/z_bmq/group/z_bmq.dep @@ -0,0 +1,5 @@ +# Level 2 +bmq + +# Level 1 +bsl diff --git a/src/groups/z_bmq/group/z_bmq.mem b/src/groups/z_bmq/group/z_bmq.mem new file mode 100644 index 000000000..c39036031 --- /dev/null +++ b/src/groups/z_bmq/group/z_bmq.mem @@ -0,0 +1,4 @@ +# [OFFLINE ONLY] + +z_bmqa +z_bmqt diff --git a/src/groups/z_bmq/group/z_bmq.t.dep b/src/groups/z_bmq/group/z_bmq.t.dep new file mode 100644 index 000000000..60e97934d --- /dev/null +++ b/src/groups/z_bmq/group/z_bmq.t.dep @@ -0,0 +1 @@ +mwc \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.dep b/src/groups/z_bmq/z_bmqa/package/z_bmqa.dep new file mode 100644 index 000000000..623e5c44d --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.dep @@ -0,0 +1 @@ +z_bmqt \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem new file mode 100644 index 000000000..e5a2a9b61 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -0,0 +1 @@ +z_bmqa_session diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 5da164d29..72855c8a7 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -9,22 +9,22 @@ namespace BloombergLP { namespace z_bmqa { -int z_bmqa_session__create(z_bmqa_session* session , z_bmqt_SessionOptions* options) { +int z_bmqa_session__create(z_bmqa_Session** session , z_bmqt_SessionOptions* options) { bmqt::SessionOptions* option_ptr = reinterpret_cast(options); bmqa::Session* session_ptr = new bmqa::Session(*option_ptr); - - *session = reinterpret_cast(session_ptr); + *session = reinterpret_cast(session_ptr); return 0; } -int z_bmqa_session__start(z_bmqa_session* session, int64_t seconds, int nanoseconds) { +int z_bmqa_Session__start(z_bmqa_Session* session, int64_t timeoutMs) { bmqa::Session* session_ptr = reinterpret_cast(session); - bsls::TimeInterval timeout(seconds, nanoseconds); - session_ptr->start(timeout); - return 0; + bsls::TimeInterval timeout; + timeout.addMilliseconds(timeoutMs); + int rc = session_ptr->start(timeout); + return rc; } -int z_bmqa_session__stop(z_bmqa_session* session) { +int z_bmqa_Session__stop(z_bmqa_Session* session) { bmqa::Session* session_ptr = reinterpret_cast(session); session_ptr->stop(); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 8415c92ff..022982a40 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -2,18 +2,19 @@ #define INCLUDED_Z_BMQA_SESSION #include +#include #if defined(__cplusplus) extern "C" { #endif -typedef void* z_bmqa_session; +typedef struct z_bmqa_Session z_bmqa_Session; -int z_bmqa_session__create(z_bmqa_session* session , z_bmqt_SessionOptions* options); +int z_bmqa_Session__create(z_bmqa_Session** session, z_bmqt_SessionOptions* options); -int z_bmqa_session__start(z_bmqa_session* session, int64_t seconds, int nanoseconds); +int z_bmqa_Session__start(z_bmqa_Session* session, int64_t milliseconds); -int z_bmqa_session__stop(z_bmqa_session* session); +int z_bmqa_Session__stop(z_bmqa_Session* session); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp new file mode 100644 index 000000000..3f9295e9f --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp @@ -0,0 +1,75 @@ +// Copyright 2014-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bmqa_session.t.cpp +#include +#include + +// MWC +#include + +// BDE +#include +#include + +// TEST DRIVER +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +static void test1_sessionOptions() +{ + mwctst::TestHelper::printTestName("Create Session"); + + // Create default sessionOptions + z_bmqt_SessionOptions* sessionOptions; + z_bmqt_SessionOptions__create(&sessionOptions); + bmqt::SessionOptions sessionOptions_cpp(s_allocator_p); + + // Make sure 'k_BROKER_DEFAULT_PORT' and the default brokerUri are in sync + { + PV("CHECKING brokerUri()"); + + + // ASSERT_EQ(sessionOptions_cpp.brokerUri(), result); + } +} + + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 1: test1_sessionOptions(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +} diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.dep b/src/groups/z_bmq/z_bmqt/package/z_bmqt.dep new file mode 100644 index 000000000..e69de29bb diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem new file mode 100644 index 000000000..e236559d5 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -0,0 +1 @@ +z_bmqt_sessionoptions \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp index dedbc6423..a3c359aa0 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -2,12 +2,17 @@ #include - -namespace BloomberLP { -int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions* options) { - BloombergLP::bmqt::SessionOptions* options_ptr = new BloombergLP::bmqt::SessionOptions(); - *options = reinterpret_cast(options_ptr); +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options) { + using namespace BloombergLP; + bmqt::SessionOptions* options_ptr = new bmqt::SessionOptions(); + *options = reinterpret_cast(options_ptr); return 0; } -}; +const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options) { + using namespace BloombergLP; + + const bmqt::SessionOptions* options_ptr = reinterpret_cast(options); + + return options_ptr->brokerUri().c_str(); +} diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h index c8b403a07..0612ad5a2 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h @@ -6,11 +6,11 @@ extern "C" { #endif +typedef struct z_bmqt_SessionOptions z_bmqt_SessionOptions; -typedef void* z_bmqt_SessionOptions; - -int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions* options); +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options); +const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options); #if defined(__cplusplus) diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp new file mode 100644 index 000000000..6f8ef3d54 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp @@ -0,0 +1,75 @@ +// Copyright 2014-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bmqt_sessionoptions.t.cpp -*-C++-*- +#include +#include + +// MWC +#include + +// BDE +#include +#include + +// TEST DRIVER +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +static void test1_sessionOptions() +{ + mwctst::TestHelper::printTestName("BREATHING TEST"); + + // Create default sessionOptions + z_bmqt_SessionOptions* sessionOptions; + z_bmqt_SessionOptions__create(&sessionOptions); + bmqt::SessionOptions sessionOptions_cpp(s_allocator_p); + + // Make sure 'k_BROKER_DEFAULT_PORT' and the default brokerUri are in sync + { + PV("CHECKING brokerUri()"); + + bsl::string_view result = z_bmqt_SessionOptions__brokerUri(sessionOptions); + ASSERT_EQ(sessionOptions_cpp.brokerUri(), result); + } +} + + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 1: test1_sessionOptions(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +} From 5f79d231dc5f7888215fceedef7ac464b7aff07c Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 27 Oct 2023 17:41:53 -0400 Subject: [PATCH 03/57] Made progress on CorrelatonId and QueueId --- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp | 52 ++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h | 23 ++++ src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 21 ++-- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 8 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 116 ++++++++++++++++++ .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 51 ++++++++ .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 8 +- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.h | 4 +- 8 files changed, 264 insertions(+), 19 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp new file mode 100644 index 000000000..1bd4c52cd --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp @@ -0,0 +1,52 @@ +#include +#include +#include + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) { + using namespace BloombergLP; + + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(); + + *queueId_obj = reinterpret_cast(queueId_ptr); + + return 0; +} + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId); + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*correlationId_ptr); + + *queueId_obj = reinterpret_cast(queueId_ptr); + + return 0; +} + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other) { + using namespace BloombergLP; + + const bmqa::QueueId* other_ptr = reinterpret_cast(other); + + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*other_ptr); + *queueId_obj = reinterpret_cast(queueId_ptr); + + return 0; +} + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, int64_t numeric) { + using namespace BloombergLP; + + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(numeric); + *queueId_obj = reinterpret_cast(queueId_ptr); + + return 0; +} + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, void* pointer) { + using namespace BloombergLP; + + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(pointer); + *queueId_obj = reinterpret_cast(queueId_ptr); + + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h new file mode 100644 index 000000000..97785f15b --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h @@ -0,0 +1,23 @@ +#ifndef INCLUDED_Z_BMQA_QUEUEID +#define INCLUDED_Z_BMQA_QUEUEID + +#include +#include + +typedef struct z_bmqa_QueueId z_bmqa_QueueId; + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj); + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId); + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other); + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, int64_t numeric); + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, void* pointer); + +int i; + + + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 72855c8a7..9866a590b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -3,20 +3,24 @@ #include #include -typedef void* TimeInterval; -namespace BloombergLP { - -namespace z_bmqa { - -int z_bmqa_session__create(z_bmqa_Session** session , z_bmqt_SessionOptions* options) { +int z_bmqa_Session__create(z_bmqa_Session** session , z_bmqt_SessionOptions* options) { + using namespace BloombergLP; bmqt::SessionOptions* option_ptr = reinterpret_cast(options); bmqa::Session* session_ptr = new bmqa::Session(*option_ptr); *session = reinterpret_cast(session_ptr); return 0; } +int z_bmqa_Session__destroy(z_bmqa_Session* session) { + using namespace BloombergLP; + bmqa::Session* session_ptr = reinterpret_cast(session); + delete session_ptr; + return 0; +} + int z_bmqa_Session__start(z_bmqa_Session* session, int64_t timeoutMs) { + using namespace BloombergLP; bmqa::Session* session_ptr = reinterpret_cast(session); bsls::TimeInterval timeout; timeout.addMilliseconds(timeoutMs); @@ -25,12 +29,9 @@ int z_bmqa_Session__start(z_bmqa_Session* session, int64_t timeoutMs) { } int z_bmqa_Session__stop(z_bmqa_Session* session) { + using namespace BloombergLP; bmqa::Session* session_ptr = reinterpret_cast(session); session_ptr->stop(); return 0; } - -} - -} diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 022982a40..3b7e6abb3 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -10,11 +10,13 @@ extern "C" { typedef struct z_bmqa_Session z_bmqa_Session; -int z_bmqa_Session__create(z_bmqa_Session** session, z_bmqt_SessionOptions* options); +int z_bmqa_Session__create(z_bmqa_Session** session_obj, z_bmqt_SessionOptions* options); -int z_bmqa_Session__start(z_bmqa_Session* session, int64_t milliseconds); +int z_bmqa_Session__destroy(z_bmqa_Session* session_obj); -int z_bmqa_Session__stop(z_bmqa_Session* session); +int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t milliseconds); + +int z_bmqa_Session__stop(z_bmqa_Session* session_obj); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp new file mode 100644 index 000000000..728867703 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -0,0 +1,116 @@ +#include +#include + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(); + + *correlationId_obj = reinterpret_cast(correlationId_ptr); + return 0; +} + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(numeric); + + *correlationId_obj = reinterpret_cast(correlationId_ptr); + return 0; +} + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, void* pointer) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(pointer); + + *correlationId_obj = reinterpret_cast(correlationId_ptr); + return 0; +} + +int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + correlationId_ptr->makeUnset(); + return 0; +} + +int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlationId_obj, int64_t numeric) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + correlationId_ptr->setNumeric(numeric); + return 0; +} + +int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlationId_obj, void* pointer) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + + correlationId_ptr->setPointer(pointer); + return 0; +} + +int z_bmqt_CorrelationId__isUnset(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->isUnset(); +} + +int z_bmqt_CorrelationId__isNumeric(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->isNumeric(); +} + +int z_bmqt_CorrelationId__isPointer(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->isPointer(); +} + +int z_bmqt_CorrelationId__isSharedPtr(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->isSharedPtr(); +} + +int z_bmqt_CorrelationId__isAutoValue(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->isAutoValue(); +} + +int64_t z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->theNumeric(); +} + +void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->thePointer(); +} + +CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + switch(correlationId_ptr->type()) { + case bmqt::CorrelationId::Type::e_NUMERIC: return e_NUMERIC; + case bmqt::CorrelationId::Type::e_POINTER: return e_POINTER; + case bmqt::CorrelationId::Type::e_SHARED_PTR: return e_SHARED_PTR; + case bmqt::CorrelationId::Type::e_AUTO_VALUE: return e_AUTO_VALUE; + case bmqt::CorrelationId::Type::e_UNSET: return e_UNSET; + default: break; + } + + return e_ERROR; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h new file mode 100644 index 000000000..9a05229cb --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -0,0 +1,51 @@ +#ifndef INCLUDED_Z_BMQA_CORRELATIONID +#define INCLUDED_Z_BMQA_CORRELATIONID + +#include + +typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; + + +enum CorrelationId_Type { + e_NUMERIC // the 'CorrelationId' holds a 64-bit integer + , + e_POINTER // the 'CorrelationId' holds a raw pointer + , + e_SHARED_PTR // the 'CorrelationId' holds a shared pointer + , + e_AUTO_VALUE // the 'CorrelationId' holds an auto value + , + e_UNSET // the 'CorrelationId' is not set + , + e_ERROR // error +}; + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric); + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, void* pointer); + +int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__isUnset(const z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__isNumeric(const z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__isPointer(const z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__isSharedPtr(const z_bmqt_CorrelationId* correlationId_obj); + +int z_bmqt_CorrelationId__isAutoValue(const z_bmqt_CorrelationId* correlation_Id_obj); + +int64_t z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlation_Id_obj); + +void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlation_Id_obj); + +CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlation_Id_obj); + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp index a3c359aa0..7e4a751ee 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -2,17 +2,17 @@ #include -int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options) { +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj) { using namespace BloombergLP; bmqt::SessionOptions* options_ptr = new bmqt::SessionOptions(); - *options = reinterpret_cast(options_ptr); + *options_obj = reinterpret_cast(options_ptr); return 0; } -const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options) { +const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj) { using namespace BloombergLP; - const bmqt::SessionOptions* options_ptr = reinterpret_cast(options); + const bmqt::SessionOptions* options_ptr = reinterpret_cast(options_obj); return options_ptr->brokerUri().c_str(); } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h index 0612ad5a2..4e86e570e 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h @@ -8,9 +8,9 @@ extern "C" { typedef struct z_bmqt_SessionOptions z_bmqt_SessionOptions; -int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options); +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj); -const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options); +const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj); #if defined(__cplusplus) From 9f2ff58e9f93954cccfd74186138b7d43024ca8f Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 7 Nov 2023 19:06:45 -0500 Subject: [PATCH 04/57] Finished QueueOptions, and changed constructors to avoid C naming conflicts --- src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 3 +- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp | 63 +++++-- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h | 26 ++- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 16 +- src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp | 22 ++- src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 5 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 11 +- .../z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 158 ++++++++++++++++++ src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h | 62 +++++++ src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp | 72 ++++++++ src/groups/z_bmq/z_bmqt/z_bmqt_uri.h | 43 +++++ 11 files changed, 446 insertions(+), 35 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_uri.h diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index e5a2a9b61..8605fa0b8 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -1 +1,2 @@ -z_bmqa_session +z_bmqa_queueid +z_bmqa_session \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp index 1bd4c52cd..c83b9d1fd 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp @@ -12,28 +12,28 @@ int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) { return 0; } -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId) { +int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId); - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*correlationId_ptr); + const bmqa::QueueId* other_ptr = reinterpret_cast(other); + + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*other_ptr); *queueId_obj = reinterpret_cast(queueId_ptr); return 0; } -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other) { +int z_bmqa_QueueId__createFromCorrelationId(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId); + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*correlationId_ptr); - const bmqa::QueueId* other_ptr = reinterpret_cast(other); - - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*other_ptr); *queueId_obj = reinterpret_cast(queueId_ptr); return 0; } -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, int64_t numeric) { +int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, int64_t numeric) { using namespace BloombergLP; bmqa::QueueId* queueId_ptr = new bmqa::QueueId(numeric); @@ -42,11 +42,54 @@ int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, int64_t numeric) { return 0; } -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, void* pointer) { +int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, void* pointer) { using namespace BloombergLP; bmqa::QueueId* queueId_ptr = new bmqa::QueueId(pointer); *queueId_obj = reinterpret_cast(queueId_ptr); return 0; -} \ No newline at end of file +} + +const z_bmqt_CorrelationId* z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); + const bmqt::CorrelationId* correlationId_ptr = &(queueId_ptr->correlationId()); + + return reinterpret_cast(correlationId_ptr); +} + +uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); + return queueId_ptr->flags(); +} + +const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); + const bmqt::Uri* uri_ptr = &(queueId_ptr->uri()); + + return reinterpret_cast(uri_ptr); + +} + +const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); + const bmqt::QueueOptions* options_ptr = &(queueId_ptr->options()); + + return reinterpret_cast(options_ptr); +} + +int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); + return queueId_ptr->isValid(); +} + diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h index 97785f15b..d7fad30f7 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h @@ -2,22 +2,38 @@ #define INCLUDED_Z_BMQA_QUEUEID #include +#include +#include #include +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_QueueId z_bmqa_QueueId; int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj); -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId); +int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other); + +int z_bmqa_QueueId__createFromCorrelationId(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId); + +int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, int64_t numeric); + +int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, void* pointer); -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other); +const z_bmqt_CorrelationId* z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj); -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, int64_t numeric); +uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj); -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, void* pointer); +const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId_obj); -int i; +const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId_obj); +int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId_obj); +#if defined(__cplusplus) +} +#endif #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 9866a590b..7c7cbec7c 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -4,33 +4,33 @@ #include -int z_bmqa_Session__create(z_bmqa_Session** session , z_bmqt_SessionOptions* options) { +int z_bmqa_Session__create(z_bmqa_Session** session_obj , z_bmqt_SessionOptions* options) { using namespace BloombergLP; bmqt::SessionOptions* option_ptr = reinterpret_cast(options); bmqa::Session* session_ptr = new bmqa::Session(*option_ptr); - *session = reinterpret_cast(session_ptr); + *session_obj = reinterpret_cast(session_ptr); return 0; } -int z_bmqa_Session__destroy(z_bmqa_Session* session) { +int z_bmqa_Session__destroy(z_bmqa_Session* session_obj) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session); + bmqa::Session* session_ptr = reinterpret_cast(session_obj); delete session_ptr; return 0; } -int z_bmqa_Session__start(z_bmqa_Session* session, int64_t timeoutMs) { +int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session); + bmqa::Session* session_ptr = reinterpret_cast(session_obj); bsls::TimeInterval timeout; timeout.addMilliseconds(timeoutMs); int rc = session_ptr->start(timeout); return rc; } -int z_bmqa_Session__stop(z_bmqa_Session* session) { +int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session); + bmqa::Session* session_ptr = reinterpret_cast(session_obj); session_ptr->stop(); return 0; diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp index 3f9295e9f..8c2c755b3 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp @@ -35,22 +35,28 @@ using namespace bsl; // TESTS // ---------------------------------------------------------------------------- -static void test1_sessionOptions() +static void test1_session() { mwctst::TestHelper::printTestName("Create Session"); - // Create default sessionOptions - z_bmqt_SessionOptions* sessionOptions; - z_bmqt_SessionOptions__create(&sessionOptions); - bmqt::SessionOptions sessionOptions_cpp(s_allocator_p); + // Create default session + + z_bmqa_Session* session; + z_bmqt_SessionOptions* options; + z_bmqt_SessionOptions__create(&options); + z_bmqa_Session__create(&session, options); // Make sure 'k_BROKER_DEFAULT_PORT' and the default brokerUri are in sync { - PV("CHECKING brokerUri()"); + PV("CHECKING start() and stop()"); + + z_bmqa_Session__start(session, 1000); - + z_bmqa_Session__stop(session); // ASSERT_EQ(sessionOptions_cpp.brokerUri(), result); } + + // z_bmqa_Session__destroy(session); } @@ -64,7 +70,7 @@ int main(int argc, char* argv[]) switch (_testCase) { case 0: - case 1: test1_sessionOptions(); break; + case 1: test1_session(); break; default: { cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; s_testStatus = -1; diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem index e236559d5..703793338 100644 --- a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -1 +1,4 @@ -z_bmqt_sessionoptions \ No newline at end of file +z_bmqt_correlationid +z_bmqt_sessionoptions +z_bmqt_queueoptions +z_bmqt_uri \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h index 9a05229cb..8ddef6724 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -5,6 +5,9 @@ typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; +#if defined(__cplusplus) +extern "C" { +#endif enum CorrelationId_Type { e_NUMERIC // the 'CorrelationId' holds a 64-bit integer @@ -22,9 +25,9 @@ enum CorrelationId_Type { int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric); +int z_bmqt_CorrelationId__createFromNumeric(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric); -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, void* pointer); +int z_bmqt_CorrelationId__createFromPointer(z_bmqt_CorrelationId** correlationId_obj, void* pointer); int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlation_Id_obj); @@ -48,4 +51,8 @@ void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlation_I CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlation_Id_obj); +#if defined(__cplusplus) +} +#endif + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp new file mode 100644 index 000000000..7fe59e788 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -0,0 +1,158 @@ +#include +#include + +int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj) { + using namespace BloombergLP; + bmqt::QueueOptions* queueOptions_ptr = new bmqt::QueueOptions; + + *queueOptions_obj = reinterpret_cast(queueOptions_ptr); + + return 0; +} + +int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other) { + using namespace BloombergLP; + const bmqt::QueueOptions* other_ptr = reinterpret_cast(other); + bmqt::QueueOptions* queueOptions_ptr = new bmqt::QueueOptions(*other_ptr); + + *queueOptions_obj = reinterpret_cast(queueOptions_ptr); + + return 0; +} + + +//Modifiers +int z_bmqt_QueueOptions__setMaxUnconfirmedMessages(z_bmqt_QueueOptions* queueOptions_obj, int value) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + + queueOptions_ptr->setMaxUnconfirmedMessages(value); + return 0; +} + +int z_bmqt_QueueOptions__setMaxUnconfirmedBytes(z_bmqt_QueueOptions* queueOptions_obj, int value) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + queueOptions_ptr->setMaxUnconfirmedBytes(value); + return 0; +} + +int z_bmqt_QueueOptions__setConsumerPriority(z_bmqt_QueueOptions* queueOptions_obj, int value) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + queueOptions_ptr->setConsumerPriority(value); + return 0; +} + +int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOptions_obj, int value) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + queueOptions_ptr->setSuspendsOnBadHostHealth(value); + return 0; +} + +int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* other_ptr = reinterpret_cast(other); + + queueOptions_ptr->merge(*other_ptr); + return 0; +} + +// int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj) { +// using namespace BloombergLP; + +// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); +// } + +// int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj) { +// using namespace BloombergLP; + +// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); +// } + +int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + queueOptions_ptr->removeAllSubscriptions(); + return 0; +} + +//Accessors +int z_bmqt_QueueOptions__maxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->maxUnconfirmedMessages(); +} + +int z_bmqt_QueueOptions__maxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->maxUnconfirmedBytes(); +} + +int z_bmqt_QueueOptions__consumerPriority(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->consumerPriority(); +} + +bool z_bmqt_QueueOptions__suspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->suspendsOnBadHostHealth(); +} + + +bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->hasMaxUnconfirmedMessages(); +} + +bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->hasMaxUnconfirmedBytes(); +} + +bool z_bmqt_QueueOptions__hasConsumerPriority(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->hasConsumerPriority(); +} + +bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj, int value) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->hasSuspendsOnBadHostHealth(); +} + + +//Experimental (Modifiers) +// bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj) { +// using namespace BloombergLP; + +// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); +// } + +// int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj) { +// using namespace BloombergLP; + +// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); +// } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h new file mode 100644 index 000000000..7b73d5e08 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -0,0 +1,62 @@ +#ifndef INCLUDED_Z_BMQT_QUEUEOPTIONS +#define INCLUDED_Z_BMQT_QUEUEOPTIONS + +typedef struct z_bmqt_QueueOptions z_bmqt_QueueOptions; + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj); + +int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other); + + +//Modifiers +int z_bmqt_QueueOptions__setMaxUnconfirmedMessages(z_bmqt_QueueOptions* queueOptions_obj, int value); + +int z_bmqt_QueueOptions__setMaxUnconfirmedBytes(z_bmqt_QueueOptions* queueOptions_obj, int value); + +int z_bmqt_QueueOptions__setConsumerPriority(z_bmqt_QueueOptions* queueOptions_obj, int value); + +int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOptions_obj, int value); + +int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other); + +int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj); + +int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj); + +int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); + +//Accessors +int z_bmqt_QueueOptions__maxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj); + +int z_bmqt_QueueOptions__maxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj); + +int z_bmqt_QueueOptions__consumerPriority(const z_bmqt_QueueOptions* queueOptions_obj); + +bool z_bmqt_QueueOptions__suspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj); + + +bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj); + +bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj); + +bool z_bmqt_QueueOptions__hasConsumerPriority(const z_bmqt_QueueOptions* queueOptions_obj); + +bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj); + + +//Experimental (Modifiers) +bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj); + +int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp new file mode 100644 index 000000000..5c5735c05 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp @@ -0,0 +1,72 @@ +#include +#include + +int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy){ + using namespace BloombergLP; + bmqt::Uri* original_uri_ptr = reinterpret_cast(to_copy); + bmqt::Uri* copy = new bmqt::Uri(*original_uri_ptr); + *uri_obj = reinterpret_cast(copy); + return 0; +} + + +//URIBUILDER + + +int z_bmqt_UriBuilder__create(z_bmqt_UriBuilder** uribuilder_obj) { + using namespace BloombergLP; + bmqt::UriBuilder* uriBuilder_ptr = new bmqt::UriBuilder(); + *uribuilder_obj = reinterpret_cast(uriBuilder_ptr); + return 0; +} + +int z_bmqt_UriBuilder__createFromUri(z_bmqt_UriBuilder** uribuilder_obj, const z_bmqt_Uri* uri_obj) { + using namespace BloombergLP; + const bmqt::Uri* uri_ptr = reinterpret_cast(uri_obj); + bmqt::UriBuilder* uriBuilder_ptr = new bmqt::UriBuilder(*uri_ptr); + *uribuilder_obj = reinterpret_cast(uriBuilder_ptr); + return 0; +} + +int z_bmqt_UriBuilder__setDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ + using namespace BloombergLP; + bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); + uriBuilder_ptr->setDomain(value); + return 0; +} + +int z_bmqt_UriBuilder__setTier(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ + using namespace BloombergLP; + bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); + uriBuilder_ptr->setTier(value); + return 0; +} + +int z_bmqt_UriBuilder__setQualifiedDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ + using namespace BloombergLP; + bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); + uriBuilder_ptr->setQualifiedDomain(value); + return 0; +} + +int z_bmqt_UriBuilder__setQueue(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ + using namespace BloombergLP; + bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); + uriBuilder_ptr->setQueue(value); + return 0; +} + +int z_bmqt_UriBuilder_uri(z_bmqt_UriBuilder* uribuilder_obj, z_bmqt_Uri** uri_obj){ + using namespace BloombergLP; + const bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uri_obj); + bmqt::Uri* uri_ptr = new bmqt::Uri(); + + int res = uriBuilder_ptr->uri(uri_ptr); // support error description ? + if(res != 0){ + delete uri_ptr; + return res; + } + + *uri_obj = reinterpret_cast(uri_ptr); + return res; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.h b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.h new file mode 100644 index 000000000..a043d7054 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.h @@ -0,0 +1,43 @@ +#ifndef INCLUDED_Z_BMQT_URI +#define INCLUDED_Z_BMQT_URI + +#if defined(__cplusplus) +extern "C" { +#endif + +// ========= +// class Uri +// ========= + +typedef struct z_bmqt_Uri z_bmqt_Uri; + + +int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy); + + +// ================ +// class UriBuilder +// ================ + +typedef struct z_bmqt_UriBuilder z_bmqt_UriBuilder; + +int z_bmqt_UriBuilder__create(z_bmqt_UriBuilder** uribuilder_obj); + +int z_bmqt_UriBuilder__createFromUri(z_bmqt_UriBuilder** uribuilder_obj, const z_bmqt_Uri* uri_obj); + +int z_bmqt_UriBuilder__setDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value); + +int z_bmqt_UriBuilder__setTier(z_bmqt_UriBuilder* uribuilder_obj, const char* value); + +int z_bmqt_UriBuilder__setQualifiedDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value); + +int z_bmqt_UriBuilder__setQueue(z_bmqt_UriBuilder* uribuilder_obj, const char* value); + +int z_bmqt_UriBuilder_uri(z_bmqt_UriBuilder* uribuilder_obj, z_bmqt_Uri** uri_obj); + + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file From f662467eedf2a3b78e72105331a0791cca1926ff Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 7 Nov 2023 19:10:17 -0500 Subject: [PATCH 05/57] Fixed minor errors --- src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 2 +- src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp index 7fe59e788..01efdbcf2 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -136,7 +136,7 @@ bool z_bmqt_QueueOptions__hasConsumerPriority(const z_bmqt_QueueOptions* queueOp return queueOptions_ptr->hasConsumerPriority(); } -bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj, int value) { +bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h index 7b73d5e08..f52b99b0f 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -25,9 +25,9 @@ int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOp int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other); -int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj); +// int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj); -int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj); +// int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj); int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); @@ -51,9 +51,9 @@ bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* //Experimental (Modifiers) -bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj); +// bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj); -int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); +// int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); #if defined(__cplusplus) } From 9190f2ae3c5d960304e0888e7fcf616c0727aa2b Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 7 Nov 2023 22:15:48 -0500 Subject: [PATCH 06/57] Added wrapper functions for Subscription, SubscriptionHandle, and SubscriptionExpression, and also finished functions in QueueOptions that use Subscription objects --- src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 3 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 12 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 8 +- .../z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 83 ++++++-- src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h | 24 ++- .../z_bmq/z_bmqt/z_bmqt_subscription.cpp | 185 ++++++++++++++++++ src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h | 82 ++++++++ 7 files changed, 365 insertions(+), 32 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem index 703793338..e37e0e3c6 100644 --- a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -1,4 +1,5 @@ z_bmqt_correlationid -z_bmqt_sessionoptions z_bmqt_queueoptions +z_bmqt_sessionoptions +z_bmqt_subscription z_bmqt_uri \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp index 728867703..958eb6020 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -104,13 +104,13 @@ CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correl const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); switch(correlationId_ptr->type()) { - case bmqt::CorrelationId::Type::e_NUMERIC: return e_NUMERIC; - case bmqt::CorrelationId::Type::e_POINTER: return e_POINTER; - case bmqt::CorrelationId::Type::e_SHARED_PTR: return e_SHARED_PTR; - case bmqt::CorrelationId::Type::e_AUTO_VALUE: return e_AUTO_VALUE; - case bmqt::CorrelationId::Type::e_UNSET: return e_UNSET; + case bmqt::CorrelationId::Type::e_NUMERIC: return CorrelationId_Type::e_NUMERIC; + case bmqt::CorrelationId::Type::e_POINTER: return CorrelationId_Type::e_POINTER; + case bmqt::CorrelationId::Type::e_SHARED_PTR: return CorrelationId_Type::e_SHARED_PTR; + case bmqt::CorrelationId::Type::e_AUTO_VALUE: return CorrelationId_Type::e_AUTO_VALUE; + case bmqt::CorrelationId::Type::e_UNSET: return CorrelationId_Type::e_UNSET; default: break; } - return e_ERROR; + return CorrelationId_Type::e_CORRELATIONID_ERROR; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h index 8ddef6724..78d93fe90 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -3,12 +3,14 @@ #include -typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; - #if defined(__cplusplus) extern "C" { #endif + +typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; + + enum CorrelationId_Type { e_NUMERIC // the 'CorrelationId' holds a 64-bit integer , @@ -20,7 +22,7 @@ enum CorrelationId_Type { , e_UNSET // the 'CorrelationId' is not set , - e_ERROR // error + e_CORRELATIONID_ERROR // error }; int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp index 01efdbcf2..42a81a021 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -1,4 +1,7 @@ #include +#include +#include +#include #include int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj) { @@ -65,17 +68,37 @@ int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bm return 0; } -// int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj) { -// using namespace BloombergLP; +int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj, char** errorDescription, const z_bmqt_SubscriptionHandle* handle, const z_bmqt_Subscription* subscription){ + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription); + + bsl::string error; -// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); -// } + queueOptions_ptr->addOrUpdateSubscription(&error, *handle_ptr, *subscription_ptr); -// int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj) { -// using namespace BloombergLP; + if(error.empty()) { + *errorDescription = NULL; + return 0; + } else { + *errorDescription = static_cast(calloc(error.size()+1, sizeof(char))); + strcpy(*errorDescription, error.c_str()); -// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); -// } + return 1; + } +} + +int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_SubscriptionHandle* handle){ + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); + queueOptions_ptr->removeSubscription(*handle_ptr); + + return 0; +} int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; @@ -145,14 +168,42 @@ bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* //Experimental (Modifiers) -// bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj) { -// using namespace BloombergLP; +bool z_bmqt_QueueOptions__loadSubscription(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_Subscription** subscription, const z_bmqt_SubscriptionHandle* handle) { + using namespace BloombergLP; -// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); -// } + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); + bmqt::Subscription* subscription_ptr = new bmqt::Subscription(); + + bool success = queueOptions_ptr->loadSubscription(subscription_ptr, *handle_ptr); + + if(success) { + *subscription = reinterpret_cast(subscription_ptr); + } else { + delete subscription_ptr; + *subscription = NULL; + } + + return success; +} + +int z_bmqt_QueueOptions__loadSubscriptions(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_SubscrptionsSnapshot* snapshot) { + using namespace BloombergLP; -// int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj) { -// using namespace BloombergLP; + bmqt::QueueOptions::SubscriptionsSnapshot vector; + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + queueOptions_ptr->loadSubscriptions(&vector); + + snapshot->size = vector.size(); + snapshot->subscriptions = static_cast(calloc(vector.size(), sizeof(z_bmqt_HandleAndSubscrption))); + + for(size_t i = 0; i < vector.size(); ++i) { + bmqt::SubscriptionHandle* handle_ptr = new bmqt::SubscriptionHandle(vector[i].first); + bmqt::Subscription* subscription_ptr = new bmqt::Subscription(vector[i].second); -// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); -// } + snapshot->subscriptions[i].handle = reinterpret_cast(handle_ptr); + snapshot->subscriptions[i].subscrption = reinterpret_cast(subscription_ptr); + } + + return 0; +} diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h index f52b99b0f..0f916643d 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -1,14 +1,25 @@ #ifndef INCLUDED_Z_BMQT_QUEUEOPTIONS #define INCLUDED_Z_BMQT_QUEUEOPTIONS -typedef struct z_bmqt_QueueOptions z_bmqt_QueueOptions; - #include +#include #if defined(__cplusplus) extern "C" { #endif +typedef struct z_bmqt_QueueOptions z_bmqt_QueueOptions; + +typedef struct z_bmqt_HandleAndSubscrption { + z_bmqt_SubscriptionHandle* handle; + z_bmqt_Subscription* subscrption; +} z_bmqt_HandleAndSubscrption; + +typedef struct z_bmqt_SubscrptionsSnapshot { + size_t size; + z_bmqt_HandleAndSubscrption* subscriptions; +} z_bmqt_SubscrptionsSnapshot; + int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj); int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other); @@ -25,9 +36,10 @@ int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOp int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other); -// int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj); +//Pass in an an uninitialized char** for errorDescription, the pointer will be set to NULL if there is no error, otherwise it will set to an appropriately sized string that is allocated on the heap +int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj, char** errorDescription, const z_bmqt_SubscriptionHandle* handle, const z_bmqt_Subscription* subscription); -// int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_SubscriptionHandle* handle); int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); @@ -51,9 +63,9 @@ bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* //Experimental (Modifiers) -// bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__loadSubscription(const z_bmqt_QueueOptions* queueOptions_obj); -// int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__loadSubscriptions(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_SubscrptionsSnapshot* snapshot); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp new file mode 100644 index 000000000..1429333e3 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp @@ -0,0 +1,185 @@ +#include +#include +#include +#include + +int z_bmqt_SubscriptionHandle__create(z_bmqt_SubscriptionHandle** subscriptionHandle_obj, const z_bmqt_CorrelationId* cid){ + using namespace BloombergLP; + + const bmqt::CorrelationId* correlationId = reinterpret_cast(cid); + bmqt::SubscriptionHandle* subscriptionHandle_ptr = new bmqt::SubscriptionHandle(*correlationId); + *subscriptionHandle_obj = reinterpret_cast(subscriptionHandle_ptr); + + return 0; +} + +unsigned int z_bmqt_SubscriptionHandle__id(const z_bmqt_SubscriptionHandle* subscriptionHandle_obj){ + using namespace BloombergLP; + + const bmqt::SubscriptionHandle* subscriptionHandle_ptr = reinterpret_cast(subscriptionHandle_obj); + return subscriptionHandle_ptr->id(); +} + +/////// + +int z_bmqt_SubscriptionExpression__create(z_bmqt_SubscriptionExpression** subscriptionExpression_obj){ + using namespace BloombergLP; + + bmqt::SubscriptionExpression* subscriptionExpression_ptr = new bmqt::SubscriptionExpression(); + *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_ptr); + + return 0; +} + +int z_bmqt_SubscriptionExpression__createFromString(z_bmqt_SubscriptionExpression** subscriptionExpression_obj, const char* expression, SubscriptionExpressionEnum version){ + using namespace BloombergLP; + + bmqt::SubscriptionExpression::Enum v; + switch(version) { + case SubscriptionExpressionEnum::e_NONE: v = bmqt::SubscriptionExpression::e_NONE; + case SubscriptionExpressionEnum::e_VERSION_1: v = bmqt::SubscriptionExpression::e_VERSION_1; + default: return 1; + } + + bmqt::SubscriptionExpression* subscriptionExpression_ptr = new bmqt::SubscriptionExpression(bsl::string(expression), v); + + *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_ptr); + + return 0; +} + +const char* z_bmqt_SubscriptionExpression__text(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ + using namespace BloombergLP; + + const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); + return subscriptionExpression_ptr->text().c_str(); +} + +SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ + using namespace BloombergLP; + + const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); + switch(subscriptionExpression_ptr->version()) { + case bmqt::SubscriptionExpression::e_NONE: return SubscriptionExpressionEnum::e_NONE; + case bmqt::SubscriptionExpression::e_VERSION_1: return SubscriptionExpressionEnum::e_VERSION_1; + default: break; + } + + return SubscriptionExpressionEnum::e_SUBSCRIPTIONEXPRESSION_ERROR; +} + +bool z_bmqt_SubscriptionExpression__isValid(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ + using namespace BloombergLP; + + const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); + return subscriptionExpression_ptr->isValid(); +} + +/////// + +int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj){ + using namespace BloombergLP; + + bmqt::Subscription* subscription_ptr = new bmqt::Subscription(); + *subscription_obj = reinterpret_cast(subscription_ptr); + + return 0; +} + +int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, const z_bmqt_Subscription* other){ + using namespace BloombergLP; + + const bmqt::Subscription* other_ptr = reinterpret_cast(other); + bmqt::Subscription* subscription_ptr = new bmqt::Subscription(*other_ptr); + *subscription_obj = reinterpret_cast(subscription_ptr); + + return 0; +} + +int z_bmqt_Subscription__setMaxUnconfirmedMessages(z_bmqt_Subscription* subscription_obj, int value){ + using namespace BloombergLP; + + bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + subscription_ptr->setMaxUnconfirmedMessages(value); + + return 0; +} + +int z_bmqt_Subscription__setMaxUnconfirmedBytes(z_bmqt_Subscription* subscription_obj, int value){ + using namespace BloombergLP; + + bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + subscription_ptr->setMaxUnconfirmedBytes(value); + + return 0; +} + +int z_bmqt_Subscription__setConsumerPriority(z_bmqt_Subscription* subscription_obj, int value){ + using namespace BloombergLP; + + bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + subscription_ptr->setConsumerPriority(value); + + return 0; +} + +int z_bmqt_Subscription__setExpression(z_bmqt_Subscription* subscription_obj, const z_bmqt_SubscriptionExpression* value){ + using namespace BloombergLP; + + bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + const bmqt::SubscriptionExpression* expression_ptr = reinterpret_cast(value); + subscription_ptr->setExpression(*expression_ptr); + + return 0; +} + +int z_bmqt_Subscription__maxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->maxUnconfirmedMessages(); +} + +int z_bmqt_Subscription__maxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->maxUnconfirmedBytes(); +} + +int z_bmqt_Subscription__consumerPriority(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->consumerPriority(); +} + +const z_bmqt_SubscriptionExpression* z_bmqt_Subscription__expression(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + const bmqt::SubscriptionExpression* expression_ptr = &(subscription_ptr->expression()); + + return reinterpret_cast(expression_ptr); +} + +bool z_bmqt_Subscription__hasMaxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->hasMaxUnconfirmedMessages(); +} + +bool z_bmqt_Subscription__hasMaxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->hasMaxUnconfirmedBytes(); +} + +bool z_bmqt_Subscription__hasConsumerPriority(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->hasConsumerPriority(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h new file mode 100644 index 000000000..36ecab0a1 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h @@ -0,0 +1,82 @@ +#ifndef INCLUDED_Z_BMQT_SUBSCRIPTION +#define INCLUDED_Z_BMQT_SUBSCRIPTION + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +// ======================== +// class SubscriptionHandle +// ======================== + +typedef struct z_bmqt_SubscriptionHandle z_bmqt_SubscriptionHandle; + +int z_bmqt_SubscriptionHandle__create(z_bmqt_SubscriptionHandle** subscriptionHandle_obj, const z_bmqt_CorrelationId* cid); + +unsigned int z_bmqt_SubscriptionHandle__id(const z_bmqt_SubscriptionHandle* subscriptionHandle_obj); + +// ============================ +// class SubscriptionExpression +// ============================ + +typedef struct z_bmqt_SubscriptionExpression z_bmqt_SubscriptionExpression; + +enum SubscriptionExpressionEnum { + // Enum representing criteria format + e_NONE = 0 // EMPTY + , + e_VERSION_1 = 1 // Simple Evaluator + , + e_SUBSCRIPTIONEXPRESSION_ERROR +}; + +int z_bmqt_SubscriptionExpression__create(z_bmqt_SubscriptionExpression** subscriptionExpression_obj); + +int z_bmqt_SubscriptionExpression__createFromString(z_bmqt_SubscriptionExpression** subscriptionExpression_obj, const char* expression, SubscriptionExpressionEnum version); + +const char* z_bmqt_SubscriptionExpression__text(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); + +SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); + +bool z_bmqt_SubscriptionExpression__isValid(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); + +// ================== +// class Subscription +// ================== + +typedef struct z_bmqt_Subscription z_bmqt_Subscription; + +int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj); + +int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, const z_bmqt_Subscription* other); + +int z_bmqt_Subscription__setMaxUnconfirmedMessages(z_bmqt_Subscription* subscription_obj, int value); + +int z_bmqt_Subscription__setMaxUnconfirmedBytes(z_bmqt_Subscription* subscription_obj, int value); + +int z_bmqt_Subscription__setConsumerPriority(z_bmqt_Subscription* subscription_obj, int value); + +int z_bmqt_Subscription__setExpression(z_bmqt_Subscription* subscription_obj, const z_bmqt_SubscriptionExpression* value); + +int z_bmqt_Subscription__maxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj); + +int z_bmqt_Subscription__maxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj); + +int z_bmqt_Subscription__consumerPriority(const z_bmqt_Subscription* subscription_obj); + +const z_bmqt_SubscriptionExpression* z_bmqt_Subscription__expression(const z_bmqt_Subscription* subscription_obj); + +bool z_bmqt_Subscription__hasMaxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj); + +bool z_bmqt_Subscription__hasMaxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj); + +bool z_bmqt_Subscription__hasConsumerPriority(const z_bmqt_Subscription* subscription_obj); + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file From 12fc0432e473b9a37e7d2bcb2a9facbd79fd9392 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 10 Nov 2023 16:57:27 -0500 Subject: [PATCH 07/57] Started Session implementation --- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 6 ++ .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 6 ++ .../z_bmq/z_bmqa/z_bmqa_messageproperties.h | 6 ++ src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 27 ++++---- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 64 ++++++++++++++++++- src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 1 + src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h | 3 +- src/groups/z_bmq/z_bmqt/z_bmqt_types.h | 16 +++++ 8 files changed, 112 insertions(+), 17 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_types.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h new file mode 100644 index 000000000..1e286a379 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -0,0 +1,6 @@ +#ifndef INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER +#define INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER + +typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h new file mode 100644 index 000000000..ee8839887 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -0,0 +1,6 @@ +#ifndef INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER +#define INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER + +typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h new file mode 100644 index 000000000..b9b2823d5 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h @@ -0,0 +1,6 @@ +#ifndef INCLUDED_Z_BMQA_MESSAGEPROPERTIES +#define INCLUDED_Z_BMQA_MESSAGEPROPERTIES + +typedef struct z_bmqa_MessageProperties z_bmqa_MessageProperties; + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 7c7cbec7c..35d68e03f 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -4,32 +4,31 @@ #include -int z_bmqa_Session__create(z_bmqa_Session** session_obj , z_bmqt_SessionOptions* options) { +int z_bmqa_Session__create(z_bmqa_Session** session_obj , const z_bmqt_SessionOptions* options) { using namespace BloombergLP; - bmqt::SessionOptions* option_ptr = reinterpret_cast(options); - bmqa::Session* session_ptr = new bmqa::Session(*option_ptr); - *session_obj = reinterpret_cast(session_ptr); - return 0; -} -int z_bmqa_Session__destroy(z_bmqa_Session* session_obj) { - using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - delete session_ptr; + const bmqt::SessionOptions* options_ptr = reinterpret_cast(options); + bmqa::Session* session_ptr = new bmqa::Session(*options_ptr); + *session_obj = reinterpret_cast(session_ptr); return 0; } int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) { using namespace BloombergLP; + bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bsls::TimeInterval timeout; - timeout.addMilliseconds(timeoutMs); - int rc = session_ptr->start(timeout); - return rc; + if(timeoutMs != 0) { + bsls::TimeInterval timeout; + timeout.addMilliseconds(timeoutMs); + return session_ptr->start(timeout); + } else { + return session_ptr->start(); + } } int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { using namespace BloombergLP; + bmqa::Session* session_ptr = reinterpret_cast(session_obj); session_ptr->stop(); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 3b7e6abb3..2d113aea2 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -2,22 +2,82 @@ #define INCLUDED_Z_BMQA_SESSION #include +#include +#include +#include +#include +#include #include #if defined(__cplusplus) extern "C" { #endif +typedef struct z_bmqa_SessionEventHandler z_bmqa_SessionEventHandler; + + typedef struct z_bmqa_Session z_bmqa_Session; -int z_bmqa_Session__create(z_bmqa_Session** session_obj, z_bmqt_SessionOptions* options); +typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; + +typedef void(*z_bmqa_SessionEventHandlerCb)(z_bmqa_SessionEvent* sessionEvent, void* data); + +typedef struct EventHandlerData { + z_bmqa_SessionEventHandlerCb callback; + void* data; +} EventHandlerData; + +// void z_bmqa_Session__setEventHandler(z_bmqa_Session* session_obj, EventHandlerData* data) { +// if(data.callback != NULL) { +// z_bmqa_SessionEvent* event = NULL; -int z_bmqa_Session__destroy(z_bmqa_Session* session_obj); +// data.callback(event, NULL); +// } +// } + +int z_bmqa_Session__create(z_bmqa_Session** session_obj, const z_bmqt_SessionOptions* options); + +int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, z_bmqa_SessionEventHandler* eventHandler, const z_bmqt_SessionOptions* options); int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t milliseconds); +int z_bmqa_Session__startAsync(); + int z_bmqa_Session__stop(z_bmqa_Session* session_obj); +int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj); + +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj); + +int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder); + +int z_bmqa_Session__loadConfirmEventBuilder(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder** builder); + +int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer); + +int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri); + +int z_bmqa_Session__getQueueIdWithCorrelationId(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_CorrelationId* correlationId); + +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const z_bmqt_Uri* uri, uint64_t flags, + const z_bmqt_QueueOptions* options, + int64_t timeout); + +// int z_bmqa_Session__openQueueAsync(z_bmqa_Session* session_obj, +// z_bmqa_QueueId* queueId, +// const z_bmqt_Uri* uri, uint64_t flags, +// const z_bmqt_QueueOptions* options, +// int64_t timeout); + +int z_bmqa_Session__configureQueue(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const z_bmqt_QueueOptions* options, + int64_t timeout); + + + #if defined(__cplusplus) } #endif diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem index e37e0e3c6..beeb8066f 100644 --- a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -2,4 +2,5 @@ z_bmqt_correlationid z_bmqt_queueoptions z_bmqt_sessionoptions z_bmqt_subscription +z_bmqt_types z_bmqt_uri \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h index 0f916643d..997e9624e 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -2,6 +2,7 @@ #define INCLUDED_Z_BMQT_QUEUEOPTIONS #include +#include #include #if defined(__cplusplus) @@ -16,7 +17,7 @@ typedef struct z_bmqt_HandleAndSubscrption { } z_bmqt_HandleAndSubscrption; typedef struct z_bmqt_SubscrptionsSnapshot { - size_t size; + uint64_t size; z_bmqt_HandleAndSubscrption* subscriptions; } z_bmqt_SubscrptionsSnapshot; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_types.h b/src/groups/z_bmq/z_bmqt/z_bmqt_types.h new file mode 100644 index 000000000..9c4af5565 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_types.h @@ -0,0 +1,16 @@ +#ifndef INCLUDED_Z_BMQT_TYPES +#define INCLUDED_Z_BMQT_TYPES + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef const char* z_bmqt_String; + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file From 031c0348f6305b49eac7fe14acb649cbeee0d0e6 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 10 Nov 2023 17:43:53 -0500 Subject: [PATCH 08/57] Added headers for z_bmqa_Session --- src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 6 ++++- src/groups/z_bmq/z_bmqa/z_bmqa_event.h | 6 +++++ src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 9 ++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h | 6 +++++ src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 22 ++++++++++++++++++- 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_event.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_message.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index 8605fa0b8..da1eb6b88 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -1,2 +1,6 @@ z_bmqa_queueid -z_bmqa_session \ No newline at end of file +z_bmqa_session +z_bmqa_event +z_bmqa_confirmeventbuilder +z_bmqa_messageeventbuilder +z_bmqa_messageproperties \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_event.h b/src/groups/z_bmq/z_bmqa/z_bmqa_event.h new file mode 100644 index 000000000..c8ec6f3ab --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_event.h @@ -0,0 +1,6 @@ +#ifndef INCLUDED_Z_BMQA_EVENT +#define INCLUDED_Z_BMQA_EVENT + +typedef struct z_bmqa_Event z_bmqa_Event; + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h new file mode 100644 index 000000000..3bb581612 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -0,0 +1,9 @@ +#ifndef INCLUDED_Z_BMQA_MESSAGE +#define INCLUDED_Z_BMQA_MESSAGE + +typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; + +typedef struct z_bmqa_Message z_bmqa_Message; + + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h new file mode 100644 index 000000000..04bcdaf66 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h @@ -0,0 +1,6 @@ +#ifndef INCLUDED_Z_BMQA_MESSAGEEVENT +#define INCLUDED_Z_BMQA_MESSAGEEVENT + +typedef struct z_bmqa_MessageEvent z_bmqa_MessageEvent; + +#endif diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 2d113aea2..bf9f9ad9c 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -5,8 +5,11 @@ #include #include #include +#include +#include #include #include +#include #include #if defined(__cplusplus) @@ -71,12 +74,29 @@ int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, // const z_bmqt_QueueOptions* options, // int64_t timeout); -int z_bmqa_Session__configureQueue(z_bmqa_Session* session_obj, +int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, const z_bmqt_QueueOptions* options, int64_t timeout); +// int z_bmqa_Session__configureQueueAsync(z_bmqa_Session* session_obj, +// z_bmqa_QueueId* queueId, +// const z_bmqt_QueueOptions* options, +// int64_t timeout); +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); + +int z_bmqa_Session__closeQueueAsync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); + +int z_bmqa_Session_nextEvent(z_bmqa_Session* session_obj, z_bmqa_Event** event_obj, int64_t timeout); + +int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event); + +int z_bmqa_Session__confirmMessage(z_bmqa_Session* session_obj, const z_bmqa_Message* message); + +int z_bmqa_Session__confirmMessageWithCookie(z_bmqa_Session* session_obj, const z_bmqa_MessageConfirmationCookie* cookie); + +int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder* builder); #if defined(__cplusplus) } From ccfa5e6722811d9af83d5d720056a3e948bd9aa5 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 17 Nov 2023 19:51:29 -0500 Subject: [PATCH 09/57] test --- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 35d68e03f..488deac3e 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -32,5 +32,63 @@ int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { bmqa::Session* session_ptr = reinterpret_cast(session_obj); session_ptr->stop(); + return 0; +} + + +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + session_ptr->finalizeStop(); + return 0; +} + + +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + session_ptr->finalizeStop(); + return 0; +} + +int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder); + + session_ptr->loadMessageEventBuilder(builder_ptr); return 0; } + +int z_bmqa_Session__loadConfirmEventBuilder(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder** builder){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder); + + session_ptr->loadConfirmEventBuilder(builder_ptr); + return 0; +} + +int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::MessageProperties* buffer_ptr = reinterpret_cast(buffer); + + session_ptr->loadMessageProperties(buffer_ptr); + return 0; +} + +int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::Q* buffer_ptr = reinterpret_cast(uri); + + session_ptr->getQueueId(buffer_ptr); + return 0; +} \ No newline at end of file From 0efcb025afd289e14141f29f93a37d65e0f38934 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 14 Nov 2023 17:02:29 -0500 Subject: [PATCH 10/57] Initial implementation of z_bmqa_MessageEventBuilder --- .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 74 +++++++++++++++++++ .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 30 ++++++++ 2 files changed, 104 insertions(+) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp new file mode 100644 index 000000000..7a8eea458 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp @@ -0,0 +1,74 @@ +#include +#include +#include + + + +int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = new bmqa::MessageEventBuilder(); + *builder_obj = reinterpret_cast(builder_ptr); + + return 0; +} + +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + builder_ptr->startMessage(); + + return 0; +} + +int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId); + return builder_ptr->packMessage(*queueId_ptr); +} + +int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + builder_ptr->reset(); + + return 0; +} + +int z_bmqa_MessageEventBuilder__messageEvent(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_MessageEvent const** event_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + const bmqa::MessageEvent* event_ptr = &(builder_ptr->messageEvent()); + *event_obj = reinterpret_cast(event_ptr); + + return 0; +} + +int z_bmqa_MessageEventBuilder__currentMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** message_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + bmqa::Message* message_ptr = &(builder_ptr->currentMessage()); + *message_obj = reinterpret_cast(message_ptr); + + return 0; +} + +int z_bmqa_MessageEventBuilder__messageCount(const z_bmqa_MessageEventBuilder* builder_obj) { + using namespace BloombergLP; + + const bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + return builder_ptr->messageCount(); +} + +int z_bmqa_MessageEventBuilder__messageEventSize(const z_bmqa_MessageEventBuilder* builder_obj) { + using namespace BloombergLP; + + const bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + return builder_ptr->messageEventSize(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index ee8839887..12c9d4273 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -1,6 +1,36 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER #define INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER + + +#include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; +int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj); + +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj); + +int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId); + +int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj); + +int z_bmqa_MessageEventBuilder__messageEvent(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_MessageEvent const** event_obj); + +int z_bmqa_MessageEventBuilder__currentMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** message_obj); + +int z_bmqa_MessageEventBuilder__messageCount(const z_bmqa_MessageEventBuilder* builder_obj); + +int z_bmqa_MessageEventBuilder__messageEventSize(const z_bmqa_MessageEventBuilder* builder_obj); + +#if defined(__cplusplus) +} +#endif + #endif \ No newline at end of file From c208895766fd62191084d1c77e46edd308585f69 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Wed, 15 Nov 2023 14:26:56 -0500 Subject: [PATCH 11/57] Initial implementation of z_bmqa_ConfirmEventBuilder --- .../z_bmqa/z_bmqa_confirmeventbuilder.cpp | 57 +++++++++++++++++++ .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 25 ++++++++ src/groups/z_bmq/z_bmqt/z_bmqt_types.h | 2 + 3 files changed, 84 insertions(+) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp new file mode 100644 index 000000000..45d493900 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp @@ -0,0 +1,57 @@ +#include +#include + + +int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj) { + using namespace BloombergLP; + + bmqa::ConfirmEventBuilder* builder_ptr = new bmqa::ConfirmEventBuilder(); + *builder_obj = reinterpret_cast(builder_ptr); + + return 0; +} + +int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_Message* message) { + using namespace BloombergLP; + + bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + const bmqa::Message* message_ptr = reinterpret_cast(message); + return builder_ptr->addMessageConfirmation(*message_ptr); +} + +int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie(z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_MessageConfirmationCookie* cookie) { + using namespace BloombergLP; + + bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + const bmqa::MessageConfirmationCookie* cookie_ptr = reinterpret_cast(cookie); + return builder_ptr->addMessageConfirmation(*cookie_ptr); +} + +int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj) { + using namespace BloombergLP; + + bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + builder_ptr->reset(); + + return 0; +} + +int z_bmqa_ConfirmEventBuilder__messageCount(const z_bmqa_ConfirmEventBuilder* builder_obj) { + using namespace BloombergLP; + + const bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + return builder_ptr->messageCount(); +} + +int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, z_bmqt_Blob const** blob_obj) { + using namespace BloombergLP; + + const bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + + const bdlbb::Blob* blob_ptr = &(builder_ptr->blob()); + *blob_obj = reinterpret_cast(blob_ptr); + + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index 1e286a379..5d872fb12 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -1,6 +1,31 @@ #ifndef INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER #define INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; +int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj); + +int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_Message* message); + +int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie(z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_MessageConfirmationCookie* cookie); + +int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj); + +int z_bmqa_ConfirmEventBuilder__messageCount(const z_bmqa_ConfirmEventBuilder* builder_obj); + +int z_bmqa_ConfirmEventBuilder__blob(const z_bmqa_ConfirmEventBuilder* builder_obj, z_bmqt_Blob const** blob_obj); + +#if defined(__cplusplus) +} +#endif + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_types.h b/src/groups/z_bmq/z_bmqt/z_bmqt_types.h index 9c4af5565..d6617b056 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_types.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_types.h @@ -9,6 +9,8 @@ extern "C" { typedef const char* z_bmqt_String; +typedef struct z_bmqt_Blob z_bmqt_Blob; + #if defined(__cplusplus) } #endif From 9459753a64a646b58f2d73555f5d2d9f0482c67e Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 1 Dec 2023 01:18:04 -0500 Subject: [PATCH 12/57] producer bare minimum --- .gitignore | 1 + src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp | 20 ++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 6 ++- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 57 ++++++++++++++++++++-- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 11 ++--- 5 files changed, 82 insertions(+), 13 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp diff --git a/.gitignore b/.gitignore index a05479a9f..05c69ceef 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ CMakeUserPresets.json /include/ /lib/ **/__pycache__/ +/thirdparty diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp new file mode 100644 index 000000000..fafb90230 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -0,0 +1,20 @@ +#include +#include + +int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj){ + using namespace BloombergLP; + + bmqa::Message* message_ptr = new bmqa::Message(); + + *message_obj = reinterpret_cast(message_ptr); + return 0; +} + +int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, size_t length){ + using namespace BloombergLP; + + bmqa::Message* message_ptr = reinterpret_cast(message_obj); + + message_ptr->setDataRef(data, length); + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index 3bb581612..9ff9745b9 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -1,9 +1,11 @@ #ifndef INCLUDED_Z_BMQA_MESSAGE #define INCLUDED_Z_BMQA_MESSAGE -typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; - typedef struct z_bmqa_Message z_bmqa_Message; +int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj); + +int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, size_t length); + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 488deac3e..be4690e9f 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -2,6 +2,7 @@ #include #include #include +#include int z_bmqa_Session__create(z_bmqa_Session** session_obj , const z_bmqt_SessionOptions* options) { @@ -83,12 +84,58 @@ int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_Me return 0; } -int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ - using namespace BloombergLP; +// int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ +// using namespace BloombergLP; +// bmqa::Session* session_ptr = reinterpret_cast(session_obj); +// bmqa::Q* buffer_ptr = reinterpret_cast(uri); + +// session_ptr->getQueueId(buffer_ptr); +// return 0; +// } + + +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ + using namespace BloombergLP; + bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::Q* buffer_ptr = reinterpret_cast(uri); + bmqt::Uri const * uri_ptr = reinterpret_cast< bmqt::Uri const *>(uri); + bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); - session_ptr->getQueueId(buffer_ptr); + //must populate out obj in future + session_ptr->openQueueSync(queueid_ptr, *uri_ptr, flags); return 0; -} \ No newline at end of file +} + +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout /*,z_bmqa_CloseQueueStatus**/){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); + + //must populate out obj in future + session_ptr->closeQueueSync(queueid_ptr); // not using timeout (we should definitely add this) + return 0; +} + +int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder); + + session_ptr->loadMessageEventBuilder(builder_ptr); + return 0; +} + +int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + const bmqa::MessageEvent* event_ptr = reinterpret_cast(event); + + session_ptr->post(*event_ptr); + return 0; +} + + diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index bf9f9ad9c..2f8e45f6c 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -23,6 +23,8 @@ typedef struct z_bmqa_Session z_bmqa_Session; typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; +typedef struct z_bmqa_OpenQueueStatus z_bmqa_OpenQueueStatus; + typedef void(*z_bmqa_SessionEventHandlerCb)(z_bmqa_SessionEvent* sessionEvent, void* data); typedef struct EventHandlerData { @@ -62,11 +64,8 @@ int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueI int z_bmqa_Session__getQueueIdWithCorrelationId(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_CorrelationId* correlationId); -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, - z_bmqa_QueueId* queueId, - const z_bmqt_Uri* uri, uint64_t flags, - const z_bmqt_QueueOptions* options, - int64_t timeout); +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); + // int z_bmqa_Session__openQueueAsync(z_bmqa_Session* session_obj, // z_bmqa_QueueId* queueId, @@ -84,7 +83,7 @@ int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, // const z_bmqt_QueueOptions* options, // int64_t timeout); -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout /*,z_bmqa_CloseQueueStatus**/); int z_bmqa_Session__closeQueueAsync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); From 63b54cf694f1089c5b6d5ed15f4153cc0947e243 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 1 Dec 2023 02:11:58 -0500 Subject: [PATCH 13/57] demo files + minor fixes --- src/groups/z_bmq/z_bmq_demo/demo.c | 83 +++++++++++++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 2 +- .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 4 +- .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 2 +- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 21 +++-- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 6 +- 6 files changed, 107 insertions(+), 11 deletions(-) create mode 100644 src/groups/z_bmq/z_bmq_demo/demo.c diff --git a/src/groups/z_bmq/z_bmq_demo/demo.c b/src/groups/z_bmq/z_bmq_demo/demo.c new file mode 100644 index 000000000..d75f39ee8 --- /dev/null +++ b/src/groups/z_bmq/z_bmq_demo/demo.c @@ -0,0 +1,83 @@ +#include +#include +#include +#include + +const int K_QUEUE_ID = 1; +const char K_QUEUE_URL[] = "bmq://bmq.test.mem.priority/test-queue"; +const int K_NUM_MESSAGES = 5; + + enum QueueFlags { + e_ADMIN = (1 << 0) // The queue is opened in admin mode (Valid only + // for BlazingMQ admin tasks) + , + e_READ = (1 << 1) // The queue is opened for consuming messages + , + e_WRITE = (1 << 2) // The queue is opened for posting messages + , + e_ACK = (1 << 3) // Set to indicate interested in receiving + // 'ACK' events for all message posted +}; + + +void postEvent(const char** text, + z_bmqa_QueueId* queueId, + z_bmqa_Session* session){ + + z_bmqa_MessageEventBuilder* builder; + z_bmqa_MessageEventBuilder__create(builder); + + z_bmqa_Session__loadMessageEventBuilder(session, builder); + + z_bmqa_Message* message; + z_bmqa_MessageEventBuilder__startMessage(builder, message); + + z_bmqa_Message_setDataRef(message, text, strlen(text)); + + z_bmqa_MessageEventBuilder__packMessage(builder, queueId); + + const z_bmqa_MessageEvent* messageEvent; + z_bmqa_MessageEventBuilder__messageEvent(builder, messageEvent); + + z_bmqa_Session__post(session, messageEvent); +} + + +void produce(z_bmqa_Session* session){ + z_bmqa_QueueId* queueId; + + z_bmqa_QueueId__createFromNumeric(queueId, K_QUEUE_ID); + z_bmqa_Session__openQueueSync(session, + queueId, + K_QUEUE_URL, + e_WRITE); + + const char*** messages = {"Hello world!", + "message 1", + "message 2", + "message 3", + "Good Bye!"}; + for(int idx = 0; idx < 5; ++idx){ + postEvent(messages[idx], queueId, session); + } + + z_bmqa_Session__closeQueueSync(session, queueId); +} + +int main(){ + z_bmqa_Session* session; + z_bmqt_SessionOptions* options; + + z_bmqt_SessionOptions__create(&options); + z_bmqa_Session__create(&session, &options); + + + //start the session + z_bmqa_Session__start(session, 1000); + + produce(session); + + //stop the session + z_bmqa_Session__stop(session); + +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index 9ff9745b9..ab2226c48 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -5,7 +5,7 @@ typedef struct z_bmqa_Message z_bmqa_Message; int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj); -int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, size_t length); +int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, int length); #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp index 7a8eea458..26a192f8e 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp @@ -13,11 +13,11 @@ int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) return 0; } -int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj) { +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message* out_obj) { using namespace BloombergLP; bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - builder_ptr->startMessage(); + out_obj = reinterpret_cast(&builder_ptr->startMessage()); // uhhhhh return 0; } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index 12c9d4273..f7e0809c6 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -15,7 +15,7 @@ typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj); -int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj); +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message* out_obj); int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index be4690e9f..9a5c660e1 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -95,19 +95,30 @@ int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_Me // } -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ +// int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ +// using namespace BloombergLP; + +// bmqa::Session* session_ptr = reinterpret_cast(session_obj); +// bmqt::Uri const * uri_ptr = reinterpret_cast< bmqt::Uri const *>(uri); +// bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); + +// //must populate out obj in future +// session_ptr->openQueueSync(queueid_ptr, *uri_ptr, flags); +// return 0; +// } + +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const char * uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ using namespace BloombergLP; bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqt::Uri const * uri_ptr = reinterpret_cast< bmqt::Uri const *>(uri); - bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); + bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); //must populate out obj in future - session_ptr->openQueueSync(queueid_ptr, *uri_ptr, flags); + session_ptr->openQueueSync(queueid_ptr, uri, flags); return 0; } -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout /*,z_bmqa_CloseQueueStatus**/){ +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId /*,z_bmqa_CloseQueueStatus**/){ using namespace BloombergLP; bmqa::Session* session_ptr = reinterpret_cast(session_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 2f8e45f6c..4985eb52b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -18,6 +18,7 @@ extern "C" { typedef struct z_bmqa_SessionEventHandler z_bmqa_SessionEventHandler; +typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; typedef struct z_bmqa_Session z_bmqa_Session; @@ -64,8 +65,9 @@ int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueI int z_bmqa_Session__getQueueIdWithCorrelationId(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_CorrelationId* correlationId); -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); +// int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const char * uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); // int z_bmqa_Session__openQueueAsync(z_bmqa_Session* session_obj, // z_bmqa_QueueId* queueId, @@ -83,7 +85,7 @@ int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, // const z_bmqt_QueueOptions* options, // int64_t timeout); -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout /*,z_bmqa_CloseQueueStatus**/); +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId /*,z_bmqa_CloseQueueStatus**/); int z_bmqa_Session__closeQueueAsync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); From 1849c31ff12885b5c1511e08992ef7c6c461829d Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 1 Dec 2023 02:22:45 -0500 Subject: [PATCH 14/57] More changes --- src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp | 2 + src/groups/z_bmq/z_bmqa/z_bmqa_event.h | 14 ++++ .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp | 65 +++++++++++++++++++ .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.h | 36 ++++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h | 15 +++++ 5 files changed, 132 insertions(+) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp new file mode 100644 index 000000000..77a1ada4f --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp @@ -0,0 +1,2 @@ +#include +#include \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_event.h b/src/groups/z_bmq/z_bmqa/z_bmqa_event.h index c8ec6f3ab..cc68d6129 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_event.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_event.h @@ -1,6 +1,20 @@ #ifndef INCLUDED_Z_BMQA_EVENT #define INCLUDED_Z_BMQA_EVENT +#include + +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_Event z_bmqa_Event; +int z_bmqa_Event__create(z_bmqa_Event** event_obj); + +int z_bmqa_Event__SessionEvent(z_bmqa_Event* event_obj); + +#if defined(__cplusplus) +} +#endif + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp new file mode 100644 index 000000000..f1ac29584 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp @@ -0,0 +1,65 @@ +#include +#include + +int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) { + using namespace BloombergLP; + + bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(); + + *status_obj = reinterpret_cast(status_ptr); + + return 0; +} + +int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_OpenQueueStatus* other) { + using namespace BloombergLP; + + const bmqa::OpenQueueStatus* other_ptr = reinterpret_cast(other); + bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(*other_ptr); + + *status_obj = reinterpret_cast(status_ptr); + + return 0; +} + +int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId); + const bsl::string errorDescription_str(errorDescription); + bmqt::OpenQueueResult::Enum result_enum = static_cast(result); + bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(*queueId_ptr, result_enum, errorDescription_str); + *status_obj = reinterpret_cast(status_ptr); + + return 0; +} + +bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj) { + using namespace BloombergLP; + const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); + return *status_ptr; +} + +int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj) { + using namespace BloombergLP; + const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); + const bmqa::QueueId* queueId_ptr = &(status_ptr->queueId()); + + *queueId_obj = reinterpret_cast(queueId_ptr); + return 0; +} + +int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj) { + using namespace BloombergLP; + const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); + return status_ptr->result(); +} + +const char* z_bmqa_OpenQueueStatus__errorDescription(const z_bmqa_OpenQueueStatus* status_obj) { + using namespace BloombergLP; + const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); + return status_ptr->errorDescription().c_str(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h new file mode 100644 index 000000000..6a75bbd84 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h @@ -0,0 +1,36 @@ +#ifndef INCLUDED_Z_BMQA_OPENQUEUESTATUS +#define INCLUDED_Z_BMQA_OPENQUEUESTATUS + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct z_bmqa_OpenQueueStatus z_bmqa_OpenQueueStatus; + +int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj); + +int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_OpenQueueStatus* other); + +int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription); + +bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj); + +int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj); + +int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj); + +const char* z_bmqa_OpenQueueStatus__errorDescription(const z_bmqa_OpenQueueStatus* status_obj); + + + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h new file mode 100644 index 000000000..cc3c74ef6 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h @@ -0,0 +1,15 @@ +#ifndef INCLUDED_Z_BMQA_SESSIONEVENT +#define INCLUDED_Z_BMQA_SESSIONEVENT + + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; + +#if defined(__cplusplus) +} +#endif + +#endif From 2ee34f7181c174433838249e0e3b78676af9a390 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 1 Dec 2023 03:40:20 -0500 Subject: [PATCH 15/57] Got C producer working, will clean later --- src/groups/z_bmq/z_bmqa/demo.h | 100 ++++++++++++++++++ src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 3 +- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 1 + src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp | 2 +- src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 10 +- .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 5 +- .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 2 +- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 28 ++--- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 4 + src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp | 27 +---- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 10 ++ .../z_bmq/z_bmqt/z_bmqt_sessionoptions.h | 2 + 12 files changed, 149 insertions(+), 45 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/demo.h diff --git a/src/groups/z_bmq/z_bmqa/demo.h b/src/groups/z_bmq/z_bmqa/demo.h new file mode 100644 index 000000000..703686a7c --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/demo.h @@ -0,0 +1,100 @@ +#include +#include +#include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +const int K_QUEUE_ID = 1; +const char K_QUEUE_URI[] = "bmq://bmq.test.mem.priority/test-queue"; +const int K_NUM_MESSAGES = 5; + + enum QueueFlags { + e_ADMIN = (1 << 0) // The queue is opened in admin mode (Valid only + // for BlazingMQ admin tasks) + , + e_READ = (1 << 1) // The queue is opened for consuming messages + , + e_WRITE = (1 << 2) // The queue is opened for posting messages + , + e_ACK = (1 << 3) // Set to indicate interested in receiving + // 'ACK' events for all message posted +}; + + +void postEvent(const char* text, + z_bmqa_QueueId* queueId, + z_bmqa_Session* session){ + + z_bmqa_MessageEventBuilder* builder; + z_bmqa_MessageEventBuilder__create(&builder); + + z_bmqa_Session__loadMessageEventBuilder(session, &builder); + + z_bmqa_Message* message; + + z_bmqa_MessageEventBuilder__startMessage(builder, &message); + + z_bmqa_Message__setDataRef(message, text, (int)strlen(text)); + + z_bmqa_MessageEventBuilder__packMessage(builder, queueId); + + const z_bmqa_MessageEvent* messageEvent; + z_bmqa_MessageEventBuilder__messageEvent(builder, &messageEvent); + + z_bmqa_Session__post(session, messageEvent); +} + + +void produce(z_bmqa_Session* session){ + z_bmqa_QueueId* queueId; + + z_bmqa_QueueId__createFromNumeric(&queueId, K_QUEUE_ID); + z_bmqa_Session__openQueueSync(session, + queueId, + K_QUEUE_URI, + e_WRITE); + + const char* messages[] = {"Hello world!", + "message 1", + "message 2", + "message 3", + "Good Bye!"}; + for(int idx = 0; idx < 5; ++idx){ + postEvent(messages[idx], queueId, session); + } + + z_bmqa_Session__closeQueueSync(session, queueId); +} + +int run_c_producer(){ + z_bmqa_Session* session; + z_bmqt_SessionOptions* options; + + z_bmqt_SessionOptions__create(&options); + z_bmqa_Session__create(&session, options); + + + //start the session + z_bmqa_Session__start(session, 1000); + + produce(session); + + //stop the session + z_bmqa_Session__stop(session); + + printf("Good2\n"); + + // z_bmqa_Session__delete(&session); + // z_bmqt_SessionOptions__delete(&options); + + return 0; + +} + +#if defined(__cplusplus) +} +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index da1eb6b88..bf62e7499 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -3,4 +3,5 @@ z_bmqa_session z_bmqa_event z_bmqa_confirmeventbuilder z_bmqa_messageeventbuilder -z_bmqa_messageproperties \ No newline at end of file +z_bmqa_messageproperties +z_bmqa_message \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index 5d872fb12..3e2fb9b34 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -9,6 +9,7 @@ extern "C" { #endif typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; +typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp index fafb90230..56ad5780b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -10,7 +10,7 @@ int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj){ return 0; } -int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, size_t length){ +int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length){ using namespace BloombergLP; bmqa::Message* message_ptr = reinterpret_cast(message_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index ab2226c48..ac3352e0b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -1,11 +1,19 @@ #ifndef INCLUDED_Z_BMQA_MESSAGE #define INCLUDED_Z_BMQA_MESSAGE +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_Message z_bmqa_Message; int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj); -int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, int length); +int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length); + +#if defined(__cplusplus) +} +#endif #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp index 26a192f8e..8d5d163df 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp @@ -13,11 +13,12 @@ int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) return 0; } -int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message* out_obj) { +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** out_obj) { using namespace BloombergLP; bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - out_obj = reinterpret_cast(&builder_ptr->startMessage()); // uhhhhh + bmqa::Message* message_ptr = &builder_ptr->startMessage(); + *out_obj = reinterpret_cast(message_ptr); return 0; } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index f7e0809c6..1d89a98e6 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -15,7 +15,7 @@ typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj); -int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message* out_obj); +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** out_obj); int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 9a5c660e1..1ad72cdcd 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -5,6 +5,16 @@ #include +int z_bmqa_Session__delete(z_bmqa_Session** session_obj) { + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + delete session_ptr; + *session_obj = NULL; + + return 0; +} + int z_bmqa_Session__create(z_bmqa_Session** session_obj , const z_bmqt_SessionOptions* options) { using namespace BloombergLP; @@ -46,19 +56,12 @@ int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ } -int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ - using namespace BloombergLP; - - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - session_ptr->finalizeStop(); - return 0; -} int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ using namespace BloombergLP; bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder); + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(*builder); session_ptr->loadMessageEventBuilder(builder_ptr); return 0; @@ -129,15 +132,6 @@ int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* return 0; } -int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ - using namespace BloombergLP; - - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder); - - session_ptr->loadMessageEventBuilder(builder_ptr); - return 0; -} int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event){ using namespace BloombergLP; diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 4985eb52b..1e029b000 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -41,6 +41,10 @@ typedef struct EventHandlerData { // } // } + // + +int z_bmqa_Session__delete(z_bmqa_Session** session_obj); + int z_bmqa_Session__create(z_bmqa_Session** session_obj, const z_bmqt_SessionOptions* options); int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, z_bmqa_SessionEventHandler* eventHandler, const z_bmqt_SessionOptions* options); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp index 8c2c755b3..d5e3c373b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp @@ -27,6 +27,8 @@ // TEST DRIVER #include +#include + // CONVENIENCE using namespace BloombergLP; using namespace bsl; @@ -37,26 +39,7 @@ using namespace bsl; static void test1_session() { - mwctst::TestHelper::printTestName("Create Session"); - - // Create default session - - z_bmqa_Session* session; - z_bmqt_SessionOptions* options; - z_bmqt_SessionOptions__create(&options); - z_bmqa_Session__create(&session, options); - - // Make sure 'k_BROKER_DEFAULT_PORT' and the default brokerUri are in sync - { - PV("CHECKING start() and stop()"); - - z_bmqa_Session__start(session, 1000); - - z_bmqa_Session__stop(session); - // ASSERT_EQ(sessionOptions_cpp.brokerUri(), result); - } - - // z_bmqa_Session__destroy(session); + run_c_producer(); } @@ -69,8 +52,8 @@ int main(int argc, char* argv[]) TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); switch (_testCase) { - case 0: - case 1: test1_session(); break; + case 0: test1_session(); break; + case 1: printf("Good\n"); break; default: { cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; s_testStatus = -1; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp index 7e4a751ee..28876700f 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -2,6 +2,16 @@ #include +int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj) { + using namespace BloombergLP; + + bmqt::SessionOptions* options_ptr = reinterpret_cast(options_obj); + delete options_ptr; + *options_obj = NULL; + + return 0; +} + int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj) { using namespace BloombergLP; bmqt::SessionOptions* options_ptr = new bmqt::SessionOptions(); diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h index 4e86e570e..269e5bba3 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h @@ -8,6 +8,8 @@ extern "C" { typedef struct z_bmqt_SessionOptions z_bmqt_SessionOptions; +int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj); + int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj); const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj); From e4e2c92c5a7836f4ab226473c21a3223b0b09883 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Wed, 6 Dec 2023 02:03:59 -0500 Subject: [PATCH 16/57] fixed mem leak and switched '_ptr' to '_p' to comply with bloomberg styling --- src/groups/z_bmq/z_bmqa/demo.h | 12 +- src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 9 +- .../z_bmqa/z_bmqa_confirmeventbuilder.cpp | 40 ++++--- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 2 + src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp | 28 ++++- src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 4 + .../z_bmq/z_bmqa/z_bmqa_messageevent.cpp | 22 ++++ src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h | 12 ++ .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 60 ++++++---- .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 4 + .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp | 34 +++--- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp | 70 +++++++----- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h | 4 + src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 74 ++++++------ .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 56 ++++----- .../z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 106 +++++++++--------- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 12 +- .../z_bmq/z_bmqt/z_bmqt_subscription.cpp | 86 +++++++------- src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp | 40 +++---- 19 files changed, 399 insertions(+), 276 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp diff --git a/src/groups/z_bmq/z_bmqa/demo.h b/src/groups/z_bmq/z_bmqa/demo.h index 703686a7c..19acc34aa 100644 --- a/src/groups/z_bmq/z_bmqa/demo.h +++ b/src/groups/z_bmq/z_bmqa/demo.h @@ -25,7 +25,7 @@ const int K_NUM_MESSAGES = 5; }; -void postEvent(const char* text, +void postEvent(const char* text, z_bmqa_QueueId* queueId, z_bmqa_Session* session){ @@ -46,6 +46,9 @@ void postEvent(const char* text, z_bmqa_MessageEventBuilder__messageEvent(builder, &messageEvent); z_bmqa_Session__post(session, messageEvent); + + z_bmqa_MessageEventBuilder__delete(&builder); + } @@ -68,6 +71,8 @@ void produce(z_bmqa_Session* session){ } z_bmqa_Session__closeQueueSync(session, queueId); + + z_bmqa_QueueId__delete(&queueId); } int run_c_producer(){ @@ -86,10 +91,9 @@ int run_c_producer(){ //stop the session z_bmqa_Session__stop(session); - printf("Good2\n"); - // z_bmqa_Session__delete(&session); - // z_bmqt_SessionOptions__delete(&options); + z_bmqa_Session__delete(&session); + z_bmqt_SessionOptions__delete(&options); return 0; diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index bf62e7499..d24a9918d 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -1,7 +1,8 @@ -z_bmqa_queueid -z_bmqa_session -z_bmqa_event z_bmqa_confirmeventbuilder +z_bmqa_event +z_bmqa_message +z_bmqa_messageevent z_bmqa_messageeventbuilder z_bmqa_messageproperties -z_bmqa_message \ No newline at end of file +z_bmqa_queueid +z_bmqa_session \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp index 45d493900..bfa36f7c1 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp @@ -2,11 +2,21 @@ #include +int z_bmqa_ConfirmEventBuilder__delete(z_bmqa_ConfirmEventBuilder const** builder_obj) { + using namespace BloombergLP; + + const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(*builder_obj); + delete builder_p; + *builder_obj = NULL; + + return 0; +} + int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj) { using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_ptr = new bmqa::ConfirmEventBuilder(); - *builder_obj = reinterpret_cast(builder_ptr); + bmqa::ConfirmEventBuilder* builder_p = new bmqa::ConfirmEventBuilder(); + *builder_obj = reinterpret_cast(builder_p); return 0; } @@ -15,25 +25,25 @@ int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilde const z_bmqa_Message* message) { using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - const bmqa::Message* message_ptr = reinterpret_cast(message); - return builder_ptr->addMessageConfirmation(*message_ptr); + bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::Message* message_p = reinterpret_cast(message); + return builder_p->addMessageConfirmation(*message_p); } int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie(z_bmqa_ConfirmEventBuilder* builder_obj, const z_bmqa_MessageConfirmationCookie* cookie) { using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - const bmqa::MessageConfirmationCookie* cookie_ptr = reinterpret_cast(cookie); - return builder_ptr->addMessageConfirmation(*cookie_ptr); + bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::MessageConfirmationCookie* cookie_p = reinterpret_cast(cookie); + return builder_p->addMessageConfirmation(*cookie_p); } int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj) { using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - builder_ptr->reset(); + bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + builder_p->reset(); return 0; } @@ -41,17 +51,17 @@ int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj) { int z_bmqa_ConfirmEventBuilder__messageCount(const z_bmqa_ConfirmEventBuilder* builder_obj) { using namespace BloombergLP; - const bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - return builder_ptr->messageCount(); + const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + return builder_p->messageCount(); } int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, z_bmqt_Blob const** blob_obj) { using namespace BloombergLP; - const bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); - const bdlbb::Blob* blob_ptr = &(builder_ptr->blob()); - *blob_obj = reinterpret_cast(blob_ptr); + const bdlbb::Blob* blob_p = &(builder_p->blob()); + *blob_obj = reinterpret_cast(blob_p); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index 3e2fb9b34..9b91bfffc 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -11,6 +11,8 @@ extern "C" { typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; +int z_bmqa_ConfirmEventBuilder__delete(z_bmqa_ConfirmEventBuilder** builder_obj); + int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj); int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilder* builder_obj, diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp index 56ad5780b..7a0c54d55 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -1,20 +1,40 @@ #include #include +int z_bmqa_Message__delete(z_bmqa_Message** message_obj) { + using namespace BloombergLP; + + bmqa::Message* message_p = reinterpret_cast(*message_obj); + delete message_p; + *message_obj = NULL; + + return 0; +} + +int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj) { + using namespace BloombergLP; + + const bmqa::Message* message_p = reinterpret_cast(*message_obj); + delete message_p; + *message_obj = NULL; + + return 0; +} + int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj){ using namespace BloombergLP; - bmqa::Message* message_ptr = new bmqa::Message(); + bmqa::Message* message_p = new bmqa::Message(); - *message_obj = reinterpret_cast(message_ptr); + *message_obj = reinterpret_cast(message_p); return 0; } int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length){ using namespace BloombergLP; - bmqa::Message* message_ptr = reinterpret_cast(message_obj); + bmqa::Message* message_p = reinterpret_cast(message_obj); - message_ptr->setDataRef(data, length); + message_p->setDataRef(data, length); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index ac3352e0b..f8bfa6c9f 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -7,6 +7,10 @@ extern "C" { typedef struct z_bmqa_Message z_bmqa_Message; +int z_bmqa_Message__delete(z_bmqa_Message** message_obj); + +int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj); + int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj); int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp new file mode 100644 index 000000000..2b8b1d2cd --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp @@ -0,0 +1,22 @@ +#include +#include + +int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj) { + using namespace BloombergLP; + + bmqa::MessageEvent* event_p = reinterpret_cast(*event_obj); + delete event_p; + *event_obj = NULL; + + return 0; +} + +int z_bmqa_MessageEvent__deleteConst(z_bmqa_MessageEvent const** event_obj) { + using namespace BloombergLP; + + const bmqa::MessageEvent* event_p = reinterpret_cast(*event_obj); + delete event_p; + *event_obj = NULL; + + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h index 04bcdaf66..fc8ddd9a4 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h @@ -1,6 +1,18 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEEVENT #define INCLUDED_Z_BMQA_MESSAGEEVENT +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_MessageEvent z_bmqa_MessageEvent; +int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj); + +int z_bmqa_MessageEvent__deleteConst(z_bmqa_MessageEvent const** event_obj); + +#if defined(__cplusplus) +} +#endif + #endif diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp index 8d5d163df..dcaf3a05a 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp @@ -4,11 +4,31 @@ +int z_bmqa_MessageEventBuilder__delete(z_bmqa_MessageEventBuilder** builder_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(*builder_obj); + delete builder_p; + *builder_obj = NULL; + + return 0; +} + +int z_bmqa_MessageEventBuilder__deleteConst(z_bmqa_MessageEventBuilder const** builder_obj) { + using namespace BloombergLP; + + const bmqa::MessageEventBuilder* builder_p = reinterpret_cast(*builder_obj); + delete builder_p; + *builder_obj = NULL; + + return 0; +} + int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = new bmqa::MessageEventBuilder(); - *builder_obj = reinterpret_cast(builder_ptr); + bmqa::MessageEventBuilder* builder_p = new bmqa::MessageEventBuilder(); + *builder_obj = reinterpret_cast(builder_p); return 0; } @@ -16,9 +36,9 @@ int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** out_obj) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - bmqa::Message* message_ptr = &builder_ptr->startMessage(); - *out_obj = reinterpret_cast(message_ptr); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + bmqa::Message* message_p = &builder_p->startMessage(); + *out_obj = reinterpret_cast(message_p); return 0; } @@ -26,16 +46,16 @@ int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId); - return builder_ptr->packMessage(*queueId_ptr); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId); + return builder_p->packMessage(*queueId_p); } int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - builder_ptr->reset(); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + builder_p->reset(); return 0; } @@ -43,9 +63,9 @@ int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj) { int z_bmqa_MessageEventBuilder__messageEvent(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_MessageEvent const** event_obj) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - const bmqa::MessageEvent* event_ptr = &(builder_ptr->messageEvent()); - *event_obj = reinterpret_cast(event_ptr); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::MessageEvent* event_p = &(builder_p->messageEvent()); + *event_obj = reinterpret_cast(event_p); return 0; } @@ -53,9 +73,9 @@ int z_bmqa_MessageEventBuilder__messageEvent(z_bmqa_MessageEventBuilder* builder int z_bmqa_MessageEventBuilder__currentMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** message_obj) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - bmqa::Message* message_ptr = &(builder_ptr->currentMessage()); - *message_obj = reinterpret_cast(message_ptr); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + bmqa::Message* message_p = &(builder_p->currentMessage()); + *message_obj = reinterpret_cast(message_p); return 0; } @@ -63,13 +83,13 @@ int z_bmqa_MessageEventBuilder__currentMessage(z_bmqa_MessageEventBuilder* build int z_bmqa_MessageEventBuilder__messageCount(const z_bmqa_MessageEventBuilder* builder_obj) { using namespace BloombergLP; - const bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - return builder_ptr->messageCount(); + const bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + return builder_p->messageCount(); } int z_bmqa_MessageEventBuilder__messageEventSize(const z_bmqa_MessageEventBuilder* builder_obj) { using namespace BloombergLP; - const bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - return builder_ptr->messageEventSize(); + const bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + return builder_p->messageEventSize(); } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index 1d89a98e6..8784bec32 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -13,6 +13,10 @@ extern "C" { typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; +int z_bmqa_MessageEventBuilder__delete(z_bmqa_MessageEventBuilder** builder_obj); + +int z_bmqa_MessageEventBuilder__deleteConst(z_bmqa_MessageEventBuilder const** builder_obj); + int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj); int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** out_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp index f1ac29584..6577aa84d 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp @@ -4,9 +4,9 @@ int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) { using namespace BloombergLP; - bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(); + bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(); - *status_obj = reinterpret_cast(status_ptr); + *status_obj = reinterpret_cast(status_p); return 0; } @@ -14,10 +14,10 @@ int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) { int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_OpenQueueStatus* other) { using namespace BloombergLP; - const bmqa::OpenQueueStatus* other_ptr = reinterpret_cast(other); - bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(*other_ptr); + const bmqa::OpenQueueStatus* other_p = reinterpret_cast(other); + bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(*other_p); - *status_obj = reinterpret_cast(status_ptr); + *status_obj = reinterpret_cast(status_p); return 0; } @@ -28,38 +28,38 @@ int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, const char* errorDescription) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId); const bsl::string errorDescription_str(errorDescription); bmqt::OpenQueueResult::Enum result_enum = static_cast(result); - bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(*queueId_ptr, result_enum, errorDescription_str); - *status_obj = reinterpret_cast(status_ptr); + bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(*queueId_p, result_enum, errorDescription_str); + *status_obj = reinterpret_cast(status_p); return 0; } bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj) { using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); - return *status_ptr; + const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + return *status_p; } int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj) { using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); - const bmqa::QueueId* queueId_ptr = &(status_ptr->queueId()); + const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + const bmqa::QueueId* queueId_p = &(status_p->queueId()); - *queueId_obj = reinterpret_cast(queueId_ptr); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj) { using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); - return status_ptr->result(); + const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + return status_p->result(); } const char* z_bmqa_OpenQueueStatus__errorDescription(const z_bmqa_OpenQueueStatus* status_obj) { using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); - return status_ptr->errorDescription().c_str(); + const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + return status_p->errorDescription().c_str(); } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp index c83b9d1fd..caaaa3f48 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp @@ -2,12 +2,32 @@ #include #include +int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj) { + using namespace BloombergLP; + + bmqa::QueueId* queueId_p = reinterpret_cast(*queueId_obj); + delete queueId_p; + *queueId_obj = NULL; + + return 0; +} + +int z_bmqa_QueueId__deleteConst(z_bmqa_QueueId const** queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_p = reinterpret_cast(*queueId_obj); + delete queueId_p; + *queueId_obj = NULL; + + return 0; +} + int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) { using namespace BloombergLP; - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(); + bmqa::QueueId* queueId_p = new bmqa::QueueId(); - *queueId_obj = reinterpret_cast(queueId_ptr); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } @@ -15,20 +35,20 @@ int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) { int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other) { using namespace BloombergLP; - const bmqa::QueueId* other_ptr = reinterpret_cast(other); + const bmqa::QueueId* other_p = reinterpret_cast(other); - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*other_ptr); - *queueId_obj = reinterpret_cast(queueId_ptr); + bmqa::QueueId* queueId_p = new bmqa::QueueId(*other_p); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } int z_bmqa_QueueId__createFromCorrelationId(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId); - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*correlationId_ptr); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId); + bmqa::QueueId* queueId_p = new bmqa::QueueId(*correlationId_p); - *queueId_obj = reinterpret_cast(queueId_ptr); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } @@ -36,8 +56,8 @@ int z_bmqa_QueueId__createFromCorrelationId(z_bmqa_QueueId** queueId_obj, const int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, int64_t numeric) { using namespace BloombergLP; - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(numeric); - *queueId_obj = reinterpret_cast(queueId_ptr); + bmqa::QueueId* queueId_p = new bmqa::QueueId(numeric); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } @@ -45,8 +65,8 @@ int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, int64_t nume int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, void* pointer) { using namespace BloombergLP; - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(pointer); - *queueId_obj = reinterpret_cast(queueId_ptr); + bmqa::QueueId* queueId_p = new bmqa::QueueId(pointer); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } @@ -54,42 +74,42 @@ int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, void* pointe const z_bmqt_CorrelationId* z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); - const bmqt::CorrelationId* correlationId_ptr = &(queueId_ptr->correlationId()); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + const bmqt::CorrelationId* correlationId_p = &(queueId_p->correlationId()); - return reinterpret_cast(correlationId_ptr); + return reinterpret_cast(correlationId_p); } uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); - return queueId_ptr->flags(); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + return queueId_p->flags(); } const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId_obj) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); - const bmqt::Uri* uri_ptr = &(queueId_ptr->uri()); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + const bmqt::Uri* uri_p = &(queueId_p->uri()); - return reinterpret_cast(uri_ptr); + return reinterpret_cast(uri_p); } const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId_obj) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); - const bmqt::QueueOptions* options_ptr = &(queueId_ptr->options()); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + const bmqt::QueueOptions* options_p = &(queueId_p->options()); - return reinterpret_cast(options_ptr); + return reinterpret_cast(options_p); } int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId_obj) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); - return queueId_ptr->isValid(); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + return queueId_p->isValid(); } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h index d7fad30f7..86b91ea49 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h @@ -12,6 +12,10 @@ extern "C" { typedef struct z_bmqa_QueueId z_bmqa_QueueId; +int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj); + +int z_bmqa_QueueId__deleteConst(z_bmqa_QueueId const** queueId_obj); + int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj); int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 1ad72cdcd..afa0a5622 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -8,8 +8,8 @@ int z_bmqa_Session__delete(z_bmqa_Session** session_obj) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - delete session_ptr; + bmqa::Session* session_p = reinterpret_cast(*session_obj); + delete session_p; *session_obj = NULL; return 0; @@ -18,30 +18,30 @@ int z_bmqa_Session__delete(z_bmqa_Session** session_obj) { int z_bmqa_Session__create(z_bmqa_Session** session_obj , const z_bmqt_SessionOptions* options) { using namespace BloombergLP; - const bmqt::SessionOptions* options_ptr = reinterpret_cast(options); - bmqa::Session* session_ptr = new bmqa::Session(*options_ptr); - *session_obj = reinterpret_cast(session_ptr); + const bmqt::SessionOptions* options_p = reinterpret_cast(options); + bmqa::Session* session_p = new bmqa::Session(*options_p); + *session_obj = reinterpret_cast(session_p); return 0; } int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session_obj); if(timeoutMs != 0) { bsls::TimeInterval timeout; timeout.addMilliseconds(timeoutMs); - return session_ptr->start(timeout); + return session_p->start(timeout); } else { - return session_ptr->start(); + return session_p->start(); } } int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - session_ptr->stop(); + bmqa::Session* session_p = reinterpret_cast(session_obj); + session_p->stop(); return 0; } @@ -50,8 +50,8 @@ int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - session_ptr->finalizeStop(); + bmqa::Session* session_p = reinterpret_cast(session_obj); + session_p->finalizeStop(); return 0; } @@ -60,40 +60,40 @@ int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(*builder); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(*builder); - session_ptr->loadMessageEventBuilder(builder_ptr); + session_p->loadMessageEventBuilder(builder_p); return 0; } int z_bmqa_Session__loadConfirmEventBuilder(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder** builder){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder); - session_ptr->loadConfirmEventBuilder(builder_ptr); + session_p->loadConfirmEventBuilder(builder_p); return 0; } int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::MessageProperties* buffer_ptr = reinterpret_cast(buffer); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::MessageProperties* buffer_p = reinterpret_cast(buffer); - session_ptr->loadMessageProperties(buffer_ptr); + session_p->loadMessageProperties(buffer_p); return 0; } // int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ // using namespace BloombergLP; -// bmqa::Session* session_ptr = reinterpret_cast(session_obj); -// bmqa::Q* buffer_ptr = reinterpret_cast(uri); +// bmqa::Session* session_p = reinterpret_cast(session_obj); +// bmqa::Q* buffer_p = reinterpret_cast(uri); -// session_ptr->getQueueId(buffer_ptr); +// session_p->getQueueId(buffer_p); // return 0; // } @@ -101,34 +101,34 @@ int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_Me // int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ // using namespace BloombergLP; -// bmqa::Session* session_ptr = reinterpret_cast(session_obj); -// bmqt::Uri const * uri_ptr = reinterpret_cast< bmqt::Uri const *>(uri); -// bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); +// bmqa::Session* session_p = reinterpret_cast(session_obj); +// bmqt::Uri const * uri_p = reinterpret_cast< bmqt::Uri const *>(uri); +// bmqa::QueueId* queueid_p = reinterpret_cast(queueId); // //must populate out obj in future -// session_ptr->openQueueSync(queueid_ptr, *uri_ptr, flags); +// session_p->openQueueSync(queueid_p, *uri_p, flags); // return 0; // } int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const char * uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::QueueId* queueid_p = reinterpret_cast(queueId); //must populate out obj in future - session_ptr->openQueueSync(queueid_ptr, uri, flags); + session_p->openQueueSync(queueid_p, uri, flags); return 0; } int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId /*,z_bmqa_CloseQueueStatus**/){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::QueueId* queueid_p = reinterpret_cast(queueId); //must populate out obj in future - session_ptr->closeQueueSync(queueid_ptr); // not using timeout (we should definitely add this) + session_p->closeQueueSync(queueid_p); // not using timeout (we should definitely add this) return 0; } @@ -136,10 +136,10 @@ int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - const bmqa::MessageEvent* event_ptr = reinterpret_cast(event); + bmqa::Session* session_p = reinterpret_cast(session_obj); + const bmqa::MessageEvent* event_p = reinterpret_cast(event); - session_ptr->post(*event_ptr); + session_p->post(*event_p); return 0; } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp index 958eb6020..9fe52738d 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -3,107 +3,107 @@ int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(); - *correlationId_obj = reinterpret_cast(correlationId_ptr); + *correlationId_obj = reinterpret_cast(correlationId_p); return 0; } int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(numeric); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(numeric); - *correlationId_obj = reinterpret_cast(correlationId_ptr); + *correlationId_obj = reinterpret_cast(correlationId_p); return 0; } int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, void* pointer) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(pointer); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(pointer); - *correlationId_obj = reinterpret_cast(correlationId_ptr); + *correlationId_obj = reinterpret_cast(correlationId_p); return 0; } int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - correlationId_ptr->makeUnset(); + correlationId_p->makeUnset(); return 0; } int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlationId_obj, int64_t numeric) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - correlationId_ptr->setNumeric(numeric); + correlationId_p->setNumeric(numeric); return 0; } int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlationId_obj, void* pointer) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - correlationId_ptr->setPointer(pointer); + correlationId_p->setPointer(pointer); return 0; } int z_bmqt_CorrelationId__isUnset(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->isUnset(); + return correlationId_p->isUnset(); } int z_bmqt_CorrelationId__isNumeric(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->isNumeric(); + return correlationId_p->isNumeric(); } int z_bmqt_CorrelationId__isPointer(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->isPointer(); + return correlationId_p->isPointer(); } int z_bmqt_CorrelationId__isSharedPtr(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->isSharedPtr(); + return correlationId_p->isSharedPtr(); } int z_bmqt_CorrelationId__isAutoValue(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->isAutoValue(); + return correlationId_p->isAutoValue(); } int64_t z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->theNumeric(); + return correlationId_p->theNumeric(); } void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->thePointer(); + return correlationId_p->thePointer(); } CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - switch(correlationId_ptr->type()) { + switch(correlationId_p->type()) { case bmqt::CorrelationId::Type::e_NUMERIC: return CorrelationId_Type::e_NUMERIC; case bmqt::CorrelationId::Type::e_POINTER: return CorrelationId_Type::e_POINTER; case bmqt::CorrelationId::Type::e_SHARED_PTR: return CorrelationId_Type::e_SHARED_PTR; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp index 42a81a021..d03311cd6 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -6,19 +6,19 @@ int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = new bmqt::QueueOptions; + bmqt::QueueOptions* queueOptions_p = new bmqt::QueueOptions; - *queueOptions_obj = reinterpret_cast(queueOptions_ptr); + *queueOptions_obj = reinterpret_cast(queueOptions_p); return 0; } int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other) { using namespace BloombergLP; - const bmqt::QueueOptions* other_ptr = reinterpret_cast(other); - bmqt::QueueOptions* queueOptions_ptr = new bmqt::QueueOptions(*other_ptr); + const bmqt::QueueOptions* other_p = reinterpret_cast(other); + bmqt::QueueOptions* queueOptions_p = new bmqt::QueueOptions(*other_p); - *queueOptions_obj = reinterpret_cast(queueOptions_ptr); + *queueOptions_obj = reinterpret_cast(queueOptions_p); return 0; } @@ -28,56 +28,56 @@ int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, cons int z_bmqt_QueueOptions__setMaxUnconfirmedMessages(z_bmqt_QueueOptions* queueOptions_obj, int value) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->setMaxUnconfirmedMessages(value); + queueOptions_p->setMaxUnconfirmedMessages(value); return 0; } int z_bmqt_QueueOptions__setMaxUnconfirmedBytes(z_bmqt_QueueOptions* queueOptions_obj, int value) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->setMaxUnconfirmedBytes(value); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + queueOptions_p->setMaxUnconfirmedBytes(value); return 0; } int z_bmqt_QueueOptions__setConsumerPriority(z_bmqt_QueueOptions* queueOptions_obj, int value) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->setConsumerPriority(value); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + queueOptions_p->setConsumerPriority(value); return 0; } int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOptions_obj, int value) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->setSuspendsOnBadHostHealth(value); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + queueOptions_p->setSuspendsOnBadHostHealth(value); return 0; } int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - const bmqt::QueueOptions* other_ptr = reinterpret_cast(other); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* other_p = reinterpret_cast(other); - queueOptions_ptr->merge(*other_ptr); + queueOptions_p->merge(*other_p); return 0; } int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj, char** errorDescription, const z_bmqt_SubscriptionHandle* handle, const z_bmqt_Subscription* subscription){ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_p = reinterpret_cast(handle); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription); bsl::string error; - queueOptions_ptr->addOrUpdateSubscription(&error, *handle_ptr, *subscription_ptr); + queueOptions_p->addOrUpdateSubscription(&error, *handle_p, *subscription_p); if(error.empty()) { *errorDescription = NULL; @@ -93,9 +93,9 @@ int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptio int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_SubscriptionHandle* handle){ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); - queueOptions_ptr->removeSubscription(*handle_ptr); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_p = reinterpret_cast(handle); + queueOptions_p->removeSubscription(*handle_p); return 0; } @@ -103,8 +103,8 @@ int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_ob int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->removeAllSubscriptions(); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + queueOptions_p->removeAllSubscriptions(); return 0; } @@ -112,58 +112,58 @@ int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOption int z_bmqt_QueueOptions__maxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->maxUnconfirmedMessages(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->maxUnconfirmedMessages(); } int z_bmqt_QueueOptions__maxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->maxUnconfirmedBytes(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->maxUnconfirmedBytes(); } int z_bmqt_QueueOptions__consumerPriority(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->consumerPriority(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->consumerPriority(); } bool z_bmqt_QueueOptions__suspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->suspendsOnBadHostHealth(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->suspendsOnBadHostHealth(); } bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->hasMaxUnconfirmedMessages(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->hasMaxUnconfirmedMessages(); } bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->hasMaxUnconfirmedBytes(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->hasMaxUnconfirmedBytes(); } bool z_bmqt_QueueOptions__hasConsumerPriority(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->hasConsumerPriority(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->hasConsumerPriority(); } bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->hasSuspendsOnBadHostHealth(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->hasSuspendsOnBadHostHealth(); } @@ -171,16 +171,16 @@ bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* bool z_bmqt_QueueOptions__loadSubscription(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_Subscription** subscription, const z_bmqt_SubscriptionHandle* handle) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); - bmqt::Subscription* subscription_ptr = new bmqt::Subscription(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_p = reinterpret_cast(handle); + bmqt::Subscription* subscription_p = new bmqt::Subscription(); - bool success = queueOptions_ptr->loadSubscription(subscription_ptr, *handle_ptr); + bool success = queueOptions_p->loadSubscription(subscription_p, *handle_p); if(success) { - *subscription = reinterpret_cast(subscription_ptr); + *subscription = reinterpret_cast(subscription_p); } else { - delete subscription_ptr; + delete subscription_p; *subscription = NULL; } @@ -191,18 +191,18 @@ int z_bmqt_QueueOptions__loadSubscriptions(const z_bmqt_QueueOptions* queueOptio using namespace BloombergLP; bmqt::QueueOptions::SubscriptionsSnapshot vector; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->loadSubscriptions(&vector); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + queueOptions_p->loadSubscriptions(&vector); snapshot->size = vector.size(); snapshot->subscriptions = static_cast(calloc(vector.size(), sizeof(z_bmqt_HandleAndSubscrption))); for(size_t i = 0; i < vector.size(); ++i) { - bmqt::SubscriptionHandle* handle_ptr = new bmqt::SubscriptionHandle(vector[i].first); - bmqt::Subscription* subscription_ptr = new bmqt::Subscription(vector[i].second); + bmqt::SubscriptionHandle* handle_p = new bmqt::SubscriptionHandle(vector[i].first); + bmqt::Subscription* subscription_p = new bmqt::Subscription(vector[i].second); - snapshot->subscriptions[i].handle = reinterpret_cast(handle_ptr); - snapshot->subscriptions[i].subscrption = reinterpret_cast(subscription_ptr); + snapshot->subscriptions[i].handle = reinterpret_cast(handle_p); + snapshot->subscriptions[i].subscrption = reinterpret_cast(subscription_p); } return 0; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp index 28876700f..14a503993 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -5,8 +5,8 @@ int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj) { using namespace BloombergLP; - bmqt::SessionOptions* options_ptr = reinterpret_cast(options_obj); - delete options_ptr; + bmqt::SessionOptions* options_p = reinterpret_cast(*options_obj); + delete options_p; *options_obj = NULL; return 0; @@ -14,15 +14,15 @@ int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj) { int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj) { using namespace BloombergLP; - bmqt::SessionOptions* options_ptr = new bmqt::SessionOptions(); - *options_obj = reinterpret_cast(options_ptr); + bmqt::SessionOptions* options_p = new bmqt::SessionOptions(); + *options_obj = reinterpret_cast(options_p); return 0; } const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj) { using namespace BloombergLP; - const bmqt::SessionOptions* options_ptr = reinterpret_cast(options_obj); + const bmqt::SessionOptions* options_p = reinterpret_cast(options_obj); - return options_ptr->brokerUri().c_str(); + return options_p->brokerUri().c_str(); } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp index 1429333e3..69c7e97dd 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp @@ -7,8 +7,8 @@ int z_bmqt_SubscriptionHandle__create(z_bmqt_SubscriptionHandle** subscriptionHa using namespace BloombergLP; const bmqt::CorrelationId* correlationId = reinterpret_cast(cid); - bmqt::SubscriptionHandle* subscriptionHandle_ptr = new bmqt::SubscriptionHandle(*correlationId); - *subscriptionHandle_obj = reinterpret_cast(subscriptionHandle_ptr); + bmqt::SubscriptionHandle* subscriptionHandle_p = new bmqt::SubscriptionHandle(*correlationId); + *subscriptionHandle_obj = reinterpret_cast(subscriptionHandle_p); return 0; } @@ -16,8 +16,8 @@ int z_bmqt_SubscriptionHandle__create(z_bmqt_SubscriptionHandle** subscriptionHa unsigned int z_bmqt_SubscriptionHandle__id(const z_bmqt_SubscriptionHandle* subscriptionHandle_obj){ using namespace BloombergLP; - const bmqt::SubscriptionHandle* subscriptionHandle_ptr = reinterpret_cast(subscriptionHandle_obj); - return subscriptionHandle_ptr->id(); + const bmqt::SubscriptionHandle* subscriptionHandle_p = reinterpret_cast(subscriptionHandle_obj); + return subscriptionHandle_p->id(); } /////// @@ -25,8 +25,8 @@ unsigned int z_bmqt_SubscriptionHandle__id(const z_bmqt_SubscriptionHandle* subs int z_bmqt_SubscriptionExpression__create(z_bmqt_SubscriptionExpression** subscriptionExpression_obj){ using namespace BloombergLP; - bmqt::SubscriptionExpression* subscriptionExpression_ptr = new bmqt::SubscriptionExpression(); - *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_ptr); + bmqt::SubscriptionExpression* subscriptionExpression_p = new bmqt::SubscriptionExpression(); + *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_p); return 0; } @@ -41,9 +41,9 @@ int z_bmqt_SubscriptionExpression__createFromString(z_bmqt_SubscriptionExpressio default: return 1; } - bmqt::SubscriptionExpression* subscriptionExpression_ptr = new bmqt::SubscriptionExpression(bsl::string(expression), v); + bmqt::SubscriptionExpression* subscriptionExpression_p = new bmqt::SubscriptionExpression(bsl::string(expression), v); - *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_ptr); + *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_p); return 0; } @@ -51,15 +51,15 @@ int z_bmqt_SubscriptionExpression__createFromString(z_bmqt_SubscriptionExpressio const char* z_bmqt_SubscriptionExpression__text(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ using namespace BloombergLP; - const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); - return subscriptionExpression_ptr->text().c_str(); + const bmqt::SubscriptionExpression* subscriptionExpression_p = reinterpret_cast(subscriptionExpression_obj); + return subscriptionExpression_p->text().c_str(); } SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ using namespace BloombergLP; - const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); - switch(subscriptionExpression_ptr->version()) { + const bmqt::SubscriptionExpression* subscriptionExpression_p = reinterpret_cast(subscriptionExpression_obj); + switch(subscriptionExpression_p->version()) { case bmqt::SubscriptionExpression::e_NONE: return SubscriptionExpressionEnum::e_NONE; case bmqt::SubscriptionExpression::e_VERSION_1: return SubscriptionExpressionEnum::e_VERSION_1; default: break; @@ -71,8 +71,8 @@ SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version(const z_bmqt_S bool z_bmqt_SubscriptionExpression__isValid(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ using namespace BloombergLP; - const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); - return subscriptionExpression_ptr->isValid(); + const bmqt::SubscriptionExpression* subscriptionExpression_p = reinterpret_cast(subscriptionExpression_obj); + return subscriptionExpression_p->isValid(); } /////// @@ -80,8 +80,8 @@ bool z_bmqt_SubscriptionExpression__isValid(const z_bmqt_SubscriptionExpression* int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj){ using namespace BloombergLP; - bmqt::Subscription* subscription_ptr = new bmqt::Subscription(); - *subscription_obj = reinterpret_cast(subscription_ptr); + bmqt::Subscription* subscription_p = new bmqt::Subscription(); + *subscription_obj = reinterpret_cast(subscription_p); return 0; } @@ -89,9 +89,9 @@ int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj){ int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, const z_bmqt_Subscription* other){ using namespace BloombergLP; - const bmqt::Subscription* other_ptr = reinterpret_cast(other); - bmqt::Subscription* subscription_ptr = new bmqt::Subscription(*other_ptr); - *subscription_obj = reinterpret_cast(subscription_ptr); + const bmqt::Subscription* other_p = reinterpret_cast(other); + bmqt::Subscription* subscription_p = new bmqt::Subscription(*other_p); + *subscription_obj = reinterpret_cast(subscription_p); return 0; } @@ -99,8 +99,8 @@ int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, cons int z_bmqt_Subscription__setMaxUnconfirmedMessages(z_bmqt_Subscription* subscription_obj, int value){ using namespace BloombergLP; - bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - subscription_ptr->setMaxUnconfirmedMessages(value); + bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + subscription_p->setMaxUnconfirmedMessages(value); return 0; } @@ -108,8 +108,8 @@ int z_bmqt_Subscription__setMaxUnconfirmedMessages(z_bmqt_Subscription* subscrip int z_bmqt_Subscription__setMaxUnconfirmedBytes(z_bmqt_Subscription* subscription_obj, int value){ using namespace BloombergLP; - bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - subscription_ptr->setMaxUnconfirmedBytes(value); + bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + subscription_p->setMaxUnconfirmedBytes(value); return 0; } @@ -117,8 +117,8 @@ int z_bmqt_Subscription__setMaxUnconfirmedBytes(z_bmqt_Subscription* subscriptio int z_bmqt_Subscription__setConsumerPriority(z_bmqt_Subscription* subscription_obj, int value){ using namespace BloombergLP; - bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - subscription_ptr->setConsumerPriority(value); + bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + subscription_p->setConsumerPriority(value); return 0; } @@ -126,9 +126,9 @@ int z_bmqt_Subscription__setConsumerPriority(z_bmqt_Subscription* subscription_o int z_bmqt_Subscription__setExpression(z_bmqt_Subscription* subscription_obj, const z_bmqt_SubscriptionExpression* value){ using namespace BloombergLP; - bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - const bmqt::SubscriptionExpression* expression_ptr = reinterpret_cast(value); - subscription_ptr->setExpression(*expression_ptr); + bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + const bmqt::SubscriptionExpression* expression_p = reinterpret_cast(value); + subscription_p->setExpression(*expression_p); return 0; } @@ -136,50 +136,50 @@ int z_bmqt_Subscription__setExpression(z_bmqt_Subscription* subscription_obj, co int z_bmqt_Subscription__maxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->maxUnconfirmedMessages(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->maxUnconfirmedMessages(); } int z_bmqt_Subscription__maxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->maxUnconfirmedBytes(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->maxUnconfirmedBytes(); } int z_bmqt_Subscription__consumerPriority(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->consumerPriority(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->consumerPriority(); } const z_bmqt_SubscriptionExpression* z_bmqt_Subscription__expression(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - const bmqt::SubscriptionExpression* expression_ptr = &(subscription_ptr->expression()); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + const bmqt::SubscriptionExpression* expression_p = &(subscription_p->expression()); - return reinterpret_cast(expression_ptr); + return reinterpret_cast(expression_p); } bool z_bmqt_Subscription__hasMaxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->hasMaxUnconfirmedMessages(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->hasMaxUnconfirmedMessages(); } bool z_bmqt_Subscription__hasMaxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->hasMaxUnconfirmedBytes(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->hasMaxUnconfirmedBytes(); } bool z_bmqt_Subscription__hasConsumerPriority(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->hasConsumerPriority(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->hasConsumerPriority(); } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp index 5c5735c05..3814cabfe 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp @@ -3,8 +3,8 @@ int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy){ using namespace BloombergLP; - bmqt::Uri* original_uri_ptr = reinterpret_cast(to_copy); - bmqt::Uri* copy = new bmqt::Uri(*original_uri_ptr); + bmqt::Uri* original_uri_p = reinterpret_cast(to_copy); + bmqt::Uri* copy = new bmqt::Uri(*original_uri_p); *uri_obj = reinterpret_cast(copy); return 0; } @@ -15,58 +15,58 @@ int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy){ int z_bmqt_UriBuilder__create(z_bmqt_UriBuilder** uribuilder_obj) { using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_ptr = new bmqt::UriBuilder(); - *uribuilder_obj = reinterpret_cast(uriBuilder_ptr); + bmqt::UriBuilder* uriBuilder_p = new bmqt::UriBuilder(); + *uribuilder_obj = reinterpret_cast(uriBuilder_p); return 0; } int z_bmqt_UriBuilder__createFromUri(z_bmqt_UriBuilder** uribuilder_obj, const z_bmqt_Uri* uri_obj) { using namespace BloombergLP; - const bmqt::Uri* uri_ptr = reinterpret_cast(uri_obj); - bmqt::UriBuilder* uriBuilder_ptr = new bmqt::UriBuilder(*uri_ptr); - *uribuilder_obj = reinterpret_cast(uriBuilder_ptr); + const bmqt::Uri* uri_p = reinterpret_cast(uri_obj); + bmqt::UriBuilder* uriBuilder_p = new bmqt::UriBuilder(*uri_p); + *uribuilder_obj = reinterpret_cast(uriBuilder_p); return 0; } int z_bmqt_UriBuilder__setDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); - uriBuilder_ptr->setDomain(value); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + uriBuilder_p->setDomain(value); return 0; } int z_bmqt_UriBuilder__setTier(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); - uriBuilder_ptr->setTier(value); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + uriBuilder_p->setTier(value); return 0; } int z_bmqt_UriBuilder__setQualifiedDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); - uriBuilder_ptr->setQualifiedDomain(value); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + uriBuilder_p->setQualifiedDomain(value); return 0; } int z_bmqt_UriBuilder__setQueue(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); - uriBuilder_ptr->setQueue(value); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + uriBuilder_p->setQueue(value); return 0; } int z_bmqt_UriBuilder_uri(z_bmqt_UriBuilder* uribuilder_obj, z_bmqt_Uri** uri_obj){ using namespace BloombergLP; - const bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uri_obj); - bmqt::Uri* uri_ptr = new bmqt::Uri(); + const bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uri_obj); + bmqt::Uri* uri_p = new bmqt::Uri(); - int res = uriBuilder_ptr->uri(uri_ptr); // support error description ? + int res = uriBuilder_p->uri(uri_p); // support error description ? if(res != 0){ - delete uri_ptr; + delete uri_p; return res; } - *uri_obj = reinterpret_cast(uri_ptr); + *uri_obj = reinterpret_cast(uri_p); return res; } \ No newline at end of file From d21c924fac64a8b7acddd99044989c6421871cbd Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 23 Jan 2024 16:30:29 -0500 Subject: [PATCH 17/57] Progress --- src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 5 +- .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp | 85 ++++++ .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.h | 36 +++ .../z_bmqa/z_bmqa_configurequeuestatus.cpp | 92 ++++++ .../z_bmqa/z_bmqa_configurequeuestatus.h | 43 +++ src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp | 272 +++++++++++++++++- src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 90 +++++- .../z_bmq/z_bmqa/z_bmqa_messageiterator.cpp | 53 ++++ .../z_bmq/z_bmqa/z_bmqa_messageiterator.h | 30 ++ .../z_bmq/z_bmqa/z_bmqa_messageproperties.cpp | 3 + .../z_bmq/z_bmqa/z_bmqa_messageproperties.h | 2 + src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 272 ++++++++++++++---- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 165 +++++++---- src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp | 4 +- .../z_bmq/z_bmqa/z_bmqa_sessionevent.cpp | 83 ++++++ src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h | 26 ++ src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 3 + .../z_bmqt_compressionalgorithmtype.cpp | 46 +++ .../z_bmqt/z_bmqt_compressionalgorithmtype.h | 65 +++++ .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 21 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 14 +- .../z_bmq/z_bmqt/z_bmqt_messageguid.cpp | 24 ++ src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h | 10 + .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp | 20 ++ .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.h | 67 +++++ src/tutorials/CMakeLists.txt | 1 + src/tutorials/c_wrapper/consumer.cpp | 266 +++++++++++++++++ src/tutorials/c_wrapper/producer.cpp | 101 +++++++ 28 files changed, 1766 insertions(+), 133 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h create mode 100644 src/tutorials/c_wrapper/consumer.cpp create mode 100644 src/tutorials/c_wrapper/producer.cpp diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index d24a9918d..89410832c 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -1,8 +1,11 @@ +z_bmqa_configurequeuestatus z_bmqa_confirmeventbuilder +z_bmqa_closequeuestatus z_bmqa_event z_bmqa_message z_bmqa_messageevent z_bmqa_messageeventbuilder z_bmqa_messageproperties z_bmqa_queueid -z_bmqa_session \ No newline at end of file +z_bmqa_session +z_bmqa_openqueuestatus \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp new file mode 100644 index 000000000..e3e312f61 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp @@ -0,0 +1,85 @@ +#include +#include + +int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** status_obj) +{ + using namespace BloombergLP; + + bmqa::CloseQueueStatus* status_p = new bmqa::CloseQueueStatus(); + + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, + const z_bmqa_CloseQueueStatus* other) +{ + using namespace BloombergLP; + + const bmqa::CloseQueueStatus* other_p = + reinterpret_cast(other); + bmqa::CloseQueueStatus* status_p = new bmqa::CloseQueueStatus(*other_p); + + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription) +{ + using namespace BloombergLP; + + const bmqa::QueueId* queueId_p = reinterpret_cast( + queueId); + const bsl::string errorDescription_str(errorDescription); + bmqt::CloseQueueResult::Enum result_enum = + static_cast(result); + bmqa::CloseQueueStatus* status_p = new bmqa::CloseQueueStatus( + *queueId_p, + result_enum, + errorDescription_str); + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +bool z_bmqa_CloseQueueStatus__toBool(const z_bmqa_CloseQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::CloseQueueStatus* status_p = + reinterpret_cast(status_obj); + return *status_p; +} + +int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, + z_bmqa_QueueId const** queueId_obj) +{ + using namespace BloombergLP; + const bmqa::CloseQueueStatus* status_p = + reinterpret_cast(status_obj); + const bmqa::QueueId* queueId_p = &(status_p->queueId()); + + *queueId_obj = reinterpret_cast(queueId_p); + return 0; +} + +int z_bmqa_CloseQueueStatus__result(const z_bmqa_CloseQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::CloseQueueStatus* status_p = + reinterpret_cast(status_obj); + return status_p->result(); +} + +const char* z_bmqa_CloseQueueStatus__errorDescription( + const z_bmqa_CloseQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::CloseQueueStatus* status_p = + reinterpret_cast(status_obj); + return status_p->errorDescription().c_str(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h new file mode 100644 index 000000000..ab47930d1 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h @@ -0,0 +1,36 @@ +#ifndef INCLUDED_Z_BMQA_CLOSEQUEUESTATUS +#define INCLUDED_Z_BMQA_CLOSEQUEUESTATUS + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct z_bmqa_CloseQueueStatus z_bmqa_CloseQueueStatus; + +int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** status_obj); + +int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, const z_bmqa_CloseQueueStatus* other); + +int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription); + +bool z_bmqa_CloseQueueStatus__toBool(const z_bmqa_CloseQueueStatus* status_obj); + +int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj); + +int z_bmqa_CloseQueueStatus__result(const z_bmqa_CloseQueueStatus* status_obj); + +const char* z_bmqa_CloseQueueStatus__errorDescription(const z_bmqa_CloseQueueStatus* status_obj); + + + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp new file mode 100644 index 000000000..18be79a2d --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp @@ -0,0 +1,92 @@ +#include +#include + +int z_bmqa_ConfigureQueueStatus__create( + z_bmqa_ConfigureQueueStatus** status_obj) +{ + using namespace BloombergLP; + + bmqa::ConfigureQueueStatus* status_p = new bmqa::ConfigureQueueStatus(); + + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +int z_bmqa_ConfigureQueueStatus__createCopy( + z_bmqa_ConfigureQueueStatus** status_obj, + const z_bmqa_ConfigureQueueStatus* other) +{ + using namespace BloombergLP; + + const bmqa::ConfigureQueueStatus* other_p = + reinterpret_cast(other); + bmqa::ConfigureQueueStatus* status_p = new bmqa::ConfigureQueueStatus( + *other_p); + + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +int z_bmqa_ConfigureQueueStatus__createFull( + z_bmqa_ConfigureQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription) +{ + using namespace BloombergLP; + + const bmqa::QueueId* queueId_p = reinterpret_cast( + queueId); + const bsl::string errorDescription_str(errorDescription); + bmqt::ConfigureQueueResult::Enum result_enum = + static_cast(result); + bmqa::ConfigureQueueStatus* status_p = new bmqa::ConfigureQueueStatus( + *queueId_p, + result_enum, + errorDescription_str); + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +bool z_bmqa_ConfigureQueueStatus__toBool( + const z_bmqa_ConfigureQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::ConfigureQueueStatus* status_p = + reinterpret_cast(status_obj); + return *status_p; +} + +int z_bmqa_ConfigureQueueStatus__queueId( + const z_bmqa_ConfigureQueueStatus* status_obj, + z_bmqa_QueueId const** queueId_obj) +{ + using namespace BloombergLP; + const bmqa::ConfigureQueueStatus* status_p = + reinterpret_cast(status_obj); + const bmqa::QueueId* queueId_p = &(status_p->queueId()); + + *queueId_obj = reinterpret_cast(queueId_p); + return 0; +} + +int z_bmqa_ConfigureQueueStatus__result( + const z_bmqa_ConfigureQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::ConfigureQueueStatus* status_p = + reinterpret_cast(status_obj); + return status_p->result(); +} + +const char* z_bmqa_ConfigureQueueStatus__errorDescription( + const z_bmqa_ConfigureQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::ConfigureQueueStatus* status_p = + reinterpret_cast(status_obj); + return status_p->errorDescription().c_str(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h new file mode 100644 index 000000000..2c0441770 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h @@ -0,0 +1,43 @@ +#ifndef INCLUDED_Z_BMQA_CONFIGUREQUEUESTATUS +#define INCLUDED_Z_BMQA_CONFIGUREQUEUESTATUS + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct z_bmqa_ConfigureQueueStatus z_bmqa_ConfigureQueueStatus; + +int z_bmqa_ConfigureQueueStatus__create( + z_bmqa_ConfigureQueueStatus** status_obj); + +int z_bmqa_ConfigureQueueStatus__createCopy( + z_bmqa_ConfigureQueueStatus** status_obj, + const z_bmqa_ConfigureQueueStatus* other); + +int z_bmqa_ConfigureQueueStatus__createFull( + z_bmqa_ConfigureQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription); + +bool z_bmqa_ConfigureQueueStatus__toBool( + const z_bmqa_ConfigureQueueStatus* status_obj); + +int z_bmqa_ConfigureQueueStatus__queueId( + const z_bmqa_ConfigureQueueStatus* status_obj, + z_bmqa_QueueId const** queueId_obj); + +int z_bmqa_ConfigureQueueStatus__result( + const z_bmqa_ConfigureQueueStatus* status_obj); + +const char* z_bmqa_ConfigureQueueStatus__errorDescription( + const z_bmqa_ConfigureQueueStatus* status_obj); + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp index 7a0c54d55..73d9cfcb5 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -1,7 +1,12 @@ +#include +#include #include +#include +#include #include -int z_bmqa_Message__delete(z_bmqa_Message** message_obj) { +int z_bmqa_Message__delete(z_bmqa_Message** message_obj) +{ using namespace BloombergLP; bmqa::Message* message_p = reinterpret_cast(*message_obj); @@ -11,17 +16,20 @@ int z_bmqa_Message__delete(z_bmqa_Message** message_obj) { return 0; } -int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj) { +int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj) +{ using namespace BloombergLP; - const bmqa::Message* message_p = reinterpret_cast(*message_obj); + const bmqa::Message* message_p = reinterpret_cast( + *message_obj); delete message_p; *message_obj = NULL; return 0; } -int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj){ +int z_bmqa_Message__create(z_bmqa_Message** message_obj) +{ using namespace BloombergLP; bmqa::Message* message_p = new bmqa::Message(); @@ -30,11 +38,263 @@ int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj){ return 0; } -int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length){ +int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, + const char* data, + int length) +{ using namespace BloombergLP; bmqa::Message* message_p = reinterpret_cast(message_obj); message_p->setDataRef(data, length); return 0; -} \ No newline at end of file +} + +int z_bmqa_Message__setPropertiesRef( + z_bmqa_Message* message_obj, + const z_bmqa_MessageProperties* properties_obj) +{ + using namespace BloombergLP; + + bmqa::Message* message_p = reinterpret_cast(message_obj); + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + message_p->setPropertiesRef(properties_p); + + return 0; +} + +int z_bmqa_Message__clearPropertiesRef(z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + bmqa::Message* message_p = reinterpret_cast(message_obj); + message_p->clearPropertiesRef(); + + return 0; +} + +int z_bmqa_Message__setCorrelationId(z_bmqa_Message* message_obj, + const z_bmqt_CorrelationId* correlationId) +{ + using namespace BloombergLP; + bmqa::Message* message_p = reinterpret_cast(message_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId); + message_p->setCorrelationId(*correlationId_p); + + return 0; +} + +int z_bmqa_Message__setCompressionAlgorithmType( + z_bmqa_Message* message_obj, + z_bmqt_CompressionAlgorithmType::Enum value) +{ + using namespace BloombergLP; + bmqa::Message* message_p = reinterpret_cast(message_obj); + bmqt::CompressionAlgorithmType::Enum compressionType = + static_cast(value); + message_p->setCompressionAlgorithmType(compressionType); + + return 0; +} + +#ifdef BMQ_ENABLE_MSG_GROUPID + +int z_bmqa_Message__setGroupId(z_bmqa_Message* message_obj, + const char* groupId) +{ + using namespace BloombergLP; + bmqa::Message* message_p = reinterpret_cast(message_obj); + bsl::string groupId_str(groupId); + message_p->setGroupId(groupId_str); + + return 0; +} + +int z_bmqa_Message__clearGroupId(z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + bmqa::Message* message_p = reinterpret_cast(message_obj); + message_p->clearGroupId(); + + return 0; +} + +#endif + +int z_bmqa_Message__clone(const z_bmqa_Message* message_obj, + z_bmqa_Message** other_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + + bmqa::Message* other_p = new bmqa::Message(); + *other_p = message_p->clone(); + *other_obj = reinterpret_cast(other_p); + + return 0; +} + +int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, + z_bmqa_QueueId const** queueId_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + *queueId_obj = reinterpret_cast( + &(message_p->queueId())); + + return 0; +} + +int z_bmqa_Message__correlationId( + const z_bmqa_Message* message_obj, + z_bmqt_CorrelationId const** correlationId_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + *correlationId_obj = reinterpret_cast( + &(message_p->correlationId())); + + return 0; +} + +int z_bmqa_Message__subscriptionHandle( + const z_bmqa_Message* message_obj, + z_bmqt_SubscriptionHandle const** subscription_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + *subscription_obj = reinterpret_cast( + &(message_p->subscriptionHandle())); + + return 0; +} + +z_bmqt_CompressionAlgorithmType::Enum +z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + + return static_cast( + message_p->compressionAlgorithmType()); +} + +#ifdef BMQ_ENABLE_MSG_GROUPID + +const char* z_bmqa_Message__groupId(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + + return message_p->groupId().c_str(); +} + +#endif + +int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, + z_bmqt_MessageGUID const** messageGUID_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + *messageGUID_obj = reinterpret_cast( + &(message_p->messageGUID())); + + return 0; +} + +int z_bmqa_Message__confirmationCookie( + const z_bmqa_Message* message_obj, + z_bmqa_MessageConfirmationCookie** cookie_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + bmqa::MessageConfirmationCookie* cookie_p = + new bmqa::MessageConfirmationCookie(message_p->confirmationCookie()); + *cookie_obj = reinterpret_cast( + cookie_p); + + return 0; +} + +int z_bmqa_Message__ackStatus(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + return message_p->ackStatus(); +} + +// Add once we figure out how to handle Blobs in C +// int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, z_bdlbb_Blob* +// blob) { +// using namespace BloombergLP; +// const bmqa::Message* message_p = reinterpret_cast(message_obj); +// } + +int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, char** buffer) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + + bdlbb::Blob data; + message_p->getData(&data); + bsl::stringstream ss; + ss << bdlbb::BlobUtilHexDumper(&data); + bsl::string data_str = ss.str(); + *buffer = new char[data_str.length()+1]; + (*buffer)[data_str.length()] = '\0'; + strcpy(*buffer, data_str.c_str()); + + return 0; +} + +int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + + return message_p->dataSize(); +} + +bool z_bmqa_Message__hasProperties(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + return message_p->hasProperties(); +} + +#ifdef BMQ_ENABLE_MSG_GROUPID + +bool z_bmqa_Message__hasGroupId(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + return message_p->hasGroupId(); +} + +#endif + +int z_bmqa_Message__loadProperties(const z_bmqa_Message* message_obj, + z_bmqa_MessageProperties* buffer) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + bmqa::MessageProperties* buffer_p = + reinterpret_cast(buffer); + return message_p->loadProperties(buffer_p); +} diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index f8bfa6c9f..7b1095226 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -1,20 +1,106 @@ #ifndef INCLUDED_Z_BMQA_MESSAGE #define INCLUDED_Z_BMQA_MESSAGE +#include +#include +#include +#include +#include +#include +#include + #if defined(__cplusplus) extern "C" { #endif typedef struct z_bmqa_Message z_bmqa_Message; +typedef struct z_bmqa_MessageConfirmationCookie + z_bmqa_MessageConfirmationCookie; + int z_bmqa_Message__delete(z_bmqa_Message** message_obj); int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj); -int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj); +int z_bmqa_Message__create(z_bmqa_Message** message_obj); + +int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, + const char* data, + int length); + +int z_bmqa_Message__setPropertiesRef( + z_bmqa_Message* message_obj, + const z_bmqa_MessageProperties* properties_obj); + +int z_bmqa_Message__clearPropertiesRef(z_bmqa_Message* message_obj); + +int z_bmqa_Message__setCorrelationId( + z_bmqa_Message* message_obj, + const z_bmqt_CorrelationId* correlationId); + +int z_bmqa_Message__setCompressionAlgorithmType( + z_bmqa_Message* message_obj, + z_bmqt_CompressionAlgorithmType::Enum value); + +#ifdef BMQ_ENABLE_MSG_GROUPID + +int z_bmqa_Message__setGroupId(z_bmqa_Message* message_obj, + const char* groupId); + +int z_bmqa_Message__clearGroupId(z_bmqa_Message* message_obj); + +#endif + +int z_bmqa_Message__clone(const z_bmqa_Message* message_obj, + z_bmqa_Message** other_obj); + +int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, + z_bmqa_QueueId const** queueId_obj); + +int z_bmqa_Message__correlationId( + const z_bmqa_Message* message_obj, + z_bmqt_CorrelationId const** correlationId_obj); + +int z_bmqa_Message__subscriptionHandle( + const z_bmqa_Message* message_obj, + z_bmqt_SubscriptionHandle const** subscription_obj); -int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length); +z_bmqt_CompressionAlgorithmType::Enum +z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message_obj); + +#ifdef BMQ_ENABLE_MSG_GROUPID + +const char* z_bmqa_Message__groupId(const z_bmqa_Message* message_obj); + +#endif + +int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, + z_bmqt_MessageGUID const** messageGUID_obj); + +int z_bmqa_Message__confirmationCookie( + const z_bmqa_Message* message_obj, + z_bmqa_MessageConfirmationCookie** cookie_obj); + +int z_bmqa_Message__ackStatus(const z_bmqa_Message* message_obj); + +// Add once we figure out how to handle Blobs in C +// int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, z_bdlbb_Blob* +// blob); + +int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, void** buffer); + +int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj); + +bool z_bmqa_Message__hasProperties(const z_bmqa_Message* message_obj); + +#ifdef BMQ_ENABLE_MSG_GROUPID + +bool z_bmqa_Message__hasGroupId(const z_bmqa_Message* message_obj); + +#endif +int z_bmqa_Message__loadProperties(const z_bmqa_Message* message_obj, + z_bmqa_MessageProperties* buffer); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp new file mode 100644 index 000000000..a16d67209 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp @@ -0,0 +1,53 @@ +#include +#include + +int z_bmqa_MessageIterator__create( + z_bmqa_MessageIterator** messageIterator_obj) +{ + using namespace BloombergLP; + + bmqa::MessageIterator* messageIterator_p = new bmqa::MessageIterator(); + + *messageIterator_obj = reinterpret_cast( + messageIterator_p); + + return 0; +} + +int z_bmqa_MessageIterator__delete( + z_bmqa_MessageIterator** messageIterator_obj) +{ + using namespace BloombergLP; + + bmqa::MessageIterator* messageIterator_p = + reinterpret_cast(messageIterator_obj); + delete messageIterator_p; + *messageIterator_obj = NULL; + + return 0; +} + +bool z_bmqa_MessageIterator__nextMessage( + z_bmqa_MessageIterator* messageIterator_obj) +{ + using namespace BloombergLP; + + bmqa::MessageIterator* messageIterator_p = + reinterpret_cast(messageIterator_obj); + + return messageIterator_p->nextMessage(); +} + +int z_bmqa_MessageIterator__message( + const z_bmqa_MessageIterator* messageIterator_obj, + z_bmqa_Message const** message_obj) +{ + using namespace BloombergLP; + + const bmqa::MessageIterator* messageIterator_p = + reinterpret_cast(messageIterator_obj); + const z_bmqa_Message* message_p = reinterpret_cast( + &messageIterator_p->message()); + + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h new file mode 100644 index 000000000..6c6f6b6e2 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h @@ -0,0 +1,30 @@ +#ifndef INCLUDED_Z_BMQA_MESSAGEITERATOR +#define INCLUDED_Z_BMQA_MESSAGEITERATOR + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct z_bmqa_MessageIterator z_bmqa_MessageIterator; + +int z_bmqa_MessageIterator__create( + z_bmqa_MessageIterator** messageIterator_obj); + +int z_bmqa_MessageIterator__delete( + z_bmqa_MessageIterator** messageIterator_obj); + +bool z_bmqa_MessageIterator__nextMessage( + z_bmqa_MessageIterator* messageIterator_obj); + +int z_bmqa_MessageIterator__message( + z_bmqa_MessageIterator* messageIterator_obj, + z_bmqa_Message const** message_obj); + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp new file mode 100644 index 000000000..5ff0f23ff --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp @@ -0,0 +1,3 @@ +#include +#include + diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h index b9b2823d5..845532437 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h @@ -3,4 +3,6 @@ typedef struct z_bmqa_MessageProperties z_bmqa_MessageProperties; + + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index afa0a5622..4c165a0b6 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -1,11 +1,86 @@ +#include +#include +#include +#include +#include #include #include -#include -#include -#include +z_bmqa_CustomSessionEventHandler::z_bmqa_CustomSessionEventHandler( + z_bmqa_OnSessionEventCb onSessionEventCb, + z_bmqa_OnMessageEventCb onMessageEventCb) +{ + this->onSessionEventCb = onSessionEventCb; + this->onMessageEventCb = onMessageEventCb; +} + +z_bmqa_CustomSessionEventHandler::~z_bmqa_CustomSessionEventHandler() +{ + if (data != NULL) { + delete[] (char*)data; + } +} + +void z_bmqa_CustomSessionEventHandler::onSessionEvent( + const BloombergLP::bmqa::SessionEvent& sessionEvent) +{ + const z_bmqa_SessionEvent* sessionEvent_p = + reinterpret_cast(&sessionEvent); + this->onSessionEventCb(sessionEvent_p, this->data); +} -int z_bmqa_Session__delete(z_bmqa_Session** session_obj) { +void z_bmqa_CustomSessionEventHandler::onMessageEvent( + const BloombergLP::bmqa::MessageEvent& messageEvent) +{ + const z_bmqa_MessageEvent* messageEvent_p = + reinterpret_cast(&messageEvent); + this->onMessageEventCb(messageEvent_p, this->data); +} + +void z_bmqa_CustomSessionEventHandler::lock() +{ + this->mutex.lock(); +} + +void z_bmqa_CustomSessionEventHandler::unlock() +{ + this->mutex.unlock(); +} + +void z_bmqa_CustomSessionEventHandler::tryLock() +{ + this->mutex.tryLock(); +} + +int z_bmqa_SessionEventHandler__create( + z_bmqa_SessionEventHandler** eventHandler_obj, + z_bmqa_OnSessionEventCb onSessionEventCb, + z_bmqa_OnMessageEventCb onMessageEventCb) +{ + using namespace BloombergLP; + + z_bmqa_CustomSessionEventHandler* eventHandler_p = + new z_bmqa_CustomSessionEventHandler(onSessionEventCb, + onMessageEventCb); + *eventHandler_obj = reinterpret_cast( + eventHandler_p); + ; + return 0; +} + +int z_bmqa_SessionEventHandler__delete( + z_bmqa_SessionEventHandler** eventHandler_obj) +{ + z_bmqa_CustomSessionEventHandler* eventHandler_p = + reinterpret_cast(*eventHandler_obj); + delete eventHandler_p; + *eventHandler_obj = NULL; + + return 0; +} + +int z_bmqa_Session__delete(z_bmqa_Session** session_obj) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(*session_obj); @@ -15,132 +90,225 @@ int z_bmqa_Session__delete(z_bmqa_Session** session_obj) { return 0; } -int z_bmqa_Session__create(z_bmqa_Session** session_obj , const z_bmqt_SessionOptions* options) { +int z_bmqa_Session__create(z_bmqa_Session** session_obj, + const z_bmqt_SessionOptions* options) +{ + using namespace BloombergLP; + + bmqa::Session* session_p; + if (options) { + const bmqt::SessionOptions* options_p = + reinterpret_cast(options); + session_p = new bmqa::Session(*options_p); + } + else { + session_p = new bmqa::Session(); + } + *session_obj = reinterpret_cast(session_p); + return 0; +} + +int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, + z_bmqa_SessionEventHandler* eventHandler, + const z_bmqt_SessionOptions* options) +{ using namespace BloombergLP; - const bmqt::SessionOptions* options_p = reinterpret_cast(options); - bmqa::Session* session_p = new bmqa::Session(*options_p); + bmqa::Session* session_p; + bmqa::SessionEventHandler* eventHandler_p = + reinterpret_cast(eventHandler); + if (options) { + const bmqt::SessionOptions* options_p = + reinterpret_cast(options); + session_p = new bmqa::Session( + bslma::ManagedPtr(eventHandler_p), + *options_p); + } + else { + session_p = new bmqa::Session( + bslma::ManagedPtr(eventHandler_p)); + } *session_obj = reinterpret_cast(session_p); return 0; } -int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) { +int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); - if(timeoutMs != 0) { + if (timeoutMs != 0) { bsls::TimeInterval timeout; timeout.addMilliseconds(timeoutMs); return session_p->start(timeout); - } else { + } + else { return session_p->start(); } } -int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { +int z_bmqa_Session__startAsync(z_bmqa_Session* session_obj, int64_t timeoutMs) +{ + using namespace BloombergLP; + + bmqa::Session* session_p = reinterpret_cast(session_obj); + if (timeoutMs != 0) { + bsls::TimeInterval timeout; + timeout.addMilliseconds(timeoutMs); + return session_p->startAsync(timeout); + } + else { + return session_p->startAsync(); + } +} + +int z_bmqa_Session__stop(z_bmqa_Session* session_obj) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); session_p->stop(); return 0; -} - +} -int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ +int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj) +{ using namespace BloombergLP; - + bmqa::Session* session_p = reinterpret_cast(session_obj); - session_p->finalizeStop(); + session_p->stopAsync(); + return 0; } +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj) +{ + using namespace BloombergLP; + bmqa::Session* session_p = reinterpret_cast(session_obj); + session_p->finalizeStop(); + return 0; +} -int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ +int z_bmqa_Session__loadMessageEventBuilder( + z_bmqa_Session* session_obj, + z_bmqa_MessageEventBuilder** builder) +{ using namespace BloombergLP; - + bmqa::Session* session_p = reinterpret_cast(session_obj); - bmqa::MessageEventBuilder* builder_p = reinterpret_cast(*builder); + bmqa::MessageEventBuilder* builder_p = + reinterpret_cast(*builder); session_p->loadMessageEventBuilder(builder_p); return 0; } -int z_bmqa_Session__loadConfirmEventBuilder(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder** builder){ +int z_bmqa_Session__loadConfirmEventBuilder( + z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder** builder) +{ using namespace BloombergLP; - + bmqa::Session* session_p = reinterpret_cast(session_obj); - bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder); + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder); session_p->loadConfirmEventBuilder(builder_p); return 0; } -int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer){ +int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, + z_bmqa_MessageProperties** buffer) +{ using namespace BloombergLP; - + bmqa::Session* session_p = reinterpret_cast(session_obj); - bmqa::MessageProperties* buffer_p = reinterpret_cast(buffer); + bmqa::MessageProperties* buffer_p = + reinterpret_cast(buffer); session_p->loadMessageProperties(buffer_p); return 0; } -// int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ +// int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, +// z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ // using namespace BloombergLP; - -// bmqa::Session* session_p = reinterpret_cast(session_obj); -// bmqa::Q* buffer_p = reinterpret_cast(uri); + +// bmqa::Session* session_p = +// reinterpret_cast(session_obj); bmqa::Q* buffer_p = +// reinterpret_cast(uri); // session_p->getQueueId(buffer_p); // return 0; // } +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const char* uri, + uint64_t flags, + z_bmqa_OpenQueueStatus** status) +{ + using namespace BloombergLP; -// int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ -// using namespace BloombergLP; - -// bmqa::Session* session_p = reinterpret_cast(session_obj); -// bmqt::Uri const * uri_p = reinterpret_cast< bmqt::Uri const *>(uri); -// bmqa::QueueId* queueid_p = reinterpret_cast(queueId); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::QueueId* queueId_p = reinterpret_cast(queueId); + bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(); -// //must populate out obj in future -// session_p->openQueueSync(queueid_p, *uri_p, flags); -// return 0; -// } + *status_p = session_p->openQueueSync(queueId_p, uri, flags); + *status = reinterpret_cast(status_p); + return 0; +} -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const char * uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ +int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const z_bmqt_QueueOptions* options, + int64_t timeoutMs, + z_bmqa_ConfigureQueueStatus** status) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); - bmqa::QueueId* queueid_p = reinterpret_cast(queueId); + bmqa::QueueId* queueId_p = reinterpret_cast(queueId); + bmqa::ConfigureQueueStatus* status_p = new bmqa::ConfigureQueueStatus(); + const bmqt::QueueOptions* options_p = + reinterpret_cast(options); + + // Implement timeout - //must populate out obj in future - session_p->openQueueSync(queueid_p, uri, flags); + *status_p = session_p->configureQueueSync(queueId_p, *options_p); + *status = reinterpret_cast(status_p); return 0; } -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId /*,z_bmqa_CloseQueueStatus**/){ +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + int64_t timeoutMs, + z_bmqa_CloseQueueStatus** status) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); - bmqa::QueueId* queueid_p = reinterpret_cast(queueId); + bmqa::QueueId* queueId_p = reinterpret_cast(queueId); + bmqa::CloseQueueStatus* status_p = new bmqa::CloseQueueStatus(); - //must populate out obj in future - session_p->closeQueueSync(queueid_p); // not using timeout (we should definitely add this) + // Implement timeout + + *status_p = session_p->closeQueueSync(queueId_p); + *status = reinterpret_cast(status_p); return 0; } - -int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event){ +int z_bmqa_Session__post(z_bmqa_Session* session_obj, + const z_bmqa_MessageEvent* event) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); - const bmqa::MessageEvent* event_p = reinterpret_cast(event); + const bmqa::MessageEvent* event_p = + reinterpret_cast(event); session_p->post(*event_p); return 0; } - - diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 1e029b000..8abb39a11 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -1,16 +1,19 @@ #ifndef INCLUDED_Z_BMQA_SESSION #define INCLUDED_Z_BMQA_SESSION -#include -#include +#include +#include +#include #include -#include #include +#include #include -#include +#include +#include +#include #include -#include -#include +#include +#include #if defined(__cplusplus) extern "C" { @@ -18,93 +21,139 @@ extern "C" { typedef struct z_bmqa_SessionEventHandler z_bmqa_SessionEventHandler; -typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; +typedef void (*z_bmqa_OnSessionEventCb)( + const z_bmqa_SessionEvent* sessionEvent, + void* data); +typedef void (*z_bmqa_OnMessageEventCb)( + const z_bmqa_MessageEvent* messageEvent, + void* data); + +int z_bmqa_SessionEventHandler__create( + z_bmqa_SessionEventHandler** eventHandler_obj, + z_bmqa_OnSessionEventCb onSessionEvent, + z_bmqa_OnMessageEventCb onMessageEvent); + +int z_bmqa_SessionEventHandler__delete( + z_bmqa_SessionEventHandler** eventHandler_obj); + +typedef struct z_bmqa_MessageConfirmationCookie + z_bmqa_MessageConfirmationCookie; typedef struct z_bmqa_Session z_bmqa_Session; -typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; +int z_bmqa_Session__delete(z_bmqa_Session** session_obj); -typedef struct z_bmqa_OpenQueueStatus z_bmqa_OpenQueueStatus; +int z_bmqa_Session__create(z_bmqa_Session** session_obj, + const z_bmqt_SessionOptions* options); -typedef void(*z_bmqa_SessionEventHandlerCb)(z_bmqa_SessionEvent* sessionEvent, void* data); +int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, + z_bmqa_SessionEventHandler* eventHandler, + const z_bmqt_SessionOptions* options); -typedef struct EventHandlerData { - z_bmqa_SessionEventHandlerCb callback; - void* data; -} EventHandlerData; +int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs); -// void z_bmqa_Session__setEventHandler(z_bmqa_Session* session_obj, EventHandlerData* data) { -// if(data.callback != NULL) { -// z_bmqa_SessionEvent* event = NULL; +int z_bmqa_Session__startAsync(z_bmqa_Session* session_obj, int64_t timeoutMs); -// data.callback(event, NULL); -// } -// } +int z_bmqa_Session__stop(z_bmqa_Session* session_obj); - // +int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj); -int z_bmqa_Session__delete(z_bmqa_Session** session_obj); +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj); -int z_bmqa_Session__create(z_bmqa_Session** session_obj, const z_bmqt_SessionOptions* options); +int z_bmqa_Session__loadMessageEventBuilder( + z_bmqa_Session* session_obj, + z_bmqa_MessageEventBuilder** builder); -int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, z_bmqa_SessionEventHandler* eventHandler, const z_bmqt_SessionOptions* options); +int z_bmqa_Session__loadConfirmEventBuilder( + z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder** builder); -int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t milliseconds); +int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, + z_bmqa_MessageProperties** buffer); -int z_bmqa_Session__startAsync(); +// int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, +// z_bmqa_QueueId** queueId, +// const z_bmqt_Uri* uri); -int z_bmqa_Session__stop(z_bmqa_Session* session_obj); +int z_bmqa_Session__getQueueIdWithCorrelationId( + z_bmqa_Session* session_obj, + z_bmqa_QueueId** queueId, + const z_bmqt_CorrelationId* correlationId); -int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj); +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const char* uri, + uint64_t flags, + z_bmqa_OpenQueueStatus** status); -int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj); +int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const z_bmqt_QueueOptions* options, + int64_t timeoutMs, + z_bmqa_ConfigureQueueStatus** status); -int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder); +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + int64_t timeoutMs, + z_bmqa_CloseQueueStatus** status); -int z_bmqa_Session__loadConfirmEventBuilder(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder** builder); +int z_bmqa_Session__closeQueueAsync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + int64_t timeout); -int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer); +int z_bmqa_Session_nextEvent(z_bmqa_Session* session_obj, + z_bmqa_Event** event_obj, + int64_t timeout); -int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri); +int z_bmqa_Session__post(z_bmqa_Session* session_obj, + const z_bmqa_MessageEvent* event); -int z_bmqa_Session__getQueueIdWithCorrelationId(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_CorrelationId* correlationId); +int z_bmqa_Session__confirmMessage(z_bmqa_Session* session_obj, + const z_bmqa_Message* message); -// int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); +int z_bmqa_Session__confirmMessageWithCookie( + z_bmqa_Session* session_obj, + const z_bmqa_MessageConfirmationCookie* cookie); -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const char * uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); +int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder* builder); -// int z_bmqa_Session__openQueueAsync(z_bmqa_Session* session_obj, -// z_bmqa_QueueId* queueId, -// const z_bmqt_Uri* uri, uint64_t flags, -// const z_bmqt_QueueOptions* options, -// int64_t timeout); +#if defined(__cplusplus) +} -int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, - z_bmqa_QueueId* queueId, - const z_bmqt_QueueOptions* options, - int64_t timeout); +#include +#include +#include +#include -// int z_bmqa_Session__configureQueueAsync(z_bmqa_Session* session_obj, -// z_bmqa_QueueId* queueId, -// const z_bmqt_QueueOptions* options, -// int64_t timeout); +class z_bmqa_CustomSessionEventHandler +: BloombergLP::bmqa::SessionEventHandler { + private: + z_bmqa_OnSessionEventCb onSessionEventCb; + z_bmqa_OnMessageEventCb onMessageEventCb; + void* data; + uint64_t mSize; -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId /*,z_bmqa_CloseQueueStatus**/); + BloombergLP::bslmt::Mutex mutex; -int z_bmqa_Session__closeQueueAsync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); + public: + z_bmqa_CustomSessionEventHandler(z_bmqa_OnSessionEventCb onSessionEventCb, + z_bmqa_OnMessageEventCb onMessageEventCb); -int z_bmqa_Session_nextEvent(z_bmqa_Session* session_obj, z_bmqa_Event** event_obj, int64_t timeout); + ~z_bmqa_CustomSessionEventHandler(); -int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event); + void onSessionEvent(const BloombergLP::bmqa::SessionEvent& sessionEvent); -int z_bmqa_Session__confirmMessage(z_bmqa_Session* session_obj, const z_bmqa_Message* message); + void onMessageEvent(const BloombergLP::bmqa::MessageEvent& messageEvent); -int z_bmqa_Session__confirmMessageWithCookie(z_bmqa_Session* session_obj, const z_bmqa_MessageConfirmationCookie* cookie); + void* getData() { return this->data; } -int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder* builder); + void lock(); -#if defined(__cplusplus) -} + void unlock(); + + void tryLock(); +}; #endif #endif diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp index d5e3c373b..e265556d6 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp @@ -27,7 +27,7 @@ // TEST DRIVER #include -#include +// #include // CONVENIENCE using namespace BloombergLP; @@ -39,7 +39,7 @@ using namespace bsl; static void test1_session() { - run_c_producer(); + // run_c_producer(); } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp new file mode 100644 index 000000000..a166350d3 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp @@ -0,0 +1,83 @@ +#include +#include + +int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** event_obj) +{ + using namespace BloombergLP; + + return 0; +} + +int z_bmqa_SessionEvent__create(z_bmqa_SessionEvent** event_obj) +{ + using namespace BloombergLP; + + bmqa::SessionEvent* event_p = new bmqa::SessionEvent(); + *event_obj = reinterpret_cast(event_p); + + return 0; +} + +int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** event_obj, + const z_bmqa_SessionEvent* other) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* other_p = + reinterpret_cast(other); + bmqa::SessionEvent* event_p = new bmqa::SessionEvent(*other_p); + + return 0; +} + +z_bmqt_SessionEventType::Enum +z_bmqa_SessionEvent__type(const z_bmqa_SessionEvent* event_obj) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); + return static_cast(event_p->type()); +} + +int z_bmqa_SessionEvent__correlationId( + const z_bmqa_SessionEvent* event_obj, + z_bmqt_CorrelationId const** correlationId_obj) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(&(event_p->correlationId())); + *correlationId_obj = reinterpret_cast(correlationId_p); + + return 0; +} + +int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* event_obj, + z_bmqa_QueueId** queueId_obj) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + bmqa::QueueId* queueId_p = new bmqa::QueueId(event_p->queueId()); + *queueId_obj = reinterpret_cast(queueId_p); + + return 0; +} + +int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* event_obj) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + return event_p->statusCode(); +} + +const char* +z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* event_obj) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + return event_p->errorDescription().c_str(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h index cc3c74ef6..7f504a058 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h @@ -1,6 +1,9 @@ #ifndef INCLUDED_Z_BMQA_SESSIONEVENT #define INCLUDED_Z_BMQA_SESSIONEVENT +#include +#include +#include #if defined(__cplusplus) extern "C" { @@ -8,6 +11,29 @@ extern "C" { typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; +int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** event_obj); + +int z_bmqa_SessionEvent__create(z_bmqa_SessionEvent** event_obj); + +int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** event_obj, + const z_bmqa_SessionEvent* other); + +z_bmqt_SessionEventType::Enum +z_bmqa_SessionEvent__type(const z_bmqa_SessionEvent* event_obj); + +int z_bmqa_SessionEvent__correlationId( + const z_bmqa_SessionEvent* event_obj, + z_bmqt_CorrelationId const** correlationId_obj); + +// Generates NEW queueId +int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* event_obj, + z_bmqa_QueueId** queueId_obj); + +int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* event_obj); + +const char* +z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* event_obj); + #if defined(__cplusplus) } #endif diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem index beeb8066f..d463eeaf5 100644 --- a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -1,5 +1,8 @@ +z_bmqt_compressionalgorithmtype z_bmqt_correlationid +z_bmqt_messageguid z_bmqt_queueoptions +z_bmqt_sessioneventtype z_bmqt_sessionoptions z_bmqt_subscription z_bmqt_types diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp new file mode 100644 index 000000000..fd2a649b0 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp @@ -0,0 +1,46 @@ +#include +#include +#include +#include + +#include + +const char* z_bmqt_CompressionAlgorithmType::toAscii( + z_bmqt_CompressionAlgorithmType::Enum value) +{ + using namespace BloombergLP; + + return bmqt::CompressionAlgorithmType::toAscii( + static_cast(value)); +} + +bool fromAscii(z_bmqt_CompressionAlgorithmType::Enum* out, const char* str) +{ + using namespace BloombergLP; + bmqt::CompressionAlgorithmType::Enum p; + bool result = bmqt::CompressionAlgorithmType::fromAscii(&p, str); + *out = static_cast(p); + return result; +} + +// Pass in unassigned pointer for error +bool isValid(const char* str, char** error) +{ + using namespace BloombergLP; + bsl::ostringstream os; + bsl::string temp_str(str); + bool result = bmqt::CompressionAlgorithmType::isValid(&temp_str, os); + + bsl::string error_str = os.str(); + + if (error_str.size() != 0) { + *error = new char[error_str.size() + 1]; + (*error)[error_str.size()] = '\0'; + strcpy(*error, error_str.c_str()); + } + else { + *error = NULL; + } + + return result; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h new file mode 100644 index 000000000..4e35d1cbd --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h @@ -0,0 +1,65 @@ +#ifndef INCLUDED_Z_BMQT_COMPRESSIONALGORITHMTYPE +#define INCLUDED_Z_BMQT_COMPRESSIONALGORITHMTYPE + +#include + +struct z_bmqt_CompressionAlgorithmType { + // TYPES + enum Enum { ec_UNKNOWN = -1, ec_NONE = 0, ec_ZLIB = 1 }; + + // CONSTANTS + + /// NOTE: This value must always be equal to the lowest type in the + /// enum because it is being used as a lower bound to verify that a + /// header's `CompressionAlgorithmType` field is a supported type. + static const int k_LOWEST_SUPPORTED_TYPE = ec_NONE; + + /// NOTE: This value must always be equal to the highest type in the + /// enum because it is being used as an upper bound to verify that a + /// header's `CompressionAlgorithmType` field is a supported type. + static const int k_HIGHEST_SUPPORTED_TYPE = ec_ZLIB; + + /// Return the non-modifiable string representation corresponding to the + /// specified enumeration `value`, if it exists, and a unique (error) + /// string otherwise. The string representation of `value` matches its + /// corresponding enumerator name with the "ec_" prefix eluded. For + /// example: + /// ``` + /// bsl::cout << CompressionAlgorithmType::toAscii( + /// CompressionAlgorithmType::ec_NONE); + /// ``` + /// will print the following on standard output: + /// ``` + /// NONE + /// ``` + /// Note that specifying a `value` that does not match any of the + /// enumerators will result in a string representation that is distinct + /// from any of those corresponding to the enumerators, but is otherwise + /// unspecified. + static const char* toAscii(z_bmqt_CompressionAlgorithmType::Enum value); + + /// Update the specified `out` with correct enum corresponding to the + /// specified string `str`, if it exists, and return true. Otherwise in + /// case of an error or unidentified string, return false. The expected + /// `str` is the enumerator name with the "ec_" prefix excluded. + /// For example: + /// ``` + /// CompressionAlgorithmType::fromAscii(out, NONE); + /// ``` + /// will return true and the value of `out` will be: + /// ``` + /// bmqt::CompresssionAlgorithmType::ec_NONE + /// ``` + /// Note that specifying a `str` that does not match any of the + /// enumerators excluding "ec_" prefix will result in the function + /// returning false and the specified `out` will not be touched. + static bool fromAscii(z_bmqt_CompressionAlgorithmType::Enum* out, + const char* str); + + /// Return true incase of valid specified `str` i.e. a enumerator name + /// with the "ec_" prefix excluded. Otherwise in case of invalid `str` + /// return false and populate the specified `stream` with error message. + static bool isValid(const char* str); +}; + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp index 9fe52738d..579bc2da0 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -104,13 +104,22 @@ CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correl const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); switch(correlationId_p->type()) { - case bmqt::CorrelationId::Type::e_NUMERIC: return CorrelationId_Type::e_NUMERIC; - case bmqt::CorrelationId::Type::e_POINTER: return CorrelationId_Type::e_POINTER; - case bmqt::CorrelationId::Type::e_SHARED_PTR: return CorrelationId_Type::e_SHARED_PTR; - case bmqt::CorrelationId::Type::e_AUTO_VALUE: return CorrelationId_Type::e_AUTO_VALUE; - case bmqt::CorrelationId::Type::e_UNSET: return CorrelationId_Type::e_UNSET; + case bmqt::CorrelationId::Type::e_NUMERIC: return CorrelationId_Type::ec_NUMERIC; + case bmqt::CorrelationId::Type::e_POINTER: return CorrelationId_Type::ec_POINTER; + case bmqt::CorrelationId::Type::e_SHARED_PTR: return CorrelationId_Type::ec_SHARED_PTR; + case bmqt::CorrelationId::Type::e_AUTO_VALUE: return CorrelationId_Type::ec_AUTO_VALUE; + case bmqt::CorrelationId::Type::e_UNSET: return CorrelationId_Type::ec_UNSET; default: break; } - return CorrelationId_Type::e_CORRELATIONID_ERROR; + return CorrelationId_Type::ec_CORRELATIONID_ERROR; +} + +int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj) { + using namespace BloombergLP; + + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(bmqt::CorrelationId::autoValue()); + *correlationId_obj = reinterpret_cast(correlationId_p); + + return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h index 78d93fe90..1b306a17c 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -12,17 +12,17 @@ typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; enum CorrelationId_Type { - e_NUMERIC // the 'CorrelationId' holds a 64-bit integer + ec_NUMERIC // the 'CorrelationId' holds a 64-bit integer , - e_POINTER // the 'CorrelationId' holds a raw pointer + ec_POINTER // the 'CorrelationId' holds a raw pointer , - e_SHARED_PTR // the 'CorrelationId' holds a shared pointer + ec_SHARED_PTR // the 'CorrelationId' holds a shared pointer , - e_AUTO_VALUE // the 'CorrelationId' holds an auto value + ec_AUTO_VALUE // the 'CorrelationId' holds an auto value , - e_UNSET // the 'CorrelationId' is not set + ec_UNSET // the 'CorrelationId' is not set , - e_CORRELATIONID_ERROR // error + ec_CORRELATIONID_ERROR // error }; int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); @@ -53,6 +53,8 @@ void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlation_I CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlation_Id_obj); +int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj); + #if defined(__cplusplus) } #endif diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp new file mode 100644 index 000000000..61d0fcd2a --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp @@ -0,0 +1,24 @@ +#include +#include + +int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj) +{ + using namespace BloombergLP; + + bmqt::MessageGUID* messageGUID_p = reinterpret_cast( + *messageGUID_obj); + delete messageGUID_p; + *messageGUID_obj = NULL; + + return 0; +} + +int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj) +{ + using namespace BloombergLP; + + bmqt::MessageGUID* messageGUID_p = new bmqt::MessageGUID(); + *messageGUID_obj = reinterpret_cast(messageGUID_p); + + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h new file mode 100644 index 000000000..874293894 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h @@ -0,0 +1,10 @@ +#ifndef INCLUDED_Z_BMQT_MESSAGEGUID +#define INCLUDED_Z_BMQT_MESSAGEGUID + +typedef struct z_bmqt_MessageGUID z_bmqt_MessageGUID; + +int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj); + +int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj); + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp new file mode 100644 index 000000000..fca2218f9 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp @@ -0,0 +1,20 @@ +#include +#include + + +const char* +z_bmqt_SessionEventType::toAscii(z_bmqt_SessionEventType::Enum value) +{ + using namespace BloombergLP; + + return bmqt::SessionEventType::toAscii(static_cast(value)); +} + +bool fromAscii(z_bmqt_SessionEventType::Enum* out, const char* str) +{ + using namespace BloombergLP; + bmqt::SessionEventType::Enum p; + bool result = bmqt::SessionEventType::fromAscii(&p, str); + *out = static_cast(p); + return result; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h new file mode 100644 index 000000000..0f2da805d --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h @@ -0,0 +1,67 @@ +#ifndef INCLUDED_Z_BMQT_SESSIONEVENTTYPE +#define INCLUDED_Z_BMQT_SESSIONEVENTTYPE + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +struct z_bmqt_SessionEventType { + // TYPES + enum Enum { + ec_ERROR = -1 // Generic error + , + ec_TIMEOUT = -2 // Time out of the operation + , + ec_CANCELED = -3 // The operation was canceled + , + ec_UNDEFINED = 0, + ec_CONNECTED = 1 // Session started + , + ec_DISCONNECTED = 2 // Session terminated + , + ec_CONNECTION_LOST = 3 // Lost connection to the broker + , + ec_RECONNECTED = 4 // Reconnected with the broker + , + ec_STATE_RESTORED = 5 // Client's state has been restored + , + ec_CONNECTION_TIMEOUT = 6 // The connection to broker timedOut + , + ec_QUEUE_OPEN_RESULT = 7 // Result of openQueue operation + , + ec_QUEUE_REOPEN_RESULT = 8 // Result of re-openQueue operation + , + ec_QUEUE_CLOSE_RESULT = 9 // Result of closeQueue operation + , + ec_SLOWCONSUMER_NORMAL = 10 // EventQueue is at lowWatermark + , + ec_SLOWCONSUMER_HIGHWATERMARK = 11 // EventQueue is at highWatermark + , + ec_QUEUE_CONFIGURE_RESULT = 12 // Result of configureQueue + , + ec_HOST_UNHEALTHY = 13 // Host has become unhealthy + , + ec_HOST_HEALTH_RESTORED = 14 // Host's health has been restored + , + ec_QUEUE_SUSPENDED = 15 // Queue has suspended operation + , + ec_QUEUE_RESUMED = 16 // Queue has resumed operation + }; + + static const char* toAscii(z_bmqt_SessionEventType::Enum value); + + /// Return true and fills the specified `out` with the enum value + /// corresponding to the specified `str`, if valid, or return false and + /// leave `out` untouched if `str` doesn't correspond to any value of + /// the enum. + static bool fromAscii(z_bmqt_SessionEventType::Enum* out, + const char* str); +}; + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/tutorials/CMakeLists.txt b/src/tutorials/CMakeLists.txt index 123679523..7409a5fe7 100644 --- a/src/tutorials/CMakeLists.txt +++ b/src/tutorials/CMakeLists.txt @@ -66,3 +66,4 @@ add_custom_target("tutorials") add_subdirectory("advanced") add_subdirectory("hello_world") add_subdirectory("subscriptions") +add_subdirectory("c_wrapper") \ No newline at end of file diff --git a/src/tutorials/c_wrapper/consumer.cpp b/src/tutorials/c_wrapper/consumer.cpp new file mode 100644 index 000000000..503903788 --- /dev/null +++ b/src/tutorials/c_wrapper/consumer.cpp @@ -0,0 +1,266 @@ +// Copyright 2014-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// consumer.cpp -*-C++-*- + +// This file is part of the BlazingMQ tutorial "Hello World". +// +// The simplest use case involves a Publisher task, a Consumer task, and a +// Message Broker. The Producer and/or the Consumer create a named queue in +// the Broker. The Producer pushes messages into the queue, and the consumer +// pulls them. Once a message has been consumed it can be removed from the +// queue. +// +// In essence the queue is a mailbox for messages to be sent to a Consumer. It +// allows decoupling the processing between the Producer and the Consumer: one +// of the tasks may be down without impacting the other, and the Consumer can +// process messages at a different pace than the Producer. + +// BMQ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// BDE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +// SYSTEM +#include + +using namespace BloombergLP; + +namespace { +// TYPES +using ManagedHandler = bslma::ManagedPtr; + +// CONSTANTS +const char k_QUEUE_URL[] = "bmq://bmq.test.mem.priority/test-queue"; + +// FUNCTIONS +bsl::function shutdownHandler; + +/// Handle the specified `signal` +void signalHandler(int signal) +{ + shutdownHandler(signal); +} + +// CLASSES + +/// Concrete implementation of an event handler. Note that the methods are +/// called on the session's own threads. +// class EventHandler : public bmqa::SessionEventHandler { +// private: +// // DATA +// bmqa::Session* d_session_p; // Pointer to session (held, not owned) + +// public: +// // MANIPULATORS +// void onMessageEvent(const bmqa::MessageEvent& messageEvent) +// BSLS_KEYWORD_OVERRIDE; +// // Process the specified 'messageEvent' received from the broker. + +// void onSessionEvent(const bmqa::SessionEvent& sessionEvent) +// BSLS_KEYWORD_OVERRIDE; +// // Process the specified 'sessionEvent' received from the broker. + +// void setSession(bmqa::Session* session); +// }; + +void onMessageEvent(const z_bmqa_MessageEvent* messageEvent) +// Handle the specified 'messageEvent' +{ + // Load a ConfirmEventBuilder from the session + bmqa::ConfirmEventBuilder confirmBuilder; + d_session_p->loadConfirmEventBuilder(&confirmBuilder); + + if (messageEvent.type() == bmqt::MessageEventType::e_PUSH) { + bmqa::MessageIterator msgIter = messageEvent.messageIterator(); + while (msgIter.nextMessage()) { + const bmqa::Message& msg = msgIter.message(); + bdlbb::Blob data; + int rc = msg.getData(&data); + if (rc == 0) { + bsl::cout << "Got message with GUID: " << msg.messageGUID() + << ", data:\n" + << bdlbb::BlobUtilHexDumper(&data) << "\n"; + } + else { + bsl::cerr << "Failed to decode message with GUID: " + << msg.messageGUID() << ", rc: " << rc << "\n"; + } + + rc = confirmBuilder.addMessageConfirmation(msg); + if (rc != 0) { + bsl::cerr << "Failed to add confirm message with GUID: " + << msg.messageGUID() << " to the builder, rc: " << rc + << "\n"; + } + } + + // Confirm reception of the messages so that it can be deleted from the + // queue. + + int rc = d_session_p->confirmMessages(&confirmBuilder); + if (rc != 0) { + bsl::cerr << "Failed to confirm " << confirmBuilder.messageCount() + << " messages" + << ", rc: " << rc; + + // Since 'Session::confirmMessages' failed, it would not have reset + // the 'builder'. So we reset it here. + + confirmBuilder.reset(); + } + } + else { + bsl::cerr << "Got unexpected event type: " << messageEvent.type() + << "\n"; + } +} + +void EventHandler::onSessionEvent(const bmqa::SessionEvent& sessionEvent) +// Handle the specified 'sessionEvent'. This method is executed in one of +// the *EVENT HANDLER* threads. +{ + bsl::cout << "Got session event: " << sessionEvent << "\n"; +} + +void EventHandler::setSession(bmqa::Session* session) +{ + d_session_p = session; +} + +} // close unnamed namespace + +//============================================================================= +// CONSUMER +//----------------------------------------------------------------------------- + +/// Open a queue with the specified `session`. The queue is created if it +/// does not exist already. Each queue is identified by a short URL +/// containing a namespace and a queue name. +static void consume(z_bmqa_Session* session) +{ + // bmqt::CorrelationId corrId(bmqt::CorrelationId::autoValue()); + z_bmqt_CorrelationId* corrId; + z_bmqt_CorrelationId__autoValue(&corrId); + z_bmqa_QueueId* queueId; + z_bmqa_OpenQueueStatus* status; + z_bmqa_QueueId__createFromCorrelationId(&queueId, corrId); + z_bmqa_Session__openQueueSync(session, queueId, k_QUEUE_URL, static_cast(bmqt::QueueFlags::e_READ), &status); + + if (!z_bmqa_OpenQueueStatus__toBool(status) || !z_bmqa_QueueId__isValid(queueId)) { + bsl::cerr << "Failed to open queue: '" << k_QUEUE_URL + << "', status: " << status << "\n"; + return; // RETURN + } + else { + bsl::cout << "Queue ['" << k_QUEUE_URL << "'] has been opened. " + << "Waiting for messages...\nPress Ctrl+C for shutdown\n"; + } + + bslmt::Mutex d_mx; + bslmt::Condition d_cv; + shutdownHandler = [&d_cv](int) { + d_cv.signal(); + }; + signal(SIGINT, signalHandler); + bslmt::LockGuard lock(&d_mx); + d_cv.wait(&d_mx); + + // Graceful shutdown by first synchronously shutting the flow of incoming + // messages and only then closing the queue. + // bmqt::QueueOptions options; + z_bmqt_QueueOptions* options; + z_bmqt_QueueOptions__create(&options); + z_bmqt_QueueOptions__setMaxUnconfirmedBytes(options, 0); + z_bmqt_QueueOptions__setMaxUnconfirmedMessages(options, 0); + z_bmqa_ConfigureQueueStatus* configureStatus; + z_bmqa_Session__configureQueueSync(session, queueId, options, 0, &configureStatus); + if (!z_bmqa_ConfigureQueueStatus__toBool(configureStatus)) { + // Error! Log something + bsl::cout << "Graceful shutdown of the queue failed: " + << bmqt::ConfigureQueueResult::Enum(z_bmqa_ConfigureQueueStatus__result(configureStatus)) + << " (" << configureStatus << ")\n"; + return; // RETURN + } + + // bmqa::CloseQueueStatus closeStatus = session->closeQueueSync(&queueId); + z_bmqa_CloseQueueStatus* closeStatus; + z_bmqa_Session__closeQueueSync(session, queueId, 0, &closeStatus); + if (!z_bmqa_CloseQueueStatus__toBool(closeStatus)) { + bsl::cerr << "Failed to close queue: '" << k_QUEUE_URL + << "', status: " << closeStatus << "\n"; + return; // RETURN + } + bsl::cerr << "Queue ['" << k_QUEUE_URL << "'] has been shut down " + << "gracefully and is now closed.\n"; +} + +//============================================================================= +// MAIN PROGRAM +//----------------------------------------------------------------------------- + +int main(BSLS_ANNOTATION_UNUSED int argc, + BSLS_ANNOTATION_UNUSED const char* argv[]) +{ + // Start a session with the message broker. This makes the SDK connect to + // the local broker by default, unless the 'Session' is created with an + // optional 'SessionOptions' object. + + EventHandler* eventHandler = new EventHandler(); + ManagedHandler eventHandlerMp(eventHandler); + bmqa::Session session(eventHandlerMp); + eventHandler->setSession(&session); + int rc = session.start(); + if (rc != 0) { + bsl::cerr << "Failed to start the session with the BlazingMQ broker" + << ", rc: " << bmqt::GenericResult::Enum(rc) << "\n"; + return rc; // RETURN + } + consume(&session); + session.stop(); + + return 0; +} diff --git a/src/tutorials/c_wrapper/producer.cpp b/src/tutorials/c_wrapper/producer.cpp new file mode 100644 index 000000000..99c6962a6 --- /dev/null +++ b/src/tutorials/c_wrapper/producer.cpp @@ -0,0 +1,101 @@ +#include +#include +#include +#include +#include +#include +#include + +const int K_QUEUE_ID = 1; +const char K_QUEUE_URI[] = "bmq://bmq.test.mem.priority/test-queue"; +const int K_NUM_MESSAGES = 5; + +enum QueueFlags { + e_ADMIN = (1 << 0) // The queue is opened in admin mode (Valid only + // for BlazingMQ admin tasks) + , + e_READ = (1 << 1) // The queue is opened for consuming messages + , + e_WRITE = (1 << 2) // The queue is opened for posting messages + , + e_ACK = (1 << 3) // Set to indicate interested in receiving + // 'ACK' events for all message posted +}; + + +void postEvent(const char* text, + z_bmqa_QueueId* queueId, + z_bmqa_Session* session){ + + z_bmqa_MessageEventBuilder* builder; + z_bmqa_MessageEventBuilder__create(&builder); + + z_bmqa_Session__loadMessageEventBuilder(session, &builder); + + z_bmqa_Message* message; + + z_bmqa_MessageEventBuilder__startMessage(builder, &message); + + z_bmqa_Message__setDataRef(message, text, (int)strlen(text)); + + z_bmqa_MessageEventBuilder__packMessage(builder, queueId); + + const z_bmqa_MessageEvent* messageEvent; + z_bmqa_MessageEventBuilder__messageEvent(builder, &messageEvent); + + z_bmqa_Session__post(session, messageEvent); + + z_bmqa_MessageEventBuilder__delete(&builder); +} + + +void produce(z_bmqa_Session* session){ + z_bmqa_QueueId* queueId; + z_bmqa_OpenQueueStatus* openStatus; + z_bmqa_CloseQueueStatus* closeStatus; + + + z_bmqa_QueueId__createFromNumeric(&queueId, K_QUEUE_ID); + z_bmqa_Session__openQueueSync(session, + queueId, + K_QUEUE_URI, + e_WRITE, + &openStatus); + + const char* messages[] = {"Hello world!", + "message 4", + "message 5", + "message 6", + "Good Bye!"}; + for(int idx = 0; idx < 5; ++idx){ + postEvent(messages[idx], queueId, session); + } + + z_bmqa_Session__closeQueueSync(session, queueId, 0, &closeStatus); + + z_bmqa_QueueId__delete(&queueId); +} + +int run_c_producer(){ + z_bmqa_Session* session; + z_bmqt_SessionOptions* options; + + z_bmqt_SessionOptions__create(&options); + z_bmqa_Session__create(&session, options); + + + //start the session + z_bmqa_Session__start(session, 1000); + + produce(session); + + //stop the session + z_bmqa_Session__stop(session); + + + z_bmqa_Session__delete(&session); + z_bmqt_SessionOptions__delete(&options); + + return 0; + +} From 0666ce9793e5d4bee4def68cb8f0a3f23ea7d917 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 23 Jan 2024 16:49:04 -0500 Subject: [PATCH 18/57] Add CMakeLists.txt for c_wrapper --- src/tutorials/c_wrapper/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/tutorials/c_wrapper/CMakeLists.txt diff --git a/src/tutorials/c_wrapper/CMakeLists.txt b/src/tutorials/c_wrapper/CMakeLists.txt new file mode 100644 index 000000000..875e43c2b --- /dev/null +++ b/src/tutorials/c_wrapper/CMakeLists.txt @@ -0,0 +1,4 @@ +# tutorial::c_wrapper +# --------------------- + +bmq_add_tutorial("c_wrapper") From a69e9783ecb7de09e19fe6cf4b1e3d89e63c8710 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Wed, 24 Jan 2024 14:17:29 -0500 Subject: [PATCH 19/57] Progress(2) --- src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 2 + .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp | 10 ++ .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.h | 24 +-- .../z_bmqa/z_bmqa_configurequeuestatus.cpp | 13 ++ .../z_bmqa/z_bmqa_configurequeuestatus.h | 2 + .../z_bmqa/z_bmqa_confirmeventbuilder.cpp | 71 +++++--- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 31 ++-- src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp | 10 +- src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 2 +- .../z_bmq/z_bmqa/z_bmqa_messageevent.cpp | 59 ++++++- src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h | 14 +- .../z_bmq/z_bmqa/z_bmqa_messageiterator.cpp | 2 + .../z_bmq/z_bmqa/z_bmqa_messageiterator.h | 2 +- .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp | 10 ++ .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.h | 2 + src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 68 ++++++-- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 18 ++- .../z_bmq/z_bmqa/z_bmqa_sessionevent.cpp | 46 ++++-- src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h | 3 + src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 1 + .../z_bmqt_compressionalgorithmtype.t.cpp | 144 +++++++++++++++++ .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 145 ++++++++++++----- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 2 + .../z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp | 20 +++ .../z_bmq/z_bmqt/z_bmqt_messageeventtype.h | 47 ++++++ .../z_bmq/z_bmqt/z_bmqt_messageguid.cpp | 31 ++++ src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h | 6 + .../z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 10 ++ src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h | 87 ++++++---- .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp | 2 +- src/tutorials/c_wrapper/consumer.cpp | 151 +++++++++++++----- src/tutorials/c_wrapper/producer.cpp | 4 +- 32 files changed, 835 insertions(+), 204 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index 89410832c..6cd84ac58 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -5,7 +5,9 @@ z_bmqa_event z_bmqa_message z_bmqa_messageevent z_bmqa_messageeventbuilder +z_bmqa_messageiterator z_bmqa_messageproperties z_bmqa_queueid z_bmqa_session +z_bmqa_sessionevent z_bmqa_openqueuestatus \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp index e3e312f61..80e9622a7 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp @@ -1,6 +1,16 @@ #include #include +int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** status_obj) { + using namespace BloombergLP; + + bmqa::CloseQueueStatus* status_p = reinterpret_cast(*status_obj); + delete status_p; + *status_obj = NULL; + + return 0; +} + int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** status_obj) { using namespace BloombergLP; diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h index ab47930d1..21b746a5f 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h @@ -1,8 +1,8 @@ #ifndef INCLUDED_Z_BMQA_CLOSEQUEUESTATUS #define INCLUDED_Z_BMQA_CLOSEQUEUESTATUS -#include #include +#include #if defined(__cplusplus) extern "C" { @@ -10,24 +10,28 @@ extern "C" { typedef struct z_bmqa_CloseQueueStatus z_bmqa_CloseQueueStatus; +int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** status_obj); + int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** status_obj); -int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, const z_bmqa_CloseQueueStatus* other); +int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, + const z_bmqa_CloseQueueStatus* other); int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** status_obj, - const z_bmqa_QueueId* queueId, - int result, - const char* errorDescription); + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription); -bool z_bmqa_CloseQueueStatus__toBool(const z_bmqa_CloseQueueStatus* status_obj); +bool z_bmqa_CloseQueueStatus__toBool( + const z_bmqa_CloseQueueStatus* status_obj); -int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj); +int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, + z_bmqa_QueueId const** queueId_obj); int z_bmqa_CloseQueueStatus__result(const z_bmqa_CloseQueueStatus* status_obj); -const char* z_bmqa_CloseQueueStatus__errorDescription(const z_bmqa_CloseQueueStatus* status_obj); - - +const char* z_bmqa_CloseQueueStatus__errorDescription( + const z_bmqa_CloseQueueStatus* status_obj); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp index 18be79a2d..bd641359e 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp @@ -1,6 +1,19 @@ #include #include +int z_bmqa_ConfigureQueueStatus__delete( + z_bmqa_ConfigureQueueStatus** status_obj) +{ + using namespace BloombergLP; + + bmqa::ConfigureQueueStatus* status_p = + reinterpret_cast(*status_obj); + delete status_p; + *status_obj = NULL; + + return 0; +} + int z_bmqa_ConfigureQueueStatus__create( z_bmqa_ConfigureQueueStatus** status_obj) { diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h index 2c0441770..b1482043b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h @@ -10,6 +10,8 @@ extern "C" { typedef struct z_bmqa_ConfigureQueueStatus z_bmqa_ConfigureQueueStatus; +int z_bmqa_ConfigureQueueStatus__delete(z_bmqa_ConfigureQueueStatus** status_obj); + int z_bmqa_ConfigureQueueStatus__create( z_bmqa_ConfigureQueueStatus** status_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp index bfa36f7c1..cdf3b4eec 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp @@ -1,18 +1,35 @@ -#include #include +#include +int z_bmqa_ConfirmEventBuilder__delete( + z_bmqa_ConfirmEventBuilder** builder_obj) +{ + using namespace BloombergLP; + + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(*builder_obj); + delete builder_p; + *builder_obj = NULL; + + return 0; +} -int z_bmqa_ConfirmEventBuilder__delete(z_bmqa_ConfirmEventBuilder const** builder_obj) { +int z_bmqa_ConfirmEventBuilder__deleteConst( + z_bmqa_ConfirmEventBuilder const** builder_obj) +{ using namespace BloombergLP; - const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(*builder_obj); + const bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(*builder_obj); delete builder_p; *builder_obj = NULL; return 0; } -int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj) { +int z_bmqa_ConfirmEventBuilder__create( + z_bmqa_ConfirmEventBuilder** builder_obj) +{ using namespace BloombergLP; bmqa::ConfirmEventBuilder* builder_p = new bmqa::ConfirmEventBuilder(); @@ -21,47 +38,63 @@ int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj) return 0; } -int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilder* builder_obj, - const z_bmqa_Message* message) { +int z_bmqa_ConfirmEventBuilder__addMessageConfirmation( + z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_Message* message) +{ using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); - const bmqa::Message* message_p = reinterpret_cast(message); + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder_obj); + const bmqa::Message* message_p = reinterpret_cast( + message); return builder_p->addMessageConfirmation(*message_p); } -int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie(z_bmqa_ConfirmEventBuilder* builder_obj, - const z_bmqa_MessageConfirmationCookie* cookie) { +int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie( + z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_MessageConfirmationCookie* cookie) +{ using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); - const bmqa::MessageConfirmationCookie* cookie_p = reinterpret_cast(cookie); + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder_obj); + const bmqa::MessageConfirmationCookie* cookie_p = + reinterpret_cast(cookie); return builder_p->addMessageConfirmation(*cookie_p); } -int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj) { +int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj) +{ using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder_obj); builder_p->reset(); return 0; } -int z_bmqa_ConfirmEventBuilder__messageCount(const z_bmqa_ConfirmEventBuilder* builder_obj) { +int z_bmqa_ConfirmEventBuilder__messageCount( + const z_bmqa_ConfirmEventBuilder* builder_obj) +{ using namespace BloombergLP; - const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder_obj); return builder_p->messageCount(); } -int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, z_bmqt_Blob const** blob_obj) { +int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, + z_bmqt_Blob const** blob_obj) +{ using namespace BloombergLP; - const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder_obj); const bdlbb::Blob* blob_p = &(builder_p->blob()); - *blob_obj = reinterpret_cast(blob_p); + *blob_obj = reinterpret_cast(blob_p); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index 9b91bfffc..cc17801c6 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -1,31 +1,42 @@ #ifndef INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER #define INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER -#include #include +#include #if defined(__cplusplus) extern "C" { #endif typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; -typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; +typedef struct z_bmqa_MessageConfirmationCookie + z_bmqa_MessageConfirmationCookie; + +int z_bmqa_ConfirmEventBuilder__delete( + z_bmqa_ConfirmEventBuilder** builder_obj); -int z_bmqa_ConfirmEventBuilder__delete(z_bmqa_ConfirmEventBuilder** builder_obj); +int z_bmqa_ConfirmEventBuilder__deleteConst( + z_bmqa_ConfirmEventBuilder const** builder_obj); -int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj); +int z_bmqa_ConfirmEventBuilder__create( + z_bmqa_ConfirmEventBuilder** builder_obj); -int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilder* builder_obj, - const z_bmqa_Message* message); +int z_bmqa_ConfirmEventBuilder__addMessageConfirmation( + z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_Message* message); -int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie(z_bmqa_ConfirmEventBuilder* builder_obj, - const z_bmqa_MessageConfirmationCookie* cookie); +int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie( + z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_MessageConfirmationCookie* cookie); int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj); -int z_bmqa_ConfirmEventBuilder__messageCount(const z_bmqa_ConfirmEventBuilder* builder_obj); +int z_bmqa_ConfirmEventBuilder__messageCount( + const z_bmqa_ConfirmEventBuilder* builder_obj); -int z_bmqa_ConfirmEventBuilder__blob(const z_bmqa_ConfirmEventBuilder* builder_obj, z_bmqt_Blob const** blob_obj); +int z_bmqa_ConfirmEventBuilder__blob( + const z_bmqa_ConfirmEventBuilder* builder_obj, + z_bmqt_Blob const** blob_obj); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp index 73d9cfcb5..3b6b47597 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -247,16 +247,16 @@ int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, char** buffer) const bmqa::Message* message_p = reinterpret_cast( message_obj); - bdlbb::Blob data; - message_p->getData(&data); + bdlbb::Blob data; + int rc = message_p->getData(&data); bsl::stringstream ss; ss << bdlbb::BlobUtilHexDumper(&data); - bsl::string data_str = ss.str(); - *buffer = new char[data_str.length()+1]; + bsl::string data_str = ss.str(); + *buffer = new char[data_str.length() + 1]; (*buffer)[data_str.length()] = '\0'; strcpy(*buffer, data_str.c_str()); - return 0; + return rc; } int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj) diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index 7b1095226..6856e31d4 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -87,7 +87,7 @@ int z_bmqa_Message__ackStatus(const z_bmqa_Message* message_obj); // int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, z_bdlbb_Blob* // blob); -int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, void** buffer); +int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, char** buffer); int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp index 2b8b1d2cd..8c48a98eb 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp @@ -1,22 +1,67 @@ -#include #include +#include +#include +#include -int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj) { +int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj) +{ using namespace BloombergLP; - bmqa::MessageEvent* event_p = reinterpret_cast(*event_obj); + bmqa::MessageEvent* event_p = reinterpret_cast( + *event_obj); delete event_p; *event_obj = NULL; return 0; } -int z_bmqa_MessageEvent__deleteConst(z_bmqa_MessageEvent const** event_obj) { +int z_bmqa_MessageEvent__create(z_bmqa_MessageEvent** event_obj) +{ using namespace BloombergLP; - const bmqa::MessageEvent* event_p = reinterpret_cast(*event_obj); - delete event_p; - *event_obj = NULL; + bmqa::MessageEvent* event_p = new bmqa::MessageEvent(); + *event_obj = reinterpret_cast(event_p); + + return 0; +} + +int z_bmqa_MessageEvent__messageIterator(const z_bmqa_MessageEvent* event_obj, + z_bmqa_MessageIterator** iterator_obj) +{ + using namespace BloombergLP; + const bmqa::MessageEvent* event_p = + reinterpret_cast(event_obj); + bmqa::MessageIterator* iterator_p = new bmqa::MessageIterator( + event_p->messageIterator()); + *iterator_obj = reinterpret_cast(iterator_p); + + return 0; +} + +z_bmqt_MessageEventType::Enum +z_bmqa_MessageEvent__type(const z_bmqa_MessageEvent* event_obj) +{ + using namespace BloombergLP; + + const bmqa::MessageEvent* event_p = + reinterpret_cast(event_obj); + return static_cast(event_p->type()); +} + +int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* event_obj, + char** out) +{ + using namespace BloombergLP; + + const bmqa::MessageEvent* event_p = + reinterpret_cast(event_obj); + bsl::ostringstream ss; + event_p->print(ss); + bsl::string out_str = ss.str(); + + *out = new char[out_str.length() + 1]; + (*out)[out_str.length()] = '\0'; + strcpy(*out, out_str.c_str()); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h index fc8ddd9a4..c4ac36a6a 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h @@ -1,6 +1,9 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEEVENT #define INCLUDED_Z_BMQA_MESSAGEEVENT +#include +#include + #if defined(__cplusplus) extern "C" { #endif @@ -9,7 +12,16 @@ typedef struct z_bmqa_MessageEvent z_bmqa_MessageEvent; int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj); -int z_bmqa_MessageEvent__deleteConst(z_bmqa_MessageEvent const** event_obj); +int z_bmqa_MessageEvent__create(z_bmqa_MessageEvent** event_obj); + +int z_bmqa_MessageEvent__messageIterator( + const z_bmqa_MessageEvent* event_obj, + z_bmqa_MessageIterator** iterator_obj); + +z_bmqt_MessageEventType::Enum z_bmqa_MessageEvent__type(const z_bmqa_MessageEvent* event_obj); + +int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* event_obj, + char** out); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp index a16d67209..abde7439f 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp @@ -48,6 +48,8 @@ int z_bmqa_MessageIterator__message( reinterpret_cast(messageIterator_obj); const z_bmqa_Message* message_p = reinterpret_cast( &messageIterator_p->message()); + + *message_obj = reinterpret_cast(message_p); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h index 6c6f6b6e2..72cbea622 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h @@ -20,7 +20,7 @@ bool z_bmqa_MessageIterator__nextMessage( z_bmqa_MessageIterator* messageIterator_obj); int z_bmqa_MessageIterator__message( - z_bmqa_MessageIterator* messageIterator_obj, + const z_bmqa_MessageIterator* messageIterator_obj, z_bmqa_Message const** message_obj); #if defined(__cplusplus) diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp index 6577aa84d..1c8cbaf3a 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp @@ -1,6 +1,16 @@ #include #include +int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj) { + using namespace BloombergLP; + + bmqa::OpenQueueStatus* status_p = reinterpret_cast(*status_obj); + delete status_p; + *status_obj = NULL; + + return 0; +} + int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) { using namespace BloombergLP; diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h index 6a75bbd84..a6b1fbb7c 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h @@ -10,6 +10,8 @@ extern "C" { typedef struct z_bmqa_OpenQueueStatus z_bmqa_OpenQueueStatus; +int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj); + int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj); int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_OpenQueueStatus* other); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 4c165a0b6..804426cbf 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -8,10 +9,19 @@ z_bmqa_CustomSessionEventHandler::z_bmqa_CustomSessionEventHandler( z_bmqa_OnSessionEventCb onSessionEventCb, - z_bmqa_OnMessageEventCb onMessageEventCb) + z_bmqa_OnMessageEventCb onMessageEventCb, + uint64_t mSize) { + this->mSize = mSize; this->onSessionEventCb = onSessionEventCb; this->onMessageEventCb = onMessageEventCb; + + if (mSize != 0) { + data = (void*)(new char[mSize]); + } + else { + data = NULL; + } } z_bmqa_CustomSessionEventHandler::~z_bmqa_CustomSessionEventHandler() @@ -55,26 +65,31 @@ void z_bmqa_CustomSessionEventHandler::tryLock() int z_bmqa_SessionEventHandler__create( z_bmqa_SessionEventHandler** eventHandler_obj, z_bmqa_OnSessionEventCb onSessionEventCb, - z_bmqa_OnMessageEventCb onMessageEventCb) + z_bmqa_OnMessageEventCb onMessageEventCb, + uint64_t dataSize) { using namespace BloombergLP; z_bmqa_CustomSessionEventHandler* eventHandler_p = new z_bmqa_CustomSessionEventHandler(onSessionEventCb, - onMessageEventCb); + onMessageEventCb, + dataSize); *eventHandler_obj = reinterpret_cast( eventHandler_p); ; return 0; } -int z_bmqa_SessionEventHandler__delete( - z_bmqa_SessionEventHandler** eventHandler_obj) +int z_bmqa_SessionEventHandler__getData( + z_bmqa_SessionEventHandler* eventHandler_obj, + void** buffer) { + using namespace BloombergLP; + z_bmqa_CustomSessionEventHandler* eventHandler_p = - reinterpret_cast(*eventHandler_obj); - delete eventHandler_p; - *eventHandler_obj = NULL; + reinterpret_cast(eventHandler_obj); + + *buffer = eventHandler_p->getData(); return 0; } @@ -192,22 +207,22 @@ int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj) } int z_bmqa_Session__loadMessageEventBuilder( - z_bmqa_Session* session_obj, - z_bmqa_MessageEventBuilder** builder) + z_bmqa_Session* session_obj, + z_bmqa_MessageEventBuilder* builder) { using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); bmqa::MessageEventBuilder* builder_p = - reinterpret_cast(*builder); + reinterpret_cast(builder); session_p->loadMessageEventBuilder(builder_p); return 0; } int z_bmqa_Session__loadConfirmEventBuilder( - z_bmqa_Session* session_obj, - z_bmqa_ConfirmEventBuilder** builder) + z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder* builder) { using namespace BloombergLP; @@ -312,3 +327,30 @@ int z_bmqa_Session__post(z_bmqa_Session* session_obj, session_p->post(*event_p); return 0; } + +// int z_bmqa_Session__confirmMessage(z_bmqa_Session* session_obj, +// const z_bmqa_Message* message) +// { +// using namespace BloombergLP; +// bmqa::Session* session_p = +// reinterpret_cast(session_obj); +// } + +// int z_bmqa_Session__confirmMessageWithCookie( +// z_bmqa_Session* session_obj, +// const z_bmqa_MessageConfirmationCookie* cookie) +// { +// using namespace BloombergLP; +// bmqa::Session* session_p = +// reinterpret_cast(session_obj); +// } + +int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder* builder) +{ + using namespace BloombergLP; + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder); + return session_p->confirmMessages(builder_p); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 8abb39a11..5742cea1a 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -31,10 +31,11 @@ typedef void (*z_bmqa_OnMessageEventCb)( int z_bmqa_SessionEventHandler__create( z_bmqa_SessionEventHandler** eventHandler_obj, z_bmqa_OnSessionEventCb onSessionEvent, - z_bmqa_OnMessageEventCb onMessageEvent); + z_bmqa_OnMessageEventCb onMessageEvent, + uint64_t dataSize); -int z_bmqa_SessionEventHandler__delete( - z_bmqa_SessionEventHandler** eventHandler_obj); +int z_bmqa_SessionEventHandler__getData( + z_bmqa_SessionEventHandler* eventHandler_obj, void** buffer); typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; @@ -61,12 +62,12 @@ int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj); int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj); int z_bmqa_Session__loadMessageEventBuilder( - z_bmqa_Session* session_obj, - z_bmqa_MessageEventBuilder** builder); + z_bmqa_Session* session_obj, + z_bmqa_MessageEventBuilder* builder); int z_bmqa_Session__loadConfirmEventBuilder( - z_bmqa_Session* session_obj, - z_bmqa_ConfirmEventBuilder** builder); + z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder* builder); int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer); @@ -138,7 +139,8 @@ class z_bmqa_CustomSessionEventHandler public: z_bmqa_CustomSessionEventHandler(z_bmqa_OnSessionEventCb onSessionEventCb, - z_bmqa_OnMessageEventCb onMessageEventCb); + z_bmqa_OnMessageEventCb onMessageEventCb, + uint64_t mSize); ~z_bmqa_CustomSessionEventHandler(); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp index a166350d3..05c58c232 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp @@ -26,6 +26,7 @@ int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** event_obj, const bmqa::SessionEvent* other_p = reinterpret_cast(other); bmqa::SessionEvent* event_p = new bmqa::SessionEvent(*other_p); + *event_obj = reinterpret_cast(event_p); return 0; } @@ -46,9 +47,13 @@ int z_bmqa_SessionEvent__correlationId( { using namespace BloombergLP; - const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(&(event_p->correlationId())); - *correlationId_obj = reinterpret_cast(correlationId_p); + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast( + &(event_p->correlationId())); + *correlationId_obj = reinterpret_cast( + correlationId_p); return 0; } @@ -57,10 +62,11 @@ int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* event_obj, z_bmqa_QueueId** queueId_obj) { using namespace BloombergLP; - - const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); bmqa::QueueId* queueId_p = new bmqa::QueueId(event_p->queueId()); - *queueId_obj = reinterpret_cast(queueId_p); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } @@ -68,8 +74,9 @@ int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* event_obj, int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* event_obj) { using namespace BloombergLP; - - const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); return event_p->statusCode(); } @@ -77,7 +84,26 @@ const char* z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* event_obj) { using namespace BloombergLP; - - const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); return event_p->errorDescription().c_str(); +} + +int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* event_obj, + char** out) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); + bsl::ostringstream ss; + event_p->print(ss); + bsl::string out_str = ss.str(); + + *out = new char[out_str.length() + 1]; + (*out)[out_str.length()] = '\0'; + strcpy(*out, out_str.c_str()); + + return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h index 7f504a058..e20f0b425 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h @@ -34,6 +34,9 @@ int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* event_obj); const char* z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* event_obj); +int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* event_obj, + char** out); + #if defined(__cplusplus) } #endif diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem index d463eeaf5..6cb44e131 100644 --- a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -1,5 +1,6 @@ z_bmqt_compressionalgorithmtype z_bmqt_correlationid +z_bmqt_messageeventtype z_bmqt_messageguid z_bmqt_queueoptions z_bmqt_sessioneventtype diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp new file mode 100644 index 000000000..594d96190 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp @@ -0,0 +1,144 @@ +// Copyright 2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bmqt_compressionalgorithmtype.t.cpp +#include + +// MWC +#include + +// TEST DRIVER +#include + +// BDE +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TEST HELPERS UTILITY +// ---------------------------------------------------------------------------- +namespace { + +struct PrintTestData { + int d_line; + int d_type; + const char* d_expected; +}; + +} // close unnamed namespace + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +template +static void printEnumHelper(ARRAY (&data)[SIZE]) +{ + for (size_t idx = 0; idx < SIZE; ++idx) { + const PrintTestData& test = data[idx]; + + PVVV("Line [" << test.d_line << "]"); + + mwcu::MemOutStream out(s_allocator_p); + mwcu::MemOutStream expected(s_allocator_p); + + typedef typename ENUM_TYPE::Enum T; + + T obj = static_cast(test.d_type); + + expected << test.d_expected; + + out.setstate(bsl::ios_base::badbit); + ENUM_TYPE::print(out, obj, 0, -1); + + ASSERT_EQ(out.str(), ""); + + out.clear(); + ENUM_TYPE::print(out, obj, 0, -1); + + ASSERT_EQ(out.str(), expected.str()); + + out.reset(); + out << obj; + + ASSERT_EQ(out.str(), expected.str()); + } +} + +static void test1_enumPrint() +// ------------------------------------------------------------------------ +// ENUM LAYOUT +// +// Concerns: +// Check that enums print methods work correct +// +// Plan: +// 1. For every type of enum for which there is a corresponding stream +// operator and print method check that layout of each enum value. +// equal to expected value: +// 1.1. Check layout of stream operator +// 1.2. Check layout of print method +// 2. Check that layout for invalid value is equal to expected. +// +// Testing: +// CompressionAlgorithmType::print +// operator<<(bsl::ostream&, CompressionAlgorithmType::Enum) +// ------------------------------------------------------------------------ +{ + mwctst::TestHelper::printTestName("ENUM LAYOUT"); + + PV("Test bmqt::CompressionAlgorithmType printing"); + { + BSLMF_ASSERT(z_bmqt_CompressionAlgorithmType::k_LOWEST_SUPPORTED_TYPE == + z_bmqt_CompressionAlgorithmType::ec_NONE); + + BSLMF_ASSERT( + z_bmqt_CompressionAlgorithmType::k_HIGHEST_SUPPORTED_TYPE == + z_bmqt_CompressionAlgorithmType::ec_ZLIB); + + PrintTestData k_DATA[] = { + {L_, z_bmqt_CompressionAlgorithmType::ec_UNKNOWN, "UNKNOWN"}, + {L_, z_bmqt_CompressionAlgorithmType::ec_NONE, "NONE"}, + {L_, z_bmqt_CompressionAlgorithmType::ec_ZLIB, "ZLIB"}, + {L_, + z_bmqt_CompressionAlgorithmType::k_HIGHEST_SUPPORTED_TYPE + 1, + "(* UNKNOWN *)"}}; + + printEnumHelper(k_DATA); + } +} + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 1: test1_enumPrint(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +} diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp index 579bc2da0..dddf4fc8d 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -1,125 +1,184 @@ #include #include -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj) { +int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(); - *correlationId_obj = reinterpret_cast(correlationId_p); + bmqt::CorrelationId* correlationId_p = + reinterpret_cast(*correlationId_obj); + delete correlationId_p; + *correlationId_obj = NULL; + return 0; } -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric) { +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(numeric); - *correlationId_obj = reinterpret_cast(correlationId_p); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(); + *correlationId_obj = reinterpret_cast( + correlationId_p); return 0; } -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, void* pointer) { +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, + int64_t numeric) +{ + using namespace BloombergLP; + + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(numeric); + *correlationId_obj = reinterpret_cast( + correlationId_p); + return 0; +} + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, + void* pointer) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(pointer); - *correlationId_obj = reinterpret_cast(correlationId_p); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(pointer); + *correlationId_obj = reinterpret_cast( + correlationId_p); return 0; } -int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); correlationId_p->makeUnset(); return 0; } -int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlationId_obj, int64_t numeric) { +int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlationId_obj, + int64_t numeric) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); correlationId_p->setNumeric(numeric); return 0; } -int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlationId_obj, void* pointer) { +int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlationId_obj, + void* pointer) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - + bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); correlationId_p->setPointer(pointer); return 0; } -int z_bmqt_CorrelationId__isUnset(const z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__isUnset( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->isUnset(); } -int z_bmqt_CorrelationId__isNumeric(const z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__isNumeric( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->isNumeric(); } -int z_bmqt_CorrelationId__isPointer(const z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__isPointer( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->isPointer(); } -int z_bmqt_CorrelationId__isSharedPtr(const z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__isSharedPtr( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->isSharedPtr(); } -int z_bmqt_CorrelationId__isAutoValue(const z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__isAutoValue( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->isAutoValue(); } -int64_t z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlationId_obj) { +int64_t +z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->theNumeric(); } -void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlationId_obj) { +void* z_bmqt_CorrelationId__thePointer( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->thePointer(); } -CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj) { +CorrelationId_Type +z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - - switch(correlationId_p->type()) { - case bmqt::CorrelationId::Type::e_NUMERIC: return CorrelationId_Type::ec_NUMERIC; - case bmqt::CorrelationId::Type::e_POINTER: return CorrelationId_Type::ec_POINTER; - case bmqt::CorrelationId::Type::e_SHARED_PTR: return CorrelationId_Type::ec_SHARED_PTR; - case bmqt::CorrelationId::Type::e_AUTO_VALUE: return CorrelationId_Type::ec_AUTO_VALUE; - case bmqt::CorrelationId::Type::e_UNSET: return CorrelationId_Type::ec_UNSET; - default: break; + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); + + switch (correlationId_p->type()) { + case bmqt::CorrelationId::Type::e_NUMERIC: + return CorrelationId_Type::ec_NUMERIC; + case bmqt::CorrelationId::Type::e_POINTER: + return CorrelationId_Type::ec_POINTER; + case bmqt::CorrelationId::Type::e_SHARED_PTR: + return CorrelationId_Type::ec_SHARED_PTR; + case bmqt::CorrelationId::Type::e_AUTO_VALUE: + return CorrelationId_Type::ec_AUTO_VALUE; + case bmqt::CorrelationId::Type::e_UNSET: + return CorrelationId_Type::ec_UNSET; + default: break; } return CorrelationId_Type::ec_CORRELATIONID_ERROR; } -int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj) { +int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(bmqt::CorrelationId::autoValue()); - *correlationId_obj = reinterpret_cast(correlationId_p); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId( + bmqt::CorrelationId::autoValue()); + *correlationId_obj = reinterpret_cast( + correlationId_p); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h index 1b306a17c..c123d3ff2 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -25,6 +25,8 @@ enum CorrelationId_Type { ec_CORRELATIONID_ERROR // error }; +int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj); + int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); int z_bmqt_CorrelationId__createFromNumeric(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric); diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp new file mode 100644 index 000000000..8c658ed48 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp @@ -0,0 +1,20 @@ +#include +#include + +const char* +z_bmqt_MessageEventType::toAscii(z_bmqt_MessageEventType::Enum value) +{ + using namespace BloombergLP; + + return bmqt::MessageEventType::toAscii( + static_cast(value)); +} + +bool z_bmqt_MessageEventType::fromAscii(z_bmqt_MessageEventType::Enum* out, const char* str) +{ + using namespace BloombergLP; + bmqt::MessageEventType::Enum p; + bool result = bmqt::MessageEventType::fromAscii(&p, str); + *out = static_cast(p); + return result; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h new file mode 100644 index 000000000..0a608d642 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h @@ -0,0 +1,47 @@ +#ifndef INCLUDED_Z_BMQA_z_bmqt_MESSAGEEVENTTYPE +#define INCLUDED_Z_BMQA_MESSAGEEVENTTYPE + +#if defined(__cplusplus) +extern "C" { +#endif + +struct z_bmqt_MessageEventType { + // TYPES + enum Enum { ec_UNDEFINED = 0, ec_PUT = 1, ec_PUSH = 2, ec_ACK = 3 }; + + // PUBLIC CONSTANTS + + /// NOTE: This value must always be equal to the lowest type in the + /// enum because it is being used as a lower bound to verify that an + /// z_bmqt_MessageEventType field is a supported type. + static const int k_LOWEST_SUPPORTED_EVENT_TYPE = ec_PUT; + + /// NOTE: This value must always be equal to the highest type in the + /// enum because it is being used as an upper bound to verify an + /// z_bmqt_MessageEventType field is a supported type. + static const int k_HIGHEST_SUPPORTED_EVENT_TYPE = ec_ACK; + + // CLASS METHODS + /// Return the non-modifiable string representation corresponding to the + /// specified enumeration `value`, if it exists, and a unique (error) + /// string otherwise. The string representation of `value` matches its + /// corresponding enumerator name with the `BMQT_` prefix elided. Note + /// that specifying a `value` that does not match any of the enumerators + /// will result in a string representation that is distinct from any of + /// those corresponding to the enumerators, but is otherwise + /// unspecified. + static const char* toAscii(z_bmqt_MessageEventType::Enum value); + + /// Return true and fills the specified `out` with the enum value + /// corresponding to the specified `str`, if valid, or return false and + /// leave `out` untouched if `str` doesn't correspond to any value of + /// the enum. + static bool fromAscii(z_bmqt_MessageEventType::Enum* out, + const char* str); +}; + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp index 61d0fcd2a..6f1bb340e 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj) @@ -13,6 +15,18 @@ int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj) return 0; } +int z_bmqt_MessageGUID__deleteConst(z_bmqt_MessageGUID const** messageGUID_obj) +{ + using namespace BloombergLP; + + const bmqt::MessageGUID* messageGUID_p = + reinterpret_cast(*messageGUID_obj); + delete messageGUID_p; + *messageGUID_obj = NULL; + + return 0; +} + int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj) { using namespace BloombergLP; @@ -20,5 +34,22 @@ int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj) bmqt::MessageGUID* messageGUID_p = new bmqt::MessageGUID(); *messageGUID_obj = reinterpret_cast(messageGUID_p); + return 0; +} + +int z_bmqt_MessageGUID__toString(const z_bmqt_MessageGUID* messageGUID_obj, + char** out) +{ + using namespace BloombergLP; + + bsl::ostringstream ss; + const bmqt::MessageGUID* messageGUID_p = + reinterpret_cast(messageGUID_obj); + messageGUID_p->print(ss); + bsl::string out_str = ss.str(); + *out = new char[out_str.length() + 1]; + (*out)[out_str.length()] = '\0'; + strcpy(*out, out_str.c_str()); + return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h index 874293894..9f845ac79 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h @@ -5,6 +5,12 @@ typedef struct z_bmqt_MessageGUID z_bmqt_MessageGUID; int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj); +int z_bmqt_MessageGUID__deleteConst( + z_bmqt_MessageGUID const** messageGUID_obj); + int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj); +int z_bmqt_MessageGUID__toString(const z_bmqt_MessageGUID* messageGUID_obj, + char** out); + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp index d03311cd6..d275357b4 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -4,6 +4,16 @@ #include #include +int z_bmqt_QueueOptions__delete(z_bmqt_QueueOptions** queueOptions_obj) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(*queueOptions_obj); + delete queueOptions_p; + *queueOptions_obj = NULL; + + return 0; +} + int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj) { using namespace BloombergLP; bmqt::QueueOptions* queueOptions_p = new bmqt::QueueOptions; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h index 997e9624e..3708a1d05 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -2,8 +2,8 @@ #define INCLUDED_Z_BMQT_QUEUEOPTIONS #include -#include #include +#include #if defined(__cplusplus) extern "C" { @@ -13,60 +13,89 @@ typedef struct z_bmqt_QueueOptions z_bmqt_QueueOptions; typedef struct z_bmqt_HandleAndSubscrption { z_bmqt_SubscriptionHandle* handle; - z_bmqt_Subscription* subscrption; + z_bmqt_Subscription* subscrption; } z_bmqt_HandleAndSubscrption; typedef struct z_bmqt_SubscrptionsSnapshot { - uint64_t size; + uint64_t size; z_bmqt_HandleAndSubscrption* subscriptions; } z_bmqt_SubscrptionsSnapshot; -int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj); - -int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other); - +int z_bmqt_QueueOptions__delete(z_bmqt_QueueOptions** queueOptions_obj); -//Modifiers -int z_bmqt_QueueOptions__setMaxUnconfirmedMessages(z_bmqt_QueueOptions* queueOptions_obj, int value); +int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj); -int z_bmqt_QueueOptions__setMaxUnconfirmedBytes(z_bmqt_QueueOptions* queueOptions_obj, int value); +int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, + const z_bmqt_QueueOptions* other); -int z_bmqt_QueueOptions__setConsumerPriority(z_bmqt_QueueOptions* queueOptions_obj, int value); +// Modifiers +int z_bmqt_QueueOptions__setMaxUnconfirmedMessages( + z_bmqt_QueueOptions* queueOptions_obj, + int value); -int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOptions_obj, int value); +int z_bmqt_QueueOptions__setMaxUnconfirmedBytes( + z_bmqt_QueueOptions* queueOptions_obj, + int value); -int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other); +int z_bmqt_QueueOptions__setConsumerPriority( + z_bmqt_QueueOptions* queueOptions_obj, + int value); -//Pass in an an uninitialized char** for errorDescription, the pointer will be set to NULL if there is no error, otherwise it will set to an appropriately sized string that is allocated on the heap -int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj, char** errorDescription, const z_bmqt_SubscriptionHandle* handle, const z_bmqt_Subscription* subscription); +int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth( + z_bmqt_QueueOptions* queueOptions_obj, + int value); -int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_SubscriptionHandle* handle); +int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, + const z_bmqt_QueueOptions* other); -int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); +// Pass in an an uninitialized char** for errorDescription, the pointer will be +// set to NULL if there is no error, otherwise it will set to an appropriately +// sized string that is allocated on the heap +int z_bmqt_QueueOptions__addOrUpdateSubscription( + z_bmqt_QueueOptions* queueOptions_obj, + char** errorDescription, + const z_bmqt_SubscriptionHandle* handle, + const z_bmqt_Subscription* subscription); -//Accessors -int z_bmqt_QueueOptions__maxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__removeSubscription( + z_bmqt_QueueOptions* queueOptions_obj, + const z_bmqt_SubscriptionHandle* handle); -int z_bmqt_QueueOptions__maxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__removeAllSubscriptions( + z_bmqt_QueueOptions* queueOptions_obj); -int z_bmqt_QueueOptions__consumerPriority(const z_bmqt_QueueOptions* queueOptions_obj); +// Accessors +int z_bmqt_QueueOptions__maxUnconfirmedMessages( + const z_bmqt_QueueOptions* queueOptions_obj); -bool z_bmqt_QueueOptions__suspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__maxUnconfirmedBytes( + const z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__consumerPriority( + const z_bmqt_QueueOptions* queueOptions_obj); -bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__suspendsOnBadHostHealth( + const z_bmqt_QueueOptions* queueOptions_obj); -bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages( + const z_bmqt_QueueOptions* queueOptions_obj); -bool z_bmqt_QueueOptions__hasConsumerPriority(const z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes( + const z_bmqt_QueueOptions* queueOptions_obj); -bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__hasConsumerPriority( + const z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth( + const z_bmqt_QueueOptions* queueOptions_obj); -//Experimental (Modifiers) -bool z_bmqt_QueueOptions__loadSubscription(const z_bmqt_QueueOptions* queueOptions_obj); +// Experimental (Modifiers) +bool z_bmqt_QueueOptions__loadSubscription( + const z_bmqt_QueueOptions* queueOptions_obj); -int z_bmqt_QueueOptions__loadSubscriptions(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_SubscrptionsSnapshot* snapshot); +int z_bmqt_QueueOptions__loadSubscriptions( + const z_bmqt_QueueOptions* queueOptions_obj, + z_bmqt_SubscrptionsSnapshot* snapshot); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp index fca2218f9..b99e51a99 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp @@ -10,7 +10,7 @@ z_bmqt_SessionEventType::toAscii(z_bmqt_SessionEventType::Enum value) return bmqt::SessionEventType::toAscii(static_cast(value)); } -bool fromAscii(z_bmqt_SessionEventType::Enum* out, const char* str) +bool z_bmqt_SessionEventType::fromAscii(z_bmqt_SessionEventType::Enum* out, const char* str) { using namespace BloombergLP; bmqt::SessionEventType::Enum p; diff --git a/src/tutorials/c_wrapper/consumer.cpp b/src/tutorials/c_wrapper/consumer.cpp index 503903788..c4ff8b14d 100644 --- a/src/tutorials/c_wrapper/consumer.cpp +++ b/src/tutorials/c_wrapper/consumer.cpp @@ -58,11 +58,12 @@ #include #include -#include -#include +#include #include -#include #include +#include +#include +#include // SYSTEM #include @@ -107,68 +108,95 @@ void signalHandler(int signal) // void setSession(bmqa::Session* session); // }; -void onMessageEvent(const z_bmqa_MessageEvent* messageEvent) +void onMessageEvent(const z_bmqa_MessageEvent* messageEvent, void* data) // Handle the specified 'messageEvent' { // Load a ConfirmEventBuilder from the session - bmqa::ConfirmEventBuilder confirmBuilder; - d_session_p->loadConfirmEventBuilder(&confirmBuilder); - - if (messageEvent.type() == bmqt::MessageEventType::e_PUSH) { - bmqa::MessageIterator msgIter = messageEvent.messageIterator(); - while (msgIter.nextMessage()) { - const bmqa::Message& msg = msgIter.message(); - bdlbb::Blob data; - int rc = msg.getData(&data); + z_bmqa_Session* session = *(static_cast(data)); + z_bmqa_ConfirmEventBuilder* confirmBuilder; + z_bmqa_ConfirmEventBuilder__create(&confirmBuilder); + + z_bmqa_Session__loadConfirmEventBuilder(session, confirmBuilder); + if (z_bmqa_MessageEvent__type(messageEvent) == + z_bmqt_MessageEventType::ec_PUSH) { + z_bmqa_MessageIterator* msgIter; + z_bmqa_MessageEvent__messageIterator(messageEvent, &msgIter); + while (z_bmqa_MessageIterator__nextMessage(msgIter)) { + const z_bmqa_Message* msg; + z_bmqa_MessageIterator__message(msgIter, &msg); + char* data; + int rc = z_bmqa_Message__getData(msg, &data); + + const z_bmqt_MessageGUID* messageGUID; + z_bmqa_Message__messageGUID(msg, &messageGUID); + char* messageGUID_str; + z_bmqt_MessageGUID__toString(messageGUID, &messageGUID_str); if (rc == 0) { - bsl::cout << "Got message with GUID: " << msg.messageGUID() - << ", data:\n" - << bdlbb::BlobUtilHexDumper(&data) << "\n"; + bsl::cout << "Got message with GUID: " + << bsl::string(messageGUID_str) << ", data:\n" + << bsl::string(data) << "\n"; } else { bsl::cerr << "Failed to decode message with GUID: " - << msg.messageGUID() << ", rc: " << rc << "\n"; + << bsl::string(messageGUID_str) << ", rc: " << rc + << "\n"; } - rc = confirmBuilder.addMessageConfirmation(msg); + rc = z_bmqa_ConfirmEventBuilder__addMessageConfirmation( + confirmBuilder, + msg); if (rc != 0) { bsl::cerr << "Failed to add confirm message with GUID: " - << msg.messageGUID() << " to the builder, rc: " << rc - << "\n"; + << bsl::string(messageGUID_str) + << " to the builder, rc: " << rc << "\n"; } + + delete[] messageGUID_str; } + // z_bmqa_MessageIterator__delete(&msgIter); + // Confirm reception of the messages so that it can be deleted from the // queue. - int rc = d_session_p->confirmMessages(&confirmBuilder); + // int rc = d_session_p->confirmMessages(&confirmBuilder); + int rc = z_bmqa_Session__confirmMessages(session, confirmBuilder); if (rc != 0) { - bsl::cerr << "Failed to confirm " << confirmBuilder.messageCount() + bsl::cerr << "Failed to confirm " + << z_bmqa_ConfirmEventBuilder__messageCount( + confirmBuilder) << " messages" << ", rc: " << rc; // Since 'Session::confirmMessages' failed, it would not have reset // the 'builder'. So we reset it here. - confirmBuilder.reset(); + z_bmqa_ConfirmEventBuilder__reset(confirmBuilder); } } else { - bsl::cerr << "Got unexpected event type: " << messageEvent.type() + const char* eventType = z_bmqt_MessageEventType::toAscii( + z_bmqa_MessageEvent__type(messageEvent)); + bsl::cerr << "Got unexpected event type: " << bsl::string(eventType) << "\n"; } + + z_bmqa_ConfirmEventBuilder__delete(&confirmBuilder); } -void EventHandler::onSessionEvent(const bmqa::SessionEvent& sessionEvent) +void onSessionEvent(const z_bmqa_SessionEvent* sessionEvent, void* data) // Handle the specified 'sessionEvent'. This method is executed in one of // the *EVENT HANDLER* threads. { - bsl::cout << "Got session event: " << sessionEvent << "\n"; + char* out; + z_bmqa_SessionEvent__toString(sessionEvent, &out); + bsl::cout << "Got session event: " << bsl::string(out) << "\n"; } -void EventHandler::setSession(bmqa::Session* session) +void setSession(void* data_p, z_bmqa_Session* session) { - d_session_p = session; + z_bmqa_Session** session_p = static_cast(data_p); + *session_p = session; } } // close unnamed namespace @@ -185,14 +213,20 @@ static void consume(z_bmqa_Session* session) // bmqt::CorrelationId corrId(bmqt::CorrelationId::autoValue()); z_bmqt_CorrelationId* corrId; z_bmqt_CorrelationId__autoValue(&corrId); - z_bmqa_QueueId* queueId; - z_bmqa_OpenQueueStatus* status; + z_bmqa_QueueId* queueId; + z_bmqa_OpenQueueStatus* openStatus; z_bmqa_QueueId__createFromCorrelationId(&queueId, corrId); - z_bmqa_Session__openQueueSync(session, queueId, k_QUEUE_URL, static_cast(bmqt::QueueFlags::e_READ), &status); - - if (!z_bmqa_OpenQueueStatus__toBool(status) || !z_bmqa_QueueId__isValid(queueId)) { + z_bmqa_Session__openQueueSync( + session, + queueId, + k_QUEUE_URL, + static_cast(bmqt::QueueFlags::e_READ), + &openStatus); + + if (!z_bmqa_OpenQueueStatus__toBool(openStatus) || + !z_bmqa_QueueId__isValid(queueId)) { bsl::cerr << "Failed to open queue: '" << k_QUEUE_URL - << "', status: " << status << "\n"; + << "', status: " << openStatus << "\n"; return; // RETURN } else { @@ -217,11 +251,16 @@ static void consume(z_bmqa_Session* session) z_bmqt_QueueOptions__setMaxUnconfirmedBytes(options, 0); z_bmqt_QueueOptions__setMaxUnconfirmedMessages(options, 0); z_bmqa_ConfigureQueueStatus* configureStatus; - z_bmqa_Session__configureQueueSync(session, queueId, options, 0, &configureStatus); + z_bmqa_Session__configureQueueSync(session, + queueId, + options, + 0, + &configureStatus); if (!z_bmqa_ConfigureQueueStatus__toBool(configureStatus)) { // Error! Log something bsl::cout << "Graceful shutdown of the queue failed: " - << bmqt::ConfigureQueueResult::Enum(z_bmqa_ConfigureQueueStatus__result(configureStatus)) + << bmqt::ConfigureQueueResult::Enum( + z_bmqa_ConfigureQueueStatus__result(configureStatus)) << " (" << configureStatus << ")\n"; return; // RETURN } @@ -236,6 +275,13 @@ static void consume(z_bmqa_Session* session) } bsl::cerr << "Queue ['" << k_QUEUE_URL << "'] has been shut down " << "gracefully and is now closed.\n"; + + z_bmqa_QueueId__delete(&queueId); + z_bmqt_QueueOptions__delete(&options); + z_bmqa_OpenQueueStatus__delete(&openStatus); + z_bmqa_ConfigureQueueStatus__delete(&configureStatus); + z_bmqa_CloseQueueStatus__delete(&closeStatus); + z_bmqt_CorrelationId__delete(&corrId); } //============================================================================= @@ -249,18 +295,35 @@ int main(BSLS_ANNOTATION_UNUSED int argc, // the local broker by default, unless the 'Session' is created with an // optional 'SessionOptions' object. - EventHandler* eventHandler = new EventHandler(); - ManagedHandler eventHandlerMp(eventHandler); - bmqa::Session session(eventHandlerMp); - eventHandler->setSession(&session); - int rc = session.start(); + // EventHandler* eventHandler = new EventHandler(); + // ManagedHandler eventHandlerMp(eventHandler); + // bmqa::Session session(eventHandlerMp); + z_bmqa_Session* session; + z_bmqa_SessionEventHandler* eventHandler; + z_bmqa_SessionEventHandler__create(&eventHandler, + onSessionEvent, + onMessageEvent, + sizeof(z_bmqa_Session*)); + z_bmqa_Session__createAsync(&session, eventHandler, NULL); + void* eventHandlerData; + z_bmqa_SessionEventHandler__getData(eventHandler, &eventHandlerData); + setSession(eventHandlerData, session); + if (*((z_bmqa_Session**)eventHandlerData) != session) { + bsl::cout << "Session not set!\n"; + return 1; + } + int rc = z_bmqa_Session__start((z_bmqa_Session*)(session), 0); if (rc != 0) { bsl::cerr << "Failed to start the session with the BlazingMQ broker" << ", rc: " << bmqt::GenericResult::Enum(rc) << "\n"; return rc; // RETURN } - consume(&session); - session.stop(); + + consume(session); + z_bmqa_Session__stop(session); + + // Calling z_bmqa_Session__delete also deletes the event handler + z_bmqa_Session__delete(&session); return 0; -} +} \ No newline at end of file diff --git a/src/tutorials/c_wrapper/producer.cpp b/src/tutorials/c_wrapper/producer.cpp index 99c6962a6..e70ef29c9 100644 --- a/src/tutorials/c_wrapper/producer.cpp +++ b/src/tutorials/c_wrapper/producer.cpp @@ -30,7 +30,7 @@ void postEvent(const char* text, z_bmqa_MessageEventBuilder* builder; z_bmqa_MessageEventBuilder__create(&builder); - z_bmqa_Session__loadMessageEventBuilder(session, &builder); + z_bmqa_Session__loadMessageEventBuilder(session, builder); z_bmqa_Message* message; @@ -76,7 +76,7 @@ void produce(z_bmqa_Session* session){ z_bmqa_QueueId__delete(&queueId); } -int run_c_producer(){ +int main(){ z_bmqa_Session* session; z_bmqt_SessionOptions* options; From 5a54f0366254ee4d31953bae6bc237ea1f4ecad8 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Wed, 24 Jan 2024 14:21:14 -0500 Subject: [PATCH 20/57] Add cmake edit --- src/tutorials/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tutorials/CMakeLists.txt b/src/tutorials/CMakeLists.txt index 7409a5fe7..0d7238214 100644 --- a/src/tutorials/CMakeLists.txt +++ b/src/tutorials/CMakeLists.txt @@ -36,7 +36,7 @@ function(BMQ_ADD_TUTORIAL name) "$") # Link with 'bmq' - target_link_libraries(${targetName} PRIVATE "bmq") + target_link_libraries(${targetName} PRIVATE "bmq" "z_bmq") ## Change the name of the generated output task from ## "_" to ".tsk" From b079bf7a9352ea757160d72c03cfbead5c8b6b5a Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Wed, 11 Oct 2023 14:13:31 -0400 Subject: [PATCH 21/57] Initial code --- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 36 +++++++++++++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 22 ++++++++++++ .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 13 +++++++ .../z_bmq/z_bmqt/z_bmqt_sessionoptions.h | 20 +++++++++++ 4 files changed, 91 insertions(+) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_session.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp new file mode 100644 index 000000000..5da164d29 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -0,0 +1,36 @@ +#include +#include +#include +#include + +typedef void* TimeInterval; + +namespace BloombergLP { + +namespace z_bmqa { + +int z_bmqa_session__create(z_bmqa_session* session , z_bmqt_SessionOptions* options) { + bmqt::SessionOptions* option_ptr = reinterpret_cast(options); + bmqa::Session* session_ptr = new bmqa::Session(*option_ptr); + + *session = reinterpret_cast(session_ptr); + return 0; +} + +int z_bmqa_session__start(z_bmqa_session* session, int64_t seconds, int nanoseconds) { + bmqa::Session* session_ptr = reinterpret_cast(session); + bsls::TimeInterval timeout(seconds, nanoseconds); + session_ptr->start(timeout); + return 0; +} + +int z_bmqa_session__stop(z_bmqa_session* session) { + bmqa::Session* session_ptr = reinterpret_cast(session); + session_ptr->stop(); + + return 0; +} + +} + +} diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h new file mode 100644 index 000000000..8415c92ff --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -0,0 +1,22 @@ +#ifndef INCLUDED_Z_BMQA_SESSION +#define INCLUDED_Z_BMQA_SESSION + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef void* z_bmqa_session; + +int z_bmqa_session__create(z_bmqa_session* session , z_bmqt_SessionOptions* options); + +int z_bmqa_session__start(z_bmqa_session* session, int64_t seconds, int nanoseconds); + +int z_bmqa_session__stop(z_bmqa_session* session); + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp new file mode 100644 index 000000000..dedbc6423 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -0,0 +1,13 @@ +#include +#include + + + +namespace BloomberLP { +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions* options) { + BloombergLP::bmqt::SessionOptions* options_ptr = new BloombergLP::bmqt::SessionOptions(); + *options = reinterpret_cast(options_ptr); + return 0; +} + +}; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h new file mode 100644 index 000000000..c8b403a07 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h @@ -0,0 +1,20 @@ +#ifndef INCLUDED_Z_BMQT_SESSIONOPTIONS +#define INCLUDED_Z_BMQT_SESSIONOPTIONS + +#if defined(__cplusplus) +extern "C" { +#endif + + + +typedef void* z_bmqt_SessionOptions; + +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions* options); + + + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file From 7011a61d5b835942c9fe666166406b988b3ab949 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 20 Oct 2023 17:04:08 -0400 Subject: [PATCH 22/57] Added z_bmq to build configs --- src/groups/CMakeLists.txt | 1 + src/groups/z_bmq/CMakeLists.txt | 11 +++ src/groups/z_bmq/doc/z_bmq.txt | 63 ++++++++++++++++ src/groups/z_bmq/group/z_bmq.dep | 5 ++ src/groups/z_bmq/group/z_bmq.mem | 4 + src/groups/z_bmq/group/z_bmq.t.dep | 1 + src/groups/z_bmq/z_bmqa/package/z_bmqa.dep | 1 + src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 1 + src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 16 ++-- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 9 ++- src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp | 75 +++++++++++++++++++ src/groups/z_bmq/z_bmqt/package/z_bmqt.dep | 0 src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 1 + .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 17 +++-- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.h | 6 +- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp | 75 +++++++++++++++++++ 16 files changed, 265 insertions(+), 21 deletions(-) create mode 100644 src/groups/z_bmq/CMakeLists.txt create mode 100644 src/groups/z_bmq/doc/z_bmq.txt create mode 100644 src/groups/z_bmq/group/z_bmq.dep create mode 100644 src/groups/z_bmq/group/z_bmq.mem create mode 100644 src/groups/z_bmq/group/z_bmq.t.dep create mode 100644 src/groups/z_bmq/z_bmqa/package/z_bmqa.dep create mode 100644 src/groups/z_bmq/z_bmqa/package/z_bmqa.mem create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp create mode 100644 src/groups/z_bmq/z_bmqt/package/z_bmqt.dep create mode 100644 src/groups/z_bmq/z_bmqt/package/z_bmqt.mem create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp diff --git a/src/groups/CMakeLists.txt b/src/groups/CMakeLists.txt index be9ff6a99..fcbff14a0 100644 --- a/src/groups/CMakeLists.txt +++ b/src/groups/CMakeLists.txt @@ -4,3 +4,4 @@ add_subdirectory(mwc) add_subdirectory(bmq) add_subdirectory(mqb) +add_subdirectory(z_bmq) diff --git a/src/groups/z_bmq/CMakeLists.txt b/src/groups/z_bmq/CMakeLists.txt new file mode 100644 index 000000000..eb384990f --- /dev/null +++ b/src/groups/z_bmq/CMakeLists.txt @@ -0,0 +1,11 @@ +# bmq +# --- + + +# Add the libbmq group library only installing the public headers +add_library(z_bmq) + +target_compile_definitions(z_bmq PRIVATE "MWC_INTERNAL_USAGE") + +target_bmq_style_uor( z_bmq ) + diff --git a/src/groups/z_bmq/doc/z_bmq.txt b/src/groups/z_bmq/doc/z_bmq.txt new file mode 100644 index 000000000..abc7e2acd --- /dev/null +++ b/src/groups/z_bmq/doc/z_bmq.txt @@ -0,0 +1,63 @@ + bmq.txt + +@PURPOSE: Public SDK API for the BlazingMQ framework. + +@MNEMONIC: BlazingMQ (bmq) + +@DESCRIPTION: BlazingmQ (package group 'bmq') is a message-queue + framework allowing application developers to use reliable distributed queues. + + The 'bmqa' and 'bmqt' packages contain all components that constitute the + public API for BlazingmQ users to use. A client should only use the + components in these packages, and should not use any other package under the + 'bmq' package group since they are implementation components that may change + at any time. + +/Hierarchical Synopsis +/--------------------- +The 'bmq' group library currently has 5 packages forming 5 levels of physical +dependency. +.. + 5. bmqa + + 4. bmqimp + + 3. bmqp + + 2. bmqt + + 1. bmqscm +.. + +/Package Synopsis +/------------------ +: 'bmqa': +: Provide applications public API for the BlazingmQ SDK. +: +: 'bmqimp': +: [INTERNAL] Provide implementation for the API of the BlazingMQ SDK. +: +: 'bmqp': +: [INTERNAL] Provide BlazingMQ protocol definition, builders and parsers. +: +: 'bmqscm': +: Provide versioning information for library components in 'bmq'. +: +: 'bmqt': +: Provide value-semantic vocabulary types. + +/Package Overview +/---------------- + The following provides a brief overview of several of the packages within the + 'bmq' package group, arranged in alphabetical order. The descriptions here + are still very brief; see the respective Package Level documents for more + details and usage examples. + +/'bmqa' +/- - - + 'bmqa' provides the top-level public APIs application can use to interact with + BlazingMQ framework in their applications. + +/'bmqt' +/- - - + 'bmqt' provides value-semantic vocabulary types used in the {'bmqa'} APIs. diff --git a/src/groups/z_bmq/group/z_bmq.dep b/src/groups/z_bmq/group/z_bmq.dep new file mode 100644 index 000000000..41790551b --- /dev/null +++ b/src/groups/z_bmq/group/z_bmq.dep @@ -0,0 +1,5 @@ +# Level 2 +bmq + +# Level 1 +bsl diff --git a/src/groups/z_bmq/group/z_bmq.mem b/src/groups/z_bmq/group/z_bmq.mem new file mode 100644 index 000000000..c39036031 --- /dev/null +++ b/src/groups/z_bmq/group/z_bmq.mem @@ -0,0 +1,4 @@ +# [OFFLINE ONLY] + +z_bmqa +z_bmqt diff --git a/src/groups/z_bmq/group/z_bmq.t.dep b/src/groups/z_bmq/group/z_bmq.t.dep new file mode 100644 index 000000000..60e97934d --- /dev/null +++ b/src/groups/z_bmq/group/z_bmq.t.dep @@ -0,0 +1 @@ +mwc \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.dep b/src/groups/z_bmq/z_bmqa/package/z_bmqa.dep new file mode 100644 index 000000000..623e5c44d --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.dep @@ -0,0 +1 @@ +z_bmqt \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem new file mode 100644 index 000000000..e5a2a9b61 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -0,0 +1 @@ +z_bmqa_session diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 5da164d29..72855c8a7 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -9,22 +9,22 @@ namespace BloombergLP { namespace z_bmqa { -int z_bmqa_session__create(z_bmqa_session* session , z_bmqt_SessionOptions* options) { +int z_bmqa_session__create(z_bmqa_Session** session , z_bmqt_SessionOptions* options) { bmqt::SessionOptions* option_ptr = reinterpret_cast(options); bmqa::Session* session_ptr = new bmqa::Session(*option_ptr); - - *session = reinterpret_cast(session_ptr); + *session = reinterpret_cast(session_ptr); return 0; } -int z_bmqa_session__start(z_bmqa_session* session, int64_t seconds, int nanoseconds) { +int z_bmqa_Session__start(z_bmqa_Session* session, int64_t timeoutMs) { bmqa::Session* session_ptr = reinterpret_cast(session); - bsls::TimeInterval timeout(seconds, nanoseconds); - session_ptr->start(timeout); - return 0; + bsls::TimeInterval timeout; + timeout.addMilliseconds(timeoutMs); + int rc = session_ptr->start(timeout); + return rc; } -int z_bmqa_session__stop(z_bmqa_session* session) { +int z_bmqa_Session__stop(z_bmqa_Session* session) { bmqa::Session* session_ptr = reinterpret_cast(session); session_ptr->stop(); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 8415c92ff..022982a40 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -2,18 +2,19 @@ #define INCLUDED_Z_BMQA_SESSION #include +#include #if defined(__cplusplus) extern "C" { #endif -typedef void* z_bmqa_session; +typedef struct z_bmqa_Session z_bmqa_Session; -int z_bmqa_session__create(z_bmqa_session* session , z_bmqt_SessionOptions* options); +int z_bmqa_Session__create(z_bmqa_Session** session, z_bmqt_SessionOptions* options); -int z_bmqa_session__start(z_bmqa_session* session, int64_t seconds, int nanoseconds); +int z_bmqa_Session__start(z_bmqa_Session* session, int64_t milliseconds); -int z_bmqa_session__stop(z_bmqa_session* session); +int z_bmqa_Session__stop(z_bmqa_Session* session); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp new file mode 100644 index 000000000..3f9295e9f --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp @@ -0,0 +1,75 @@ +// Copyright 2014-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bmqa_session.t.cpp +#include +#include + +// MWC +#include + +// BDE +#include +#include + +// TEST DRIVER +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +static void test1_sessionOptions() +{ + mwctst::TestHelper::printTestName("Create Session"); + + // Create default sessionOptions + z_bmqt_SessionOptions* sessionOptions; + z_bmqt_SessionOptions__create(&sessionOptions); + bmqt::SessionOptions sessionOptions_cpp(s_allocator_p); + + // Make sure 'k_BROKER_DEFAULT_PORT' and the default brokerUri are in sync + { + PV("CHECKING brokerUri()"); + + + // ASSERT_EQ(sessionOptions_cpp.brokerUri(), result); + } +} + + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 1: test1_sessionOptions(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +} diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.dep b/src/groups/z_bmq/z_bmqt/package/z_bmqt.dep new file mode 100644 index 000000000..e69de29bb diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem new file mode 100644 index 000000000..e236559d5 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -0,0 +1 @@ +z_bmqt_sessionoptions \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp index dedbc6423..a3c359aa0 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -2,12 +2,17 @@ #include - -namespace BloomberLP { -int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions* options) { - BloombergLP::bmqt::SessionOptions* options_ptr = new BloombergLP::bmqt::SessionOptions(); - *options = reinterpret_cast(options_ptr); +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options) { + using namespace BloombergLP; + bmqt::SessionOptions* options_ptr = new bmqt::SessionOptions(); + *options = reinterpret_cast(options_ptr); return 0; } -}; +const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options) { + using namespace BloombergLP; + + const bmqt::SessionOptions* options_ptr = reinterpret_cast(options); + + return options_ptr->brokerUri().c_str(); +} diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h index c8b403a07..0612ad5a2 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h @@ -6,11 +6,11 @@ extern "C" { #endif +typedef struct z_bmqt_SessionOptions z_bmqt_SessionOptions; -typedef void* z_bmqt_SessionOptions; - -int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions* options); +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options); +const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options); #if defined(__cplusplus) diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp new file mode 100644 index 000000000..6f8ef3d54 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp @@ -0,0 +1,75 @@ +// Copyright 2014-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bmqt_sessionoptions.t.cpp -*-C++-*- +#include +#include + +// MWC +#include + +// BDE +#include +#include + +// TEST DRIVER +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +static void test1_sessionOptions() +{ + mwctst::TestHelper::printTestName("BREATHING TEST"); + + // Create default sessionOptions + z_bmqt_SessionOptions* sessionOptions; + z_bmqt_SessionOptions__create(&sessionOptions); + bmqt::SessionOptions sessionOptions_cpp(s_allocator_p); + + // Make sure 'k_BROKER_DEFAULT_PORT' and the default brokerUri are in sync + { + PV("CHECKING brokerUri()"); + + bsl::string_view result = z_bmqt_SessionOptions__brokerUri(sessionOptions); + ASSERT_EQ(sessionOptions_cpp.brokerUri(), result); + } +} + + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 1: test1_sessionOptions(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +} From 572e38cdc5c868d461440b3ebe66c5be2397c265 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 27 Oct 2023 17:41:53 -0400 Subject: [PATCH 23/57] Made progress on CorrelatonId and QueueId --- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp | 52 ++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h | 23 ++++ src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 21 ++-- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 8 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 116 ++++++++++++++++++ .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 51 ++++++++ .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 8 +- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.h | 4 +- 8 files changed, 264 insertions(+), 19 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp new file mode 100644 index 000000000..1bd4c52cd --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp @@ -0,0 +1,52 @@ +#include +#include +#include + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) { + using namespace BloombergLP; + + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(); + + *queueId_obj = reinterpret_cast(queueId_ptr); + + return 0; +} + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId); + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*correlationId_ptr); + + *queueId_obj = reinterpret_cast(queueId_ptr); + + return 0; +} + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other) { + using namespace BloombergLP; + + const bmqa::QueueId* other_ptr = reinterpret_cast(other); + + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*other_ptr); + *queueId_obj = reinterpret_cast(queueId_ptr); + + return 0; +} + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, int64_t numeric) { + using namespace BloombergLP; + + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(numeric); + *queueId_obj = reinterpret_cast(queueId_ptr); + + return 0; +} + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, void* pointer) { + using namespace BloombergLP; + + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(pointer); + *queueId_obj = reinterpret_cast(queueId_ptr); + + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h new file mode 100644 index 000000000..97785f15b --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h @@ -0,0 +1,23 @@ +#ifndef INCLUDED_Z_BMQA_QUEUEID +#define INCLUDED_Z_BMQA_QUEUEID + +#include +#include + +typedef struct z_bmqa_QueueId z_bmqa_QueueId; + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj); + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId); + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other); + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, int64_t numeric); + +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, void* pointer); + +int i; + + + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 72855c8a7..9866a590b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -3,20 +3,24 @@ #include #include -typedef void* TimeInterval; -namespace BloombergLP { - -namespace z_bmqa { - -int z_bmqa_session__create(z_bmqa_Session** session , z_bmqt_SessionOptions* options) { +int z_bmqa_Session__create(z_bmqa_Session** session , z_bmqt_SessionOptions* options) { + using namespace BloombergLP; bmqt::SessionOptions* option_ptr = reinterpret_cast(options); bmqa::Session* session_ptr = new bmqa::Session(*option_ptr); *session = reinterpret_cast(session_ptr); return 0; } +int z_bmqa_Session__destroy(z_bmqa_Session* session) { + using namespace BloombergLP; + bmqa::Session* session_ptr = reinterpret_cast(session); + delete session_ptr; + return 0; +} + int z_bmqa_Session__start(z_bmqa_Session* session, int64_t timeoutMs) { + using namespace BloombergLP; bmqa::Session* session_ptr = reinterpret_cast(session); bsls::TimeInterval timeout; timeout.addMilliseconds(timeoutMs); @@ -25,12 +29,9 @@ int z_bmqa_Session__start(z_bmqa_Session* session, int64_t timeoutMs) { } int z_bmqa_Session__stop(z_bmqa_Session* session) { + using namespace BloombergLP; bmqa::Session* session_ptr = reinterpret_cast(session); session_ptr->stop(); return 0; } - -} - -} diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 022982a40..3b7e6abb3 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -10,11 +10,13 @@ extern "C" { typedef struct z_bmqa_Session z_bmqa_Session; -int z_bmqa_Session__create(z_bmqa_Session** session, z_bmqt_SessionOptions* options); +int z_bmqa_Session__create(z_bmqa_Session** session_obj, z_bmqt_SessionOptions* options); -int z_bmqa_Session__start(z_bmqa_Session* session, int64_t milliseconds); +int z_bmqa_Session__destroy(z_bmqa_Session* session_obj); -int z_bmqa_Session__stop(z_bmqa_Session* session); +int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t milliseconds); + +int z_bmqa_Session__stop(z_bmqa_Session* session_obj); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp new file mode 100644 index 000000000..728867703 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -0,0 +1,116 @@ +#include +#include + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(); + + *correlationId_obj = reinterpret_cast(correlationId_ptr); + return 0; +} + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(numeric); + + *correlationId_obj = reinterpret_cast(correlationId_ptr); + return 0; +} + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, void* pointer) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(pointer); + + *correlationId_obj = reinterpret_cast(correlationId_ptr); + return 0; +} + +int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + correlationId_ptr->makeUnset(); + return 0; +} + +int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlationId_obj, int64_t numeric) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + correlationId_ptr->setNumeric(numeric); + return 0; +} + +int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlationId_obj, void* pointer) { + using namespace BloombergLP; + bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + + correlationId_ptr->setPointer(pointer); + return 0; +} + +int z_bmqt_CorrelationId__isUnset(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->isUnset(); +} + +int z_bmqt_CorrelationId__isNumeric(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->isNumeric(); +} + +int z_bmqt_CorrelationId__isPointer(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->isPointer(); +} + +int z_bmqt_CorrelationId__isSharedPtr(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->isSharedPtr(); +} + +int z_bmqt_CorrelationId__isAutoValue(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->isAutoValue(); +} + +int64_t z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->theNumeric(); +} + +void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + return correlationId_ptr->thePointer(); +} + +CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj) { + using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + + switch(correlationId_ptr->type()) { + case bmqt::CorrelationId::Type::e_NUMERIC: return e_NUMERIC; + case bmqt::CorrelationId::Type::e_POINTER: return e_POINTER; + case bmqt::CorrelationId::Type::e_SHARED_PTR: return e_SHARED_PTR; + case bmqt::CorrelationId::Type::e_AUTO_VALUE: return e_AUTO_VALUE; + case bmqt::CorrelationId::Type::e_UNSET: return e_UNSET; + default: break; + } + + return e_ERROR; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h new file mode 100644 index 000000000..9a05229cb --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -0,0 +1,51 @@ +#ifndef INCLUDED_Z_BMQA_CORRELATIONID +#define INCLUDED_Z_BMQA_CORRELATIONID + +#include + +typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; + + +enum CorrelationId_Type { + e_NUMERIC // the 'CorrelationId' holds a 64-bit integer + , + e_POINTER // the 'CorrelationId' holds a raw pointer + , + e_SHARED_PTR // the 'CorrelationId' holds a shared pointer + , + e_AUTO_VALUE // the 'CorrelationId' holds an auto value + , + e_UNSET // the 'CorrelationId' is not set + , + e_ERROR // error +}; + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric); + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, void* pointer); + +int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__isUnset(const z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__isNumeric(const z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__isPointer(const z_bmqt_CorrelationId* correlation_Id_obj); + +int z_bmqt_CorrelationId__isSharedPtr(const z_bmqt_CorrelationId* correlationId_obj); + +int z_bmqt_CorrelationId__isAutoValue(const z_bmqt_CorrelationId* correlation_Id_obj); + +int64_t z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlation_Id_obj); + +void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlation_Id_obj); + +CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlation_Id_obj); + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp index a3c359aa0..7e4a751ee 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -2,17 +2,17 @@ #include -int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options) { +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj) { using namespace BloombergLP; bmqt::SessionOptions* options_ptr = new bmqt::SessionOptions(); - *options = reinterpret_cast(options_ptr); + *options_obj = reinterpret_cast(options_ptr); return 0; } -const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options) { +const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj) { using namespace BloombergLP; - const bmqt::SessionOptions* options_ptr = reinterpret_cast(options); + const bmqt::SessionOptions* options_ptr = reinterpret_cast(options_obj); return options_ptr->brokerUri().c_str(); } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h index 0612ad5a2..4e86e570e 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h @@ -8,9 +8,9 @@ extern "C" { typedef struct z_bmqt_SessionOptions z_bmqt_SessionOptions; -int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options); +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj); -const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options); +const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj); #if defined(__cplusplus) From 8e188c3a7faff12989a9e92b405b30fef3a36cc3 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 7 Nov 2023 19:06:45 -0500 Subject: [PATCH 24/57] Finished QueueOptions, and changed constructors to avoid C naming conflicts --- src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 3 +- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp | 63 +++++-- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h | 26 ++- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 16 +- src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp | 22 ++- src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 5 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 11 +- .../z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 158 ++++++++++++++++++ src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h | 62 +++++++ src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp | 72 ++++++++ src/groups/z_bmq/z_bmqt/z_bmqt_uri.h | 43 +++++ 11 files changed, 446 insertions(+), 35 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_uri.h diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index e5a2a9b61..8605fa0b8 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -1 +1,2 @@ -z_bmqa_session +z_bmqa_queueid +z_bmqa_session \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp index 1bd4c52cd..c83b9d1fd 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp @@ -12,28 +12,28 @@ int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) { return 0; } -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId) { +int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId); - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*correlationId_ptr); + const bmqa::QueueId* other_ptr = reinterpret_cast(other); + + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*other_ptr); *queueId_obj = reinterpret_cast(queueId_ptr); return 0; } -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other) { +int z_bmqa_QueueId__createFromCorrelationId(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; + const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId); + bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*correlationId_ptr); - const bmqa::QueueId* other_ptr = reinterpret_cast(other); - - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*other_ptr); *queueId_obj = reinterpret_cast(queueId_ptr); return 0; } -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, int64_t numeric) { +int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, int64_t numeric) { using namespace BloombergLP; bmqa::QueueId* queueId_ptr = new bmqa::QueueId(numeric); @@ -42,11 +42,54 @@ int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, int64_t numeric) { return 0; } -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, void* pointer) { +int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, void* pointer) { using namespace BloombergLP; bmqa::QueueId* queueId_ptr = new bmqa::QueueId(pointer); *queueId_obj = reinterpret_cast(queueId_ptr); return 0; -} \ No newline at end of file +} + +const z_bmqt_CorrelationId* z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); + const bmqt::CorrelationId* correlationId_ptr = &(queueId_ptr->correlationId()); + + return reinterpret_cast(correlationId_ptr); +} + +uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); + return queueId_ptr->flags(); +} + +const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); + const bmqt::Uri* uri_ptr = &(queueId_ptr->uri()); + + return reinterpret_cast(uri_ptr); + +} + +const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); + const bmqt::QueueOptions* options_ptr = &(queueId_ptr->options()); + + return reinterpret_cast(options_ptr); +} + +int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); + return queueId_ptr->isValid(); +} + diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h index 97785f15b..d7fad30f7 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h @@ -2,22 +2,38 @@ #define INCLUDED_Z_BMQA_QUEUEID #include +#include +#include #include +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_QueueId z_bmqa_QueueId; int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj); -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId); +int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other); + +int z_bmqa_QueueId__createFromCorrelationId(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId); + +int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, int64_t numeric); + +int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, void* pointer); -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other); +const z_bmqt_CorrelationId* z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj); -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, int64_t numeric); +uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj); -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj, void* pointer); +const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId_obj); -int i; +const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId_obj); +int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId_obj); +#if defined(__cplusplus) +} +#endif #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 9866a590b..7c7cbec7c 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -4,33 +4,33 @@ #include -int z_bmqa_Session__create(z_bmqa_Session** session , z_bmqt_SessionOptions* options) { +int z_bmqa_Session__create(z_bmqa_Session** session_obj , z_bmqt_SessionOptions* options) { using namespace BloombergLP; bmqt::SessionOptions* option_ptr = reinterpret_cast(options); bmqa::Session* session_ptr = new bmqa::Session(*option_ptr); - *session = reinterpret_cast(session_ptr); + *session_obj = reinterpret_cast(session_ptr); return 0; } -int z_bmqa_Session__destroy(z_bmqa_Session* session) { +int z_bmqa_Session__destroy(z_bmqa_Session* session_obj) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session); + bmqa::Session* session_ptr = reinterpret_cast(session_obj); delete session_ptr; return 0; } -int z_bmqa_Session__start(z_bmqa_Session* session, int64_t timeoutMs) { +int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session); + bmqa::Session* session_ptr = reinterpret_cast(session_obj); bsls::TimeInterval timeout; timeout.addMilliseconds(timeoutMs); int rc = session_ptr->start(timeout); return rc; } -int z_bmqa_Session__stop(z_bmqa_Session* session) { +int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session); + bmqa::Session* session_ptr = reinterpret_cast(session_obj); session_ptr->stop(); return 0; diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp index 3f9295e9f..8c2c755b3 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp @@ -35,22 +35,28 @@ using namespace bsl; // TESTS // ---------------------------------------------------------------------------- -static void test1_sessionOptions() +static void test1_session() { mwctst::TestHelper::printTestName("Create Session"); - // Create default sessionOptions - z_bmqt_SessionOptions* sessionOptions; - z_bmqt_SessionOptions__create(&sessionOptions); - bmqt::SessionOptions sessionOptions_cpp(s_allocator_p); + // Create default session + + z_bmqa_Session* session; + z_bmqt_SessionOptions* options; + z_bmqt_SessionOptions__create(&options); + z_bmqa_Session__create(&session, options); // Make sure 'k_BROKER_DEFAULT_PORT' and the default brokerUri are in sync { - PV("CHECKING brokerUri()"); + PV("CHECKING start() and stop()"); + + z_bmqa_Session__start(session, 1000); - + z_bmqa_Session__stop(session); // ASSERT_EQ(sessionOptions_cpp.brokerUri(), result); } + + // z_bmqa_Session__destroy(session); } @@ -64,7 +70,7 @@ int main(int argc, char* argv[]) switch (_testCase) { case 0: - case 1: test1_sessionOptions(); break; + case 1: test1_session(); break; default: { cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; s_testStatus = -1; diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem index e236559d5..703793338 100644 --- a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -1 +1,4 @@ -z_bmqt_sessionoptions \ No newline at end of file +z_bmqt_correlationid +z_bmqt_sessionoptions +z_bmqt_queueoptions +z_bmqt_uri \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h index 9a05229cb..8ddef6724 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -5,6 +5,9 @@ typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; +#if defined(__cplusplus) +extern "C" { +#endif enum CorrelationId_Type { e_NUMERIC // the 'CorrelationId' holds a 64-bit integer @@ -22,9 +25,9 @@ enum CorrelationId_Type { int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric); +int z_bmqt_CorrelationId__createFromNumeric(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric); -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, void* pointer); +int z_bmqt_CorrelationId__createFromPointer(z_bmqt_CorrelationId** correlationId_obj, void* pointer); int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlation_Id_obj); @@ -48,4 +51,8 @@ void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlation_I CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlation_Id_obj); +#if defined(__cplusplus) +} +#endif + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp new file mode 100644 index 000000000..7fe59e788 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -0,0 +1,158 @@ +#include +#include + +int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj) { + using namespace BloombergLP; + bmqt::QueueOptions* queueOptions_ptr = new bmqt::QueueOptions; + + *queueOptions_obj = reinterpret_cast(queueOptions_ptr); + + return 0; +} + +int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other) { + using namespace BloombergLP; + const bmqt::QueueOptions* other_ptr = reinterpret_cast(other); + bmqt::QueueOptions* queueOptions_ptr = new bmqt::QueueOptions(*other_ptr); + + *queueOptions_obj = reinterpret_cast(queueOptions_ptr); + + return 0; +} + + +//Modifiers +int z_bmqt_QueueOptions__setMaxUnconfirmedMessages(z_bmqt_QueueOptions* queueOptions_obj, int value) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + + queueOptions_ptr->setMaxUnconfirmedMessages(value); + return 0; +} + +int z_bmqt_QueueOptions__setMaxUnconfirmedBytes(z_bmqt_QueueOptions* queueOptions_obj, int value) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + queueOptions_ptr->setMaxUnconfirmedBytes(value); + return 0; +} + +int z_bmqt_QueueOptions__setConsumerPriority(z_bmqt_QueueOptions* queueOptions_obj, int value) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + queueOptions_ptr->setConsumerPriority(value); + return 0; +} + +int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOptions_obj, int value) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + queueOptions_ptr->setSuspendsOnBadHostHealth(value); + return 0; +} + +int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* other_ptr = reinterpret_cast(other); + + queueOptions_ptr->merge(*other_ptr); + return 0; +} + +// int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj) { +// using namespace BloombergLP; + +// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); +// } + +// int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj) { +// using namespace BloombergLP; + +// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); +// } + +int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + queueOptions_ptr->removeAllSubscriptions(); + return 0; +} + +//Accessors +int z_bmqt_QueueOptions__maxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->maxUnconfirmedMessages(); +} + +int z_bmqt_QueueOptions__maxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->maxUnconfirmedBytes(); +} + +int z_bmqt_QueueOptions__consumerPriority(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->consumerPriority(); +} + +bool z_bmqt_QueueOptions__suspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->suspendsOnBadHostHealth(); +} + + +bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->hasMaxUnconfirmedMessages(); +} + +bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->hasMaxUnconfirmedBytes(); +} + +bool z_bmqt_QueueOptions__hasConsumerPriority(const z_bmqt_QueueOptions* queueOptions_obj) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->hasConsumerPriority(); +} + +bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj, int value) { + using namespace BloombergLP; + + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + return queueOptions_ptr->hasSuspendsOnBadHostHealth(); +} + + +//Experimental (Modifiers) +// bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj) { +// using namespace BloombergLP; + +// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); +// } + +// int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj) { +// using namespace BloombergLP; + +// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); +// } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h new file mode 100644 index 000000000..7b73d5e08 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -0,0 +1,62 @@ +#ifndef INCLUDED_Z_BMQT_QUEUEOPTIONS +#define INCLUDED_Z_BMQT_QUEUEOPTIONS + +typedef struct z_bmqt_QueueOptions z_bmqt_QueueOptions; + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj); + +int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other); + + +//Modifiers +int z_bmqt_QueueOptions__setMaxUnconfirmedMessages(z_bmqt_QueueOptions* queueOptions_obj, int value); + +int z_bmqt_QueueOptions__setMaxUnconfirmedBytes(z_bmqt_QueueOptions* queueOptions_obj, int value); + +int z_bmqt_QueueOptions__setConsumerPriority(z_bmqt_QueueOptions* queueOptions_obj, int value); + +int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOptions_obj, int value); + +int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other); + +int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj); + +int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj); + +int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); + +//Accessors +int z_bmqt_QueueOptions__maxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj); + +int z_bmqt_QueueOptions__maxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj); + +int z_bmqt_QueueOptions__consumerPriority(const z_bmqt_QueueOptions* queueOptions_obj); + +bool z_bmqt_QueueOptions__suspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj); + + +bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj); + +bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj); + +bool z_bmqt_QueueOptions__hasConsumerPriority(const z_bmqt_QueueOptions* queueOptions_obj); + +bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj); + + +//Experimental (Modifiers) +bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj); + +int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp new file mode 100644 index 000000000..5c5735c05 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp @@ -0,0 +1,72 @@ +#include +#include + +int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy){ + using namespace BloombergLP; + bmqt::Uri* original_uri_ptr = reinterpret_cast(to_copy); + bmqt::Uri* copy = new bmqt::Uri(*original_uri_ptr); + *uri_obj = reinterpret_cast(copy); + return 0; +} + + +//URIBUILDER + + +int z_bmqt_UriBuilder__create(z_bmqt_UriBuilder** uribuilder_obj) { + using namespace BloombergLP; + bmqt::UriBuilder* uriBuilder_ptr = new bmqt::UriBuilder(); + *uribuilder_obj = reinterpret_cast(uriBuilder_ptr); + return 0; +} + +int z_bmqt_UriBuilder__createFromUri(z_bmqt_UriBuilder** uribuilder_obj, const z_bmqt_Uri* uri_obj) { + using namespace BloombergLP; + const bmqt::Uri* uri_ptr = reinterpret_cast(uri_obj); + bmqt::UriBuilder* uriBuilder_ptr = new bmqt::UriBuilder(*uri_ptr); + *uribuilder_obj = reinterpret_cast(uriBuilder_ptr); + return 0; +} + +int z_bmqt_UriBuilder__setDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ + using namespace BloombergLP; + bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); + uriBuilder_ptr->setDomain(value); + return 0; +} + +int z_bmqt_UriBuilder__setTier(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ + using namespace BloombergLP; + bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); + uriBuilder_ptr->setTier(value); + return 0; +} + +int z_bmqt_UriBuilder__setQualifiedDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ + using namespace BloombergLP; + bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); + uriBuilder_ptr->setQualifiedDomain(value); + return 0; +} + +int z_bmqt_UriBuilder__setQueue(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ + using namespace BloombergLP; + bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); + uriBuilder_ptr->setQueue(value); + return 0; +} + +int z_bmqt_UriBuilder_uri(z_bmqt_UriBuilder* uribuilder_obj, z_bmqt_Uri** uri_obj){ + using namespace BloombergLP; + const bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uri_obj); + bmqt::Uri* uri_ptr = new bmqt::Uri(); + + int res = uriBuilder_ptr->uri(uri_ptr); // support error description ? + if(res != 0){ + delete uri_ptr; + return res; + } + + *uri_obj = reinterpret_cast(uri_ptr); + return res; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.h b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.h new file mode 100644 index 000000000..a043d7054 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.h @@ -0,0 +1,43 @@ +#ifndef INCLUDED_Z_BMQT_URI +#define INCLUDED_Z_BMQT_URI + +#if defined(__cplusplus) +extern "C" { +#endif + +// ========= +// class Uri +// ========= + +typedef struct z_bmqt_Uri z_bmqt_Uri; + + +int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy); + + +// ================ +// class UriBuilder +// ================ + +typedef struct z_bmqt_UriBuilder z_bmqt_UriBuilder; + +int z_bmqt_UriBuilder__create(z_bmqt_UriBuilder** uribuilder_obj); + +int z_bmqt_UriBuilder__createFromUri(z_bmqt_UriBuilder** uribuilder_obj, const z_bmqt_Uri* uri_obj); + +int z_bmqt_UriBuilder__setDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value); + +int z_bmqt_UriBuilder__setTier(z_bmqt_UriBuilder* uribuilder_obj, const char* value); + +int z_bmqt_UriBuilder__setQualifiedDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value); + +int z_bmqt_UriBuilder__setQueue(z_bmqt_UriBuilder* uribuilder_obj, const char* value); + +int z_bmqt_UriBuilder_uri(z_bmqt_UriBuilder* uribuilder_obj, z_bmqt_Uri** uri_obj); + + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file From 232222d0f8a7075ec3a4fef64d18ed88d5567af8 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 7 Nov 2023 19:10:17 -0500 Subject: [PATCH 25/57] Fixed minor errors --- src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 2 +- src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp index 7fe59e788..01efdbcf2 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -136,7 +136,7 @@ bool z_bmqt_QueueOptions__hasConsumerPriority(const z_bmqt_QueueOptions* queueOp return queueOptions_ptr->hasConsumerPriority(); } -bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj, int value) { +bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h index 7b73d5e08..f52b99b0f 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -25,9 +25,9 @@ int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOp int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other); -int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj); +// int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj); -int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj); +// int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj); int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); @@ -51,9 +51,9 @@ bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* //Experimental (Modifiers) -bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj); +// bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj); -int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); +// int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); #if defined(__cplusplus) } From be3ef3f026d65886d4f12e13efbee7dd24b0313e Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 7 Nov 2023 22:15:48 -0500 Subject: [PATCH 26/57] Added wrapper functions for Subscription, SubscriptionHandle, and SubscriptionExpression, and also finished functions in QueueOptions that use Subscription objects --- src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 3 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 12 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 8 +- .../z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 83 ++++++-- src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h | 24 ++- .../z_bmq/z_bmqt/z_bmqt_subscription.cpp | 185 ++++++++++++++++++ src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h | 82 ++++++++ 7 files changed, 365 insertions(+), 32 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem index 703793338..e37e0e3c6 100644 --- a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -1,4 +1,5 @@ z_bmqt_correlationid -z_bmqt_sessionoptions z_bmqt_queueoptions +z_bmqt_sessionoptions +z_bmqt_subscription z_bmqt_uri \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp index 728867703..958eb6020 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -104,13 +104,13 @@ CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correl const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); switch(correlationId_ptr->type()) { - case bmqt::CorrelationId::Type::e_NUMERIC: return e_NUMERIC; - case bmqt::CorrelationId::Type::e_POINTER: return e_POINTER; - case bmqt::CorrelationId::Type::e_SHARED_PTR: return e_SHARED_PTR; - case bmqt::CorrelationId::Type::e_AUTO_VALUE: return e_AUTO_VALUE; - case bmqt::CorrelationId::Type::e_UNSET: return e_UNSET; + case bmqt::CorrelationId::Type::e_NUMERIC: return CorrelationId_Type::e_NUMERIC; + case bmqt::CorrelationId::Type::e_POINTER: return CorrelationId_Type::e_POINTER; + case bmqt::CorrelationId::Type::e_SHARED_PTR: return CorrelationId_Type::e_SHARED_PTR; + case bmqt::CorrelationId::Type::e_AUTO_VALUE: return CorrelationId_Type::e_AUTO_VALUE; + case bmqt::CorrelationId::Type::e_UNSET: return CorrelationId_Type::e_UNSET; default: break; } - return e_ERROR; + return CorrelationId_Type::e_CORRELATIONID_ERROR; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h index 8ddef6724..78d93fe90 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -3,12 +3,14 @@ #include -typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; - #if defined(__cplusplus) extern "C" { #endif + +typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; + + enum CorrelationId_Type { e_NUMERIC // the 'CorrelationId' holds a 64-bit integer , @@ -20,7 +22,7 @@ enum CorrelationId_Type { , e_UNSET // the 'CorrelationId' is not set , - e_ERROR // error + e_CORRELATIONID_ERROR // error }; int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp index 01efdbcf2..42a81a021 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -1,4 +1,7 @@ #include +#include +#include +#include #include int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj) { @@ -65,17 +68,37 @@ int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bm return 0; } -// int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj) { -// using namespace BloombergLP; +int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj, char** errorDescription, const z_bmqt_SubscriptionHandle* handle, const z_bmqt_Subscription* subscription){ + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription); + + bsl::string error; -// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); -// } + queueOptions_ptr->addOrUpdateSubscription(&error, *handle_ptr, *subscription_ptr); -// int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj) { -// using namespace BloombergLP; + if(error.empty()) { + *errorDescription = NULL; + return 0; + } else { + *errorDescription = static_cast(calloc(error.size()+1, sizeof(char))); + strcpy(*errorDescription, error.c_str()); -// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); -// } + return 1; + } +} + +int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_SubscriptionHandle* handle){ + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); + queueOptions_ptr->removeSubscription(*handle_ptr); + + return 0; +} int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; @@ -145,14 +168,42 @@ bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* //Experimental (Modifiers) -// bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj) { -// using namespace BloombergLP; +bool z_bmqt_QueueOptions__loadSubscription(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_Subscription** subscription, const z_bmqt_SubscriptionHandle* handle) { + using namespace BloombergLP; -// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); -// } + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); + bmqt::Subscription* subscription_ptr = new bmqt::Subscription(); + + bool success = queueOptions_ptr->loadSubscription(subscription_ptr, *handle_ptr); + + if(success) { + *subscription = reinterpret_cast(subscription_ptr); + } else { + delete subscription_ptr; + *subscription = NULL; + } + + return success; +} + +int z_bmqt_QueueOptions__loadSubscriptions(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_SubscrptionsSnapshot* snapshot) { + using namespace BloombergLP; -// int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj) { -// using namespace BloombergLP; + bmqt::QueueOptions::SubscriptionsSnapshot vector; + const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + queueOptions_ptr->loadSubscriptions(&vector); + + snapshot->size = vector.size(); + snapshot->subscriptions = static_cast(calloc(vector.size(), sizeof(z_bmqt_HandleAndSubscrption))); + + for(size_t i = 0; i < vector.size(); ++i) { + bmqt::SubscriptionHandle* handle_ptr = new bmqt::SubscriptionHandle(vector[i].first); + bmqt::Subscription* subscription_ptr = new bmqt::Subscription(vector[i].second); -// bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); -// } + snapshot->subscriptions[i].handle = reinterpret_cast(handle_ptr); + snapshot->subscriptions[i].subscrption = reinterpret_cast(subscription_ptr); + } + + return 0; +} diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h index f52b99b0f..0f916643d 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -1,14 +1,25 @@ #ifndef INCLUDED_Z_BMQT_QUEUEOPTIONS #define INCLUDED_Z_BMQT_QUEUEOPTIONS -typedef struct z_bmqt_QueueOptions z_bmqt_QueueOptions; - #include +#include #if defined(__cplusplus) extern "C" { #endif +typedef struct z_bmqt_QueueOptions z_bmqt_QueueOptions; + +typedef struct z_bmqt_HandleAndSubscrption { + z_bmqt_SubscriptionHandle* handle; + z_bmqt_Subscription* subscrption; +} z_bmqt_HandleAndSubscrption; + +typedef struct z_bmqt_SubscrptionsSnapshot { + size_t size; + z_bmqt_HandleAndSubscrption* subscriptions; +} z_bmqt_SubscrptionsSnapshot; + int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj); int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other); @@ -25,9 +36,10 @@ int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOp int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other); -// int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj); +//Pass in an an uninitialized char** for errorDescription, the pointer will be set to NULL if there is no error, otherwise it will set to an appropriately sized string that is allocated on the heap +int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj, char** errorDescription, const z_bmqt_SubscriptionHandle* handle, const z_bmqt_Subscription* subscription); -// int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_SubscriptionHandle* handle); int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); @@ -51,9 +63,9 @@ bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* //Experimental (Modifiers) -// bool z_bmqt_QueueOptions__loadSubcription(z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__loadSubscription(const z_bmqt_QueueOptions* queueOptions_obj); -// int z_bmqt_QueueOptions__loadSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__loadSubscriptions(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_SubscrptionsSnapshot* snapshot); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp new file mode 100644 index 000000000..1429333e3 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp @@ -0,0 +1,185 @@ +#include +#include +#include +#include + +int z_bmqt_SubscriptionHandle__create(z_bmqt_SubscriptionHandle** subscriptionHandle_obj, const z_bmqt_CorrelationId* cid){ + using namespace BloombergLP; + + const bmqt::CorrelationId* correlationId = reinterpret_cast(cid); + bmqt::SubscriptionHandle* subscriptionHandle_ptr = new bmqt::SubscriptionHandle(*correlationId); + *subscriptionHandle_obj = reinterpret_cast(subscriptionHandle_ptr); + + return 0; +} + +unsigned int z_bmqt_SubscriptionHandle__id(const z_bmqt_SubscriptionHandle* subscriptionHandle_obj){ + using namespace BloombergLP; + + const bmqt::SubscriptionHandle* subscriptionHandle_ptr = reinterpret_cast(subscriptionHandle_obj); + return subscriptionHandle_ptr->id(); +} + +/////// + +int z_bmqt_SubscriptionExpression__create(z_bmqt_SubscriptionExpression** subscriptionExpression_obj){ + using namespace BloombergLP; + + bmqt::SubscriptionExpression* subscriptionExpression_ptr = new bmqt::SubscriptionExpression(); + *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_ptr); + + return 0; +} + +int z_bmqt_SubscriptionExpression__createFromString(z_bmqt_SubscriptionExpression** subscriptionExpression_obj, const char* expression, SubscriptionExpressionEnum version){ + using namespace BloombergLP; + + bmqt::SubscriptionExpression::Enum v; + switch(version) { + case SubscriptionExpressionEnum::e_NONE: v = bmqt::SubscriptionExpression::e_NONE; + case SubscriptionExpressionEnum::e_VERSION_1: v = bmqt::SubscriptionExpression::e_VERSION_1; + default: return 1; + } + + bmqt::SubscriptionExpression* subscriptionExpression_ptr = new bmqt::SubscriptionExpression(bsl::string(expression), v); + + *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_ptr); + + return 0; +} + +const char* z_bmqt_SubscriptionExpression__text(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ + using namespace BloombergLP; + + const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); + return subscriptionExpression_ptr->text().c_str(); +} + +SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ + using namespace BloombergLP; + + const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); + switch(subscriptionExpression_ptr->version()) { + case bmqt::SubscriptionExpression::e_NONE: return SubscriptionExpressionEnum::e_NONE; + case bmqt::SubscriptionExpression::e_VERSION_1: return SubscriptionExpressionEnum::e_VERSION_1; + default: break; + } + + return SubscriptionExpressionEnum::e_SUBSCRIPTIONEXPRESSION_ERROR; +} + +bool z_bmqt_SubscriptionExpression__isValid(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ + using namespace BloombergLP; + + const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); + return subscriptionExpression_ptr->isValid(); +} + +/////// + +int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj){ + using namespace BloombergLP; + + bmqt::Subscription* subscription_ptr = new bmqt::Subscription(); + *subscription_obj = reinterpret_cast(subscription_ptr); + + return 0; +} + +int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, const z_bmqt_Subscription* other){ + using namespace BloombergLP; + + const bmqt::Subscription* other_ptr = reinterpret_cast(other); + bmqt::Subscription* subscription_ptr = new bmqt::Subscription(*other_ptr); + *subscription_obj = reinterpret_cast(subscription_ptr); + + return 0; +} + +int z_bmqt_Subscription__setMaxUnconfirmedMessages(z_bmqt_Subscription* subscription_obj, int value){ + using namespace BloombergLP; + + bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + subscription_ptr->setMaxUnconfirmedMessages(value); + + return 0; +} + +int z_bmqt_Subscription__setMaxUnconfirmedBytes(z_bmqt_Subscription* subscription_obj, int value){ + using namespace BloombergLP; + + bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + subscription_ptr->setMaxUnconfirmedBytes(value); + + return 0; +} + +int z_bmqt_Subscription__setConsumerPriority(z_bmqt_Subscription* subscription_obj, int value){ + using namespace BloombergLP; + + bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + subscription_ptr->setConsumerPriority(value); + + return 0; +} + +int z_bmqt_Subscription__setExpression(z_bmqt_Subscription* subscription_obj, const z_bmqt_SubscriptionExpression* value){ + using namespace BloombergLP; + + bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + const bmqt::SubscriptionExpression* expression_ptr = reinterpret_cast(value); + subscription_ptr->setExpression(*expression_ptr); + + return 0; +} + +int z_bmqt_Subscription__maxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->maxUnconfirmedMessages(); +} + +int z_bmqt_Subscription__maxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->maxUnconfirmedBytes(); +} + +int z_bmqt_Subscription__consumerPriority(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->consumerPriority(); +} + +const z_bmqt_SubscriptionExpression* z_bmqt_Subscription__expression(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + const bmqt::SubscriptionExpression* expression_ptr = &(subscription_ptr->expression()); + + return reinterpret_cast(expression_ptr); +} + +bool z_bmqt_Subscription__hasMaxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->hasMaxUnconfirmedMessages(); +} + +bool z_bmqt_Subscription__hasMaxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->hasMaxUnconfirmedBytes(); +} + +bool z_bmqt_Subscription__hasConsumerPriority(const z_bmqt_Subscription* subscription_obj){ + using namespace BloombergLP; + + const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); + return subscription_ptr->hasConsumerPriority(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h new file mode 100644 index 000000000..36ecab0a1 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h @@ -0,0 +1,82 @@ +#ifndef INCLUDED_Z_BMQT_SUBSCRIPTION +#define INCLUDED_Z_BMQT_SUBSCRIPTION + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +// ======================== +// class SubscriptionHandle +// ======================== + +typedef struct z_bmqt_SubscriptionHandle z_bmqt_SubscriptionHandle; + +int z_bmqt_SubscriptionHandle__create(z_bmqt_SubscriptionHandle** subscriptionHandle_obj, const z_bmqt_CorrelationId* cid); + +unsigned int z_bmqt_SubscriptionHandle__id(const z_bmqt_SubscriptionHandle* subscriptionHandle_obj); + +// ============================ +// class SubscriptionExpression +// ============================ + +typedef struct z_bmqt_SubscriptionExpression z_bmqt_SubscriptionExpression; + +enum SubscriptionExpressionEnum { + // Enum representing criteria format + e_NONE = 0 // EMPTY + , + e_VERSION_1 = 1 // Simple Evaluator + , + e_SUBSCRIPTIONEXPRESSION_ERROR +}; + +int z_bmqt_SubscriptionExpression__create(z_bmqt_SubscriptionExpression** subscriptionExpression_obj); + +int z_bmqt_SubscriptionExpression__createFromString(z_bmqt_SubscriptionExpression** subscriptionExpression_obj, const char* expression, SubscriptionExpressionEnum version); + +const char* z_bmqt_SubscriptionExpression__text(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); + +SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); + +bool z_bmqt_SubscriptionExpression__isValid(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); + +// ================== +// class Subscription +// ================== + +typedef struct z_bmqt_Subscription z_bmqt_Subscription; + +int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj); + +int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, const z_bmqt_Subscription* other); + +int z_bmqt_Subscription__setMaxUnconfirmedMessages(z_bmqt_Subscription* subscription_obj, int value); + +int z_bmqt_Subscription__setMaxUnconfirmedBytes(z_bmqt_Subscription* subscription_obj, int value); + +int z_bmqt_Subscription__setConsumerPriority(z_bmqt_Subscription* subscription_obj, int value); + +int z_bmqt_Subscription__setExpression(z_bmqt_Subscription* subscription_obj, const z_bmqt_SubscriptionExpression* value); + +int z_bmqt_Subscription__maxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj); + +int z_bmqt_Subscription__maxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj); + +int z_bmqt_Subscription__consumerPriority(const z_bmqt_Subscription* subscription_obj); + +const z_bmqt_SubscriptionExpression* z_bmqt_Subscription__expression(const z_bmqt_Subscription* subscription_obj); + +bool z_bmqt_Subscription__hasMaxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj); + +bool z_bmqt_Subscription__hasMaxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj); + +bool z_bmqt_Subscription__hasConsumerPriority(const z_bmqt_Subscription* subscription_obj); + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file From 29ee11eafcce8959869c578b413a9cc076e1768a Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 10 Nov 2023 16:57:27 -0500 Subject: [PATCH 27/57] Started Session implementation --- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 6 ++ .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 6 ++ .../z_bmq/z_bmqa/z_bmqa_messageproperties.h | 6 ++ src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 27 ++++---- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 64 ++++++++++++++++++- src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 1 + src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h | 3 +- src/groups/z_bmq/z_bmqt/z_bmqt_types.h | 16 +++++ 8 files changed, 112 insertions(+), 17 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_types.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h new file mode 100644 index 000000000..1e286a379 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -0,0 +1,6 @@ +#ifndef INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER +#define INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER + +typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h new file mode 100644 index 000000000..ee8839887 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -0,0 +1,6 @@ +#ifndef INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER +#define INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER + +typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h new file mode 100644 index 000000000..b9b2823d5 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h @@ -0,0 +1,6 @@ +#ifndef INCLUDED_Z_BMQA_MESSAGEPROPERTIES +#define INCLUDED_Z_BMQA_MESSAGEPROPERTIES + +typedef struct z_bmqa_MessageProperties z_bmqa_MessageProperties; + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 7c7cbec7c..35d68e03f 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -4,32 +4,31 @@ #include -int z_bmqa_Session__create(z_bmqa_Session** session_obj , z_bmqt_SessionOptions* options) { +int z_bmqa_Session__create(z_bmqa_Session** session_obj , const z_bmqt_SessionOptions* options) { using namespace BloombergLP; - bmqt::SessionOptions* option_ptr = reinterpret_cast(options); - bmqa::Session* session_ptr = new bmqa::Session(*option_ptr); - *session_obj = reinterpret_cast(session_ptr); - return 0; -} -int z_bmqa_Session__destroy(z_bmqa_Session* session_obj) { - using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - delete session_ptr; + const bmqt::SessionOptions* options_ptr = reinterpret_cast(options); + bmqa::Session* session_ptr = new bmqa::Session(*options_ptr); + *session_obj = reinterpret_cast(session_ptr); return 0; } int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) { using namespace BloombergLP; + bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bsls::TimeInterval timeout; - timeout.addMilliseconds(timeoutMs); - int rc = session_ptr->start(timeout); - return rc; + if(timeoutMs != 0) { + bsls::TimeInterval timeout; + timeout.addMilliseconds(timeoutMs); + return session_ptr->start(timeout); + } else { + return session_ptr->start(); + } } int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { using namespace BloombergLP; + bmqa::Session* session_ptr = reinterpret_cast(session_obj); session_ptr->stop(); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 3b7e6abb3..2d113aea2 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -2,22 +2,82 @@ #define INCLUDED_Z_BMQA_SESSION #include +#include +#include +#include +#include +#include #include #if defined(__cplusplus) extern "C" { #endif +typedef struct z_bmqa_SessionEventHandler z_bmqa_SessionEventHandler; + + typedef struct z_bmqa_Session z_bmqa_Session; -int z_bmqa_Session__create(z_bmqa_Session** session_obj, z_bmqt_SessionOptions* options); +typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; + +typedef void(*z_bmqa_SessionEventHandlerCb)(z_bmqa_SessionEvent* sessionEvent, void* data); + +typedef struct EventHandlerData { + z_bmqa_SessionEventHandlerCb callback; + void* data; +} EventHandlerData; + +// void z_bmqa_Session__setEventHandler(z_bmqa_Session* session_obj, EventHandlerData* data) { +// if(data.callback != NULL) { +// z_bmqa_SessionEvent* event = NULL; -int z_bmqa_Session__destroy(z_bmqa_Session* session_obj); +// data.callback(event, NULL); +// } +// } + +int z_bmqa_Session__create(z_bmqa_Session** session_obj, const z_bmqt_SessionOptions* options); + +int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, z_bmqa_SessionEventHandler* eventHandler, const z_bmqt_SessionOptions* options); int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t milliseconds); +int z_bmqa_Session__startAsync(); + int z_bmqa_Session__stop(z_bmqa_Session* session_obj); +int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj); + +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj); + +int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder); + +int z_bmqa_Session__loadConfirmEventBuilder(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder** builder); + +int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer); + +int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri); + +int z_bmqa_Session__getQueueIdWithCorrelationId(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_CorrelationId* correlationId); + +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const z_bmqt_Uri* uri, uint64_t flags, + const z_bmqt_QueueOptions* options, + int64_t timeout); + +// int z_bmqa_Session__openQueueAsync(z_bmqa_Session* session_obj, +// z_bmqa_QueueId* queueId, +// const z_bmqt_Uri* uri, uint64_t flags, +// const z_bmqt_QueueOptions* options, +// int64_t timeout); + +int z_bmqa_Session__configureQueue(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const z_bmqt_QueueOptions* options, + int64_t timeout); + + + #if defined(__cplusplus) } #endif diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem index e37e0e3c6..beeb8066f 100644 --- a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -2,4 +2,5 @@ z_bmqt_correlationid z_bmqt_queueoptions z_bmqt_sessionoptions z_bmqt_subscription +z_bmqt_types z_bmqt_uri \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h index 0f916643d..997e9624e 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -2,6 +2,7 @@ #define INCLUDED_Z_BMQT_QUEUEOPTIONS #include +#include #include #if defined(__cplusplus) @@ -16,7 +17,7 @@ typedef struct z_bmqt_HandleAndSubscrption { } z_bmqt_HandleAndSubscrption; typedef struct z_bmqt_SubscrptionsSnapshot { - size_t size; + uint64_t size; z_bmqt_HandleAndSubscrption* subscriptions; } z_bmqt_SubscrptionsSnapshot; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_types.h b/src/groups/z_bmq/z_bmqt/z_bmqt_types.h new file mode 100644 index 000000000..9c4af5565 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_types.h @@ -0,0 +1,16 @@ +#ifndef INCLUDED_Z_BMQT_TYPES +#define INCLUDED_Z_BMQT_TYPES + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef const char* z_bmqt_String; + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file From 02ef69c9d0260663c36672e806b805003b56c35d Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 10 Nov 2023 17:43:53 -0500 Subject: [PATCH 28/57] Added headers for z_bmqa_Session --- src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 6 ++++- src/groups/z_bmq/z_bmqa/z_bmqa_event.h | 6 +++++ src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 9 ++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h | 6 +++++ src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 22 ++++++++++++++++++- 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_event.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_message.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index 8605fa0b8..da1eb6b88 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -1,2 +1,6 @@ z_bmqa_queueid -z_bmqa_session \ No newline at end of file +z_bmqa_session +z_bmqa_event +z_bmqa_confirmeventbuilder +z_bmqa_messageeventbuilder +z_bmqa_messageproperties \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_event.h b/src/groups/z_bmq/z_bmqa/z_bmqa_event.h new file mode 100644 index 000000000..c8ec6f3ab --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_event.h @@ -0,0 +1,6 @@ +#ifndef INCLUDED_Z_BMQA_EVENT +#define INCLUDED_Z_BMQA_EVENT + +typedef struct z_bmqa_Event z_bmqa_Event; + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h new file mode 100644 index 000000000..3bb581612 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -0,0 +1,9 @@ +#ifndef INCLUDED_Z_BMQA_MESSAGE +#define INCLUDED_Z_BMQA_MESSAGE + +typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; + +typedef struct z_bmqa_Message z_bmqa_Message; + + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h new file mode 100644 index 000000000..04bcdaf66 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h @@ -0,0 +1,6 @@ +#ifndef INCLUDED_Z_BMQA_MESSAGEEVENT +#define INCLUDED_Z_BMQA_MESSAGEEVENT + +typedef struct z_bmqa_MessageEvent z_bmqa_MessageEvent; + +#endif diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 2d113aea2..bf9f9ad9c 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -5,8 +5,11 @@ #include #include #include +#include +#include #include #include +#include #include #if defined(__cplusplus) @@ -71,12 +74,29 @@ int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, // const z_bmqt_QueueOptions* options, // int64_t timeout); -int z_bmqa_Session__configureQueue(z_bmqa_Session* session_obj, +int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, const z_bmqt_QueueOptions* options, int64_t timeout); +// int z_bmqa_Session__configureQueueAsync(z_bmqa_Session* session_obj, +// z_bmqa_QueueId* queueId, +// const z_bmqt_QueueOptions* options, +// int64_t timeout); +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); + +int z_bmqa_Session__closeQueueAsync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); + +int z_bmqa_Session_nextEvent(z_bmqa_Session* session_obj, z_bmqa_Event** event_obj, int64_t timeout); + +int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event); + +int z_bmqa_Session__confirmMessage(z_bmqa_Session* session_obj, const z_bmqa_Message* message); + +int z_bmqa_Session__confirmMessageWithCookie(z_bmqa_Session* session_obj, const z_bmqa_MessageConfirmationCookie* cookie); + +int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder* builder); #if defined(__cplusplus) } From 3e1c44cd7c55abc33277e3751864ea2d75c7be8b Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 17 Nov 2023 19:51:29 -0500 Subject: [PATCH 29/57] test --- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 35d68e03f..488deac3e 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -32,5 +32,63 @@ int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { bmqa::Session* session_ptr = reinterpret_cast(session_obj); session_ptr->stop(); + return 0; +} + + +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + session_ptr->finalizeStop(); + return 0; +} + + +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + session_ptr->finalizeStop(); + return 0; +} + +int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder); + + session_ptr->loadMessageEventBuilder(builder_ptr); return 0; } + +int z_bmqa_Session__loadConfirmEventBuilder(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder** builder){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder); + + session_ptr->loadConfirmEventBuilder(builder_ptr); + return 0; +} + +int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::MessageProperties* buffer_ptr = reinterpret_cast(buffer); + + session_ptr->loadMessageProperties(buffer_ptr); + return 0; +} + +int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::Q* buffer_ptr = reinterpret_cast(uri); + + session_ptr->getQueueId(buffer_ptr); + return 0; +} \ No newline at end of file From a45f417b92d44e759183b4c5588f611a5394d614 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 14 Nov 2023 17:02:29 -0500 Subject: [PATCH 30/57] Initial implementation of z_bmqa_MessageEventBuilder --- .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 74 +++++++++++++++++++ .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 30 ++++++++ 2 files changed, 104 insertions(+) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp new file mode 100644 index 000000000..7a8eea458 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp @@ -0,0 +1,74 @@ +#include +#include +#include + + + +int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = new bmqa::MessageEventBuilder(); + *builder_obj = reinterpret_cast(builder_ptr); + + return 0; +} + +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + builder_ptr->startMessage(); + + return 0; +} + +int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId); + return builder_ptr->packMessage(*queueId_ptr); +} + +int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + builder_ptr->reset(); + + return 0; +} + +int z_bmqa_MessageEventBuilder__messageEvent(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_MessageEvent const** event_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + const bmqa::MessageEvent* event_ptr = &(builder_ptr->messageEvent()); + *event_obj = reinterpret_cast(event_ptr); + + return 0; +} + +int z_bmqa_MessageEventBuilder__currentMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** message_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + bmqa::Message* message_ptr = &(builder_ptr->currentMessage()); + *message_obj = reinterpret_cast(message_ptr); + + return 0; +} + +int z_bmqa_MessageEventBuilder__messageCount(const z_bmqa_MessageEventBuilder* builder_obj) { + using namespace BloombergLP; + + const bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + return builder_ptr->messageCount(); +} + +int z_bmqa_MessageEventBuilder__messageEventSize(const z_bmqa_MessageEventBuilder* builder_obj) { + using namespace BloombergLP; + + const bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + return builder_ptr->messageEventSize(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index ee8839887..12c9d4273 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -1,6 +1,36 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER #define INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER + + +#include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; +int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj); + +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj); + +int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId); + +int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj); + +int z_bmqa_MessageEventBuilder__messageEvent(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_MessageEvent const** event_obj); + +int z_bmqa_MessageEventBuilder__currentMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** message_obj); + +int z_bmqa_MessageEventBuilder__messageCount(const z_bmqa_MessageEventBuilder* builder_obj); + +int z_bmqa_MessageEventBuilder__messageEventSize(const z_bmqa_MessageEventBuilder* builder_obj); + +#if defined(__cplusplus) +} +#endif + #endif \ No newline at end of file From 78d60c81d41074a7f41f3bfe9ac2927226783e46 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Wed, 15 Nov 2023 14:26:56 -0500 Subject: [PATCH 31/57] Initial implementation of z_bmqa_ConfirmEventBuilder --- .../z_bmqa/z_bmqa_confirmeventbuilder.cpp | 57 +++++++++++++++++++ .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 25 ++++++++ src/groups/z_bmq/z_bmqt/z_bmqt_types.h | 2 + 3 files changed, 84 insertions(+) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp new file mode 100644 index 000000000..45d493900 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp @@ -0,0 +1,57 @@ +#include +#include + + +int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj) { + using namespace BloombergLP; + + bmqa::ConfirmEventBuilder* builder_ptr = new bmqa::ConfirmEventBuilder(); + *builder_obj = reinterpret_cast(builder_ptr); + + return 0; +} + +int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_Message* message) { + using namespace BloombergLP; + + bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + const bmqa::Message* message_ptr = reinterpret_cast(message); + return builder_ptr->addMessageConfirmation(*message_ptr); +} + +int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie(z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_MessageConfirmationCookie* cookie) { + using namespace BloombergLP; + + bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + const bmqa::MessageConfirmationCookie* cookie_ptr = reinterpret_cast(cookie); + return builder_ptr->addMessageConfirmation(*cookie_ptr); +} + +int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj) { + using namespace BloombergLP; + + bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + builder_ptr->reset(); + + return 0; +} + +int z_bmqa_ConfirmEventBuilder__messageCount(const z_bmqa_ConfirmEventBuilder* builder_obj) { + using namespace BloombergLP; + + const bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + return builder_ptr->messageCount(); +} + +int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, z_bmqt_Blob const** blob_obj) { + using namespace BloombergLP; + + const bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + + const bdlbb::Blob* blob_ptr = &(builder_ptr->blob()); + *blob_obj = reinterpret_cast(blob_ptr); + + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index 1e286a379..5d872fb12 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -1,6 +1,31 @@ #ifndef INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER #define INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; +int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj); + +int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_Message* message); + +int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie(z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_MessageConfirmationCookie* cookie); + +int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj); + +int z_bmqa_ConfirmEventBuilder__messageCount(const z_bmqa_ConfirmEventBuilder* builder_obj); + +int z_bmqa_ConfirmEventBuilder__blob(const z_bmqa_ConfirmEventBuilder* builder_obj, z_bmqt_Blob const** blob_obj); + +#if defined(__cplusplus) +} +#endif + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_types.h b/src/groups/z_bmq/z_bmqt/z_bmqt_types.h index 9c4af5565..d6617b056 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_types.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_types.h @@ -9,6 +9,8 @@ extern "C" { typedef const char* z_bmqt_String; +typedef struct z_bmqt_Blob z_bmqt_Blob; + #if defined(__cplusplus) } #endif From e9373461ca8b070fe763e92416cf2944db3d091b Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 1 Dec 2023 01:18:04 -0500 Subject: [PATCH 32/57] producer bare minimum --- .gitignore | 1 + src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp | 20 ++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 6 ++- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 57 ++++++++++++++++++++-- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 11 ++--- 5 files changed, 82 insertions(+), 13 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp diff --git a/.gitignore b/.gitignore index a05479a9f..05c69ceef 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ CMakeUserPresets.json /include/ /lib/ **/__pycache__/ +/thirdparty diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp new file mode 100644 index 000000000..fafb90230 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -0,0 +1,20 @@ +#include +#include + +int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj){ + using namespace BloombergLP; + + bmqa::Message* message_ptr = new bmqa::Message(); + + *message_obj = reinterpret_cast(message_ptr); + return 0; +} + +int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, size_t length){ + using namespace BloombergLP; + + bmqa::Message* message_ptr = reinterpret_cast(message_obj); + + message_ptr->setDataRef(data, length); + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index 3bb581612..9ff9745b9 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -1,9 +1,11 @@ #ifndef INCLUDED_Z_BMQA_MESSAGE #define INCLUDED_Z_BMQA_MESSAGE -typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; - typedef struct z_bmqa_Message z_bmqa_Message; +int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj); + +int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, size_t length); + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 488deac3e..be4690e9f 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -2,6 +2,7 @@ #include #include #include +#include int z_bmqa_Session__create(z_bmqa_Session** session_obj , const z_bmqt_SessionOptions* options) { @@ -83,12 +84,58 @@ int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_Me return 0; } -int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ - using namespace BloombergLP; +// int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ +// using namespace BloombergLP; +// bmqa::Session* session_ptr = reinterpret_cast(session_obj); +// bmqa::Q* buffer_ptr = reinterpret_cast(uri); + +// session_ptr->getQueueId(buffer_ptr); +// return 0; +// } + + +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ + using namespace BloombergLP; + bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::Q* buffer_ptr = reinterpret_cast(uri); + bmqt::Uri const * uri_ptr = reinterpret_cast< bmqt::Uri const *>(uri); + bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); - session_ptr->getQueueId(buffer_ptr); + //must populate out obj in future + session_ptr->openQueueSync(queueid_ptr, *uri_ptr, flags); return 0; -} \ No newline at end of file +} + +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout /*,z_bmqa_CloseQueueStatus**/){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); + + //must populate out obj in future + session_ptr->closeQueueSync(queueid_ptr); // not using timeout (we should definitely add this) + return 0; +} + +int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder); + + session_ptr->loadMessageEventBuilder(builder_ptr); + return 0; +} + +int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event){ + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + const bmqa::MessageEvent* event_ptr = reinterpret_cast(event); + + session_ptr->post(*event_ptr); + return 0; +} + + diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index bf9f9ad9c..2f8e45f6c 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -23,6 +23,8 @@ typedef struct z_bmqa_Session z_bmqa_Session; typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; +typedef struct z_bmqa_OpenQueueStatus z_bmqa_OpenQueueStatus; + typedef void(*z_bmqa_SessionEventHandlerCb)(z_bmqa_SessionEvent* sessionEvent, void* data); typedef struct EventHandlerData { @@ -62,11 +64,8 @@ int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueI int z_bmqa_Session__getQueueIdWithCorrelationId(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_CorrelationId* correlationId); -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, - z_bmqa_QueueId* queueId, - const z_bmqt_Uri* uri, uint64_t flags, - const z_bmqt_QueueOptions* options, - int64_t timeout); +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); + // int z_bmqa_Session__openQueueAsync(z_bmqa_Session* session_obj, // z_bmqa_QueueId* queueId, @@ -84,7 +83,7 @@ int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, // const z_bmqt_QueueOptions* options, // int64_t timeout); -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout /*,z_bmqa_CloseQueueStatus**/); int z_bmqa_Session__closeQueueAsync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); From e35c2f368e2e4e5623d6d1f16f1158e95f5b12a4 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 1 Dec 2023 02:11:58 -0500 Subject: [PATCH 33/57] demo files + minor fixes --- src/groups/z_bmq/z_bmq_demo/demo.c | 83 +++++++++++++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 2 +- .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 4 +- .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 2 +- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 21 +++-- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 6 +- 6 files changed, 107 insertions(+), 11 deletions(-) create mode 100644 src/groups/z_bmq/z_bmq_demo/demo.c diff --git a/src/groups/z_bmq/z_bmq_demo/demo.c b/src/groups/z_bmq/z_bmq_demo/demo.c new file mode 100644 index 000000000..d75f39ee8 --- /dev/null +++ b/src/groups/z_bmq/z_bmq_demo/demo.c @@ -0,0 +1,83 @@ +#include +#include +#include +#include + +const int K_QUEUE_ID = 1; +const char K_QUEUE_URL[] = "bmq://bmq.test.mem.priority/test-queue"; +const int K_NUM_MESSAGES = 5; + + enum QueueFlags { + e_ADMIN = (1 << 0) // The queue is opened in admin mode (Valid only + // for BlazingMQ admin tasks) + , + e_READ = (1 << 1) // The queue is opened for consuming messages + , + e_WRITE = (1 << 2) // The queue is opened for posting messages + , + e_ACK = (1 << 3) // Set to indicate interested in receiving + // 'ACK' events for all message posted +}; + + +void postEvent(const char** text, + z_bmqa_QueueId* queueId, + z_bmqa_Session* session){ + + z_bmqa_MessageEventBuilder* builder; + z_bmqa_MessageEventBuilder__create(builder); + + z_bmqa_Session__loadMessageEventBuilder(session, builder); + + z_bmqa_Message* message; + z_bmqa_MessageEventBuilder__startMessage(builder, message); + + z_bmqa_Message_setDataRef(message, text, strlen(text)); + + z_bmqa_MessageEventBuilder__packMessage(builder, queueId); + + const z_bmqa_MessageEvent* messageEvent; + z_bmqa_MessageEventBuilder__messageEvent(builder, messageEvent); + + z_bmqa_Session__post(session, messageEvent); +} + + +void produce(z_bmqa_Session* session){ + z_bmqa_QueueId* queueId; + + z_bmqa_QueueId__createFromNumeric(queueId, K_QUEUE_ID); + z_bmqa_Session__openQueueSync(session, + queueId, + K_QUEUE_URL, + e_WRITE); + + const char*** messages = {"Hello world!", + "message 1", + "message 2", + "message 3", + "Good Bye!"}; + for(int idx = 0; idx < 5; ++idx){ + postEvent(messages[idx], queueId, session); + } + + z_bmqa_Session__closeQueueSync(session, queueId); +} + +int main(){ + z_bmqa_Session* session; + z_bmqt_SessionOptions* options; + + z_bmqt_SessionOptions__create(&options); + z_bmqa_Session__create(&session, &options); + + + //start the session + z_bmqa_Session__start(session, 1000); + + produce(session); + + //stop the session + z_bmqa_Session__stop(session); + +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index 9ff9745b9..ab2226c48 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -5,7 +5,7 @@ typedef struct z_bmqa_Message z_bmqa_Message; int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj); -int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, size_t length); +int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, int length); #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp index 7a8eea458..26a192f8e 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp @@ -13,11 +13,11 @@ int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) return 0; } -int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj) { +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message* out_obj) { using namespace BloombergLP; bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - builder_ptr->startMessage(); + out_obj = reinterpret_cast(&builder_ptr->startMessage()); // uhhhhh return 0; } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index 12c9d4273..f7e0809c6 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -15,7 +15,7 @@ typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj); -int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj); +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message* out_obj); int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index be4690e9f..9a5c660e1 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -95,19 +95,30 @@ int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_Me // } -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ +// int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ +// using namespace BloombergLP; + +// bmqa::Session* session_ptr = reinterpret_cast(session_obj); +// bmqt::Uri const * uri_ptr = reinterpret_cast< bmqt::Uri const *>(uri); +// bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); + +// //must populate out obj in future +// session_ptr->openQueueSync(queueid_ptr, *uri_ptr, flags); +// return 0; +// } + +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const char * uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ using namespace BloombergLP; bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqt::Uri const * uri_ptr = reinterpret_cast< bmqt::Uri const *>(uri); - bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); + bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); //must populate out obj in future - session_ptr->openQueueSync(queueid_ptr, *uri_ptr, flags); + session_ptr->openQueueSync(queueid_ptr, uri, flags); return 0; } -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout /*,z_bmqa_CloseQueueStatus**/){ +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId /*,z_bmqa_CloseQueueStatus**/){ using namespace BloombergLP; bmqa::Session* session_ptr = reinterpret_cast(session_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 2f8e45f6c..4985eb52b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -18,6 +18,7 @@ extern "C" { typedef struct z_bmqa_SessionEventHandler z_bmqa_SessionEventHandler; +typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; typedef struct z_bmqa_Session z_bmqa_Session; @@ -64,8 +65,9 @@ int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueI int z_bmqa_Session__getQueueIdWithCorrelationId(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_CorrelationId* correlationId); -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); +// int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const char * uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); // int z_bmqa_Session__openQueueAsync(z_bmqa_Session* session_obj, // z_bmqa_QueueId* queueId, @@ -83,7 +85,7 @@ int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, // const z_bmqt_QueueOptions* options, // int64_t timeout); -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout /*,z_bmqa_CloseQueueStatus**/); +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId /*,z_bmqa_CloseQueueStatus**/); int z_bmqa_Session__closeQueueAsync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); From a24c1f86cb573e2d132560d79f5eedb89e991f16 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 1 Dec 2023 02:22:45 -0500 Subject: [PATCH 34/57] More changes --- src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp | 2 + src/groups/z_bmq/z_bmqa/z_bmqa_event.h | 14 ++++ .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp | 65 +++++++++++++++++++ .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.h | 36 ++++++++++ src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h | 15 +++++ 5 files changed, 132 insertions(+) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp new file mode 100644 index 000000000..77a1ada4f --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp @@ -0,0 +1,2 @@ +#include +#include \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_event.h b/src/groups/z_bmq/z_bmqa/z_bmqa_event.h index c8ec6f3ab..cc68d6129 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_event.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_event.h @@ -1,6 +1,20 @@ #ifndef INCLUDED_Z_BMQA_EVENT #define INCLUDED_Z_BMQA_EVENT +#include + +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_Event z_bmqa_Event; +int z_bmqa_Event__create(z_bmqa_Event** event_obj); + +int z_bmqa_Event__SessionEvent(z_bmqa_Event* event_obj); + +#if defined(__cplusplus) +} +#endif + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp new file mode 100644 index 000000000..f1ac29584 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp @@ -0,0 +1,65 @@ +#include +#include + +int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) { + using namespace BloombergLP; + + bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(); + + *status_obj = reinterpret_cast(status_ptr); + + return 0; +} + +int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_OpenQueueStatus* other) { + using namespace BloombergLP; + + const bmqa::OpenQueueStatus* other_ptr = reinterpret_cast(other); + bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(*other_ptr); + + *status_obj = reinterpret_cast(status_ptr); + + return 0; +} + +int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId); + const bsl::string errorDescription_str(errorDescription); + bmqt::OpenQueueResult::Enum result_enum = static_cast(result); + bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(*queueId_ptr, result_enum, errorDescription_str); + *status_obj = reinterpret_cast(status_ptr); + + return 0; +} + +bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj) { + using namespace BloombergLP; + const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); + return *status_ptr; +} + +int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj) { + using namespace BloombergLP; + const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); + const bmqa::QueueId* queueId_ptr = &(status_ptr->queueId()); + + *queueId_obj = reinterpret_cast(queueId_ptr); + return 0; +} + +int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj) { + using namespace BloombergLP; + const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); + return status_ptr->result(); +} + +const char* z_bmqa_OpenQueueStatus__errorDescription(const z_bmqa_OpenQueueStatus* status_obj) { + using namespace BloombergLP; + const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); + return status_ptr->errorDescription().c_str(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h new file mode 100644 index 000000000..6a75bbd84 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h @@ -0,0 +1,36 @@ +#ifndef INCLUDED_Z_BMQA_OPENQUEUESTATUS +#define INCLUDED_Z_BMQA_OPENQUEUESTATUS + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct z_bmqa_OpenQueueStatus z_bmqa_OpenQueueStatus; + +int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj); + +int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_OpenQueueStatus* other); + +int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription); + +bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj); + +int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj); + +int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj); + +const char* z_bmqa_OpenQueueStatus__errorDescription(const z_bmqa_OpenQueueStatus* status_obj); + + + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h new file mode 100644 index 000000000..cc3c74ef6 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h @@ -0,0 +1,15 @@ +#ifndef INCLUDED_Z_BMQA_SESSIONEVENT +#define INCLUDED_Z_BMQA_SESSIONEVENT + + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; + +#if defined(__cplusplus) +} +#endif + +#endif From d03af92d59ab46fd304e637202247e10f5425673 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 1 Dec 2023 03:40:20 -0500 Subject: [PATCH 35/57] Got C producer working, will clean later --- src/groups/z_bmq/z_bmqa/demo.h | 100 ++++++++++++++++++ src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 3 +- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 1 + src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp | 2 +- src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 10 +- .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 5 +- .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 2 +- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 28 ++--- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 4 + src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp | 27 +---- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 10 ++ .../z_bmq/z_bmqt/z_bmqt_sessionoptions.h | 2 + 12 files changed, 149 insertions(+), 45 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/demo.h diff --git a/src/groups/z_bmq/z_bmqa/demo.h b/src/groups/z_bmq/z_bmqa/demo.h new file mode 100644 index 000000000..703686a7c --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/demo.h @@ -0,0 +1,100 @@ +#include +#include +#include +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +const int K_QUEUE_ID = 1; +const char K_QUEUE_URI[] = "bmq://bmq.test.mem.priority/test-queue"; +const int K_NUM_MESSAGES = 5; + + enum QueueFlags { + e_ADMIN = (1 << 0) // The queue is opened in admin mode (Valid only + // for BlazingMQ admin tasks) + , + e_READ = (1 << 1) // The queue is opened for consuming messages + , + e_WRITE = (1 << 2) // The queue is opened for posting messages + , + e_ACK = (1 << 3) // Set to indicate interested in receiving + // 'ACK' events for all message posted +}; + + +void postEvent(const char* text, + z_bmqa_QueueId* queueId, + z_bmqa_Session* session){ + + z_bmqa_MessageEventBuilder* builder; + z_bmqa_MessageEventBuilder__create(&builder); + + z_bmqa_Session__loadMessageEventBuilder(session, &builder); + + z_bmqa_Message* message; + + z_bmqa_MessageEventBuilder__startMessage(builder, &message); + + z_bmqa_Message__setDataRef(message, text, (int)strlen(text)); + + z_bmqa_MessageEventBuilder__packMessage(builder, queueId); + + const z_bmqa_MessageEvent* messageEvent; + z_bmqa_MessageEventBuilder__messageEvent(builder, &messageEvent); + + z_bmqa_Session__post(session, messageEvent); +} + + +void produce(z_bmqa_Session* session){ + z_bmqa_QueueId* queueId; + + z_bmqa_QueueId__createFromNumeric(&queueId, K_QUEUE_ID); + z_bmqa_Session__openQueueSync(session, + queueId, + K_QUEUE_URI, + e_WRITE); + + const char* messages[] = {"Hello world!", + "message 1", + "message 2", + "message 3", + "Good Bye!"}; + for(int idx = 0; idx < 5; ++idx){ + postEvent(messages[idx], queueId, session); + } + + z_bmqa_Session__closeQueueSync(session, queueId); +} + +int run_c_producer(){ + z_bmqa_Session* session; + z_bmqt_SessionOptions* options; + + z_bmqt_SessionOptions__create(&options); + z_bmqa_Session__create(&session, options); + + + //start the session + z_bmqa_Session__start(session, 1000); + + produce(session); + + //stop the session + z_bmqa_Session__stop(session); + + printf("Good2\n"); + + // z_bmqa_Session__delete(&session); + // z_bmqt_SessionOptions__delete(&options); + + return 0; + +} + +#if defined(__cplusplus) +} +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index da1eb6b88..bf62e7499 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -3,4 +3,5 @@ z_bmqa_session z_bmqa_event z_bmqa_confirmeventbuilder z_bmqa_messageeventbuilder -z_bmqa_messageproperties \ No newline at end of file +z_bmqa_messageproperties +z_bmqa_message \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index 5d872fb12..3e2fb9b34 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -9,6 +9,7 @@ extern "C" { #endif typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; +typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp index fafb90230..56ad5780b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -10,7 +10,7 @@ int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj){ return 0; } -int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, size_t length){ +int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length){ using namespace BloombergLP; bmqa::Message* message_ptr = reinterpret_cast(message_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index ab2226c48..ac3352e0b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -1,11 +1,19 @@ #ifndef INCLUDED_Z_BMQA_MESSAGE #define INCLUDED_Z_BMQA_MESSAGE +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_Message z_bmqa_Message; int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj); -int z_bmqa_Message_setDataRef(z_bmqa_Message** message_obj, const char* data, int length); +int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length); + +#if defined(__cplusplus) +} +#endif #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp index 26a192f8e..8d5d163df 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp @@ -13,11 +13,12 @@ int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) return 0; } -int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message* out_obj) { +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** out_obj) { using namespace BloombergLP; bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - out_obj = reinterpret_cast(&builder_ptr->startMessage()); // uhhhhh + bmqa::Message* message_ptr = &builder_ptr->startMessage(); + *out_obj = reinterpret_cast(message_ptr); return 0; } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index f7e0809c6..1d89a98e6 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -15,7 +15,7 @@ typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj); -int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message* out_obj); +int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** out_obj); int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 9a5c660e1..1ad72cdcd 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -5,6 +5,16 @@ #include +int z_bmqa_Session__delete(z_bmqa_Session** session_obj) { + using namespace BloombergLP; + + bmqa::Session* session_ptr = reinterpret_cast(session_obj); + delete session_ptr; + *session_obj = NULL; + + return 0; +} + int z_bmqa_Session__create(z_bmqa_Session** session_obj , const z_bmqt_SessionOptions* options) { using namespace BloombergLP; @@ -46,19 +56,12 @@ int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ } -int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ - using namespace BloombergLP; - - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - session_ptr->finalizeStop(); - return 0; -} int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ using namespace BloombergLP; bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder); + bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(*builder); session_ptr->loadMessageEventBuilder(builder_ptr); return 0; @@ -129,15 +132,6 @@ int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* return 0; } -int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ - using namespace BloombergLP; - - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder); - - session_ptr->loadMessageEventBuilder(builder_ptr); - return 0; -} int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event){ using namespace BloombergLP; diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 4985eb52b..1e029b000 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -41,6 +41,10 @@ typedef struct EventHandlerData { // } // } + // + +int z_bmqa_Session__delete(z_bmqa_Session** session_obj); + int z_bmqa_Session__create(z_bmqa_Session** session_obj, const z_bmqt_SessionOptions* options); int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, z_bmqa_SessionEventHandler* eventHandler, const z_bmqt_SessionOptions* options); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp index 8c2c755b3..d5e3c373b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp @@ -27,6 +27,8 @@ // TEST DRIVER #include +#include + // CONVENIENCE using namespace BloombergLP; using namespace bsl; @@ -37,26 +39,7 @@ using namespace bsl; static void test1_session() { - mwctst::TestHelper::printTestName("Create Session"); - - // Create default session - - z_bmqa_Session* session; - z_bmqt_SessionOptions* options; - z_bmqt_SessionOptions__create(&options); - z_bmqa_Session__create(&session, options); - - // Make sure 'k_BROKER_DEFAULT_PORT' and the default brokerUri are in sync - { - PV("CHECKING start() and stop()"); - - z_bmqa_Session__start(session, 1000); - - z_bmqa_Session__stop(session); - // ASSERT_EQ(sessionOptions_cpp.brokerUri(), result); - } - - // z_bmqa_Session__destroy(session); + run_c_producer(); } @@ -69,8 +52,8 @@ int main(int argc, char* argv[]) TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); switch (_testCase) { - case 0: - case 1: test1_session(); break; + case 0: test1_session(); break; + case 1: printf("Good\n"); break; default: { cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; s_testStatus = -1; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp index 7e4a751ee..28876700f 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -2,6 +2,16 @@ #include +int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj) { + using namespace BloombergLP; + + bmqt::SessionOptions* options_ptr = reinterpret_cast(options_obj); + delete options_ptr; + *options_obj = NULL; + + return 0; +} + int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj) { using namespace BloombergLP; bmqt::SessionOptions* options_ptr = new bmqt::SessionOptions(); diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h index 4e86e570e..269e5bba3 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h @@ -8,6 +8,8 @@ extern "C" { typedef struct z_bmqt_SessionOptions z_bmqt_SessionOptions; +int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj); + int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj); const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj); From 5493d191d63b28a58a830864327028cedd7c9118 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Wed, 6 Dec 2023 02:03:59 -0500 Subject: [PATCH 36/57] fixed mem leak and switched '_ptr' to '_p' to comply with bloomberg styling --- src/groups/z_bmq/z_bmqa/demo.h | 12 +- src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 9 +- .../z_bmqa/z_bmqa_confirmeventbuilder.cpp | 40 ++++--- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 2 + src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp | 28 ++++- src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 4 + .../z_bmq/z_bmqa/z_bmqa_messageevent.cpp | 22 ++++ src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h | 12 ++ .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 60 ++++++---- .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 4 + .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp | 34 +++--- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp | 70 +++++++----- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h | 4 + src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 74 ++++++------ .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 56 ++++----- .../z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 106 +++++++++--------- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 12 +- .../z_bmq/z_bmqt/z_bmqt_subscription.cpp | 86 +++++++------- src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp | 40 +++---- 19 files changed, 399 insertions(+), 276 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp diff --git a/src/groups/z_bmq/z_bmqa/demo.h b/src/groups/z_bmq/z_bmqa/demo.h index 703686a7c..19acc34aa 100644 --- a/src/groups/z_bmq/z_bmqa/demo.h +++ b/src/groups/z_bmq/z_bmqa/demo.h @@ -25,7 +25,7 @@ const int K_NUM_MESSAGES = 5; }; -void postEvent(const char* text, +void postEvent(const char* text, z_bmqa_QueueId* queueId, z_bmqa_Session* session){ @@ -46,6 +46,9 @@ void postEvent(const char* text, z_bmqa_MessageEventBuilder__messageEvent(builder, &messageEvent); z_bmqa_Session__post(session, messageEvent); + + z_bmqa_MessageEventBuilder__delete(&builder); + } @@ -68,6 +71,8 @@ void produce(z_bmqa_Session* session){ } z_bmqa_Session__closeQueueSync(session, queueId); + + z_bmqa_QueueId__delete(&queueId); } int run_c_producer(){ @@ -86,10 +91,9 @@ int run_c_producer(){ //stop the session z_bmqa_Session__stop(session); - printf("Good2\n"); - // z_bmqa_Session__delete(&session); - // z_bmqt_SessionOptions__delete(&options); + z_bmqa_Session__delete(&session); + z_bmqt_SessionOptions__delete(&options); return 0; diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index bf62e7499..d24a9918d 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -1,7 +1,8 @@ -z_bmqa_queueid -z_bmqa_session -z_bmqa_event z_bmqa_confirmeventbuilder +z_bmqa_event +z_bmqa_message +z_bmqa_messageevent z_bmqa_messageeventbuilder z_bmqa_messageproperties -z_bmqa_message \ No newline at end of file +z_bmqa_queueid +z_bmqa_session \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp index 45d493900..bfa36f7c1 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp @@ -2,11 +2,21 @@ #include +int z_bmqa_ConfirmEventBuilder__delete(z_bmqa_ConfirmEventBuilder const** builder_obj) { + using namespace BloombergLP; + + const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(*builder_obj); + delete builder_p; + *builder_obj = NULL; + + return 0; +} + int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj) { using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_ptr = new bmqa::ConfirmEventBuilder(); - *builder_obj = reinterpret_cast(builder_ptr); + bmqa::ConfirmEventBuilder* builder_p = new bmqa::ConfirmEventBuilder(); + *builder_obj = reinterpret_cast(builder_p); return 0; } @@ -15,25 +25,25 @@ int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilde const z_bmqa_Message* message) { using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - const bmqa::Message* message_ptr = reinterpret_cast(message); - return builder_ptr->addMessageConfirmation(*message_ptr); + bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::Message* message_p = reinterpret_cast(message); + return builder_p->addMessageConfirmation(*message_p); } int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie(z_bmqa_ConfirmEventBuilder* builder_obj, const z_bmqa_MessageConfirmationCookie* cookie) { using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - const bmqa::MessageConfirmationCookie* cookie_ptr = reinterpret_cast(cookie); - return builder_ptr->addMessageConfirmation(*cookie_ptr); + bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::MessageConfirmationCookie* cookie_p = reinterpret_cast(cookie); + return builder_p->addMessageConfirmation(*cookie_p); } int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj) { using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - builder_ptr->reset(); + bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + builder_p->reset(); return 0; } @@ -41,17 +51,17 @@ int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj) { int z_bmqa_ConfirmEventBuilder__messageCount(const z_bmqa_ConfirmEventBuilder* builder_obj) { using namespace BloombergLP; - const bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - return builder_ptr->messageCount(); + const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + return builder_p->messageCount(); } int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, z_bmqt_Blob const** blob_obj) { using namespace BloombergLP; - const bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder_obj); + const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); - const bdlbb::Blob* blob_ptr = &(builder_ptr->blob()); - *blob_obj = reinterpret_cast(blob_ptr); + const bdlbb::Blob* blob_p = &(builder_p->blob()); + *blob_obj = reinterpret_cast(blob_p); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index 3e2fb9b34..9b91bfffc 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -11,6 +11,8 @@ extern "C" { typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; +int z_bmqa_ConfirmEventBuilder__delete(z_bmqa_ConfirmEventBuilder** builder_obj); + int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj); int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilder* builder_obj, diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp index 56ad5780b..7a0c54d55 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -1,20 +1,40 @@ #include #include +int z_bmqa_Message__delete(z_bmqa_Message** message_obj) { + using namespace BloombergLP; + + bmqa::Message* message_p = reinterpret_cast(*message_obj); + delete message_p; + *message_obj = NULL; + + return 0; +} + +int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj) { + using namespace BloombergLP; + + const bmqa::Message* message_p = reinterpret_cast(*message_obj); + delete message_p; + *message_obj = NULL; + + return 0; +} + int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj){ using namespace BloombergLP; - bmqa::Message* message_ptr = new bmqa::Message(); + bmqa::Message* message_p = new bmqa::Message(); - *message_obj = reinterpret_cast(message_ptr); + *message_obj = reinterpret_cast(message_p); return 0; } int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length){ using namespace BloombergLP; - bmqa::Message* message_ptr = reinterpret_cast(message_obj); + bmqa::Message* message_p = reinterpret_cast(message_obj); - message_ptr->setDataRef(data, length); + message_p->setDataRef(data, length); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index ac3352e0b..f8bfa6c9f 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -7,6 +7,10 @@ extern "C" { typedef struct z_bmqa_Message z_bmqa_Message; +int z_bmqa_Message__delete(z_bmqa_Message** message_obj); + +int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj); + int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj); int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp new file mode 100644 index 000000000..2b8b1d2cd --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp @@ -0,0 +1,22 @@ +#include +#include + +int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj) { + using namespace BloombergLP; + + bmqa::MessageEvent* event_p = reinterpret_cast(*event_obj); + delete event_p; + *event_obj = NULL; + + return 0; +} + +int z_bmqa_MessageEvent__deleteConst(z_bmqa_MessageEvent const** event_obj) { + using namespace BloombergLP; + + const bmqa::MessageEvent* event_p = reinterpret_cast(*event_obj); + delete event_p; + *event_obj = NULL; + + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h index 04bcdaf66..fc8ddd9a4 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h @@ -1,6 +1,18 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEEVENT #define INCLUDED_Z_BMQA_MESSAGEEVENT +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqa_MessageEvent z_bmqa_MessageEvent; +int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj); + +int z_bmqa_MessageEvent__deleteConst(z_bmqa_MessageEvent const** event_obj); + +#if defined(__cplusplus) +} +#endif + #endif diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp index 8d5d163df..dcaf3a05a 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp @@ -4,11 +4,31 @@ +int z_bmqa_MessageEventBuilder__delete(z_bmqa_MessageEventBuilder** builder_obj) { + using namespace BloombergLP; + + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(*builder_obj); + delete builder_p; + *builder_obj = NULL; + + return 0; +} + +int z_bmqa_MessageEventBuilder__deleteConst(z_bmqa_MessageEventBuilder const** builder_obj) { + using namespace BloombergLP; + + const bmqa::MessageEventBuilder* builder_p = reinterpret_cast(*builder_obj); + delete builder_p; + *builder_obj = NULL; + + return 0; +} + int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = new bmqa::MessageEventBuilder(); - *builder_obj = reinterpret_cast(builder_ptr); + bmqa::MessageEventBuilder* builder_p = new bmqa::MessageEventBuilder(); + *builder_obj = reinterpret_cast(builder_p); return 0; } @@ -16,9 +36,9 @@ int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** out_obj) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - bmqa::Message* message_ptr = &builder_ptr->startMessage(); - *out_obj = reinterpret_cast(message_ptr); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + bmqa::Message* message_p = &builder_p->startMessage(); + *out_obj = reinterpret_cast(message_p); return 0; } @@ -26,16 +46,16 @@ int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId); - return builder_ptr->packMessage(*queueId_ptr); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId); + return builder_p->packMessage(*queueId_p); } int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - builder_ptr->reset(); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + builder_p->reset(); return 0; } @@ -43,9 +63,9 @@ int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj) { int z_bmqa_MessageEventBuilder__messageEvent(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_MessageEvent const** event_obj) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - const bmqa::MessageEvent* event_ptr = &(builder_ptr->messageEvent()); - *event_obj = reinterpret_cast(event_ptr); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::MessageEvent* event_p = &(builder_p->messageEvent()); + *event_obj = reinterpret_cast(event_p); return 0; } @@ -53,9 +73,9 @@ int z_bmqa_MessageEventBuilder__messageEvent(z_bmqa_MessageEventBuilder* builder int z_bmqa_MessageEventBuilder__currentMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** message_obj) { using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - bmqa::Message* message_ptr = &(builder_ptr->currentMessage()); - *message_obj = reinterpret_cast(message_ptr); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + bmqa::Message* message_p = &(builder_p->currentMessage()); + *message_obj = reinterpret_cast(message_p); return 0; } @@ -63,13 +83,13 @@ int z_bmqa_MessageEventBuilder__currentMessage(z_bmqa_MessageEventBuilder* build int z_bmqa_MessageEventBuilder__messageCount(const z_bmqa_MessageEventBuilder* builder_obj) { using namespace BloombergLP; - const bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - return builder_ptr->messageCount(); + const bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + return builder_p->messageCount(); } int z_bmqa_MessageEventBuilder__messageEventSize(const z_bmqa_MessageEventBuilder* builder_obj) { using namespace BloombergLP; - const bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(builder_obj); - return builder_ptr->messageEventSize(); + const bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + return builder_p->messageEventSize(); } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index 1d89a98e6..8784bec32 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -13,6 +13,10 @@ extern "C" { typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; +int z_bmqa_MessageEventBuilder__delete(z_bmqa_MessageEventBuilder** builder_obj); + +int z_bmqa_MessageEventBuilder__deleteConst(z_bmqa_MessageEventBuilder const** builder_obj); + int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj); int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** out_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp index f1ac29584..6577aa84d 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp @@ -4,9 +4,9 @@ int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) { using namespace BloombergLP; - bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(); + bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(); - *status_obj = reinterpret_cast(status_ptr); + *status_obj = reinterpret_cast(status_p); return 0; } @@ -14,10 +14,10 @@ int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) { int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_OpenQueueStatus* other) { using namespace BloombergLP; - const bmqa::OpenQueueStatus* other_ptr = reinterpret_cast(other); - bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(*other_ptr); + const bmqa::OpenQueueStatus* other_p = reinterpret_cast(other); + bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(*other_p); - *status_obj = reinterpret_cast(status_ptr); + *status_obj = reinterpret_cast(status_p); return 0; } @@ -28,38 +28,38 @@ int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, const char* errorDescription) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId); const bsl::string errorDescription_str(errorDescription); bmqt::OpenQueueResult::Enum result_enum = static_cast(result); - bmqa::OpenQueueStatus* status_ptr = new bmqa::OpenQueueStatus(*queueId_ptr, result_enum, errorDescription_str); - *status_obj = reinterpret_cast(status_ptr); + bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(*queueId_p, result_enum, errorDescription_str); + *status_obj = reinterpret_cast(status_p); return 0; } bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj) { using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); - return *status_ptr; + const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + return *status_p; } int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj) { using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); - const bmqa::QueueId* queueId_ptr = &(status_ptr->queueId()); + const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + const bmqa::QueueId* queueId_p = &(status_p->queueId()); - *queueId_obj = reinterpret_cast(queueId_ptr); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj) { using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); - return status_ptr->result(); + const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + return status_p->result(); } const char* z_bmqa_OpenQueueStatus__errorDescription(const z_bmqa_OpenQueueStatus* status_obj) { using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_ptr = reinterpret_cast(status_obj); - return status_ptr->errorDescription().c_str(); + const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + return status_p->errorDescription().c_str(); } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp index c83b9d1fd..caaaa3f48 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp @@ -2,12 +2,32 @@ #include #include +int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj) { + using namespace BloombergLP; + + bmqa::QueueId* queueId_p = reinterpret_cast(*queueId_obj); + delete queueId_p; + *queueId_obj = NULL; + + return 0; +} + +int z_bmqa_QueueId__deleteConst(z_bmqa_QueueId const** queueId_obj) { + using namespace BloombergLP; + + const bmqa::QueueId* queueId_p = reinterpret_cast(*queueId_obj); + delete queueId_p; + *queueId_obj = NULL; + + return 0; +} + int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) { using namespace BloombergLP; - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(); + bmqa::QueueId* queueId_p = new bmqa::QueueId(); - *queueId_obj = reinterpret_cast(queueId_ptr); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } @@ -15,20 +35,20 @@ int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) { int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other) { using namespace BloombergLP; - const bmqa::QueueId* other_ptr = reinterpret_cast(other); + const bmqa::QueueId* other_p = reinterpret_cast(other); - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*other_ptr); - *queueId_obj = reinterpret_cast(queueId_ptr); + bmqa::QueueId* queueId_p = new bmqa::QueueId(*other_p); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } int z_bmqa_QueueId__createFromCorrelationId(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId); - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(*correlationId_ptr); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId); + bmqa::QueueId* queueId_p = new bmqa::QueueId(*correlationId_p); - *queueId_obj = reinterpret_cast(queueId_ptr); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } @@ -36,8 +56,8 @@ int z_bmqa_QueueId__createFromCorrelationId(z_bmqa_QueueId** queueId_obj, const int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, int64_t numeric) { using namespace BloombergLP; - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(numeric); - *queueId_obj = reinterpret_cast(queueId_ptr); + bmqa::QueueId* queueId_p = new bmqa::QueueId(numeric); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } @@ -45,8 +65,8 @@ int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, int64_t nume int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, void* pointer) { using namespace BloombergLP; - bmqa::QueueId* queueId_ptr = new bmqa::QueueId(pointer); - *queueId_obj = reinterpret_cast(queueId_ptr); + bmqa::QueueId* queueId_p = new bmqa::QueueId(pointer); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } @@ -54,42 +74,42 @@ int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, void* pointe const z_bmqt_CorrelationId* z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); - const bmqt::CorrelationId* correlationId_ptr = &(queueId_ptr->correlationId()); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + const bmqt::CorrelationId* correlationId_p = &(queueId_p->correlationId()); - return reinterpret_cast(correlationId_ptr); + return reinterpret_cast(correlationId_p); } uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); - return queueId_ptr->flags(); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + return queueId_p->flags(); } const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId_obj) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); - const bmqt::Uri* uri_ptr = &(queueId_ptr->uri()); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + const bmqt::Uri* uri_p = &(queueId_p->uri()); - return reinterpret_cast(uri_ptr); + return reinterpret_cast(uri_p); } const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId_obj) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); - const bmqt::QueueOptions* options_ptr = &(queueId_ptr->options()); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + const bmqt::QueueOptions* options_p = &(queueId_p->options()); - return reinterpret_cast(options_ptr); + return reinterpret_cast(options_p); } int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId_obj) { using namespace BloombergLP; - const bmqa::QueueId* queueId_ptr = reinterpret_cast(queueId_obj); - return queueId_ptr->isValid(); + const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + return queueId_p->isValid(); } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h index d7fad30f7..86b91ea49 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h @@ -12,6 +12,10 @@ extern "C" { typedef struct z_bmqa_QueueId z_bmqa_QueueId; +int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj); + +int z_bmqa_QueueId__deleteConst(z_bmqa_QueueId const** queueId_obj); + int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj); int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 1ad72cdcd..afa0a5622 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -8,8 +8,8 @@ int z_bmqa_Session__delete(z_bmqa_Session** session_obj) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - delete session_ptr; + bmqa::Session* session_p = reinterpret_cast(*session_obj); + delete session_p; *session_obj = NULL; return 0; @@ -18,30 +18,30 @@ int z_bmqa_Session__delete(z_bmqa_Session** session_obj) { int z_bmqa_Session__create(z_bmqa_Session** session_obj , const z_bmqt_SessionOptions* options) { using namespace BloombergLP; - const bmqt::SessionOptions* options_ptr = reinterpret_cast(options); - bmqa::Session* session_ptr = new bmqa::Session(*options_ptr); - *session_obj = reinterpret_cast(session_ptr); + const bmqt::SessionOptions* options_p = reinterpret_cast(options); + bmqa::Session* session_p = new bmqa::Session(*options_p); + *session_obj = reinterpret_cast(session_p); return 0; } int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session_obj); if(timeoutMs != 0) { bsls::TimeInterval timeout; timeout.addMilliseconds(timeoutMs); - return session_ptr->start(timeout); + return session_p->start(timeout); } else { - return session_ptr->start(); + return session_p->start(); } } int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - session_ptr->stop(); + bmqa::Session* session_p = reinterpret_cast(session_obj); + session_p->stop(); return 0; } @@ -50,8 +50,8 @@ int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - session_ptr->finalizeStop(); + bmqa::Session* session_p = reinterpret_cast(session_obj); + session_p->finalizeStop(); return 0; } @@ -60,40 +60,40 @@ int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::MessageEventBuilder* builder_ptr = reinterpret_cast(*builder); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(*builder); - session_ptr->loadMessageEventBuilder(builder_ptr); + session_p->loadMessageEventBuilder(builder_p); return 0; } int z_bmqa_Session__loadConfirmEventBuilder(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder** builder){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::ConfirmEventBuilder* builder_ptr = reinterpret_cast(builder); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder); - session_ptr->loadConfirmEventBuilder(builder_ptr); + session_p->loadConfirmEventBuilder(builder_p); return 0; } int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::MessageProperties* buffer_ptr = reinterpret_cast(buffer); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::MessageProperties* buffer_p = reinterpret_cast(buffer); - session_ptr->loadMessageProperties(buffer_ptr); + session_p->loadMessageProperties(buffer_p); return 0; } // int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ // using namespace BloombergLP; -// bmqa::Session* session_ptr = reinterpret_cast(session_obj); -// bmqa::Q* buffer_ptr = reinterpret_cast(uri); +// bmqa::Session* session_p = reinterpret_cast(session_obj); +// bmqa::Q* buffer_p = reinterpret_cast(uri); -// session_ptr->getQueueId(buffer_ptr); +// session_p->getQueueId(buffer_p); // return 0; // } @@ -101,34 +101,34 @@ int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_Me // int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ // using namespace BloombergLP; -// bmqa::Session* session_ptr = reinterpret_cast(session_obj); -// bmqt::Uri const * uri_ptr = reinterpret_cast< bmqt::Uri const *>(uri); -// bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); +// bmqa::Session* session_p = reinterpret_cast(session_obj); +// bmqt::Uri const * uri_p = reinterpret_cast< bmqt::Uri const *>(uri); +// bmqa::QueueId* queueid_p = reinterpret_cast(queueId); // //must populate out obj in future -// session_ptr->openQueueSync(queueid_ptr, *uri_ptr, flags); +// session_p->openQueueSync(queueid_p, *uri_p, flags); // return 0; // } int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const char * uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::QueueId* queueid_p = reinterpret_cast(queueId); //must populate out obj in future - session_ptr->openQueueSync(queueid_ptr, uri, flags); + session_p->openQueueSync(queueid_p, uri, flags); return 0; } int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId /*,z_bmqa_CloseQueueStatus**/){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - bmqa::QueueId* queueid_ptr = reinterpret_cast(queueId); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::QueueId* queueid_p = reinterpret_cast(queueId); //must populate out obj in future - session_ptr->closeQueueSync(queueid_ptr); // not using timeout (we should definitely add this) + session_p->closeQueueSync(queueid_p); // not using timeout (we should definitely add this) return 0; } @@ -136,10 +136,10 @@ int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event){ using namespace BloombergLP; - bmqa::Session* session_ptr = reinterpret_cast(session_obj); - const bmqa::MessageEvent* event_ptr = reinterpret_cast(event); + bmqa::Session* session_p = reinterpret_cast(session_obj); + const bmqa::MessageEvent* event_p = reinterpret_cast(event); - session_ptr->post(*event_ptr); + session_p->post(*event_p); return 0; } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp index 958eb6020..9fe52738d 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -3,107 +3,107 @@ int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(); - *correlationId_obj = reinterpret_cast(correlationId_ptr); + *correlationId_obj = reinterpret_cast(correlationId_p); return 0; } int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(numeric); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(numeric); - *correlationId_obj = reinterpret_cast(correlationId_ptr); + *correlationId_obj = reinterpret_cast(correlationId_p); return 0; } int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, void* pointer) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = new bmqt::CorrelationId(pointer); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(pointer); - *correlationId_obj = reinterpret_cast(correlationId_ptr); + *correlationId_obj = reinterpret_cast(correlationId_p); return 0; } int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - correlationId_ptr->makeUnset(); + correlationId_p->makeUnset(); return 0; } int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlationId_obj, int64_t numeric) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - correlationId_ptr->setNumeric(numeric); + correlationId_p->setNumeric(numeric); return 0; } int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlationId_obj, void* pointer) { using namespace BloombergLP; - bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - correlationId_ptr->setPointer(pointer); + correlationId_p->setPointer(pointer); return 0; } int z_bmqt_CorrelationId__isUnset(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->isUnset(); + return correlationId_p->isUnset(); } int z_bmqt_CorrelationId__isNumeric(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->isNumeric(); + return correlationId_p->isNumeric(); } int z_bmqt_CorrelationId__isPointer(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->isPointer(); + return correlationId_p->isPointer(); } int z_bmqt_CorrelationId__isSharedPtr(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->isSharedPtr(); + return correlationId_p->isSharedPtr(); } int z_bmqt_CorrelationId__isAutoValue(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->isAutoValue(); + return correlationId_p->isAutoValue(); } int64_t z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->theNumeric(); + return correlationId_p->theNumeric(); } void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - return correlationId_ptr->thePointer(); + return correlationId_p->thePointer(); } CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_ptr = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - switch(correlationId_ptr->type()) { + switch(correlationId_p->type()) { case bmqt::CorrelationId::Type::e_NUMERIC: return CorrelationId_Type::e_NUMERIC; case bmqt::CorrelationId::Type::e_POINTER: return CorrelationId_Type::e_POINTER; case bmqt::CorrelationId::Type::e_SHARED_PTR: return CorrelationId_Type::e_SHARED_PTR; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp index 42a81a021..d03311cd6 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -6,19 +6,19 @@ int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = new bmqt::QueueOptions; + bmqt::QueueOptions* queueOptions_p = new bmqt::QueueOptions; - *queueOptions_obj = reinterpret_cast(queueOptions_ptr); + *queueOptions_obj = reinterpret_cast(queueOptions_p); return 0; } int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other) { using namespace BloombergLP; - const bmqt::QueueOptions* other_ptr = reinterpret_cast(other); - bmqt::QueueOptions* queueOptions_ptr = new bmqt::QueueOptions(*other_ptr); + const bmqt::QueueOptions* other_p = reinterpret_cast(other); + bmqt::QueueOptions* queueOptions_p = new bmqt::QueueOptions(*other_p); - *queueOptions_obj = reinterpret_cast(queueOptions_ptr); + *queueOptions_obj = reinterpret_cast(queueOptions_p); return 0; } @@ -28,56 +28,56 @@ int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, cons int z_bmqt_QueueOptions__setMaxUnconfirmedMessages(z_bmqt_QueueOptions* queueOptions_obj, int value) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->setMaxUnconfirmedMessages(value); + queueOptions_p->setMaxUnconfirmedMessages(value); return 0; } int z_bmqt_QueueOptions__setMaxUnconfirmedBytes(z_bmqt_QueueOptions* queueOptions_obj, int value) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->setMaxUnconfirmedBytes(value); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + queueOptions_p->setMaxUnconfirmedBytes(value); return 0; } int z_bmqt_QueueOptions__setConsumerPriority(z_bmqt_QueueOptions* queueOptions_obj, int value) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->setConsumerPriority(value); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + queueOptions_p->setConsumerPriority(value); return 0; } int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOptions_obj, int value) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->setSuspendsOnBadHostHealth(value); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + queueOptions_p->setSuspendsOnBadHostHealth(value); return 0; } int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - const bmqt::QueueOptions* other_ptr = reinterpret_cast(other); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* other_p = reinterpret_cast(other); - queueOptions_ptr->merge(*other_ptr); + queueOptions_p->merge(*other_p); return 0; } int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj, char** errorDescription, const z_bmqt_SubscriptionHandle* handle, const z_bmqt_Subscription* subscription){ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_p = reinterpret_cast(handle); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription); bsl::string error; - queueOptions_ptr->addOrUpdateSubscription(&error, *handle_ptr, *subscription_ptr); + queueOptions_p->addOrUpdateSubscription(&error, *handle_p, *subscription_p); if(error.empty()) { *errorDescription = NULL; @@ -93,9 +93,9 @@ int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptio int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_SubscriptionHandle* handle){ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); - queueOptions_ptr->removeSubscription(*handle_ptr); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_p = reinterpret_cast(handle); + queueOptions_p->removeSubscription(*handle_p); return 0; } @@ -103,8 +103,8 @@ int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_ob int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->removeAllSubscriptions(); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + queueOptions_p->removeAllSubscriptions(); return 0; } @@ -112,58 +112,58 @@ int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOption int z_bmqt_QueueOptions__maxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->maxUnconfirmedMessages(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->maxUnconfirmedMessages(); } int z_bmqt_QueueOptions__maxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->maxUnconfirmedBytes(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->maxUnconfirmedBytes(); } int z_bmqt_QueueOptions__consumerPriority(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->consumerPriority(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->consumerPriority(); } bool z_bmqt_QueueOptions__suspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->suspendsOnBadHostHealth(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->suspendsOnBadHostHealth(); } bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->hasMaxUnconfirmedMessages(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->hasMaxUnconfirmedMessages(); } bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->hasMaxUnconfirmedBytes(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->hasMaxUnconfirmedBytes(); } bool z_bmqt_QueueOptions__hasConsumerPriority(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->hasConsumerPriority(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->hasConsumerPriority(); } bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - return queueOptions_ptr->hasSuspendsOnBadHostHealth(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + return queueOptions_p->hasSuspendsOnBadHostHealth(); } @@ -171,16 +171,16 @@ bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* bool z_bmqt_QueueOptions__loadSubscription(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_Subscription** subscription, const z_bmqt_SubscriptionHandle* handle) { using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - const bmqt::SubscriptionHandle* handle_ptr = reinterpret_cast(handle); - bmqt::Subscription* subscription_ptr = new bmqt::Subscription(); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_p = reinterpret_cast(handle); + bmqt::Subscription* subscription_p = new bmqt::Subscription(); - bool success = queueOptions_ptr->loadSubscription(subscription_ptr, *handle_ptr); + bool success = queueOptions_p->loadSubscription(subscription_p, *handle_p); if(success) { - *subscription = reinterpret_cast(subscription_ptr); + *subscription = reinterpret_cast(subscription_p); } else { - delete subscription_ptr; + delete subscription_p; *subscription = NULL; } @@ -191,18 +191,18 @@ int z_bmqt_QueueOptions__loadSubscriptions(const z_bmqt_QueueOptions* queueOptio using namespace BloombergLP; bmqt::QueueOptions::SubscriptionsSnapshot vector; - const bmqt::QueueOptions* queueOptions_ptr = reinterpret_cast(queueOptions_obj); - queueOptions_ptr->loadSubscriptions(&vector); + const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + queueOptions_p->loadSubscriptions(&vector); snapshot->size = vector.size(); snapshot->subscriptions = static_cast(calloc(vector.size(), sizeof(z_bmqt_HandleAndSubscrption))); for(size_t i = 0; i < vector.size(); ++i) { - bmqt::SubscriptionHandle* handle_ptr = new bmqt::SubscriptionHandle(vector[i].first); - bmqt::Subscription* subscription_ptr = new bmqt::Subscription(vector[i].second); + bmqt::SubscriptionHandle* handle_p = new bmqt::SubscriptionHandle(vector[i].first); + bmqt::Subscription* subscription_p = new bmqt::Subscription(vector[i].second); - snapshot->subscriptions[i].handle = reinterpret_cast(handle_ptr); - snapshot->subscriptions[i].subscrption = reinterpret_cast(subscription_ptr); + snapshot->subscriptions[i].handle = reinterpret_cast(handle_p); + snapshot->subscriptions[i].subscrption = reinterpret_cast(subscription_p); } return 0; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp index 28876700f..14a503993 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -5,8 +5,8 @@ int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj) { using namespace BloombergLP; - bmqt::SessionOptions* options_ptr = reinterpret_cast(options_obj); - delete options_ptr; + bmqt::SessionOptions* options_p = reinterpret_cast(*options_obj); + delete options_p; *options_obj = NULL; return 0; @@ -14,15 +14,15 @@ int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj) { int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj) { using namespace BloombergLP; - bmqt::SessionOptions* options_ptr = new bmqt::SessionOptions(); - *options_obj = reinterpret_cast(options_ptr); + bmqt::SessionOptions* options_p = new bmqt::SessionOptions(); + *options_obj = reinterpret_cast(options_p); return 0; } const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj) { using namespace BloombergLP; - const bmqt::SessionOptions* options_ptr = reinterpret_cast(options_obj); + const bmqt::SessionOptions* options_p = reinterpret_cast(options_obj); - return options_ptr->brokerUri().c_str(); + return options_p->brokerUri().c_str(); } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp index 1429333e3..69c7e97dd 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp @@ -7,8 +7,8 @@ int z_bmqt_SubscriptionHandle__create(z_bmqt_SubscriptionHandle** subscriptionHa using namespace BloombergLP; const bmqt::CorrelationId* correlationId = reinterpret_cast(cid); - bmqt::SubscriptionHandle* subscriptionHandle_ptr = new bmqt::SubscriptionHandle(*correlationId); - *subscriptionHandle_obj = reinterpret_cast(subscriptionHandle_ptr); + bmqt::SubscriptionHandle* subscriptionHandle_p = new bmqt::SubscriptionHandle(*correlationId); + *subscriptionHandle_obj = reinterpret_cast(subscriptionHandle_p); return 0; } @@ -16,8 +16,8 @@ int z_bmqt_SubscriptionHandle__create(z_bmqt_SubscriptionHandle** subscriptionHa unsigned int z_bmqt_SubscriptionHandle__id(const z_bmqt_SubscriptionHandle* subscriptionHandle_obj){ using namespace BloombergLP; - const bmqt::SubscriptionHandle* subscriptionHandle_ptr = reinterpret_cast(subscriptionHandle_obj); - return subscriptionHandle_ptr->id(); + const bmqt::SubscriptionHandle* subscriptionHandle_p = reinterpret_cast(subscriptionHandle_obj); + return subscriptionHandle_p->id(); } /////// @@ -25,8 +25,8 @@ unsigned int z_bmqt_SubscriptionHandle__id(const z_bmqt_SubscriptionHandle* subs int z_bmqt_SubscriptionExpression__create(z_bmqt_SubscriptionExpression** subscriptionExpression_obj){ using namespace BloombergLP; - bmqt::SubscriptionExpression* subscriptionExpression_ptr = new bmqt::SubscriptionExpression(); - *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_ptr); + bmqt::SubscriptionExpression* subscriptionExpression_p = new bmqt::SubscriptionExpression(); + *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_p); return 0; } @@ -41,9 +41,9 @@ int z_bmqt_SubscriptionExpression__createFromString(z_bmqt_SubscriptionExpressio default: return 1; } - bmqt::SubscriptionExpression* subscriptionExpression_ptr = new bmqt::SubscriptionExpression(bsl::string(expression), v); + bmqt::SubscriptionExpression* subscriptionExpression_p = new bmqt::SubscriptionExpression(bsl::string(expression), v); - *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_ptr); + *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_p); return 0; } @@ -51,15 +51,15 @@ int z_bmqt_SubscriptionExpression__createFromString(z_bmqt_SubscriptionExpressio const char* z_bmqt_SubscriptionExpression__text(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ using namespace BloombergLP; - const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); - return subscriptionExpression_ptr->text().c_str(); + const bmqt::SubscriptionExpression* subscriptionExpression_p = reinterpret_cast(subscriptionExpression_obj); + return subscriptionExpression_p->text().c_str(); } SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ using namespace BloombergLP; - const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); - switch(subscriptionExpression_ptr->version()) { + const bmqt::SubscriptionExpression* subscriptionExpression_p = reinterpret_cast(subscriptionExpression_obj); + switch(subscriptionExpression_p->version()) { case bmqt::SubscriptionExpression::e_NONE: return SubscriptionExpressionEnum::e_NONE; case bmqt::SubscriptionExpression::e_VERSION_1: return SubscriptionExpressionEnum::e_VERSION_1; default: break; @@ -71,8 +71,8 @@ SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version(const z_bmqt_S bool z_bmqt_SubscriptionExpression__isValid(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ using namespace BloombergLP; - const bmqt::SubscriptionExpression* subscriptionExpression_ptr = reinterpret_cast(subscriptionExpression_obj); - return subscriptionExpression_ptr->isValid(); + const bmqt::SubscriptionExpression* subscriptionExpression_p = reinterpret_cast(subscriptionExpression_obj); + return subscriptionExpression_p->isValid(); } /////// @@ -80,8 +80,8 @@ bool z_bmqt_SubscriptionExpression__isValid(const z_bmqt_SubscriptionExpression* int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj){ using namespace BloombergLP; - bmqt::Subscription* subscription_ptr = new bmqt::Subscription(); - *subscription_obj = reinterpret_cast(subscription_ptr); + bmqt::Subscription* subscription_p = new bmqt::Subscription(); + *subscription_obj = reinterpret_cast(subscription_p); return 0; } @@ -89,9 +89,9 @@ int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj){ int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, const z_bmqt_Subscription* other){ using namespace BloombergLP; - const bmqt::Subscription* other_ptr = reinterpret_cast(other); - bmqt::Subscription* subscription_ptr = new bmqt::Subscription(*other_ptr); - *subscription_obj = reinterpret_cast(subscription_ptr); + const bmqt::Subscription* other_p = reinterpret_cast(other); + bmqt::Subscription* subscription_p = new bmqt::Subscription(*other_p); + *subscription_obj = reinterpret_cast(subscription_p); return 0; } @@ -99,8 +99,8 @@ int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, cons int z_bmqt_Subscription__setMaxUnconfirmedMessages(z_bmqt_Subscription* subscription_obj, int value){ using namespace BloombergLP; - bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - subscription_ptr->setMaxUnconfirmedMessages(value); + bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + subscription_p->setMaxUnconfirmedMessages(value); return 0; } @@ -108,8 +108,8 @@ int z_bmqt_Subscription__setMaxUnconfirmedMessages(z_bmqt_Subscription* subscrip int z_bmqt_Subscription__setMaxUnconfirmedBytes(z_bmqt_Subscription* subscription_obj, int value){ using namespace BloombergLP; - bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - subscription_ptr->setMaxUnconfirmedBytes(value); + bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + subscription_p->setMaxUnconfirmedBytes(value); return 0; } @@ -117,8 +117,8 @@ int z_bmqt_Subscription__setMaxUnconfirmedBytes(z_bmqt_Subscription* subscriptio int z_bmqt_Subscription__setConsumerPriority(z_bmqt_Subscription* subscription_obj, int value){ using namespace BloombergLP; - bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - subscription_ptr->setConsumerPriority(value); + bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + subscription_p->setConsumerPriority(value); return 0; } @@ -126,9 +126,9 @@ int z_bmqt_Subscription__setConsumerPriority(z_bmqt_Subscription* subscription_o int z_bmqt_Subscription__setExpression(z_bmqt_Subscription* subscription_obj, const z_bmqt_SubscriptionExpression* value){ using namespace BloombergLP; - bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - const bmqt::SubscriptionExpression* expression_ptr = reinterpret_cast(value); - subscription_ptr->setExpression(*expression_ptr); + bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + const bmqt::SubscriptionExpression* expression_p = reinterpret_cast(value); + subscription_p->setExpression(*expression_p); return 0; } @@ -136,50 +136,50 @@ int z_bmqt_Subscription__setExpression(z_bmqt_Subscription* subscription_obj, co int z_bmqt_Subscription__maxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->maxUnconfirmedMessages(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->maxUnconfirmedMessages(); } int z_bmqt_Subscription__maxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->maxUnconfirmedBytes(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->maxUnconfirmedBytes(); } int z_bmqt_Subscription__consumerPriority(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->consumerPriority(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->consumerPriority(); } const z_bmqt_SubscriptionExpression* z_bmqt_Subscription__expression(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - const bmqt::SubscriptionExpression* expression_ptr = &(subscription_ptr->expression()); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + const bmqt::SubscriptionExpression* expression_p = &(subscription_p->expression()); - return reinterpret_cast(expression_ptr); + return reinterpret_cast(expression_p); } bool z_bmqt_Subscription__hasMaxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->hasMaxUnconfirmedMessages(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->hasMaxUnconfirmedMessages(); } bool z_bmqt_Subscription__hasMaxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->hasMaxUnconfirmedBytes(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->hasMaxUnconfirmedBytes(); } bool z_bmqt_Subscription__hasConsumerPriority(const z_bmqt_Subscription* subscription_obj){ using namespace BloombergLP; - const bmqt::Subscription* subscription_ptr = reinterpret_cast(subscription_obj); - return subscription_ptr->hasConsumerPriority(); + const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + return subscription_p->hasConsumerPriority(); } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp index 5c5735c05..3814cabfe 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp @@ -3,8 +3,8 @@ int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy){ using namespace BloombergLP; - bmqt::Uri* original_uri_ptr = reinterpret_cast(to_copy); - bmqt::Uri* copy = new bmqt::Uri(*original_uri_ptr); + bmqt::Uri* original_uri_p = reinterpret_cast(to_copy); + bmqt::Uri* copy = new bmqt::Uri(*original_uri_p); *uri_obj = reinterpret_cast(copy); return 0; } @@ -15,58 +15,58 @@ int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy){ int z_bmqt_UriBuilder__create(z_bmqt_UriBuilder** uribuilder_obj) { using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_ptr = new bmqt::UriBuilder(); - *uribuilder_obj = reinterpret_cast(uriBuilder_ptr); + bmqt::UriBuilder* uriBuilder_p = new bmqt::UriBuilder(); + *uribuilder_obj = reinterpret_cast(uriBuilder_p); return 0; } int z_bmqt_UriBuilder__createFromUri(z_bmqt_UriBuilder** uribuilder_obj, const z_bmqt_Uri* uri_obj) { using namespace BloombergLP; - const bmqt::Uri* uri_ptr = reinterpret_cast(uri_obj); - bmqt::UriBuilder* uriBuilder_ptr = new bmqt::UriBuilder(*uri_ptr); - *uribuilder_obj = reinterpret_cast(uriBuilder_ptr); + const bmqt::Uri* uri_p = reinterpret_cast(uri_obj); + bmqt::UriBuilder* uriBuilder_p = new bmqt::UriBuilder(*uri_p); + *uribuilder_obj = reinterpret_cast(uriBuilder_p); return 0; } int z_bmqt_UriBuilder__setDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); - uriBuilder_ptr->setDomain(value); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + uriBuilder_p->setDomain(value); return 0; } int z_bmqt_UriBuilder__setTier(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); - uriBuilder_ptr->setTier(value); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + uriBuilder_p->setTier(value); return 0; } int z_bmqt_UriBuilder__setQualifiedDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); - uriBuilder_ptr->setQualifiedDomain(value); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + uriBuilder_p->setQualifiedDomain(value); return 0; } int z_bmqt_UriBuilder__setQueue(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uribuilder_obj); - uriBuilder_ptr->setQueue(value); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + uriBuilder_p->setQueue(value); return 0; } int z_bmqt_UriBuilder_uri(z_bmqt_UriBuilder* uribuilder_obj, z_bmqt_Uri** uri_obj){ using namespace BloombergLP; - const bmqt::UriBuilder* uriBuilder_ptr = reinterpret_cast(uri_obj); - bmqt::Uri* uri_ptr = new bmqt::Uri(); + const bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uri_obj); + bmqt::Uri* uri_p = new bmqt::Uri(); - int res = uriBuilder_ptr->uri(uri_ptr); // support error description ? + int res = uriBuilder_p->uri(uri_p); // support error description ? if(res != 0){ - delete uri_ptr; + delete uri_p; return res; } - *uri_obj = reinterpret_cast(uri_ptr); + *uri_obj = reinterpret_cast(uri_p); return res; } \ No newline at end of file From cd3479e74ada3e473b3fbc9ab90a9ef16dfbb5da Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 23 Jan 2024 16:30:29 -0500 Subject: [PATCH 37/57] Progress --- src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 5 +- .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp | 85 ++++++ .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.h | 36 +++ .../z_bmqa/z_bmqa_configurequeuestatus.cpp | 92 ++++++ .../z_bmqa/z_bmqa_configurequeuestatus.h | 43 +++ src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp | 272 +++++++++++++++++- src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 90 +++++- .../z_bmq/z_bmqa/z_bmqa_messageiterator.cpp | 53 ++++ .../z_bmq/z_bmqa/z_bmqa_messageiterator.h | 30 ++ .../z_bmq/z_bmqa/z_bmqa_messageproperties.cpp | 3 + .../z_bmq/z_bmqa/z_bmqa_messageproperties.h | 2 + src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 272 ++++++++++++++---- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 165 +++++++---- src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp | 4 +- .../z_bmq/z_bmqa/z_bmqa_sessionevent.cpp | 83 ++++++ src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h | 26 ++ src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 3 + .../z_bmqt_compressionalgorithmtype.cpp | 46 +++ .../z_bmqt/z_bmqt_compressionalgorithmtype.h | 65 +++++ .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 21 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 14 +- .../z_bmq/z_bmqt/z_bmqt_messageguid.cpp | 24 ++ src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h | 10 + .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp | 20 ++ .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.h | 67 +++++ src/tutorials/CMakeLists.txt | 1 + src/tutorials/c_wrapper/consumer.cpp | 266 +++++++++++++++++ src/tutorials/c_wrapper/producer.cpp | 101 +++++++ 28 files changed, 1766 insertions(+), 133 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp create mode 100644 src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h create mode 100644 src/tutorials/c_wrapper/consumer.cpp create mode 100644 src/tutorials/c_wrapper/producer.cpp diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index d24a9918d..89410832c 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -1,8 +1,11 @@ +z_bmqa_configurequeuestatus z_bmqa_confirmeventbuilder +z_bmqa_closequeuestatus z_bmqa_event z_bmqa_message z_bmqa_messageevent z_bmqa_messageeventbuilder z_bmqa_messageproperties z_bmqa_queueid -z_bmqa_session \ No newline at end of file +z_bmqa_session +z_bmqa_openqueuestatus \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp new file mode 100644 index 000000000..e3e312f61 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp @@ -0,0 +1,85 @@ +#include +#include + +int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** status_obj) +{ + using namespace BloombergLP; + + bmqa::CloseQueueStatus* status_p = new bmqa::CloseQueueStatus(); + + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, + const z_bmqa_CloseQueueStatus* other) +{ + using namespace BloombergLP; + + const bmqa::CloseQueueStatus* other_p = + reinterpret_cast(other); + bmqa::CloseQueueStatus* status_p = new bmqa::CloseQueueStatus(*other_p); + + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription) +{ + using namespace BloombergLP; + + const bmqa::QueueId* queueId_p = reinterpret_cast( + queueId); + const bsl::string errorDescription_str(errorDescription); + bmqt::CloseQueueResult::Enum result_enum = + static_cast(result); + bmqa::CloseQueueStatus* status_p = new bmqa::CloseQueueStatus( + *queueId_p, + result_enum, + errorDescription_str); + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +bool z_bmqa_CloseQueueStatus__toBool(const z_bmqa_CloseQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::CloseQueueStatus* status_p = + reinterpret_cast(status_obj); + return *status_p; +} + +int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, + z_bmqa_QueueId const** queueId_obj) +{ + using namespace BloombergLP; + const bmqa::CloseQueueStatus* status_p = + reinterpret_cast(status_obj); + const bmqa::QueueId* queueId_p = &(status_p->queueId()); + + *queueId_obj = reinterpret_cast(queueId_p); + return 0; +} + +int z_bmqa_CloseQueueStatus__result(const z_bmqa_CloseQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::CloseQueueStatus* status_p = + reinterpret_cast(status_obj); + return status_p->result(); +} + +const char* z_bmqa_CloseQueueStatus__errorDescription( + const z_bmqa_CloseQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::CloseQueueStatus* status_p = + reinterpret_cast(status_obj); + return status_p->errorDescription().c_str(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h new file mode 100644 index 000000000..ab47930d1 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h @@ -0,0 +1,36 @@ +#ifndef INCLUDED_Z_BMQA_CLOSEQUEUESTATUS +#define INCLUDED_Z_BMQA_CLOSEQUEUESTATUS + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct z_bmqa_CloseQueueStatus z_bmqa_CloseQueueStatus; + +int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** status_obj); + +int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, const z_bmqa_CloseQueueStatus* other); + +int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription); + +bool z_bmqa_CloseQueueStatus__toBool(const z_bmqa_CloseQueueStatus* status_obj); + +int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj); + +int z_bmqa_CloseQueueStatus__result(const z_bmqa_CloseQueueStatus* status_obj); + +const char* z_bmqa_CloseQueueStatus__errorDescription(const z_bmqa_CloseQueueStatus* status_obj); + + + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp new file mode 100644 index 000000000..18be79a2d --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp @@ -0,0 +1,92 @@ +#include +#include + +int z_bmqa_ConfigureQueueStatus__create( + z_bmqa_ConfigureQueueStatus** status_obj) +{ + using namespace BloombergLP; + + bmqa::ConfigureQueueStatus* status_p = new bmqa::ConfigureQueueStatus(); + + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +int z_bmqa_ConfigureQueueStatus__createCopy( + z_bmqa_ConfigureQueueStatus** status_obj, + const z_bmqa_ConfigureQueueStatus* other) +{ + using namespace BloombergLP; + + const bmqa::ConfigureQueueStatus* other_p = + reinterpret_cast(other); + bmqa::ConfigureQueueStatus* status_p = new bmqa::ConfigureQueueStatus( + *other_p); + + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +int z_bmqa_ConfigureQueueStatus__createFull( + z_bmqa_ConfigureQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription) +{ + using namespace BloombergLP; + + const bmqa::QueueId* queueId_p = reinterpret_cast( + queueId); + const bsl::string errorDescription_str(errorDescription); + bmqt::ConfigureQueueResult::Enum result_enum = + static_cast(result); + bmqa::ConfigureQueueStatus* status_p = new bmqa::ConfigureQueueStatus( + *queueId_p, + result_enum, + errorDescription_str); + *status_obj = reinterpret_cast(status_p); + + return 0; +} + +bool z_bmqa_ConfigureQueueStatus__toBool( + const z_bmqa_ConfigureQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::ConfigureQueueStatus* status_p = + reinterpret_cast(status_obj); + return *status_p; +} + +int z_bmqa_ConfigureQueueStatus__queueId( + const z_bmqa_ConfigureQueueStatus* status_obj, + z_bmqa_QueueId const** queueId_obj) +{ + using namespace BloombergLP; + const bmqa::ConfigureQueueStatus* status_p = + reinterpret_cast(status_obj); + const bmqa::QueueId* queueId_p = &(status_p->queueId()); + + *queueId_obj = reinterpret_cast(queueId_p); + return 0; +} + +int z_bmqa_ConfigureQueueStatus__result( + const z_bmqa_ConfigureQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::ConfigureQueueStatus* status_p = + reinterpret_cast(status_obj); + return status_p->result(); +} + +const char* z_bmqa_ConfigureQueueStatus__errorDescription( + const z_bmqa_ConfigureQueueStatus* status_obj) +{ + using namespace BloombergLP; + const bmqa::ConfigureQueueStatus* status_p = + reinterpret_cast(status_obj); + return status_p->errorDescription().c_str(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h new file mode 100644 index 000000000..2c0441770 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h @@ -0,0 +1,43 @@ +#ifndef INCLUDED_Z_BMQA_CONFIGUREQUEUESTATUS +#define INCLUDED_Z_BMQA_CONFIGUREQUEUESTATUS + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct z_bmqa_ConfigureQueueStatus z_bmqa_ConfigureQueueStatus; + +int z_bmqa_ConfigureQueueStatus__create( + z_bmqa_ConfigureQueueStatus** status_obj); + +int z_bmqa_ConfigureQueueStatus__createCopy( + z_bmqa_ConfigureQueueStatus** status_obj, + const z_bmqa_ConfigureQueueStatus* other); + +int z_bmqa_ConfigureQueueStatus__createFull( + z_bmqa_ConfigureQueueStatus** status_obj, + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription); + +bool z_bmqa_ConfigureQueueStatus__toBool( + const z_bmqa_ConfigureQueueStatus* status_obj); + +int z_bmqa_ConfigureQueueStatus__queueId( + const z_bmqa_ConfigureQueueStatus* status_obj, + z_bmqa_QueueId const** queueId_obj); + +int z_bmqa_ConfigureQueueStatus__result( + const z_bmqa_ConfigureQueueStatus* status_obj); + +const char* z_bmqa_ConfigureQueueStatus__errorDescription( + const z_bmqa_ConfigureQueueStatus* status_obj); + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp index 7a0c54d55..73d9cfcb5 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -1,7 +1,12 @@ +#include +#include #include +#include +#include #include -int z_bmqa_Message__delete(z_bmqa_Message** message_obj) { +int z_bmqa_Message__delete(z_bmqa_Message** message_obj) +{ using namespace BloombergLP; bmqa::Message* message_p = reinterpret_cast(*message_obj); @@ -11,17 +16,20 @@ int z_bmqa_Message__delete(z_bmqa_Message** message_obj) { return 0; } -int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj) { +int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj) +{ using namespace BloombergLP; - const bmqa::Message* message_p = reinterpret_cast(*message_obj); + const bmqa::Message* message_p = reinterpret_cast( + *message_obj); delete message_p; *message_obj = NULL; return 0; } -int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj){ +int z_bmqa_Message__create(z_bmqa_Message** message_obj) +{ using namespace BloombergLP; bmqa::Message* message_p = new bmqa::Message(); @@ -30,11 +38,263 @@ int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj){ return 0; } -int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length){ +int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, + const char* data, + int length) +{ using namespace BloombergLP; bmqa::Message* message_p = reinterpret_cast(message_obj); message_p->setDataRef(data, length); return 0; -} \ No newline at end of file +} + +int z_bmqa_Message__setPropertiesRef( + z_bmqa_Message* message_obj, + const z_bmqa_MessageProperties* properties_obj) +{ + using namespace BloombergLP; + + bmqa::Message* message_p = reinterpret_cast(message_obj); + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + message_p->setPropertiesRef(properties_p); + + return 0; +} + +int z_bmqa_Message__clearPropertiesRef(z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + bmqa::Message* message_p = reinterpret_cast(message_obj); + message_p->clearPropertiesRef(); + + return 0; +} + +int z_bmqa_Message__setCorrelationId(z_bmqa_Message* message_obj, + const z_bmqt_CorrelationId* correlationId) +{ + using namespace BloombergLP; + bmqa::Message* message_p = reinterpret_cast(message_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId); + message_p->setCorrelationId(*correlationId_p); + + return 0; +} + +int z_bmqa_Message__setCompressionAlgorithmType( + z_bmqa_Message* message_obj, + z_bmqt_CompressionAlgorithmType::Enum value) +{ + using namespace BloombergLP; + bmqa::Message* message_p = reinterpret_cast(message_obj); + bmqt::CompressionAlgorithmType::Enum compressionType = + static_cast(value); + message_p->setCompressionAlgorithmType(compressionType); + + return 0; +} + +#ifdef BMQ_ENABLE_MSG_GROUPID + +int z_bmqa_Message__setGroupId(z_bmqa_Message* message_obj, + const char* groupId) +{ + using namespace BloombergLP; + bmqa::Message* message_p = reinterpret_cast(message_obj); + bsl::string groupId_str(groupId); + message_p->setGroupId(groupId_str); + + return 0; +} + +int z_bmqa_Message__clearGroupId(z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + bmqa::Message* message_p = reinterpret_cast(message_obj); + message_p->clearGroupId(); + + return 0; +} + +#endif + +int z_bmqa_Message__clone(const z_bmqa_Message* message_obj, + z_bmqa_Message** other_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + + bmqa::Message* other_p = new bmqa::Message(); + *other_p = message_p->clone(); + *other_obj = reinterpret_cast(other_p); + + return 0; +} + +int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, + z_bmqa_QueueId const** queueId_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + *queueId_obj = reinterpret_cast( + &(message_p->queueId())); + + return 0; +} + +int z_bmqa_Message__correlationId( + const z_bmqa_Message* message_obj, + z_bmqt_CorrelationId const** correlationId_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + *correlationId_obj = reinterpret_cast( + &(message_p->correlationId())); + + return 0; +} + +int z_bmqa_Message__subscriptionHandle( + const z_bmqa_Message* message_obj, + z_bmqt_SubscriptionHandle const** subscription_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + *subscription_obj = reinterpret_cast( + &(message_p->subscriptionHandle())); + + return 0; +} + +z_bmqt_CompressionAlgorithmType::Enum +z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + + return static_cast( + message_p->compressionAlgorithmType()); +} + +#ifdef BMQ_ENABLE_MSG_GROUPID + +const char* z_bmqa_Message__groupId(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + + return message_p->groupId().c_str(); +} + +#endif + +int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, + z_bmqt_MessageGUID const** messageGUID_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + *messageGUID_obj = reinterpret_cast( + &(message_p->messageGUID())); + + return 0; +} + +int z_bmqa_Message__confirmationCookie( + const z_bmqa_Message* message_obj, + z_bmqa_MessageConfirmationCookie** cookie_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + bmqa::MessageConfirmationCookie* cookie_p = + new bmqa::MessageConfirmationCookie(message_p->confirmationCookie()); + *cookie_obj = reinterpret_cast( + cookie_p); + + return 0; +} + +int z_bmqa_Message__ackStatus(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + return message_p->ackStatus(); +} + +// Add once we figure out how to handle Blobs in C +// int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, z_bdlbb_Blob* +// blob) { +// using namespace BloombergLP; +// const bmqa::Message* message_p = reinterpret_cast(message_obj); +// } + +int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, char** buffer) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + + bdlbb::Blob data; + message_p->getData(&data); + bsl::stringstream ss; + ss << bdlbb::BlobUtilHexDumper(&data); + bsl::string data_str = ss.str(); + *buffer = new char[data_str.length()+1]; + (*buffer)[data_str.length()] = '\0'; + strcpy(*buffer, data_str.c_str()); + + return 0; +} + +int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + + return message_p->dataSize(); +} + +bool z_bmqa_Message__hasProperties(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + return message_p->hasProperties(); +} + +#ifdef BMQ_ENABLE_MSG_GROUPID + +bool z_bmqa_Message__hasGroupId(const z_bmqa_Message* message_obj) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + return message_p->hasGroupId(); +} + +#endif + +int z_bmqa_Message__loadProperties(const z_bmqa_Message* message_obj, + z_bmqa_MessageProperties* buffer) +{ + using namespace BloombergLP; + const bmqa::Message* message_p = reinterpret_cast( + message_obj); + bmqa::MessageProperties* buffer_p = + reinterpret_cast(buffer); + return message_p->loadProperties(buffer_p); +} diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index f8bfa6c9f..7b1095226 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -1,20 +1,106 @@ #ifndef INCLUDED_Z_BMQA_MESSAGE #define INCLUDED_Z_BMQA_MESSAGE +#include +#include +#include +#include +#include +#include +#include + #if defined(__cplusplus) extern "C" { #endif typedef struct z_bmqa_Message z_bmqa_Message; +typedef struct z_bmqa_MessageConfirmationCookie + z_bmqa_MessageConfirmationCookie; + int z_bmqa_Message__delete(z_bmqa_Message** message_obj); int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj); -int z_bmqa_Message__createEmpty(z_bmqa_Message** message_obj); +int z_bmqa_Message__create(z_bmqa_Message** message_obj); + +int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, + const char* data, + int length); + +int z_bmqa_Message__setPropertiesRef( + z_bmqa_Message* message_obj, + const z_bmqa_MessageProperties* properties_obj); + +int z_bmqa_Message__clearPropertiesRef(z_bmqa_Message* message_obj); + +int z_bmqa_Message__setCorrelationId( + z_bmqa_Message* message_obj, + const z_bmqt_CorrelationId* correlationId); + +int z_bmqa_Message__setCompressionAlgorithmType( + z_bmqa_Message* message_obj, + z_bmqt_CompressionAlgorithmType::Enum value); + +#ifdef BMQ_ENABLE_MSG_GROUPID + +int z_bmqa_Message__setGroupId(z_bmqa_Message* message_obj, + const char* groupId); + +int z_bmqa_Message__clearGroupId(z_bmqa_Message* message_obj); + +#endif + +int z_bmqa_Message__clone(const z_bmqa_Message* message_obj, + z_bmqa_Message** other_obj); + +int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, + z_bmqa_QueueId const** queueId_obj); + +int z_bmqa_Message__correlationId( + const z_bmqa_Message* message_obj, + z_bmqt_CorrelationId const** correlationId_obj); + +int z_bmqa_Message__subscriptionHandle( + const z_bmqa_Message* message_obj, + z_bmqt_SubscriptionHandle const** subscription_obj); -int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length); +z_bmqt_CompressionAlgorithmType::Enum +z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message_obj); + +#ifdef BMQ_ENABLE_MSG_GROUPID + +const char* z_bmqa_Message__groupId(const z_bmqa_Message* message_obj); + +#endif + +int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, + z_bmqt_MessageGUID const** messageGUID_obj); + +int z_bmqa_Message__confirmationCookie( + const z_bmqa_Message* message_obj, + z_bmqa_MessageConfirmationCookie** cookie_obj); + +int z_bmqa_Message__ackStatus(const z_bmqa_Message* message_obj); + +// Add once we figure out how to handle Blobs in C +// int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, z_bdlbb_Blob* +// blob); + +int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, void** buffer); + +int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj); + +bool z_bmqa_Message__hasProperties(const z_bmqa_Message* message_obj); + +#ifdef BMQ_ENABLE_MSG_GROUPID + +bool z_bmqa_Message__hasGroupId(const z_bmqa_Message* message_obj); + +#endif +int z_bmqa_Message__loadProperties(const z_bmqa_Message* message_obj, + z_bmqa_MessageProperties* buffer); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp new file mode 100644 index 000000000..a16d67209 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp @@ -0,0 +1,53 @@ +#include +#include + +int z_bmqa_MessageIterator__create( + z_bmqa_MessageIterator** messageIterator_obj) +{ + using namespace BloombergLP; + + bmqa::MessageIterator* messageIterator_p = new bmqa::MessageIterator(); + + *messageIterator_obj = reinterpret_cast( + messageIterator_p); + + return 0; +} + +int z_bmqa_MessageIterator__delete( + z_bmqa_MessageIterator** messageIterator_obj) +{ + using namespace BloombergLP; + + bmqa::MessageIterator* messageIterator_p = + reinterpret_cast(messageIterator_obj); + delete messageIterator_p; + *messageIterator_obj = NULL; + + return 0; +} + +bool z_bmqa_MessageIterator__nextMessage( + z_bmqa_MessageIterator* messageIterator_obj) +{ + using namespace BloombergLP; + + bmqa::MessageIterator* messageIterator_p = + reinterpret_cast(messageIterator_obj); + + return messageIterator_p->nextMessage(); +} + +int z_bmqa_MessageIterator__message( + const z_bmqa_MessageIterator* messageIterator_obj, + z_bmqa_Message const** message_obj) +{ + using namespace BloombergLP; + + const bmqa::MessageIterator* messageIterator_p = + reinterpret_cast(messageIterator_obj); + const z_bmqa_Message* message_p = reinterpret_cast( + &messageIterator_p->message()); + + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h new file mode 100644 index 000000000..6c6f6b6e2 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h @@ -0,0 +1,30 @@ +#ifndef INCLUDED_Z_BMQA_MESSAGEITERATOR +#define INCLUDED_Z_BMQA_MESSAGEITERATOR + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct z_bmqa_MessageIterator z_bmqa_MessageIterator; + +int z_bmqa_MessageIterator__create( + z_bmqa_MessageIterator** messageIterator_obj); + +int z_bmqa_MessageIterator__delete( + z_bmqa_MessageIterator** messageIterator_obj); + +bool z_bmqa_MessageIterator__nextMessage( + z_bmqa_MessageIterator* messageIterator_obj); + +int z_bmqa_MessageIterator__message( + z_bmqa_MessageIterator* messageIterator_obj, + z_bmqa_Message const** message_obj); + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp new file mode 100644 index 000000000..5ff0f23ff --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp @@ -0,0 +1,3 @@ +#include +#include + diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h index b9b2823d5..845532437 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h @@ -3,4 +3,6 @@ typedef struct z_bmqa_MessageProperties z_bmqa_MessageProperties; + + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index afa0a5622..4c165a0b6 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -1,11 +1,86 @@ +#include +#include +#include +#include +#include #include #include -#include -#include -#include +z_bmqa_CustomSessionEventHandler::z_bmqa_CustomSessionEventHandler( + z_bmqa_OnSessionEventCb onSessionEventCb, + z_bmqa_OnMessageEventCb onMessageEventCb) +{ + this->onSessionEventCb = onSessionEventCb; + this->onMessageEventCb = onMessageEventCb; +} + +z_bmqa_CustomSessionEventHandler::~z_bmqa_CustomSessionEventHandler() +{ + if (data != NULL) { + delete[] (char*)data; + } +} + +void z_bmqa_CustomSessionEventHandler::onSessionEvent( + const BloombergLP::bmqa::SessionEvent& sessionEvent) +{ + const z_bmqa_SessionEvent* sessionEvent_p = + reinterpret_cast(&sessionEvent); + this->onSessionEventCb(sessionEvent_p, this->data); +} -int z_bmqa_Session__delete(z_bmqa_Session** session_obj) { +void z_bmqa_CustomSessionEventHandler::onMessageEvent( + const BloombergLP::bmqa::MessageEvent& messageEvent) +{ + const z_bmqa_MessageEvent* messageEvent_p = + reinterpret_cast(&messageEvent); + this->onMessageEventCb(messageEvent_p, this->data); +} + +void z_bmqa_CustomSessionEventHandler::lock() +{ + this->mutex.lock(); +} + +void z_bmqa_CustomSessionEventHandler::unlock() +{ + this->mutex.unlock(); +} + +void z_bmqa_CustomSessionEventHandler::tryLock() +{ + this->mutex.tryLock(); +} + +int z_bmqa_SessionEventHandler__create( + z_bmqa_SessionEventHandler** eventHandler_obj, + z_bmqa_OnSessionEventCb onSessionEventCb, + z_bmqa_OnMessageEventCb onMessageEventCb) +{ + using namespace BloombergLP; + + z_bmqa_CustomSessionEventHandler* eventHandler_p = + new z_bmqa_CustomSessionEventHandler(onSessionEventCb, + onMessageEventCb); + *eventHandler_obj = reinterpret_cast( + eventHandler_p); + ; + return 0; +} + +int z_bmqa_SessionEventHandler__delete( + z_bmqa_SessionEventHandler** eventHandler_obj) +{ + z_bmqa_CustomSessionEventHandler* eventHandler_p = + reinterpret_cast(*eventHandler_obj); + delete eventHandler_p; + *eventHandler_obj = NULL; + + return 0; +} + +int z_bmqa_Session__delete(z_bmqa_Session** session_obj) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(*session_obj); @@ -15,132 +90,225 @@ int z_bmqa_Session__delete(z_bmqa_Session** session_obj) { return 0; } -int z_bmqa_Session__create(z_bmqa_Session** session_obj , const z_bmqt_SessionOptions* options) { +int z_bmqa_Session__create(z_bmqa_Session** session_obj, + const z_bmqt_SessionOptions* options) +{ + using namespace BloombergLP; + + bmqa::Session* session_p; + if (options) { + const bmqt::SessionOptions* options_p = + reinterpret_cast(options); + session_p = new bmqa::Session(*options_p); + } + else { + session_p = new bmqa::Session(); + } + *session_obj = reinterpret_cast(session_p); + return 0; +} + +int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, + z_bmqa_SessionEventHandler* eventHandler, + const z_bmqt_SessionOptions* options) +{ using namespace BloombergLP; - const bmqt::SessionOptions* options_p = reinterpret_cast(options); - bmqa::Session* session_p = new bmqa::Session(*options_p); + bmqa::Session* session_p; + bmqa::SessionEventHandler* eventHandler_p = + reinterpret_cast(eventHandler); + if (options) { + const bmqt::SessionOptions* options_p = + reinterpret_cast(options); + session_p = new bmqa::Session( + bslma::ManagedPtr(eventHandler_p), + *options_p); + } + else { + session_p = new bmqa::Session( + bslma::ManagedPtr(eventHandler_p)); + } *session_obj = reinterpret_cast(session_p); return 0; } -int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) { +int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); - if(timeoutMs != 0) { + if (timeoutMs != 0) { bsls::TimeInterval timeout; timeout.addMilliseconds(timeoutMs); return session_p->start(timeout); - } else { + } + else { return session_p->start(); } } -int z_bmqa_Session__stop(z_bmqa_Session* session_obj) { +int z_bmqa_Session__startAsync(z_bmqa_Session* session_obj, int64_t timeoutMs) +{ + using namespace BloombergLP; + + bmqa::Session* session_p = reinterpret_cast(session_obj); + if (timeoutMs != 0) { + bsls::TimeInterval timeout; + timeout.addMilliseconds(timeoutMs); + return session_p->startAsync(timeout); + } + else { + return session_p->startAsync(); + } +} + +int z_bmqa_Session__stop(z_bmqa_Session* session_obj) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); session_p->stop(); return 0; -} - +} -int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj){ +int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj) +{ using namespace BloombergLP; - + bmqa::Session* session_p = reinterpret_cast(session_obj); - session_p->finalizeStop(); + session_p->stopAsync(); + return 0; } +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj) +{ + using namespace BloombergLP; + bmqa::Session* session_p = reinterpret_cast(session_obj); + session_p->finalizeStop(); + return 0; +} -int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder){ +int z_bmqa_Session__loadMessageEventBuilder( + z_bmqa_Session* session_obj, + z_bmqa_MessageEventBuilder** builder) +{ using namespace BloombergLP; - + bmqa::Session* session_p = reinterpret_cast(session_obj); - bmqa::MessageEventBuilder* builder_p = reinterpret_cast(*builder); + bmqa::MessageEventBuilder* builder_p = + reinterpret_cast(*builder); session_p->loadMessageEventBuilder(builder_p); return 0; } -int z_bmqa_Session__loadConfirmEventBuilder(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder** builder){ +int z_bmqa_Session__loadConfirmEventBuilder( + z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder** builder) +{ using namespace BloombergLP; - + bmqa::Session* session_p = reinterpret_cast(session_obj); - bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder); + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder); session_p->loadConfirmEventBuilder(builder_p); return 0; } -int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer){ +int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, + z_bmqa_MessageProperties** buffer) +{ using namespace BloombergLP; - + bmqa::Session* session_p = reinterpret_cast(session_obj); - bmqa::MessageProperties* buffer_p = reinterpret_cast(buffer); + bmqa::MessageProperties* buffer_p = + reinterpret_cast(buffer); session_p->loadMessageProperties(buffer_p); return 0; } -// int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ +// int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, +// z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ // using namespace BloombergLP; - -// bmqa::Session* session_p = reinterpret_cast(session_obj); -// bmqa::Q* buffer_p = reinterpret_cast(uri); + +// bmqa::Session* session_p = +// reinterpret_cast(session_obj); bmqa::Q* buffer_p = +// reinterpret_cast(uri); // session_p->getQueueId(buffer_p); // return 0; // } +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const char* uri, + uint64_t flags, + z_bmqa_OpenQueueStatus** status) +{ + using namespace BloombergLP; -// int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ -// using namespace BloombergLP; - -// bmqa::Session* session_p = reinterpret_cast(session_obj); -// bmqt::Uri const * uri_p = reinterpret_cast< bmqt::Uri const *>(uri); -// bmqa::QueueId* queueid_p = reinterpret_cast(queueId); + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::QueueId* queueId_p = reinterpret_cast(queueId); + bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(); -// //must populate out obj in future -// session_p->openQueueSync(queueid_p, *uri_p, flags); -// return 0; -// } + *status_p = session_p->openQueueSync(queueId_p, uri, flags); + *status = reinterpret_cast(status_p); + return 0; +} -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const char * uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/){ +int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const z_bmqt_QueueOptions* options, + int64_t timeoutMs, + z_bmqa_ConfigureQueueStatus** status) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); - bmqa::QueueId* queueid_p = reinterpret_cast(queueId); + bmqa::QueueId* queueId_p = reinterpret_cast(queueId); + bmqa::ConfigureQueueStatus* status_p = new bmqa::ConfigureQueueStatus(); + const bmqt::QueueOptions* options_p = + reinterpret_cast(options); + + // Implement timeout - //must populate out obj in future - session_p->openQueueSync(queueid_p, uri, flags); + *status_p = session_p->configureQueueSync(queueId_p, *options_p); + *status = reinterpret_cast(status_p); return 0; } -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId /*,z_bmqa_CloseQueueStatus**/){ +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + int64_t timeoutMs, + z_bmqa_CloseQueueStatus** status) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); - bmqa::QueueId* queueid_p = reinterpret_cast(queueId); + bmqa::QueueId* queueId_p = reinterpret_cast(queueId); + bmqa::CloseQueueStatus* status_p = new bmqa::CloseQueueStatus(); - //must populate out obj in future - session_p->closeQueueSync(queueid_p); // not using timeout (we should definitely add this) + // Implement timeout + + *status_p = session_p->closeQueueSync(queueId_p); + *status = reinterpret_cast(status_p); return 0; } - -int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event){ +int z_bmqa_Session__post(z_bmqa_Session* session_obj, + const z_bmqa_MessageEvent* event) +{ using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); - const bmqa::MessageEvent* event_p = reinterpret_cast(event); + const bmqa::MessageEvent* event_p = + reinterpret_cast(event); session_p->post(*event_p); return 0; } - - diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 1e029b000..8abb39a11 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -1,16 +1,19 @@ #ifndef INCLUDED_Z_BMQA_SESSION #define INCLUDED_Z_BMQA_SESSION -#include -#include +#include +#include +#include #include -#include #include +#include #include -#include +#include +#include +#include #include -#include -#include +#include +#include #if defined(__cplusplus) extern "C" { @@ -18,93 +21,139 @@ extern "C" { typedef struct z_bmqa_SessionEventHandler z_bmqa_SessionEventHandler; -typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; +typedef void (*z_bmqa_OnSessionEventCb)( + const z_bmqa_SessionEvent* sessionEvent, + void* data); +typedef void (*z_bmqa_OnMessageEventCb)( + const z_bmqa_MessageEvent* messageEvent, + void* data); + +int z_bmqa_SessionEventHandler__create( + z_bmqa_SessionEventHandler** eventHandler_obj, + z_bmqa_OnSessionEventCb onSessionEvent, + z_bmqa_OnMessageEventCb onMessageEvent); + +int z_bmqa_SessionEventHandler__delete( + z_bmqa_SessionEventHandler** eventHandler_obj); + +typedef struct z_bmqa_MessageConfirmationCookie + z_bmqa_MessageConfirmationCookie; typedef struct z_bmqa_Session z_bmqa_Session; -typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; +int z_bmqa_Session__delete(z_bmqa_Session** session_obj); -typedef struct z_bmqa_OpenQueueStatus z_bmqa_OpenQueueStatus; +int z_bmqa_Session__create(z_bmqa_Session** session_obj, + const z_bmqt_SessionOptions* options); -typedef void(*z_bmqa_SessionEventHandlerCb)(z_bmqa_SessionEvent* sessionEvent, void* data); +int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, + z_bmqa_SessionEventHandler* eventHandler, + const z_bmqt_SessionOptions* options); -typedef struct EventHandlerData { - z_bmqa_SessionEventHandlerCb callback; - void* data; -} EventHandlerData; +int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs); -// void z_bmqa_Session__setEventHandler(z_bmqa_Session* session_obj, EventHandlerData* data) { -// if(data.callback != NULL) { -// z_bmqa_SessionEvent* event = NULL; +int z_bmqa_Session__startAsync(z_bmqa_Session* session_obj, int64_t timeoutMs); -// data.callback(event, NULL); -// } -// } +int z_bmqa_Session__stop(z_bmqa_Session* session_obj); - // +int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj); -int z_bmqa_Session__delete(z_bmqa_Session** session_obj); +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj); -int z_bmqa_Session__create(z_bmqa_Session** session_obj, const z_bmqt_SessionOptions* options); +int z_bmqa_Session__loadMessageEventBuilder( + z_bmqa_Session* session_obj, + z_bmqa_MessageEventBuilder** builder); -int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, z_bmqa_SessionEventHandler* eventHandler, const z_bmqt_SessionOptions* options); +int z_bmqa_Session__loadConfirmEventBuilder( + z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder** builder); -int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t milliseconds); +int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, + z_bmqa_MessageProperties** buffer); -int z_bmqa_Session__startAsync(); +// int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, +// z_bmqa_QueueId** queueId, +// const z_bmqt_Uri* uri); -int z_bmqa_Session__stop(z_bmqa_Session* session_obj); +int z_bmqa_Session__getQueueIdWithCorrelationId( + z_bmqa_Session* session_obj, + z_bmqa_QueueId** queueId, + const z_bmqt_CorrelationId* correlationId); -int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj); +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const char* uri, + uint64_t flags, + z_bmqa_OpenQueueStatus** status); -int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj); +int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + const z_bmqt_QueueOptions* options, + int64_t timeoutMs, + z_bmqa_ConfigureQueueStatus** status); -int z_bmqa_Session__loadMessageEventBuilder(z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder** builder); +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + int64_t timeoutMs, + z_bmqa_CloseQueueStatus** status); -int z_bmqa_Session__loadConfirmEventBuilder(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder** builder); +int z_bmqa_Session__closeQueueAsync(z_bmqa_Session* session_obj, + z_bmqa_QueueId* queueId, + int64_t timeout); -int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer); +int z_bmqa_Session_nextEvent(z_bmqa_Session* session_obj, + z_bmqa_Event** event_obj, + int64_t timeout); -int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri); +int z_bmqa_Session__post(z_bmqa_Session* session_obj, + const z_bmqa_MessageEvent* event); -int z_bmqa_Session__getQueueIdWithCorrelationId(z_bmqa_Session* session_obj, z_bmqa_QueueId** queueId, const z_bmqt_CorrelationId* correlationId); +int z_bmqa_Session__confirmMessage(z_bmqa_Session* session_obj, + const z_bmqa_Message* message); -// int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const z_bmqt_Uri* uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); +int z_bmqa_Session__confirmMessageWithCookie( + z_bmqa_Session* session_obj, + const z_bmqa_MessageConfirmationCookie* cookie); -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj,z_bmqa_QueueId* queueId,const char * uri,uint64_t flags /*,z_bmqa_OpenQueueStatus* out_obj*/); +int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder* builder); -// int z_bmqa_Session__openQueueAsync(z_bmqa_Session* session_obj, -// z_bmqa_QueueId* queueId, -// const z_bmqt_Uri* uri, uint64_t flags, -// const z_bmqt_QueueOptions* options, -// int64_t timeout); +#if defined(__cplusplus) +} -int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, - z_bmqa_QueueId* queueId, - const z_bmqt_QueueOptions* options, - int64_t timeout); +#include +#include +#include +#include -// int z_bmqa_Session__configureQueueAsync(z_bmqa_Session* session_obj, -// z_bmqa_QueueId* queueId, -// const z_bmqt_QueueOptions* options, -// int64_t timeout); +class z_bmqa_CustomSessionEventHandler +: BloombergLP::bmqa::SessionEventHandler { + private: + z_bmqa_OnSessionEventCb onSessionEventCb; + z_bmqa_OnMessageEventCb onMessageEventCb; + void* data; + uint64_t mSize; -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId /*,z_bmqa_CloseQueueStatus**/); + BloombergLP::bslmt::Mutex mutex; -int z_bmqa_Session__closeQueueAsync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeout); + public: + z_bmqa_CustomSessionEventHandler(z_bmqa_OnSessionEventCb onSessionEventCb, + z_bmqa_OnMessageEventCb onMessageEventCb); -int z_bmqa_Session_nextEvent(z_bmqa_Session* session_obj, z_bmqa_Event** event_obj, int64_t timeout); + ~z_bmqa_CustomSessionEventHandler(); -int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event); + void onSessionEvent(const BloombergLP::bmqa::SessionEvent& sessionEvent); -int z_bmqa_Session__confirmMessage(z_bmqa_Session* session_obj, const z_bmqa_Message* message); + void onMessageEvent(const BloombergLP::bmqa::MessageEvent& messageEvent); -int z_bmqa_Session__confirmMessageWithCookie(z_bmqa_Session* session_obj, const z_bmqa_MessageConfirmationCookie* cookie); + void* getData() { return this->data; } -int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder* builder); + void lock(); -#if defined(__cplusplus) -} + void unlock(); + + void tryLock(); +}; #endif #endif diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp index d5e3c373b..e265556d6 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp @@ -27,7 +27,7 @@ // TEST DRIVER #include -#include +// #include // CONVENIENCE using namespace BloombergLP; @@ -39,7 +39,7 @@ using namespace bsl; static void test1_session() { - run_c_producer(); + // run_c_producer(); } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp new file mode 100644 index 000000000..a166350d3 --- /dev/null +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp @@ -0,0 +1,83 @@ +#include +#include + +int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** event_obj) +{ + using namespace BloombergLP; + + return 0; +} + +int z_bmqa_SessionEvent__create(z_bmqa_SessionEvent** event_obj) +{ + using namespace BloombergLP; + + bmqa::SessionEvent* event_p = new bmqa::SessionEvent(); + *event_obj = reinterpret_cast(event_p); + + return 0; +} + +int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** event_obj, + const z_bmqa_SessionEvent* other) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* other_p = + reinterpret_cast(other); + bmqa::SessionEvent* event_p = new bmqa::SessionEvent(*other_p); + + return 0; +} + +z_bmqt_SessionEventType::Enum +z_bmqa_SessionEvent__type(const z_bmqa_SessionEvent* event_obj) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); + return static_cast(event_p->type()); +} + +int z_bmqa_SessionEvent__correlationId( + const z_bmqa_SessionEvent* event_obj, + z_bmqt_CorrelationId const** correlationId_obj) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + const bmqt::CorrelationId* correlationId_p = reinterpret_cast(&(event_p->correlationId())); + *correlationId_obj = reinterpret_cast(correlationId_p); + + return 0; +} + +int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* event_obj, + z_bmqa_QueueId** queueId_obj) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + bmqa::QueueId* queueId_p = new bmqa::QueueId(event_p->queueId()); + *queueId_obj = reinterpret_cast(queueId_p); + + return 0; +} + +int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* event_obj) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + return event_p->statusCode(); +} + +const char* +z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* event_obj) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + return event_p->errorDescription().c_str(); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h index cc3c74ef6..7f504a058 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h @@ -1,6 +1,9 @@ #ifndef INCLUDED_Z_BMQA_SESSIONEVENT #define INCLUDED_Z_BMQA_SESSIONEVENT +#include +#include +#include #if defined(__cplusplus) extern "C" { @@ -8,6 +11,29 @@ extern "C" { typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; +int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** event_obj); + +int z_bmqa_SessionEvent__create(z_bmqa_SessionEvent** event_obj); + +int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** event_obj, + const z_bmqa_SessionEvent* other); + +z_bmqt_SessionEventType::Enum +z_bmqa_SessionEvent__type(const z_bmqa_SessionEvent* event_obj); + +int z_bmqa_SessionEvent__correlationId( + const z_bmqa_SessionEvent* event_obj, + z_bmqt_CorrelationId const** correlationId_obj); + +// Generates NEW queueId +int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* event_obj, + z_bmqa_QueueId** queueId_obj); + +int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* event_obj); + +const char* +z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* event_obj); + #if defined(__cplusplus) } #endif diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem index beeb8066f..d463eeaf5 100644 --- a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -1,5 +1,8 @@ +z_bmqt_compressionalgorithmtype z_bmqt_correlationid +z_bmqt_messageguid z_bmqt_queueoptions +z_bmqt_sessioneventtype z_bmqt_sessionoptions z_bmqt_subscription z_bmqt_types diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp new file mode 100644 index 000000000..fd2a649b0 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp @@ -0,0 +1,46 @@ +#include +#include +#include +#include + +#include + +const char* z_bmqt_CompressionAlgorithmType::toAscii( + z_bmqt_CompressionAlgorithmType::Enum value) +{ + using namespace BloombergLP; + + return bmqt::CompressionAlgorithmType::toAscii( + static_cast(value)); +} + +bool fromAscii(z_bmqt_CompressionAlgorithmType::Enum* out, const char* str) +{ + using namespace BloombergLP; + bmqt::CompressionAlgorithmType::Enum p; + bool result = bmqt::CompressionAlgorithmType::fromAscii(&p, str); + *out = static_cast(p); + return result; +} + +// Pass in unassigned pointer for error +bool isValid(const char* str, char** error) +{ + using namespace BloombergLP; + bsl::ostringstream os; + bsl::string temp_str(str); + bool result = bmqt::CompressionAlgorithmType::isValid(&temp_str, os); + + bsl::string error_str = os.str(); + + if (error_str.size() != 0) { + *error = new char[error_str.size() + 1]; + (*error)[error_str.size()] = '\0'; + strcpy(*error, error_str.c_str()); + } + else { + *error = NULL; + } + + return result; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h new file mode 100644 index 000000000..4e35d1cbd --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h @@ -0,0 +1,65 @@ +#ifndef INCLUDED_Z_BMQT_COMPRESSIONALGORITHMTYPE +#define INCLUDED_Z_BMQT_COMPRESSIONALGORITHMTYPE + +#include + +struct z_bmqt_CompressionAlgorithmType { + // TYPES + enum Enum { ec_UNKNOWN = -1, ec_NONE = 0, ec_ZLIB = 1 }; + + // CONSTANTS + + /// NOTE: This value must always be equal to the lowest type in the + /// enum because it is being used as a lower bound to verify that a + /// header's `CompressionAlgorithmType` field is a supported type. + static const int k_LOWEST_SUPPORTED_TYPE = ec_NONE; + + /// NOTE: This value must always be equal to the highest type in the + /// enum because it is being used as an upper bound to verify that a + /// header's `CompressionAlgorithmType` field is a supported type. + static const int k_HIGHEST_SUPPORTED_TYPE = ec_ZLIB; + + /// Return the non-modifiable string representation corresponding to the + /// specified enumeration `value`, if it exists, and a unique (error) + /// string otherwise. The string representation of `value` matches its + /// corresponding enumerator name with the "ec_" prefix eluded. For + /// example: + /// ``` + /// bsl::cout << CompressionAlgorithmType::toAscii( + /// CompressionAlgorithmType::ec_NONE); + /// ``` + /// will print the following on standard output: + /// ``` + /// NONE + /// ``` + /// Note that specifying a `value` that does not match any of the + /// enumerators will result in a string representation that is distinct + /// from any of those corresponding to the enumerators, but is otherwise + /// unspecified. + static const char* toAscii(z_bmqt_CompressionAlgorithmType::Enum value); + + /// Update the specified `out` with correct enum corresponding to the + /// specified string `str`, if it exists, and return true. Otherwise in + /// case of an error or unidentified string, return false. The expected + /// `str` is the enumerator name with the "ec_" prefix excluded. + /// For example: + /// ``` + /// CompressionAlgorithmType::fromAscii(out, NONE); + /// ``` + /// will return true and the value of `out` will be: + /// ``` + /// bmqt::CompresssionAlgorithmType::ec_NONE + /// ``` + /// Note that specifying a `str` that does not match any of the + /// enumerators excluding "ec_" prefix will result in the function + /// returning false and the specified `out` will not be touched. + static bool fromAscii(z_bmqt_CompressionAlgorithmType::Enum* out, + const char* str); + + /// Return true incase of valid specified `str` i.e. a enumerator name + /// with the "ec_" prefix excluded. Otherwise in case of invalid `str` + /// return false and populate the specified `stream` with error message. + static bool isValid(const char* str); +}; + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp index 9fe52738d..579bc2da0 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -104,13 +104,22 @@ CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correl const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); switch(correlationId_p->type()) { - case bmqt::CorrelationId::Type::e_NUMERIC: return CorrelationId_Type::e_NUMERIC; - case bmqt::CorrelationId::Type::e_POINTER: return CorrelationId_Type::e_POINTER; - case bmqt::CorrelationId::Type::e_SHARED_PTR: return CorrelationId_Type::e_SHARED_PTR; - case bmqt::CorrelationId::Type::e_AUTO_VALUE: return CorrelationId_Type::e_AUTO_VALUE; - case bmqt::CorrelationId::Type::e_UNSET: return CorrelationId_Type::e_UNSET; + case bmqt::CorrelationId::Type::e_NUMERIC: return CorrelationId_Type::ec_NUMERIC; + case bmqt::CorrelationId::Type::e_POINTER: return CorrelationId_Type::ec_POINTER; + case bmqt::CorrelationId::Type::e_SHARED_PTR: return CorrelationId_Type::ec_SHARED_PTR; + case bmqt::CorrelationId::Type::e_AUTO_VALUE: return CorrelationId_Type::ec_AUTO_VALUE; + case bmqt::CorrelationId::Type::e_UNSET: return CorrelationId_Type::ec_UNSET; default: break; } - return CorrelationId_Type::e_CORRELATIONID_ERROR; + return CorrelationId_Type::ec_CORRELATIONID_ERROR; +} + +int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj) { + using namespace BloombergLP; + + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(bmqt::CorrelationId::autoValue()); + *correlationId_obj = reinterpret_cast(correlationId_p); + + return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h index 78d93fe90..1b306a17c 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -12,17 +12,17 @@ typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; enum CorrelationId_Type { - e_NUMERIC // the 'CorrelationId' holds a 64-bit integer + ec_NUMERIC // the 'CorrelationId' holds a 64-bit integer , - e_POINTER // the 'CorrelationId' holds a raw pointer + ec_POINTER // the 'CorrelationId' holds a raw pointer , - e_SHARED_PTR // the 'CorrelationId' holds a shared pointer + ec_SHARED_PTR // the 'CorrelationId' holds a shared pointer , - e_AUTO_VALUE // the 'CorrelationId' holds an auto value + ec_AUTO_VALUE // the 'CorrelationId' holds an auto value , - e_UNSET // the 'CorrelationId' is not set + ec_UNSET // the 'CorrelationId' is not set , - e_CORRELATIONID_ERROR // error + ec_CORRELATIONID_ERROR // error }; int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); @@ -53,6 +53,8 @@ void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlation_I CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlation_Id_obj); +int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj); + #if defined(__cplusplus) } #endif diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp new file mode 100644 index 000000000..61d0fcd2a --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp @@ -0,0 +1,24 @@ +#include +#include + +int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj) +{ + using namespace BloombergLP; + + bmqt::MessageGUID* messageGUID_p = reinterpret_cast( + *messageGUID_obj); + delete messageGUID_p; + *messageGUID_obj = NULL; + + return 0; +} + +int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj) +{ + using namespace BloombergLP; + + bmqt::MessageGUID* messageGUID_p = new bmqt::MessageGUID(); + *messageGUID_obj = reinterpret_cast(messageGUID_p); + + return 0; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h new file mode 100644 index 000000000..874293894 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h @@ -0,0 +1,10 @@ +#ifndef INCLUDED_Z_BMQT_MESSAGEGUID +#define INCLUDED_Z_BMQT_MESSAGEGUID + +typedef struct z_bmqt_MessageGUID z_bmqt_MessageGUID; + +int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj); + +int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj); + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp new file mode 100644 index 000000000..fca2218f9 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp @@ -0,0 +1,20 @@ +#include +#include + + +const char* +z_bmqt_SessionEventType::toAscii(z_bmqt_SessionEventType::Enum value) +{ + using namespace BloombergLP; + + return bmqt::SessionEventType::toAscii(static_cast(value)); +} + +bool fromAscii(z_bmqt_SessionEventType::Enum* out, const char* str) +{ + using namespace BloombergLP; + bmqt::SessionEventType::Enum p; + bool result = bmqt::SessionEventType::fromAscii(&p, str); + *out = static_cast(p); + return result; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h new file mode 100644 index 000000000..0f2da805d --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h @@ -0,0 +1,67 @@ +#ifndef INCLUDED_Z_BMQT_SESSIONEVENTTYPE +#define INCLUDED_Z_BMQT_SESSIONEVENTTYPE + +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +struct z_bmqt_SessionEventType { + // TYPES + enum Enum { + ec_ERROR = -1 // Generic error + , + ec_TIMEOUT = -2 // Time out of the operation + , + ec_CANCELED = -3 // The operation was canceled + , + ec_UNDEFINED = 0, + ec_CONNECTED = 1 // Session started + , + ec_DISCONNECTED = 2 // Session terminated + , + ec_CONNECTION_LOST = 3 // Lost connection to the broker + , + ec_RECONNECTED = 4 // Reconnected with the broker + , + ec_STATE_RESTORED = 5 // Client's state has been restored + , + ec_CONNECTION_TIMEOUT = 6 // The connection to broker timedOut + , + ec_QUEUE_OPEN_RESULT = 7 // Result of openQueue operation + , + ec_QUEUE_REOPEN_RESULT = 8 // Result of re-openQueue operation + , + ec_QUEUE_CLOSE_RESULT = 9 // Result of closeQueue operation + , + ec_SLOWCONSUMER_NORMAL = 10 // EventQueue is at lowWatermark + , + ec_SLOWCONSUMER_HIGHWATERMARK = 11 // EventQueue is at highWatermark + , + ec_QUEUE_CONFIGURE_RESULT = 12 // Result of configureQueue + , + ec_HOST_UNHEALTHY = 13 // Host has become unhealthy + , + ec_HOST_HEALTH_RESTORED = 14 // Host's health has been restored + , + ec_QUEUE_SUSPENDED = 15 // Queue has suspended operation + , + ec_QUEUE_RESUMED = 16 // Queue has resumed operation + }; + + static const char* toAscii(z_bmqt_SessionEventType::Enum value); + + /// Return true and fills the specified `out` with the enum value + /// corresponding to the specified `str`, if valid, or return false and + /// leave `out` untouched if `str` doesn't correspond to any value of + /// the enum. + static bool fromAscii(z_bmqt_SessionEventType::Enum* out, + const char* str); +}; + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/tutorials/CMakeLists.txt b/src/tutorials/CMakeLists.txt index 123679523..7409a5fe7 100644 --- a/src/tutorials/CMakeLists.txt +++ b/src/tutorials/CMakeLists.txt @@ -66,3 +66,4 @@ add_custom_target("tutorials") add_subdirectory("advanced") add_subdirectory("hello_world") add_subdirectory("subscriptions") +add_subdirectory("c_wrapper") \ No newline at end of file diff --git a/src/tutorials/c_wrapper/consumer.cpp b/src/tutorials/c_wrapper/consumer.cpp new file mode 100644 index 000000000..503903788 --- /dev/null +++ b/src/tutorials/c_wrapper/consumer.cpp @@ -0,0 +1,266 @@ +// Copyright 2014-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// consumer.cpp -*-C++-*- + +// This file is part of the BlazingMQ tutorial "Hello World". +// +// The simplest use case involves a Publisher task, a Consumer task, and a +// Message Broker. The Producer and/or the Consumer create a named queue in +// the Broker. The Producer pushes messages into the queue, and the consumer +// pulls them. Once a message has been consumed it can be removed from the +// queue. +// +// In essence the queue is a mailbox for messages to be sent to a Consumer. It +// allows decoupling the processing between the Producer and the Consumer: one +// of the tasks may be down without impacting the other, and the Consumer can +// process messages at a different pace than the Producer. + +// BMQ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// BDE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +// SYSTEM +#include + +using namespace BloombergLP; + +namespace { +// TYPES +using ManagedHandler = bslma::ManagedPtr; + +// CONSTANTS +const char k_QUEUE_URL[] = "bmq://bmq.test.mem.priority/test-queue"; + +// FUNCTIONS +bsl::function shutdownHandler; + +/// Handle the specified `signal` +void signalHandler(int signal) +{ + shutdownHandler(signal); +} + +// CLASSES + +/// Concrete implementation of an event handler. Note that the methods are +/// called on the session's own threads. +// class EventHandler : public bmqa::SessionEventHandler { +// private: +// // DATA +// bmqa::Session* d_session_p; // Pointer to session (held, not owned) + +// public: +// // MANIPULATORS +// void onMessageEvent(const bmqa::MessageEvent& messageEvent) +// BSLS_KEYWORD_OVERRIDE; +// // Process the specified 'messageEvent' received from the broker. + +// void onSessionEvent(const bmqa::SessionEvent& sessionEvent) +// BSLS_KEYWORD_OVERRIDE; +// // Process the specified 'sessionEvent' received from the broker. + +// void setSession(bmqa::Session* session); +// }; + +void onMessageEvent(const z_bmqa_MessageEvent* messageEvent) +// Handle the specified 'messageEvent' +{ + // Load a ConfirmEventBuilder from the session + bmqa::ConfirmEventBuilder confirmBuilder; + d_session_p->loadConfirmEventBuilder(&confirmBuilder); + + if (messageEvent.type() == bmqt::MessageEventType::e_PUSH) { + bmqa::MessageIterator msgIter = messageEvent.messageIterator(); + while (msgIter.nextMessage()) { + const bmqa::Message& msg = msgIter.message(); + bdlbb::Blob data; + int rc = msg.getData(&data); + if (rc == 0) { + bsl::cout << "Got message with GUID: " << msg.messageGUID() + << ", data:\n" + << bdlbb::BlobUtilHexDumper(&data) << "\n"; + } + else { + bsl::cerr << "Failed to decode message with GUID: " + << msg.messageGUID() << ", rc: " << rc << "\n"; + } + + rc = confirmBuilder.addMessageConfirmation(msg); + if (rc != 0) { + bsl::cerr << "Failed to add confirm message with GUID: " + << msg.messageGUID() << " to the builder, rc: " << rc + << "\n"; + } + } + + // Confirm reception of the messages so that it can be deleted from the + // queue. + + int rc = d_session_p->confirmMessages(&confirmBuilder); + if (rc != 0) { + bsl::cerr << "Failed to confirm " << confirmBuilder.messageCount() + << " messages" + << ", rc: " << rc; + + // Since 'Session::confirmMessages' failed, it would not have reset + // the 'builder'. So we reset it here. + + confirmBuilder.reset(); + } + } + else { + bsl::cerr << "Got unexpected event type: " << messageEvent.type() + << "\n"; + } +} + +void EventHandler::onSessionEvent(const bmqa::SessionEvent& sessionEvent) +// Handle the specified 'sessionEvent'. This method is executed in one of +// the *EVENT HANDLER* threads. +{ + bsl::cout << "Got session event: " << sessionEvent << "\n"; +} + +void EventHandler::setSession(bmqa::Session* session) +{ + d_session_p = session; +} + +} // close unnamed namespace + +//============================================================================= +// CONSUMER +//----------------------------------------------------------------------------- + +/// Open a queue with the specified `session`. The queue is created if it +/// does not exist already. Each queue is identified by a short URL +/// containing a namespace and a queue name. +static void consume(z_bmqa_Session* session) +{ + // bmqt::CorrelationId corrId(bmqt::CorrelationId::autoValue()); + z_bmqt_CorrelationId* corrId; + z_bmqt_CorrelationId__autoValue(&corrId); + z_bmqa_QueueId* queueId; + z_bmqa_OpenQueueStatus* status; + z_bmqa_QueueId__createFromCorrelationId(&queueId, corrId); + z_bmqa_Session__openQueueSync(session, queueId, k_QUEUE_URL, static_cast(bmqt::QueueFlags::e_READ), &status); + + if (!z_bmqa_OpenQueueStatus__toBool(status) || !z_bmqa_QueueId__isValid(queueId)) { + bsl::cerr << "Failed to open queue: '" << k_QUEUE_URL + << "', status: " << status << "\n"; + return; // RETURN + } + else { + bsl::cout << "Queue ['" << k_QUEUE_URL << "'] has been opened. " + << "Waiting for messages...\nPress Ctrl+C for shutdown\n"; + } + + bslmt::Mutex d_mx; + bslmt::Condition d_cv; + shutdownHandler = [&d_cv](int) { + d_cv.signal(); + }; + signal(SIGINT, signalHandler); + bslmt::LockGuard lock(&d_mx); + d_cv.wait(&d_mx); + + // Graceful shutdown by first synchronously shutting the flow of incoming + // messages and only then closing the queue. + // bmqt::QueueOptions options; + z_bmqt_QueueOptions* options; + z_bmqt_QueueOptions__create(&options); + z_bmqt_QueueOptions__setMaxUnconfirmedBytes(options, 0); + z_bmqt_QueueOptions__setMaxUnconfirmedMessages(options, 0); + z_bmqa_ConfigureQueueStatus* configureStatus; + z_bmqa_Session__configureQueueSync(session, queueId, options, 0, &configureStatus); + if (!z_bmqa_ConfigureQueueStatus__toBool(configureStatus)) { + // Error! Log something + bsl::cout << "Graceful shutdown of the queue failed: " + << bmqt::ConfigureQueueResult::Enum(z_bmqa_ConfigureQueueStatus__result(configureStatus)) + << " (" << configureStatus << ")\n"; + return; // RETURN + } + + // bmqa::CloseQueueStatus closeStatus = session->closeQueueSync(&queueId); + z_bmqa_CloseQueueStatus* closeStatus; + z_bmqa_Session__closeQueueSync(session, queueId, 0, &closeStatus); + if (!z_bmqa_CloseQueueStatus__toBool(closeStatus)) { + bsl::cerr << "Failed to close queue: '" << k_QUEUE_URL + << "', status: " << closeStatus << "\n"; + return; // RETURN + } + bsl::cerr << "Queue ['" << k_QUEUE_URL << "'] has been shut down " + << "gracefully and is now closed.\n"; +} + +//============================================================================= +// MAIN PROGRAM +//----------------------------------------------------------------------------- + +int main(BSLS_ANNOTATION_UNUSED int argc, + BSLS_ANNOTATION_UNUSED const char* argv[]) +{ + // Start a session with the message broker. This makes the SDK connect to + // the local broker by default, unless the 'Session' is created with an + // optional 'SessionOptions' object. + + EventHandler* eventHandler = new EventHandler(); + ManagedHandler eventHandlerMp(eventHandler); + bmqa::Session session(eventHandlerMp); + eventHandler->setSession(&session); + int rc = session.start(); + if (rc != 0) { + bsl::cerr << "Failed to start the session with the BlazingMQ broker" + << ", rc: " << bmqt::GenericResult::Enum(rc) << "\n"; + return rc; // RETURN + } + consume(&session); + session.stop(); + + return 0; +} diff --git a/src/tutorials/c_wrapper/producer.cpp b/src/tutorials/c_wrapper/producer.cpp new file mode 100644 index 000000000..99c6962a6 --- /dev/null +++ b/src/tutorials/c_wrapper/producer.cpp @@ -0,0 +1,101 @@ +#include +#include +#include +#include +#include +#include +#include + +const int K_QUEUE_ID = 1; +const char K_QUEUE_URI[] = "bmq://bmq.test.mem.priority/test-queue"; +const int K_NUM_MESSAGES = 5; + +enum QueueFlags { + e_ADMIN = (1 << 0) // The queue is opened in admin mode (Valid only + // for BlazingMQ admin tasks) + , + e_READ = (1 << 1) // The queue is opened for consuming messages + , + e_WRITE = (1 << 2) // The queue is opened for posting messages + , + e_ACK = (1 << 3) // Set to indicate interested in receiving + // 'ACK' events for all message posted +}; + + +void postEvent(const char* text, + z_bmqa_QueueId* queueId, + z_bmqa_Session* session){ + + z_bmqa_MessageEventBuilder* builder; + z_bmqa_MessageEventBuilder__create(&builder); + + z_bmqa_Session__loadMessageEventBuilder(session, &builder); + + z_bmqa_Message* message; + + z_bmqa_MessageEventBuilder__startMessage(builder, &message); + + z_bmqa_Message__setDataRef(message, text, (int)strlen(text)); + + z_bmqa_MessageEventBuilder__packMessage(builder, queueId); + + const z_bmqa_MessageEvent* messageEvent; + z_bmqa_MessageEventBuilder__messageEvent(builder, &messageEvent); + + z_bmqa_Session__post(session, messageEvent); + + z_bmqa_MessageEventBuilder__delete(&builder); +} + + +void produce(z_bmqa_Session* session){ + z_bmqa_QueueId* queueId; + z_bmqa_OpenQueueStatus* openStatus; + z_bmqa_CloseQueueStatus* closeStatus; + + + z_bmqa_QueueId__createFromNumeric(&queueId, K_QUEUE_ID); + z_bmqa_Session__openQueueSync(session, + queueId, + K_QUEUE_URI, + e_WRITE, + &openStatus); + + const char* messages[] = {"Hello world!", + "message 4", + "message 5", + "message 6", + "Good Bye!"}; + for(int idx = 0; idx < 5; ++idx){ + postEvent(messages[idx], queueId, session); + } + + z_bmqa_Session__closeQueueSync(session, queueId, 0, &closeStatus); + + z_bmqa_QueueId__delete(&queueId); +} + +int run_c_producer(){ + z_bmqa_Session* session; + z_bmqt_SessionOptions* options; + + z_bmqt_SessionOptions__create(&options); + z_bmqa_Session__create(&session, options); + + + //start the session + z_bmqa_Session__start(session, 1000); + + produce(session); + + //stop the session + z_bmqa_Session__stop(session); + + + z_bmqa_Session__delete(&session); + z_bmqt_SessionOptions__delete(&options); + + return 0; + +} From f4bc2f95cf267a04ca4c3f0f77b5f27e0c452f6c Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Tue, 23 Jan 2024 16:49:04 -0500 Subject: [PATCH 38/57] Add CMakeLists.txt for c_wrapper --- src/tutorials/c_wrapper/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/tutorials/c_wrapper/CMakeLists.txt diff --git a/src/tutorials/c_wrapper/CMakeLists.txt b/src/tutorials/c_wrapper/CMakeLists.txt new file mode 100644 index 000000000..875e43c2b --- /dev/null +++ b/src/tutorials/c_wrapper/CMakeLists.txt @@ -0,0 +1,4 @@ +# tutorial::c_wrapper +# --------------------- + +bmq_add_tutorial("c_wrapper") From 0eb49cc51c619ffa3865ee9daacd31b1c13fd667 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Wed, 24 Jan 2024 14:17:29 -0500 Subject: [PATCH 39/57] Progress(2) --- src/groups/z_bmq/z_bmqa/package/z_bmqa.mem | 2 + .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp | 10 ++ .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.h | 24 +-- .../z_bmqa/z_bmqa_configurequeuestatus.cpp | 13 ++ .../z_bmqa/z_bmqa_configurequeuestatus.h | 2 + .../z_bmqa/z_bmqa_confirmeventbuilder.cpp | 71 +++++--- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 31 ++-- src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp | 10 +- src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 2 +- .../z_bmq/z_bmqa/z_bmqa_messageevent.cpp | 59 ++++++- src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h | 14 +- .../z_bmq/z_bmqa/z_bmqa_messageiterator.cpp | 2 + .../z_bmq/z_bmqa/z_bmqa_messageiterator.h | 2 +- .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp | 10 ++ .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.h | 2 + src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 68 ++++++-- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 18 ++- .../z_bmq/z_bmqa/z_bmqa_sessionevent.cpp | 46 ++++-- src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h | 3 + src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 1 + .../z_bmqt_compressionalgorithmtype.t.cpp | 144 +++++++++++++++++ .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 145 ++++++++++++----- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 2 + .../z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp | 20 +++ .../z_bmq/z_bmqt/z_bmqt_messageeventtype.h | 47 ++++++ .../z_bmq/z_bmqt/z_bmqt_messageguid.cpp | 31 ++++ src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h | 6 + .../z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 10 ++ src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h | 87 ++++++---- .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp | 2 +- src/tutorials/c_wrapper/consumer.cpp | 151 +++++++++++++----- src/tutorials/c_wrapper/producer.cpp | 4 +- 32 files changed, 835 insertions(+), 204 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem index 89410832c..6cd84ac58 100644 --- a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem +++ b/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem @@ -5,7 +5,9 @@ z_bmqa_event z_bmqa_message z_bmqa_messageevent z_bmqa_messageeventbuilder +z_bmqa_messageiterator z_bmqa_messageproperties z_bmqa_queueid z_bmqa_session +z_bmqa_sessionevent z_bmqa_openqueuestatus \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp index e3e312f61..80e9622a7 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp @@ -1,6 +1,16 @@ #include #include +int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** status_obj) { + using namespace BloombergLP; + + bmqa::CloseQueueStatus* status_p = reinterpret_cast(*status_obj); + delete status_p; + *status_obj = NULL; + + return 0; +} + int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** status_obj) { using namespace BloombergLP; diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h index ab47930d1..21b746a5f 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h @@ -1,8 +1,8 @@ #ifndef INCLUDED_Z_BMQA_CLOSEQUEUESTATUS #define INCLUDED_Z_BMQA_CLOSEQUEUESTATUS -#include #include +#include #if defined(__cplusplus) extern "C" { @@ -10,24 +10,28 @@ extern "C" { typedef struct z_bmqa_CloseQueueStatus z_bmqa_CloseQueueStatus; +int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** status_obj); + int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** status_obj); -int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, const z_bmqa_CloseQueueStatus* other); +int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, + const z_bmqa_CloseQueueStatus* other); int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** status_obj, - const z_bmqa_QueueId* queueId, - int result, - const char* errorDescription); + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription); -bool z_bmqa_CloseQueueStatus__toBool(const z_bmqa_CloseQueueStatus* status_obj); +bool z_bmqa_CloseQueueStatus__toBool( + const z_bmqa_CloseQueueStatus* status_obj); -int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj); +int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, + z_bmqa_QueueId const** queueId_obj); int z_bmqa_CloseQueueStatus__result(const z_bmqa_CloseQueueStatus* status_obj); -const char* z_bmqa_CloseQueueStatus__errorDescription(const z_bmqa_CloseQueueStatus* status_obj); - - +const char* z_bmqa_CloseQueueStatus__errorDescription( + const z_bmqa_CloseQueueStatus* status_obj); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp index 18be79a2d..bd641359e 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp @@ -1,6 +1,19 @@ #include #include +int z_bmqa_ConfigureQueueStatus__delete( + z_bmqa_ConfigureQueueStatus** status_obj) +{ + using namespace BloombergLP; + + bmqa::ConfigureQueueStatus* status_p = + reinterpret_cast(*status_obj); + delete status_p; + *status_obj = NULL; + + return 0; +} + int z_bmqa_ConfigureQueueStatus__create( z_bmqa_ConfigureQueueStatus** status_obj) { diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h index 2c0441770..b1482043b 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h @@ -10,6 +10,8 @@ extern "C" { typedef struct z_bmqa_ConfigureQueueStatus z_bmqa_ConfigureQueueStatus; +int z_bmqa_ConfigureQueueStatus__delete(z_bmqa_ConfigureQueueStatus** status_obj); + int z_bmqa_ConfigureQueueStatus__create( z_bmqa_ConfigureQueueStatus** status_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp index bfa36f7c1..cdf3b4eec 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp @@ -1,18 +1,35 @@ -#include #include +#include +int z_bmqa_ConfirmEventBuilder__delete( + z_bmqa_ConfirmEventBuilder** builder_obj) +{ + using namespace BloombergLP; + + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(*builder_obj); + delete builder_p; + *builder_obj = NULL; + + return 0; +} -int z_bmqa_ConfirmEventBuilder__delete(z_bmqa_ConfirmEventBuilder const** builder_obj) { +int z_bmqa_ConfirmEventBuilder__deleteConst( + z_bmqa_ConfirmEventBuilder const** builder_obj) +{ using namespace BloombergLP; - const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(*builder_obj); + const bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(*builder_obj); delete builder_p; *builder_obj = NULL; return 0; } -int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj) { +int z_bmqa_ConfirmEventBuilder__create( + z_bmqa_ConfirmEventBuilder** builder_obj) +{ using namespace BloombergLP; bmqa::ConfirmEventBuilder* builder_p = new bmqa::ConfirmEventBuilder(); @@ -21,47 +38,63 @@ int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj) return 0; } -int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilder* builder_obj, - const z_bmqa_Message* message) { +int z_bmqa_ConfirmEventBuilder__addMessageConfirmation( + z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_Message* message) +{ using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); - const bmqa::Message* message_p = reinterpret_cast(message); + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder_obj); + const bmqa::Message* message_p = reinterpret_cast( + message); return builder_p->addMessageConfirmation(*message_p); } -int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie(z_bmqa_ConfirmEventBuilder* builder_obj, - const z_bmqa_MessageConfirmationCookie* cookie) { +int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie( + z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_MessageConfirmationCookie* cookie) +{ using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); - const bmqa::MessageConfirmationCookie* cookie_p = reinterpret_cast(cookie); + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder_obj); + const bmqa::MessageConfirmationCookie* cookie_p = + reinterpret_cast(cookie); return builder_p->addMessageConfirmation(*cookie_p); } -int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj) { +int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj) +{ using namespace BloombergLP; - bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder_obj); builder_p->reset(); return 0; } -int z_bmqa_ConfirmEventBuilder__messageCount(const z_bmqa_ConfirmEventBuilder* builder_obj) { +int z_bmqa_ConfirmEventBuilder__messageCount( + const z_bmqa_ConfirmEventBuilder* builder_obj) +{ using namespace BloombergLP; - const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder_obj); return builder_p->messageCount(); } -int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, z_bmqt_Blob const** blob_obj) { +int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, + z_bmqt_Blob const** blob_obj) +{ using namespace BloombergLP; - const bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder_obj); const bdlbb::Blob* blob_p = &(builder_p->blob()); - *blob_obj = reinterpret_cast(blob_p); + *blob_obj = reinterpret_cast(blob_p); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index 9b91bfffc..cc17801c6 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -1,31 +1,42 @@ #ifndef INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER #define INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER -#include #include +#include #if defined(__cplusplus) extern "C" { #endif typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; -typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; +typedef struct z_bmqa_MessageConfirmationCookie + z_bmqa_MessageConfirmationCookie; + +int z_bmqa_ConfirmEventBuilder__delete( + z_bmqa_ConfirmEventBuilder** builder_obj); -int z_bmqa_ConfirmEventBuilder__delete(z_bmqa_ConfirmEventBuilder** builder_obj); +int z_bmqa_ConfirmEventBuilder__deleteConst( + z_bmqa_ConfirmEventBuilder const** builder_obj); -int z_bmqa_ConfirmEventBuilder__create(z_bmqa_ConfirmEventBuilder** builder_obj); +int z_bmqa_ConfirmEventBuilder__create( + z_bmqa_ConfirmEventBuilder** builder_obj); -int z_bmqa_ConfirmEventBuilder__addMessageConfirmation(z_bmqa_ConfirmEventBuilder* builder_obj, - const z_bmqa_Message* message); +int z_bmqa_ConfirmEventBuilder__addMessageConfirmation( + z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_Message* message); -int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie(z_bmqa_ConfirmEventBuilder* builder_obj, - const z_bmqa_MessageConfirmationCookie* cookie); +int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie( + z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqa_MessageConfirmationCookie* cookie); int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj); -int z_bmqa_ConfirmEventBuilder__messageCount(const z_bmqa_ConfirmEventBuilder* builder_obj); +int z_bmqa_ConfirmEventBuilder__messageCount( + const z_bmqa_ConfirmEventBuilder* builder_obj); -int z_bmqa_ConfirmEventBuilder__blob(const z_bmqa_ConfirmEventBuilder* builder_obj, z_bmqt_Blob const** blob_obj); +int z_bmqa_ConfirmEventBuilder__blob( + const z_bmqa_ConfirmEventBuilder* builder_obj, + z_bmqt_Blob const** blob_obj); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp index 73d9cfcb5..3b6b47597 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -247,16 +247,16 @@ int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, char** buffer) const bmqa::Message* message_p = reinterpret_cast( message_obj); - bdlbb::Blob data; - message_p->getData(&data); + bdlbb::Blob data; + int rc = message_p->getData(&data); bsl::stringstream ss; ss << bdlbb::BlobUtilHexDumper(&data); - bsl::string data_str = ss.str(); - *buffer = new char[data_str.length()+1]; + bsl::string data_str = ss.str(); + *buffer = new char[data_str.length() + 1]; (*buffer)[data_str.length()] = '\0'; strcpy(*buffer, data_str.c_str()); - return 0; + return rc; } int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj) diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index 7b1095226..6856e31d4 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -87,7 +87,7 @@ int z_bmqa_Message__ackStatus(const z_bmqa_Message* message_obj); // int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, z_bdlbb_Blob* // blob); -int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, void** buffer); +int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, char** buffer); int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp index 2b8b1d2cd..8c48a98eb 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp @@ -1,22 +1,67 @@ -#include #include +#include +#include +#include -int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj) { +int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj) +{ using namespace BloombergLP; - bmqa::MessageEvent* event_p = reinterpret_cast(*event_obj); + bmqa::MessageEvent* event_p = reinterpret_cast( + *event_obj); delete event_p; *event_obj = NULL; return 0; } -int z_bmqa_MessageEvent__deleteConst(z_bmqa_MessageEvent const** event_obj) { +int z_bmqa_MessageEvent__create(z_bmqa_MessageEvent** event_obj) +{ using namespace BloombergLP; - const bmqa::MessageEvent* event_p = reinterpret_cast(*event_obj); - delete event_p; - *event_obj = NULL; + bmqa::MessageEvent* event_p = new bmqa::MessageEvent(); + *event_obj = reinterpret_cast(event_p); + + return 0; +} + +int z_bmqa_MessageEvent__messageIterator(const z_bmqa_MessageEvent* event_obj, + z_bmqa_MessageIterator** iterator_obj) +{ + using namespace BloombergLP; + const bmqa::MessageEvent* event_p = + reinterpret_cast(event_obj); + bmqa::MessageIterator* iterator_p = new bmqa::MessageIterator( + event_p->messageIterator()); + *iterator_obj = reinterpret_cast(iterator_p); + + return 0; +} + +z_bmqt_MessageEventType::Enum +z_bmqa_MessageEvent__type(const z_bmqa_MessageEvent* event_obj) +{ + using namespace BloombergLP; + + const bmqa::MessageEvent* event_p = + reinterpret_cast(event_obj); + return static_cast(event_p->type()); +} + +int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* event_obj, + char** out) +{ + using namespace BloombergLP; + + const bmqa::MessageEvent* event_p = + reinterpret_cast(event_obj); + bsl::ostringstream ss; + event_p->print(ss); + bsl::string out_str = ss.str(); + + *out = new char[out_str.length() + 1]; + (*out)[out_str.length()] = '\0'; + strcpy(*out, out_str.c_str()); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h index fc8ddd9a4..c4ac36a6a 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h @@ -1,6 +1,9 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEEVENT #define INCLUDED_Z_BMQA_MESSAGEEVENT +#include +#include + #if defined(__cplusplus) extern "C" { #endif @@ -9,7 +12,16 @@ typedef struct z_bmqa_MessageEvent z_bmqa_MessageEvent; int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj); -int z_bmqa_MessageEvent__deleteConst(z_bmqa_MessageEvent const** event_obj); +int z_bmqa_MessageEvent__create(z_bmqa_MessageEvent** event_obj); + +int z_bmqa_MessageEvent__messageIterator( + const z_bmqa_MessageEvent* event_obj, + z_bmqa_MessageIterator** iterator_obj); + +z_bmqt_MessageEventType::Enum z_bmqa_MessageEvent__type(const z_bmqa_MessageEvent* event_obj); + +int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* event_obj, + char** out); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp index a16d67209..abde7439f 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp @@ -48,6 +48,8 @@ int z_bmqa_MessageIterator__message( reinterpret_cast(messageIterator_obj); const z_bmqa_Message* message_p = reinterpret_cast( &messageIterator_p->message()); + + *message_obj = reinterpret_cast(message_p); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h index 6c6f6b6e2..72cbea622 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h @@ -20,7 +20,7 @@ bool z_bmqa_MessageIterator__nextMessage( z_bmqa_MessageIterator* messageIterator_obj); int z_bmqa_MessageIterator__message( - z_bmqa_MessageIterator* messageIterator_obj, + const z_bmqa_MessageIterator* messageIterator_obj, z_bmqa_Message const** message_obj); #if defined(__cplusplus) diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp index 6577aa84d..1c8cbaf3a 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp @@ -1,6 +1,16 @@ #include #include +int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj) { + using namespace BloombergLP; + + bmqa::OpenQueueStatus* status_p = reinterpret_cast(*status_obj); + delete status_p; + *status_obj = NULL; + + return 0; +} + int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) { using namespace BloombergLP; diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h index 6a75bbd84..a6b1fbb7c 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h @@ -10,6 +10,8 @@ extern "C" { typedef struct z_bmqa_OpenQueueStatus z_bmqa_OpenQueueStatus; +int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj); + int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj); int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_OpenQueueStatus* other); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 4c165a0b6..804426cbf 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -8,10 +9,19 @@ z_bmqa_CustomSessionEventHandler::z_bmqa_CustomSessionEventHandler( z_bmqa_OnSessionEventCb onSessionEventCb, - z_bmqa_OnMessageEventCb onMessageEventCb) + z_bmqa_OnMessageEventCb onMessageEventCb, + uint64_t mSize) { + this->mSize = mSize; this->onSessionEventCb = onSessionEventCb; this->onMessageEventCb = onMessageEventCb; + + if (mSize != 0) { + data = (void*)(new char[mSize]); + } + else { + data = NULL; + } } z_bmqa_CustomSessionEventHandler::~z_bmqa_CustomSessionEventHandler() @@ -55,26 +65,31 @@ void z_bmqa_CustomSessionEventHandler::tryLock() int z_bmqa_SessionEventHandler__create( z_bmqa_SessionEventHandler** eventHandler_obj, z_bmqa_OnSessionEventCb onSessionEventCb, - z_bmqa_OnMessageEventCb onMessageEventCb) + z_bmqa_OnMessageEventCb onMessageEventCb, + uint64_t dataSize) { using namespace BloombergLP; z_bmqa_CustomSessionEventHandler* eventHandler_p = new z_bmqa_CustomSessionEventHandler(onSessionEventCb, - onMessageEventCb); + onMessageEventCb, + dataSize); *eventHandler_obj = reinterpret_cast( eventHandler_p); ; return 0; } -int z_bmqa_SessionEventHandler__delete( - z_bmqa_SessionEventHandler** eventHandler_obj) +int z_bmqa_SessionEventHandler__getData( + z_bmqa_SessionEventHandler* eventHandler_obj, + void** buffer) { + using namespace BloombergLP; + z_bmqa_CustomSessionEventHandler* eventHandler_p = - reinterpret_cast(*eventHandler_obj); - delete eventHandler_p; - *eventHandler_obj = NULL; + reinterpret_cast(eventHandler_obj); + + *buffer = eventHandler_p->getData(); return 0; } @@ -192,22 +207,22 @@ int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj) } int z_bmqa_Session__loadMessageEventBuilder( - z_bmqa_Session* session_obj, - z_bmqa_MessageEventBuilder** builder) + z_bmqa_Session* session_obj, + z_bmqa_MessageEventBuilder* builder) { using namespace BloombergLP; bmqa::Session* session_p = reinterpret_cast(session_obj); bmqa::MessageEventBuilder* builder_p = - reinterpret_cast(*builder); + reinterpret_cast(builder); session_p->loadMessageEventBuilder(builder_p); return 0; } int z_bmqa_Session__loadConfirmEventBuilder( - z_bmqa_Session* session_obj, - z_bmqa_ConfirmEventBuilder** builder) + z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder* builder) { using namespace BloombergLP; @@ -312,3 +327,30 @@ int z_bmqa_Session__post(z_bmqa_Session* session_obj, session_p->post(*event_p); return 0; } + +// int z_bmqa_Session__confirmMessage(z_bmqa_Session* session_obj, +// const z_bmqa_Message* message) +// { +// using namespace BloombergLP; +// bmqa::Session* session_p = +// reinterpret_cast(session_obj); +// } + +// int z_bmqa_Session__confirmMessageWithCookie( +// z_bmqa_Session* session_obj, +// const z_bmqa_MessageConfirmationCookie* cookie) +// { +// using namespace BloombergLP; +// bmqa::Session* session_p = +// reinterpret_cast(session_obj); +// } + +int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder* builder) +{ + using namespace BloombergLP; + bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::ConfirmEventBuilder* builder_p = + reinterpret_cast(builder); + return session_p->confirmMessages(builder_p); +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 8abb39a11..5742cea1a 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -31,10 +31,11 @@ typedef void (*z_bmqa_OnMessageEventCb)( int z_bmqa_SessionEventHandler__create( z_bmqa_SessionEventHandler** eventHandler_obj, z_bmqa_OnSessionEventCb onSessionEvent, - z_bmqa_OnMessageEventCb onMessageEvent); + z_bmqa_OnMessageEventCb onMessageEvent, + uint64_t dataSize); -int z_bmqa_SessionEventHandler__delete( - z_bmqa_SessionEventHandler** eventHandler_obj); +int z_bmqa_SessionEventHandler__getData( + z_bmqa_SessionEventHandler* eventHandler_obj, void** buffer); typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; @@ -61,12 +62,12 @@ int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj); int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj); int z_bmqa_Session__loadMessageEventBuilder( - z_bmqa_Session* session_obj, - z_bmqa_MessageEventBuilder** builder); + z_bmqa_Session* session_obj, + z_bmqa_MessageEventBuilder* builder); int z_bmqa_Session__loadConfirmEventBuilder( - z_bmqa_Session* session_obj, - z_bmqa_ConfirmEventBuilder** builder); + z_bmqa_Session* session_obj, + z_bmqa_ConfirmEventBuilder* builder); int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer); @@ -138,7 +139,8 @@ class z_bmqa_CustomSessionEventHandler public: z_bmqa_CustomSessionEventHandler(z_bmqa_OnSessionEventCb onSessionEventCb, - z_bmqa_OnMessageEventCb onMessageEventCb); + z_bmqa_OnMessageEventCb onMessageEventCb, + uint64_t mSize); ~z_bmqa_CustomSessionEventHandler(); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp index a166350d3..05c58c232 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp @@ -26,6 +26,7 @@ int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** event_obj, const bmqa::SessionEvent* other_p = reinterpret_cast(other); bmqa::SessionEvent* event_p = new bmqa::SessionEvent(*other_p); + *event_obj = reinterpret_cast(event_p); return 0; } @@ -46,9 +47,13 @@ int z_bmqa_SessionEvent__correlationId( { using namespace BloombergLP; - const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(&(event_p->correlationId())); - *correlationId_obj = reinterpret_cast(correlationId_p); + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast( + &(event_p->correlationId())); + *correlationId_obj = reinterpret_cast( + correlationId_p); return 0; } @@ -57,10 +62,11 @@ int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* event_obj, z_bmqa_QueueId** queueId_obj) { using namespace BloombergLP; - - const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); bmqa::QueueId* queueId_p = new bmqa::QueueId(event_p->queueId()); - *queueId_obj = reinterpret_cast(queueId_p); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } @@ -68,8 +74,9 @@ int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* event_obj, int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* event_obj) { using namespace BloombergLP; - - const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); return event_p->statusCode(); } @@ -77,7 +84,26 @@ const char* z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* event_obj) { using namespace BloombergLP; - - const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); + + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); return event_p->errorDescription().c_str(); +} + +int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* event_obj, + char** out) +{ + using namespace BloombergLP; + + const bmqa::SessionEvent* event_p = + reinterpret_cast(event_obj); + bsl::ostringstream ss; + event_p->print(ss); + bsl::string out_str = ss.str(); + + *out = new char[out_str.length() + 1]; + (*out)[out_str.length()] = '\0'; + strcpy(*out, out_str.c_str()); + + return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h index 7f504a058..e20f0b425 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h @@ -34,6 +34,9 @@ int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* event_obj); const char* z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* event_obj); +int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* event_obj, + char** out); + #if defined(__cplusplus) } #endif diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem index d463eeaf5..6cb44e131 100644 --- a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -1,5 +1,6 @@ z_bmqt_compressionalgorithmtype z_bmqt_correlationid +z_bmqt_messageeventtype z_bmqt_messageguid z_bmqt_queueoptions z_bmqt_sessioneventtype diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp new file mode 100644 index 000000000..594d96190 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp @@ -0,0 +1,144 @@ +// Copyright 2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bmqt_compressionalgorithmtype.t.cpp +#include + +// MWC +#include + +// TEST DRIVER +#include + +// BDE +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TEST HELPERS UTILITY +// ---------------------------------------------------------------------------- +namespace { + +struct PrintTestData { + int d_line; + int d_type; + const char* d_expected; +}; + +} // close unnamed namespace + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +template +static void printEnumHelper(ARRAY (&data)[SIZE]) +{ + for (size_t idx = 0; idx < SIZE; ++idx) { + const PrintTestData& test = data[idx]; + + PVVV("Line [" << test.d_line << "]"); + + mwcu::MemOutStream out(s_allocator_p); + mwcu::MemOutStream expected(s_allocator_p); + + typedef typename ENUM_TYPE::Enum T; + + T obj = static_cast(test.d_type); + + expected << test.d_expected; + + out.setstate(bsl::ios_base::badbit); + ENUM_TYPE::print(out, obj, 0, -1); + + ASSERT_EQ(out.str(), ""); + + out.clear(); + ENUM_TYPE::print(out, obj, 0, -1); + + ASSERT_EQ(out.str(), expected.str()); + + out.reset(); + out << obj; + + ASSERT_EQ(out.str(), expected.str()); + } +} + +static void test1_enumPrint() +// ------------------------------------------------------------------------ +// ENUM LAYOUT +// +// Concerns: +// Check that enums print methods work correct +// +// Plan: +// 1. For every type of enum for which there is a corresponding stream +// operator and print method check that layout of each enum value. +// equal to expected value: +// 1.1. Check layout of stream operator +// 1.2. Check layout of print method +// 2. Check that layout for invalid value is equal to expected. +// +// Testing: +// CompressionAlgorithmType::print +// operator<<(bsl::ostream&, CompressionAlgorithmType::Enum) +// ------------------------------------------------------------------------ +{ + mwctst::TestHelper::printTestName("ENUM LAYOUT"); + + PV("Test bmqt::CompressionAlgorithmType printing"); + { + BSLMF_ASSERT(z_bmqt_CompressionAlgorithmType::k_LOWEST_SUPPORTED_TYPE == + z_bmqt_CompressionAlgorithmType::ec_NONE); + + BSLMF_ASSERT( + z_bmqt_CompressionAlgorithmType::k_HIGHEST_SUPPORTED_TYPE == + z_bmqt_CompressionAlgorithmType::ec_ZLIB); + + PrintTestData k_DATA[] = { + {L_, z_bmqt_CompressionAlgorithmType::ec_UNKNOWN, "UNKNOWN"}, + {L_, z_bmqt_CompressionAlgorithmType::ec_NONE, "NONE"}, + {L_, z_bmqt_CompressionAlgorithmType::ec_ZLIB, "ZLIB"}, + {L_, + z_bmqt_CompressionAlgorithmType::k_HIGHEST_SUPPORTED_TYPE + 1, + "(* UNKNOWN *)"}}; + + printEnumHelper(k_DATA); + } +} + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 1: test1_enumPrint(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +} diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp index 579bc2da0..dddf4fc8d 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -1,125 +1,184 @@ #include #include -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj) { +int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(); - *correlationId_obj = reinterpret_cast(correlationId_p); + bmqt::CorrelationId* correlationId_p = + reinterpret_cast(*correlationId_obj); + delete correlationId_p; + *correlationId_obj = NULL; + return 0; } -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric) { +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(numeric); - *correlationId_obj = reinterpret_cast(correlationId_p); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(); + *correlationId_obj = reinterpret_cast( + correlationId_p); return 0; } -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, void* pointer) { +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, + int64_t numeric) +{ + using namespace BloombergLP; + + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(numeric); + *correlationId_obj = reinterpret_cast( + correlationId_p); + return 0; +} + +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, + void* pointer) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(pointer); - *correlationId_obj = reinterpret_cast(correlationId_p); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(pointer); + *correlationId_obj = reinterpret_cast( + correlationId_p); return 0; } -int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); correlationId_p->makeUnset(); return 0; } -int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlationId_obj, int64_t numeric) { +int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlationId_obj, + int64_t numeric) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); correlationId_p->setNumeric(numeric); return 0; } -int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlationId_obj, void* pointer) { +int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlationId_obj, + void* pointer) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - + bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); correlationId_p->setPointer(pointer); return 0; } -int z_bmqt_CorrelationId__isUnset(const z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__isUnset( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->isUnset(); } -int z_bmqt_CorrelationId__isNumeric(const z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__isNumeric( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->isNumeric(); } -int z_bmqt_CorrelationId__isPointer(const z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__isPointer( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->isPointer(); } -int z_bmqt_CorrelationId__isSharedPtr(const z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__isSharedPtr( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->isSharedPtr(); } -int z_bmqt_CorrelationId__isAutoValue(const z_bmqt_CorrelationId* correlationId_obj) { +int z_bmqt_CorrelationId__isAutoValue( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->isAutoValue(); } -int64_t z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlationId_obj) { +int64_t +z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->theNumeric(); } -void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlationId_obj) { +void* z_bmqt_CorrelationId__thePointer( + const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); return correlationId_p->thePointer(); } -CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj) { +CorrelationId_Type +z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - - switch(correlationId_p->type()) { - case bmqt::CorrelationId::Type::e_NUMERIC: return CorrelationId_Type::ec_NUMERIC; - case bmqt::CorrelationId::Type::e_POINTER: return CorrelationId_Type::ec_POINTER; - case bmqt::CorrelationId::Type::e_SHARED_PTR: return CorrelationId_Type::ec_SHARED_PTR; - case bmqt::CorrelationId::Type::e_AUTO_VALUE: return CorrelationId_Type::ec_AUTO_VALUE; - case bmqt::CorrelationId::Type::e_UNSET: return CorrelationId_Type::ec_UNSET; - default: break; + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); + + switch (correlationId_p->type()) { + case bmqt::CorrelationId::Type::e_NUMERIC: + return CorrelationId_Type::ec_NUMERIC; + case bmqt::CorrelationId::Type::e_POINTER: + return CorrelationId_Type::ec_POINTER; + case bmqt::CorrelationId::Type::e_SHARED_PTR: + return CorrelationId_Type::ec_SHARED_PTR; + case bmqt::CorrelationId::Type::e_AUTO_VALUE: + return CorrelationId_Type::ec_AUTO_VALUE; + case bmqt::CorrelationId::Type::e_UNSET: + return CorrelationId_Type::ec_UNSET; + default: break; } return CorrelationId_Type::ec_CORRELATIONID_ERROR; } -int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj) { +int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj) +{ using namespace BloombergLP; - bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(bmqt::CorrelationId::autoValue()); - *correlationId_obj = reinterpret_cast(correlationId_p); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId( + bmqt::CorrelationId::autoValue()); + *correlationId_obj = reinterpret_cast( + correlationId_p); return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h index 1b306a17c..c123d3ff2 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -25,6 +25,8 @@ enum CorrelationId_Type { ec_CORRELATIONID_ERROR // error }; +int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj); + int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); int z_bmqt_CorrelationId__createFromNumeric(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric); diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp new file mode 100644 index 000000000..8c658ed48 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp @@ -0,0 +1,20 @@ +#include +#include + +const char* +z_bmqt_MessageEventType::toAscii(z_bmqt_MessageEventType::Enum value) +{ + using namespace BloombergLP; + + return bmqt::MessageEventType::toAscii( + static_cast(value)); +} + +bool z_bmqt_MessageEventType::fromAscii(z_bmqt_MessageEventType::Enum* out, const char* str) +{ + using namespace BloombergLP; + bmqt::MessageEventType::Enum p; + bool result = bmqt::MessageEventType::fromAscii(&p, str); + *out = static_cast(p); + return result; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h new file mode 100644 index 000000000..0a608d642 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h @@ -0,0 +1,47 @@ +#ifndef INCLUDED_Z_BMQA_z_bmqt_MESSAGEEVENTTYPE +#define INCLUDED_Z_BMQA_MESSAGEEVENTTYPE + +#if defined(__cplusplus) +extern "C" { +#endif + +struct z_bmqt_MessageEventType { + // TYPES + enum Enum { ec_UNDEFINED = 0, ec_PUT = 1, ec_PUSH = 2, ec_ACK = 3 }; + + // PUBLIC CONSTANTS + + /// NOTE: This value must always be equal to the lowest type in the + /// enum because it is being used as a lower bound to verify that an + /// z_bmqt_MessageEventType field is a supported type. + static const int k_LOWEST_SUPPORTED_EVENT_TYPE = ec_PUT; + + /// NOTE: This value must always be equal to the highest type in the + /// enum because it is being used as an upper bound to verify an + /// z_bmqt_MessageEventType field is a supported type. + static const int k_HIGHEST_SUPPORTED_EVENT_TYPE = ec_ACK; + + // CLASS METHODS + /// Return the non-modifiable string representation corresponding to the + /// specified enumeration `value`, if it exists, and a unique (error) + /// string otherwise. The string representation of `value` matches its + /// corresponding enumerator name with the `BMQT_` prefix elided. Note + /// that specifying a `value` that does not match any of the enumerators + /// will result in a string representation that is distinct from any of + /// those corresponding to the enumerators, but is otherwise + /// unspecified. + static const char* toAscii(z_bmqt_MessageEventType::Enum value); + + /// Return true and fills the specified `out` with the enum value + /// corresponding to the specified `str`, if valid, or return false and + /// leave `out` untouched if `str` doesn't correspond to any value of + /// the enum. + static bool fromAscii(z_bmqt_MessageEventType::Enum* out, + const char* str); +}; + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp index 61d0fcd2a..6f1bb340e 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj) @@ -13,6 +15,18 @@ int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj) return 0; } +int z_bmqt_MessageGUID__deleteConst(z_bmqt_MessageGUID const** messageGUID_obj) +{ + using namespace BloombergLP; + + const bmqt::MessageGUID* messageGUID_p = + reinterpret_cast(*messageGUID_obj); + delete messageGUID_p; + *messageGUID_obj = NULL; + + return 0; +} + int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj) { using namespace BloombergLP; @@ -20,5 +34,22 @@ int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj) bmqt::MessageGUID* messageGUID_p = new bmqt::MessageGUID(); *messageGUID_obj = reinterpret_cast(messageGUID_p); + return 0; +} + +int z_bmqt_MessageGUID__toString(const z_bmqt_MessageGUID* messageGUID_obj, + char** out) +{ + using namespace BloombergLP; + + bsl::ostringstream ss; + const bmqt::MessageGUID* messageGUID_p = + reinterpret_cast(messageGUID_obj); + messageGUID_p->print(ss); + bsl::string out_str = ss.str(); + *out = new char[out_str.length() + 1]; + (*out)[out_str.length()] = '\0'; + strcpy(*out, out_str.c_str()); + return 0; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h index 874293894..9f845ac79 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h @@ -5,6 +5,12 @@ typedef struct z_bmqt_MessageGUID z_bmqt_MessageGUID; int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj); +int z_bmqt_MessageGUID__deleteConst( + z_bmqt_MessageGUID const** messageGUID_obj); + int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj); +int z_bmqt_MessageGUID__toString(const z_bmqt_MessageGUID* messageGUID_obj, + char** out); + #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp index d03311cd6..d275357b4 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -4,6 +4,16 @@ #include #include +int z_bmqt_QueueOptions__delete(z_bmqt_QueueOptions** queueOptions_obj) { + using namespace BloombergLP; + + bmqt::QueueOptions* queueOptions_p = reinterpret_cast(*queueOptions_obj); + delete queueOptions_p; + *queueOptions_obj = NULL; + + return 0; +} + int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj) { using namespace BloombergLP; bmqt::QueueOptions* queueOptions_p = new bmqt::QueueOptions; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h index 997e9624e..3708a1d05 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -2,8 +2,8 @@ #define INCLUDED_Z_BMQT_QUEUEOPTIONS #include -#include #include +#include #if defined(__cplusplus) extern "C" { @@ -13,60 +13,89 @@ typedef struct z_bmqt_QueueOptions z_bmqt_QueueOptions; typedef struct z_bmqt_HandleAndSubscrption { z_bmqt_SubscriptionHandle* handle; - z_bmqt_Subscription* subscrption; + z_bmqt_Subscription* subscrption; } z_bmqt_HandleAndSubscrption; typedef struct z_bmqt_SubscrptionsSnapshot { - uint64_t size; + uint64_t size; z_bmqt_HandleAndSubscrption* subscriptions; } z_bmqt_SubscrptionsSnapshot; -int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj); - -int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other); - +int z_bmqt_QueueOptions__delete(z_bmqt_QueueOptions** queueOptions_obj); -//Modifiers -int z_bmqt_QueueOptions__setMaxUnconfirmedMessages(z_bmqt_QueueOptions* queueOptions_obj, int value); +int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj); -int z_bmqt_QueueOptions__setMaxUnconfirmedBytes(z_bmqt_QueueOptions* queueOptions_obj, int value); +int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, + const z_bmqt_QueueOptions* other); -int z_bmqt_QueueOptions__setConsumerPriority(z_bmqt_QueueOptions* queueOptions_obj, int value); +// Modifiers +int z_bmqt_QueueOptions__setMaxUnconfirmedMessages( + z_bmqt_QueueOptions* queueOptions_obj, + int value); -int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOptions_obj, int value); +int z_bmqt_QueueOptions__setMaxUnconfirmedBytes( + z_bmqt_QueueOptions* queueOptions_obj, + int value); -int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other); +int z_bmqt_QueueOptions__setConsumerPriority( + z_bmqt_QueueOptions* queueOptions_obj, + int value); -//Pass in an an uninitialized char** for errorDescription, the pointer will be set to NULL if there is no error, otherwise it will set to an appropriately sized string that is allocated on the heap -int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj, char** errorDescription, const z_bmqt_SubscriptionHandle* handle, const z_bmqt_Subscription* subscription); +int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth( + z_bmqt_QueueOptions* queueOptions_obj, + int value); -int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_SubscriptionHandle* handle); +int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, + const z_bmqt_QueueOptions* other); -int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj); +// Pass in an an uninitialized char** for errorDescription, the pointer will be +// set to NULL if there is no error, otherwise it will set to an appropriately +// sized string that is allocated on the heap +int z_bmqt_QueueOptions__addOrUpdateSubscription( + z_bmqt_QueueOptions* queueOptions_obj, + char** errorDescription, + const z_bmqt_SubscriptionHandle* handle, + const z_bmqt_Subscription* subscription); -//Accessors -int z_bmqt_QueueOptions__maxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__removeSubscription( + z_bmqt_QueueOptions* queueOptions_obj, + const z_bmqt_SubscriptionHandle* handle); -int z_bmqt_QueueOptions__maxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__removeAllSubscriptions( + z_bmqt_QueueOptions* queueOptions_obj); -int z_bmqt_QueueOptions__consumerPriority(const z_bmqt_QueueOptions* queueOptions_obj); +// Accessors +int z_bmqt_QueueOptions__maxUnconfirmedMessages( + const z_bmqt_QueueOptions* queueOptions_obj); -bool z_bmqt_QueueOptions__suspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__maxUnconfirmedBytes( + const z_bmqt_QueueOptions* queueOptions_obj); +int z_bmqt_QueueOptions__consumerPriority( + const z_bmqt_QueueOptions* queueOptions_obj); -bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__suspendsOnBadHostHealth( + const z_bmqt_QueueOptions* queueOptions_obj); -bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages( + const z_bmqt_QueueOptions* queueOptions_obj); -bool z_bmqt_QueueOptions__hasConsumerPriority(const z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes( + const z_bmqt_QueueOptions* queueOptions_obj); -bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__hasConsumerPriority( + const z_bmqt_QueueOptions* queueOptions_obj); +bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth( + const z_bmqt_QueueOptions* queueOptions_obj); -//Experimental (Modifiers) -bool z_bmqt_QueueOptions__loadSubscription(const z_bmqt_QueueOptions* queueOptions_obj); +// Experimental (Modifiers) +bool z_bmqt_QueueOptions__loadSubscription( + const z_bmqt_QueueOptions* queueOptions_obj); -int z_bmqt_QueueOptions__loadSubscriptions(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_SubscrptionsSnapshot* snapshot); +int z_bmqt_QueueOptions__loadSubscriptions( + const z_bmqt_QueueOptions* queueOptions_obj, + z_bmqt_SubscrptionsSnapshot* snapshot); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp index fca2218f9..b99e51a99 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp @@ -10,7 +10,7 @@ z_bmqt_SessionEventType::toAscii(z_bmqt_SessionEventType::Enum value) return bmqt::SessionEventType::toAscii(static_cast(value)); } -bool fromAscii(z_bmqt_SessionEventType::Enum* out, const char* str) +bool z_bmqt_SessionEventType::fromAscii(z_bmqt_SessionEventType::Enum* out, const char* str) { using namespace BloombergLP; bmqt::SessionEventType::Enum p; diff --git a/src/tutorials/c_wrapper/consumer.cpp b/src/tutorials/c_wrapper/consumer.cpp index 503903788..c4ff8b14d 100644 --- a/src/tutorials/c_wrapper/consumer.cpp +++ b/src/tutorials/c_wrapper/consumer.cpp @@ -58,11 +58,12 @@ #include #include -#include -#include +#include #include -#include #include +#include +#include +#include // SYSTEM #include @@ -107,68 +108,95 @@ void signalHandler(int signal) // void setSession(bmqa::Session* session); // }; -void onMessageEvent(const z_bmqa_MessageEvent* messageEvent) +void onMessageEvent(const z_bmqa_MessageEvent* messageEvent, void* data) // Handle the specified 'messageEvent' { // Load a ConfirmEventBuilder from the session - bmqa::ConfirmEventBuilder confirmBuilder; - d_session_p->loadConfirmEventBuilder(&confirmBuilder); - - if (messageEvent.type() == bmqt::MessageEventType::e_PUSH) { - bmqa::MessageIterator msgIter = messageEvent.messageIterator(); - while (msgIter.nextMessage()) { - const bmqa::Message& msg = msgIter.message(); - bdlbb::Blob data; - int rc = msg.getData(&data); + z_bmqa_Session* session = *(static_cast(data)); + z_bmqa_ConfirmEventBuilder* confirmBuilder; + z_bmqa_ConfirmEventBuilder__create(&confirmBuilder); + + z_bmqa_Session__loadConfirmEventBuilder(session, confirmBuilder); + if (z_bmqa_MessageEvent__type(messageEvent) == + z_bmqt_MessageEventType::ec_PUSH) { + z_bmqa_MessageIterator* msgIter; + z_bmqa_MessageEvent__messageIterator(messageEvent, &msgIter); + while (z_bmqa_MessageIterator__nextMessage(msgIter)) { + const z_bmqa_Message* msg; + z_bmqa_MessageIterator__message(msgIter, &msg); + char* data; + int rc = z_bmqa_Message__getData(msg, &data); + + const z_bmqt_MessageGUID* messageGUID; + z_bmqa_Message__messageGUID(msg, &messageGUID); + char* messageGUID_str; + z_bmqt_MessageGUID__toString(messageGUID, &messageGUID_str); if (rc == 0) { - bsl::cout << "Got message with GUID: " << msg.messageGUID() - << ", data:\n" - << bdlbb::BlobUtilHexDumper(&data) << "\n"; + bsl::cout << "Got message with GUID: " + << bsl::string(messageGUID_str) << ", data:\n" + << bsl::string(data) << "\n"; } else { bsl::cerr << "Failed to decode message with GUID: " - << msg.messageGUID() << ", rc: " << rc << "\n"; + << bsl::string(messageGUID_str) << ", rc: " << rc + << "\n"; } - rc = confirmBuilder.addMessageConfirmation(msg); + rc = z_bmqa_ConfirmEventBuilder__addMessageConfirmation( + confirmBuilder, + msg); if (rc != 0) { bsl::cerr << "Failed to add confirm message with GUID: " - << msg.messageGUID() << " to the builder, rc: " << rc - << "\n"; + << bsl::string(messageGUID_str) + << " to the builder, rc: " << rc << "\n"; } + + delete[] messageGUID_str; } + // z_bmqa_MessageIterator__delete(&msgIter); + // Confirm reception of the messages so that it can be deleted from the // queue. - int rc = d_session_p->confirmMessages(&confirmBuilder); + // int rc = d_session_p->confirmMessages(&confirmBuilder); + int rc = z_bmqa_Session__confirmMessages(session, confirmBuilder); if (rc != 0) { - bsl::cerr << "Failed to confirm " << confirmBuilder.messageCount() + bsl::cerr << "Failed to confirm " + << z_bmqa_ConfirmEventBuilder__messageCount( + confirmBuilder) << " messages" << ", rc: " << rc; // Since 'Session::confirmMessages' failed, it would not have reset // the 'builder'. So we reset it here. - confirmBuilder.reset(); + z_bmqa_ConfirmEventBuilder__reset(confirmBuilder); } } else { - bsl::cerr << "Got unexpected event type: " << messageEvent.type() + const char* eventType = z_bmqt_MessageEventType::toAscii( + z_bmqa_MessageEvent__type(messageEvent)); + bsl::cerr << "Got unexpected event type: " << bsl::string(eventType) << "\n"; } + + z_bmqa_ConfirmEventBuilder__delete(&confirmBuilder); } -void EventHandler::onSessionEvent(const bmqa::SessionEvent& sessionEvent) +void onSessionEvent(const z_bmqa_SessionEvent* sessionEvent, void* data) // Handle the specified 'sessionEvent'. This method is executed in one of // the *EVENT HANDLER* threads. { - bsl::cout << "Got session event: " << sessionEvent << "\n"; + char* out; + z_bmqa_SessionEvent__toString(sessionEvent, &out); + bsl::cout << "Got session event: " << bsl::string(out) << "\n"; } -void EventHandler::setSession(bmqa::Session* session) +void setSession(void* data_p, z_bmqa_Session* session) { - d_session_p = session; + z_bmqa_Session** session_p = static_cast(data_p); + *session_p = session; } } // close unnamed namespace @@ -185,14 +213,20 @@ static void consume(z_bmqa_Session* session) // bmqt::CorrelationId corrId(bmqt::CorrelationId::autoValue()); z_bmqt_CorrelationId* corrId; z_bmqt_CorrelationId__autoValue(&corrId); - z_bmqa_QueueId* queueId; - z_bmqa_OpenQueueStatus* status; + z_bmqa_QueueId* queueId; + z_bmqa_OpenQueueStatus* openStatus; z_bmqa_QueueId__createFromCorrelationId(&queueId, corrId); - z_bmqa_Session__openQueueSync(session, queueId, k_QUEUE_URL, static_cast(bmqt::QueueFlags::e_READ), &status); - - if (!z_bmqa_OpenQueueStatus__toBool(status) || !z_bmqa_QueueId__isValid(queueId)) { + z_bmqa_Session__openQueueSync( + session, + queueId, + k_QUEUE_URL, + static_cast(bmqt::QueueFlags::e_READ), + &openStatus); + + if (!z_bmqa_OpenQueueStatus__toBool(openStatus) || + !z_bmqa_QueueId__isValid(queueId)) { bsl::cerr << "Failed to open queue: '" << k_QUEUE_URL - << "', status: " << status << "\n"; + << "', status: " << openStatus << "\n"; return; // RETURN } else { @@ -217,11 +251,16 @@ static void consume(z_bmqa_Session* session) z_bmqt_QueueOptions__setMaxUnconfirmedBytes(options, 0); z_bmqt_QueueOptions__setMaxUnconfirmedMessages(options, 0); z_bmqa_ConfigureQueueStatus* configureStatus; - z_bmqa_Session__configureQueueSync(session, queueId, options, 0, &configureStatus); + z_bmqa_Session__configureQueueSync(session, + queueId, + options, + 0, + &configureStatus); if (!z_bmqa_ConfigureQueueStatus__toBool(configureStatus)) { // Error! Log something bsl::cout << "Graceful shutdown of the queue failed: " - << bmqt::ConfigureQueueResult::Enum(z_bmqa_ConfigureQueueStatus__result(configureStatus)) + << bmqt::ConfigureQueueResult::Enum( + z_bmqa_ConfigureQueueStatus__result(configureStatus)) << " (" << configureStatus << ")\n"; return; // RETURN } @@ -236,6 +275,13 @@ static void consume(z_bmqa_Session* session) } bsl::cerr << "Queue ['" << k_QUEUE_URL << "'] has been shut down " << "gracefully and is now closed.\n"; + + z_bmqa_QueueId__delete(&queueId); + z_bmqt_QueueOptions__delete(&options); + z_bmqa_OpenQueueStatus__delete(&openStatus); + z_bmqa_ConfigureQueueStatus__delete(&configureStatus); + z_bmqa_CloseQueueStatus__delete(&closeStatus); + z_bmqt_CorrelationId__delete(&corrId); } //============================================================================= @@ -249,18 +295,35 @@ int main(BSLS_ANNOTATION_UNUSED int argc, // the local broker by default, unless the 'Session' is created with an // optional 'SessionOptions' object. - EventHandler* eventHandler = new EventHandler(); - ManagedHandler eventHandlerMp(eventHandler); - bmqa::Session session(eventHandlerMp); - eventHandler->setSession(&session); - int rc = session.start(); + // EventHandler* eventHandler = new EventHandler(); + // ManagedHandler eventHandlerMp(eventHandler); + // bmqa::Session session(eventHandlerMp); + z_bmqa_Session* session; + z_bmqa_SessionEventHandler* eventHandler; + z_bmqa_SessionEventHandler__create(&eventHandler, + onSessionEvent, + onMessageEvent, + sizeof(z_bmqa_Session*)); + z_bmqa_Session__createAsync(&session, eventHandler, NULL); + void* eventHandlerData; + z_bmqa_SessionEventHandler__getData(eventHandler, &eventHandlerData); + setSession(eventHandlerData, session); + if (*((z_bmqa_Session**)eventHandlerData) != session) { + bsl::cout << "Session not set!\n"; + return 1; + } + int rc = z_bmqa_Session__start((z_bmqa_Session*)(session), 0); if (rc != 0) { bsl::cerr << "Failed to start the session with the BlazingMQ broker" << ", rc: " << bmqt::GenericResult::Enum(rc) << "\n"; return rc; // RETURN } - consume(&session); - session.stop(); + + consume(session); + z_bmqa_Session__stop(session); + + // Calling z_bmqa_Session__delete also deletes the event handler + z_bmqa_Session__delete(&session); return 0; -} +} \ No newline at end of file diff --git a/src/tutorials/c_wrapper/producer.cpp b/src/tutorials/c_wrapper/producer.cpp index 99c6962a6..e70ef29c9 100644 --- a/src/tutorials/c_wrapper/producer.cpp +++ b/src/tutorials/c_wrapper/producer.cpp @@ -30,7 +30,7 @@ void postEvent(const char* text, z_bmqa_MessageEventBuilder* builder; z_bmqa_MessageEventBuilder__create(&builder); - z_bmqa_Session__loadMessageEventBuilder(session, &builder); + z_bmqa_Session__loadMessageEventBuilder(session, builder); z_bmqa_Message* message; @@ -76,7 +76,7 @@ void produce(z_bmqa_Session* session){ z_bmqa_QueueId__delete(&queueId); } -int run_c_producer(){ +int main(){ z_bmqa_Session* session; z_bmqt_SessionOptions* options; From 51011161047056df9c3bb05247257ff925873757 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Thu, 25 Jan 2024 14:15:22 -0500 Subject: [PATCH 40/57] Added a way use member functions with a SessionEventHandler --- src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp | 25 ++++++---- src/groups/z_bmq/z_bmqa/z_bmqa_session.h | 18 ++++--- .../z_bmq/z_bmqa/z_bmqa_sessionevent.cpp | 2 +- .../z_bmq/z_bmqt/z_bmqt_messageguid.cpp | 2 +- src/tutorials/c_wrapper/consumer.cpp | 49 ++++++------------- 5 files changed, 43 insertions(+), 53 deletions(-) diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp index 804426cbf..4dea8d48a 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -17,7 +17,7 @@ z_bmqa_CustomSessionEventHandler::z_bmqa_CustomSessionEventHandler( this->onMessageEventCb = onMessageEventCb; if (mSize != 0) { - data = (void*)(new char[mSize]); + data = static_cast(new char[mSize]); } else { data = NULL; @@ -27,7 +27,7 @@ z_bmqa_CustomSessionEventHandler::z_bmqa_CustomSessionEventHandler( z_bmqa_CustomSessionEventHandler::~z_bmqa_CustomSessionEventHandler() { if (data != NULL) { - delete[] (char*)data; + delete[] static_cast(data); } } @@ -47,6 +47,13 @@ void z_bmqa_CustomSessionEventHandler::onMessageEvent( this->onMessageEventCb(messageEvent_p, this->data); } +void z_bmqa_CustomSessionEventHandler::callCustomFunction( + z_bmqa_SessionEventHandlerMemberFunction function, + void* args) +{ + function(args, this->data); +} + void z_bmqa_CustomSessionEventHandler::lock() { this->mutex.lock(); @@ -76,20 +83,18 @@ int z_bmqa_SessionEventHandler__create( dataSize); *eventHandler_obj = reinterpret_cast( eventHandler_p); - ; + return 0; } -int z_bmqa_SessionEventHandler__getData( - z_bmqa_SessionEventHandler* eventHandler_obj, - void** buffer) +int z_bmqa_SessionEventHandler__callCustomFunction( + z_bmqa_SessionEventHandler* eventHandler_obj, + z_bmqa_SessionEventHandlerMemberFunction cb, + void* args) { - using namespace BloombergLP; - z_bmqa_CustomSessionEventHandler* eventHandler_p = reinterpret_cast(eventHandler_obj); - - *buffer = eventHandler_p->getData(); + eventHandler_p->callCustomFunction(cb, args); return 0; } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h index 5742cea1a..3a9867a8d 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.h @@ -27,18 +27,19 @@ typedef void (*z_bmqa_OnSessionEventCb)( typedef void (*z_bmqa_OnMessageEventCb)( const z_bmqa_MessageEvent* messageEvent, void* data); +typedef void (*z_bmqa_SessionEventHandlerMemberFunction)(void* args, + void* data); int z_bmqa_SessionEventHandler__create( z_bmqa_SessionEventHandler** eventHandler_obj, z_bmqa_OnSessionEventCb onSessionEvent, z_bmqa_OnMessageEventCb onMessageEvent, - uint64_t dataSize); + uint64_t dataSize); -int z_bmqa_SessionEventHandler__getData( - z_bmqa_SessionEventHandler* eventHandler_obj, void** buffer); - -typedef struct z_bmqa_MessageConfirmationCookie - z_bmqa_MessageConfirmationCookie; +int z_bmqa_SessionEventHandler__callCustomFunction( + z_bmqa_SessionEventHandler* eventHandler_obj, + z_bmqa_SessionEventHandlerMemberFunction cb, + void* args); typedef struct z_bmqa_Session z_bmqa_Session; @@ -148,7 +149,8 @@ class z_bmqa_CustomSessionEventHandler void onMessageEvent(const BloombergLP::bmqa::MessageEvent& messageEvent); - void* getData() { return this->data; } + void callCustomFunction(z_bmqa_SessionEventHandlerMemberFunction function, + void* args); void lock(); @@ -158,4 +160,4 @@ class z_bmqa_CustomSessionEventHandler }; #endif -#endif +#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp index 05c58c232..262270a54 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp @@ -98,7 +98,7 @@ int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* event_obj, const bmqa::SessionEvent* event_p = reinterpret_cast(event_obj); bsl::ostringstream ss; - event_p->print(ss); + ss << *event_p; bsl::string out_str = ss.str(); *out = new char[out_str.length() + 1]; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp index 6f1bb340e..e52633cc5 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp @@ -45,7 +45,7 @@ int z_bmqt_MessageGUID__toString(const z_bmqt_MessageGUID* messageGUID_obj, bsl::ostringstream ss; const bmqt::MessageGUID* messageGUID_p = reinterpret_cast(messageGUID_obj); - messageGUID_p->print(ss); + ss << *messageGUID_p; bsl::string out_str = ss.str(); *out = new char[out_str.length() + 1]; (*out)[out_str.length()] = '\0'; diff --git a/src/tutorials/c_wrapper/consumer.cpp b/src/tutorials/c_wrapper/consumer.cpp index c4ff8b14d..78e12eece 100644 --- a/src/tutorials/c_wrapper/consumer.cpp +++ b/src/tutorials/c_wrapper/consumer.cpp @@ -86,27 +86,9 @@ void signalHandler(int signal) shutdownHandler(signal); } -// CLASSES - -/// Concrete implementation of an event handler. Note that the methods are -/// called on the session's own threads. -// class EventHandler : public bmqa::SessionEventHandler { -// private: -// // DATA -// bmqa::Session* d_session_p; // Pointer to session (held, not owned) - -// public: -// // MANIPULATORS -// void onMessageEvent(const bmqa::MessageEvent& messageEvent) -// BSLS_KEYWORD_OVERRIDE; -// // Process the specified 'messageEvent' received from the broker. - -// void onSessionEvent(const bmqa::SessionEvent& sessionEvent) -// BSLS_KEYWORD_OVERRIDE; -// // Process the specified 'sessionEvent' received from the broker. - -// void setSession(bmqa::Session* session); -// }; +typedef struct SetSessionArgs { + z_bmqa_Session* session; +} SetSessionArgs; void onMessageEvent(const z_bmqa_MessageEvent* messageEvent, void* data) // Handle the specified 'messageEvent' @@ -117,6 +99,7 @@ void onMessageEvent(const z_bmqa_MessageEvent* messageEvent, void* data) z_bmqa_ConfirmEventBuilder__create(&confirmBuilder); z_bmqa_Session__loadConfirmEventBuilder(session, confirmBuilder); + if (z_bmqa_MessageEvent__type(messageEvent) == z_bmqt_MessageEventType::ec_PUSH) { z_bmqa_MessageIterator* msgIter; @@ -154,8 +137,6 @@ void onMessageEvent(const z_bmqa_MessageEvent* messageEvent, void* data) delete[] messageGUID_str; } - // z_bmqa_MessageIterator__delete(&msgIter); - // Confirm reception of the messages so that it can be deleted from the // queue. @@ -191,12 +172,14 @@ void onSessionEvent(const z_bmqa_SessionEvent* sessionEvent, void* data) char* out; z_bmqa_SessionEvent__toString(sessionEvent, &out); bsl::cout << "Got session event: " << bsl::string(out) << "\n"; + delete [] out; } -void setSession(void* data_p, z_bmqa_Session* session) +void setSession(void* args, void* eventHandlerData) { - z_bmqa_Session** session_p = static_cast(data_p); - *session_p = session; + SetSessionArgs* args_p = static_cast(args); + z_bmqa_Session** session_p = static_cast(eventHandlerData); + *session_p = args_p->session; } } // close unnamed namespace @@ -276,6 +259,8 @@ static void consume(z_bmqa_Session* session) bsl::cerr << "Queue ['" << k_QUEUE_URL << "'] has been shut down " << "gracefully and is now closed.\n"; + + // Must delete all objects z_bmqa_QueueId__delete(&queueId); z_bmqt_QueueOptions__delete(&options); z_bmqa_OpenQueueStatus__delete(&openStatus); @@ -305,13 +290,11 @@ int main(BSLS_ANNOTATION_UNUSED int argc, onMessageEvent, sizeof(z_bmqa_Session*)); z_bmqa_Session__createAsync(&session, eventHandler, NULL); - void* eventHandlerData; - z_bmqa_SessionEventHandler__getData(eventHandler, &eventHandlerData); - setSession(eventHandlerData, session); - if (*((z_bmqa_Session**)eventHandlerData) != session) { - bsl::cout << "Session not set!\n"; - return 1; - } + + SetSessionArgs setSessionArgs; + setSessionArgs.session = session; + z_bmqa_SessionEventHandler__callCustomFunction(eventHandler, setSession, &setSessionArgs); + int rc = z_bmqa_Session__start((z_bmqa_Session*)(session), 0); if (rc != 0) { bsl::cerr << "Failed to start the session with the BlazingMQ broker" From c2e3856d16b5b6728192b4ed3cfa8b953f011d01 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Thu, 25 Jan 2024 14:47:25 -0500 Subject: [PATCH 41/57] Removed unused imports from consumer.cpp and added queueflags --- src/groups/z_bmq/z_bmqt/package/z_bmqt.mem | 1 + src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp | 19 ++++++ src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h | 60 +++++++++++++++++++ src/tutorials/c_wrapper/consumer.cpp | 34 +---------- 4 files changed, 82 insertions(+), 32 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem index 6cb44e131..7276c1d7e 100644 --- a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem @@ -2,6 +2,7 @@ z_bmqt_compressionalgorithmtype z_bmqt_correlationid z_bmqt_messageeventtype z_bmqt_messageguid +z_bmqt_queueflags z_bmqt_queueoptions z_bmqt_sessioneventtype z_bmqt_sessionoptions diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp new file mode 100644 index 000000000..92a45a772 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp @@ -0,0 +1,19 @@ +#include +#include + +const char* z_bmqt_QueueFlags::toAscii(z_bmqt_QueueFlags::Enum value) +{ + using namespace BloombergLP; + + return bmqt::QueueFlags::toAscii(static_cast(value)); +} + +bool z_bmqt_QueueFlags::fromAscii(z_bmqt_QueueFlags::Enum* out, + const char* str) +{ + using namespace BloombergLP; + bmqt::QueueFlags::Enum p; + bool result = bmqt::QueueFlags::fromAscii(&p, str); + *out = static_cast(p); + return result; +} \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h new file mode 100644 index 000000000..b3dfad319 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h @@ -0,0 +1,60 @@ +#ifndef INCLUDED_Z_BMQT_z_bmqt_QUEUEFLAGS +#define INCLUDED_Z_BMQT_z_bmqt_QUEUEFLAGS + +#if defined(__cplusplus) +extern "C" { +#endif + +#include + +/// This enum represents queue flags +struct z_bmqt_QueueFlags { + // TYPES + enum Enum { + ec_ADMIN = (1 << 0) // The queue is opened in admin mode (Valid only + // for BlazingMQ admin tasks) + , + ec_READ = (1 << 1) // The queue is opened for consuming messages + , + ec_WRITE = (1 << 2) // The queue is opened for posting messages + , + ec_ACK = (1 << 3) // Set to indicate interested in receiving + // 'ACK' events for all message posted + }; + + // PUBLIC CONSTANTS + + /// NOTE: This value must always be equal to the lowest type in the + /// enum because it is being used as a lower bound to verify that a + /// z_bmqt_QueueFlags field is a supported type. + static const int k_LOWEST_SUPPORTED_QUEUEc_FLAG = ec_ADMIN; + + /// NOTE: This value must always be equal to the highest *supported* + /// type in the enum because it is being used to verify a z_bmqt_QueueFlags + /// field is a supported type. + static const int k_HIGHEST_SUPPORTED_QUEUEc_FLAG = ec_ACK; + + // CLASS METHODS + + /// Return the non-modifiable string representation corresponding to the + /// specified enumeration `value`, if it exists, and a unique (error) + /// string otherwise. The string representation of `value` matches its + /// corresponding enumerator name with the `ec_` prefix elided. Note + /// that specifying a `value` that does not match any of the enumerators + /// will result in a string representation that is distinct from any of + /// those corresponding to the enumerators, but is otherwise + /// unspecified. + static const char* toAscii(z_bmqt_QueueFlags::Enum value); + + /// Return true and fills the specified `out` with the enum value + /// corresponding to the specified `str`, if valid, or return false and + /// leave `out` untouched if `str` doesn't correspond to any value of + /// the enum. + static bool fromAscii(z_bmqt_QueueFlags::Enum* out, const char* str); +}; + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/tutorials/c_wrapper/consumer.cpp b/src/tutorials/c_wrapper/consumer.cpp index 78e12eece..310a5e568 100644 --- a/src/tutorials/c_wrapper/consumer.cpp +++ b/src/tutorials/c_wrapper/consumer.cpp @@ -28,29 +28,8 @@ // of the tasks may be down without impacting the other, and the Consumer can // process messages at a different pace than the Producer. -// BMQ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - // BDE -#include -#include #include -#include -#include #include #include #include @@ -61,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -70,10 +50,6 @@ using namespace BloombergLP; -namespace { -// TYPES -using ManagedHandler = bslma::ManagedPtr; - // CONSTANTS const char k_QUEUE_URL[] = "bmq://bmq.test.mem.priority/test-queue"; @@ -182,8 +158,6 @@ void setSession(void* args, void* eventHandlerData) *session_p = args_p->session; } -} // close unnamed namespace - //============================================================================= // CONSUMER //----------------------------------------------------------------------------- @@ -203,7 +177,7 @@ static void consume(z_bmqa_Session* session) session, queueId, k_QUEUE_URL, - static_cast(bmqt::QueueFlags::e_READ), + static_cast(z_bmqt_QueueFlags::ec_READ), &openStatus); if (!z_bmqa_OpenQueueStatus__toBool(openStatus) || @@ -248,7 +222,6 @@ static void consume(z_bmqa_Session* session) return; // RETURN } - // bmqa::CloseQueueStatus closeStatus = session->closeQueueSync(&queueId); z_bmqa_CloseQueueStatus* closeStatus; z_bmqa_Session__closeQueueSync(session, queueId, 0, &closeStatus); if (!z_bmqa_CloseQueueStatus__toBool(closeStatus)) { @@ -280,9 +253,6 @@ int main(BSLS_ANNOTATION_UNUSED int argc, // the local broker by default, unless the 'Session' is created with an // optional 'SessionOptions' object. - // EventHandler* eventHandler = new EventHandler(); - // ManagedHandler eventHandlerMp(eventHandler); - // bmqa::Session session(eventHandlerMp); z_bmqa_Session* session; z_bmqa_SessionEventHandler* eventHandler; z_bmqa_SessionEventHandler__create(&eventHandler, From 7f492a6669e82ce8176dfc9cd63f92e52c1160dd Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 26 Jan 2024 13:02:36 -0500 Subject: [PATCH 42/57] Added tests for SessionEventType, MessageEventType, and CompressionAlgorithmType --- .../z_bmqt_compressionalgorithmtype.t.cpp | 76 ++++------ .../z_bmqt/z_bmqt_messageeventtype.t.cpp | 128 +++++++++++++++++ .../z_bmqt/z_bmqt_sessioneventtype.t.cpp | 135 ++++++++++++++++++ 3 files changed, 289 insertions(+), 50 deletions(-) create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.t.cpp create mode 100644 src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp index 594d96190..f19b069b1 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// bmqt_compressionalgorithmtype.t.cpp +// bmqt_compressionalgorithmtype.t.cpp #include // MWC @@ -23,6 +23,7 @@ #include // BDE +#include #include // CONVENIENCE @@ -34,8 +35,7 @@ using namespace bsl; // ---------------------------------------------------------------------------- namespace { -struct PrintTestData { - int d_line; +struct ToAsciiTestData { int d_type; const char* d_expected; }; @@ -47,56 +47,32 @@ struct PrintTestData { // ---------------------------------------------------------------------------- template -static void printEnumHelper(ARRAY (&data)[SIZE]) +static void enumToAsciiHelper(ARRAY (&data)[SIZE]) { for (size_t idx = 0; idx < SIZE; ++idx) { - const PrintTestData& test = data[idx]; - - PVVV("Line [" << test.d_line << "]"); - - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); - - typedef typename ENUM_TYPE::Enum T; - - T obj = static_cast(test.d_type); - - expected << test.d_expected; - - out.setstate(bsl::ios_base::badbit); - ENUM_TYPE::print(out, obj, 0, -1); - - ASSERT_EQ(out.str(), ""); - - out.clear(); - ENUM_TYPE::print(out, obj, 0, -1); - - ASSERT_EQ(out.str(), expected.str()); - - out.reset(); - out << obj; - - ASSERT_EQ(out.str(), expected.str()); + const ToAsciiTestData& test = data[idx]; + z_bmqt_CompressionAlgorithmType::Enum type = + static_cast(test.d_type); + const char* result = z_bmqt_CompressionAlgorithmType::toAscii(type); + ASSERT_EQ(strcmp(result, test.d_expected), 0); } } -static void test1_enumPrint() +static void test1_enumToAscii() // ------------------------------------------------------------------------ // ENUM LAYOUT // // Concerns: -// Check that enums print methods work correct +// Check that enums toAscii methods work correct // // Plan: -// 1. For every type of enum for which there is a corresponding stream -// operator and print method check that layout of each enum value. -// equal to expected value: -// 1.1. Check layout of stream operator -// 1.2. Check layout of print method -// 2. Check that layout for invalid value is equal to expected. +// 1. For every type of enum for which there is a corresponding toAscii +// function check that output of the print function. +// equal to expected value +// 2. Check that the result for invalid value is equal to expected. // // Testing: -// CompressionAlgorithmType::print +// z_bmqt_CompressionAlgorithmType::toAscii // operator<<(bsl::ostream&, CompressionAlgorithmType::Enum) // ------------------------------------------------------------------------ { @@ -104,22 +80,22 @@ static void test1_enumPrint() PV("Test bmqt::CompressionAlgorithmType printing"); { - BSLMF_ASSERT(z_bmqt_CompressionAlgorithmType::k_LOWEST_SUPPORTED_TYPE == - z_bmqt_CompressionAlgorithmType::ec_NONE); + BSLMF_ASSERT( + z_bmqt_CompressionAlgorithmType::k_LOWEST_SUPPORTED_TYPE == + z_bmqt_CompressionAlgorithmType::ec_NONE); BSLMF_ASSERT( z_bmqt_CompressionAlgorithmType::k_HIGHEST_SUPPORTED_TYPE == z_bmqt_CompressionAlgorithmType::ec_ZLIB); - PrintTestData k_DATA[] = { - {L_, z_bmqt_CompressionAlgorithmType::ec_UNKNOWN, "UNKNOWN"}, - {L_, z_bmqt_CompressionAlgorithmType::ec_NONE, "NONE"}, - {L_, z_bmqt_CompressionAlgorithmType::ec_ZLIB, "ZLIB"}, - {L_, - z_bmqt_CompressionAlgorithmType::k_HIGHEST_SUPPORTED_TYPE + 1, + ToAsciiTestData k_DATA[] = { + {z_bmqt_CompressionAlgorithmType::ec_UNKNOWN, "UNKNOWN"}, + {z_bmqt_CompressionAlgorithmType::ec_NONE, "NONE"}, + {z_bmqt_CompressionAlgorithmType::ec_ZLIB, "ZLIB"}, + {z_bmqt_CompressionAlgorithmType::k_HIGHEST_SUPPORTED_TYPE + 1, "(* UNKNOWN *)"}}; - printEnumHelper(k_DATA); + enumToAsciiHelper(k_DATA); } } @@ -133,7 +109,7 @@ int main(int argc, char* argv[]) switch (_testCase) { case 0: - case 1: test1_enumPrint(); break; + case 1: test1_enumToAscii(); break; default: { cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; s_testStatus = -1; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.t.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.t.cpp new file mode 100644 index 000000000..c4d5197c1 --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.t.cpp @@ -0,0 +1,128 @@ +// Copyright 2014-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// z_bmqt_messageeventtype.t.cpp -*-C++-*- +#include +#include + +// MWC +#include + +// BDE +#include +#include +#include + +// TEST DRIVER +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +static void test1_breathingTest() +{ + mwctst::TestHelper::printTestName("BREATHING TEST"); + + z_bmqt_MessageEventType::Enum obj; + bsl::string str; + bool res; + + PV("Testing toAscii"); + str = z_bmqt_MessageEventType::toAscii(z_bmqt_MessageEventType::ec_PUSH); + ASSERT_EQ(str, "PUSH"); + + obj = static_cast(-1); + str = z_bmqt_MessageEventType::toAscii(obj); + ASSERT_EQ(str, "(* UNKNOWN *)"); + + PV("Testing fromAscii"); + res = z_bmqt_MessageEventType::fromAscii(&obj, "PUT"); + ASSERT_EQ(res, true); + ASSERT_EQ(obj, z_bmqt_MessageEventType::ec_PUT); + + res = z_bmqt_MessageEventType::fromAscii(&obj, "invalid"); + ASSERT_EQ(res, false); + + PV("Testing: toAscii(fromAscii(value)) = value"); + res = z_bmqt_MessageEventType::fromAscii(&obj, "ACK"); + ASSERT_EQ(res, true); + str = z_bmqt_MessageEventType::toAscii(obj); + ASSERT_EQ(str, "ACK"); +} + +static void test2_conversionTest() +{ + mwctst::TestHelper::printTestName("BREATHING TEST"); + + // Ensure that the values are equivalent in number + ASSERT_EQ( + static_cast(z_bmqt_MessageEventType::Enum::ec_UNDEFINED), + static_cast(bmqt::MessageEventType::Enum::e_UNDEFINED)); + ASSERT_EQ(static_cast(z_bmqt_MessageEventType::Enum::ec_PUT), + static_cast(bmqt::MessageEventType::Enum::e_PUT)); + ASSERT_EQ(static_cast(z_bmqt_MessageEventType::Enum::ec_PUSH), + static_cast(bmqt::MessageEventType::Enum::e_PUSH)); + ASSERT_EQ(static_cast(z_bmqt_MessageEventType::Enum::ec_ACK), + static_cast(bmqt::MessageEventType::Enum::e_ACK)); + // Ensure that static cast works correctly + struct Test { + z_bmqt_MessageEventType::Enum c_type; + bmqt::MessageEventType::Enum cpp_type; + } k_DATA[] = {{z_bmqt_MessageEventType::Enum::ec_UNDEFINED, + bmqt::MessageEventType::e_UNDEFINED}, + {z_bmqt_MessageEventType::Enum::ec_PUT, + bmqt::MessageEventType::e_PUT}, + {z_bmqt_MessageEventType::Enum::ec_PUSH, + bmqt::MessageEventType::e_PUSH}, + {z_bmqt_MessageEventType::Enum::ec_ACK, + bmqt::MessageEventType::e_ACK}}; + + const size_t k_NUM_DATA = sizeof(k_DATA) / sizeof(*k_DATA); + + for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { + const Test& test = k_DATA[idx]; + + ASSERT_EQ(static_cast(test.c_type), + test.cpp_type); + ASSERT_EQ(test.c_type, + static_cast(test.cpp_type)); + } +} + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 2: test2_conversionTest(); break; + case 1: test1_breathingTest(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +} diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp new file mode 100644 index 000000000..f33fc350d --- /dev/null +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp @@ -0,0 +1,135 @@ +// Copyright 2014-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// z_bmqt_sessioneventtype.t.cpp -*-C++-*- +#include +#include + +// MWC +#include + +// BDE +#include +#include + +// TEST DRIVER +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +static void test1_breathingTest() +{ + mwctst::TestHelper::printTestName("BREATHING TEST"); + + z_bmqt_SessionEventType::Enum obj; + bsl::string str; + bool res; + + PV("Testing toAscii"); + str = z_bmqt_SessionEventType::toAscii(z_bmqt_SessionEventType::ec_CONNECTED); + ASSERT_EQ(str, "CONNECTED"); + + PV("Testing fromAscii"); + res = z_bmqt_SessionEventType::fromAscii(&obj, "QUEUE_OPEN_RESULT"); + ASSERT_EQ(res, true); + ASSERT_EQ(obj, z_bmqt_SessionEventType::ec_QUEUE_OPEN_RESULT); + res = z_bmqt_SessionEventType::fromAscii(&obj, "invalid"); + ASSERT_EQ(res, false); + + PV("Testing: fromAscii(toAscii(value)) = value"); + res = z_bmqt_SessionEventType::fromAscii( + &obj, + z_bmqt_SessionEventType::toAscii(z_bmqt_SessionEventType::ec_TIMEOUT)); + ASSERT_EQ(res, true); + ASSERT_EQ(obj, z_bmqt_SessionEventType::ec_TIMEOUT); + + PV("Testing: toAscii(fromAscii(value)) = value"); + res = z_bmqt_SessionEventType::fromAscii(&obj, "DISCONNECTED"); + ASSERT_EQ(res, true); + str = z_bmqt_SessionEventType::toAscii(obj); + ASSERT_EQ(str, "DISCONNECTED"); +} + +static void test2_toAsciiTest() +{ + mwctst::TestHelper::printTestName("TOASCII"); + + PV("Testing print"); + + struct Test { + z_bmqt_SessionEventType::Enum d_type; + const char* d_expected; + } k_DATA[] = { + {z_bmqt_SessionEventType::ec_UNDEFINED, "UNDEFINED"}, + {z_bmqt_SessionEventType::ec_CONNECTED, "CONNECTED"}, + {z_bmqt_SessionEventType::ec_DISCONNECTED, "DISCONNECTED"}, + {z_bmqt_SessionEventType::ec_CONNECTION_LOST, "CONNECTION_LOST"}, + {z_bmqt_SessionEventType::ec_RECONNECTED, "RECONNECTED"}, + {z_bmqt_SessionEventType::ec_STATE_RESTORED, "STATE_RESTORED"}, + {z_bmqt_SessionEventType::ec_CONNECTION_TIMEOUT, "CONNECTION_TIMEOUT"}, + {z_bmqt_SessionEventType::ec_QUEUE_OPEN_RESULT, "QUEUE_OPEN_RESULT"}, + {z_bmqt_SessionEventType::ec_QUEUE_REOPEN_RESULT, "QUEUE_REOPEN_RESULT"}, + {z_bmqt_SessionEventType::ec_QUEUE_CLOSE_RESULT, "QUEUE_CLOSE_RESULT"}, + {z_bmqt_SessionEventType::ec_SLOWCONSUMER_NORMAL, "SLOWCONSUMER_NORMAL"}, + {z_bmqt_SessionEventType::ec_SLOWCONSUMER_HIGHWATERMARK, + "SLOWCONSUMER_HIGHWATERMARK"}, + {z_bmqt_SessionEventType::ec_QUEUE_CONFIGURE_RESULT, + "QUEUE_CONFIGURE_RESULT"}, + {z_bmqt_SessionEventType::ec_HOST_UNHEALTHY, "HOST_UNHEALTHY"}, + {z_bmqt_SessionEventType::ec_HOST_HEALTH_RESTORED, + "HOST_HEALTH_RESTORED"}, + {z_bmqt_SessionEventType::ec_QUEUE_SUSPENDED, "QUEUE_SUSPENDED"}, + {z_bmqt_SessionEventType::ec_QUEUE_RESUMED, "QUEUE_RESUMED"}, + {z_bmqt_SessionEventType::ec_ERROR, "ERROR"}, + {z_bmqt_SessionEventType::ec_TIMEOUT, "TIMEOUT"}, + {z_bmqt_SessionEventType::ec_CANCELED, "CANCELED"}, + {static_cast(-1234), "(* UNKNOWN *)"}, + }; + + const size_t k_NUM_DATA = sizeof(k_DATA) / sizeof(*k_DATA); + + for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { + const Test& test = k_DATA[idx]; + const char* result = z_bmqt_SessionEventType::toAscii(test.d_type); + ASSERT_EQ(strcmp(result, test.d_expected), 0); + } +} + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 2: test2_toAsciiTest(); break; + case 1: test1_breathingTest(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +} From d7c657dc9c928133318b47bedb55f9b2c4bd0c8f Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 26 Jan 2024 13:17:02 -0500 Subject: [PATCH 43/57] Ran formatter and deleted demo.h --- src/groups/z_bmq/z_bmqa/demo.h | 104 --------- .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp | 6 +- .../z_bmqa/z_bmqa_configurequeuestatus.h | 3 +- src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp | 4 +- src/groups/z_bmq/z_bmqa/z_bmqa_message.h | 2 +- .../z_bmq/z_bmqa/z_bmqa_messageevent.cpp | 2 +- src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h | 3 +- .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 83 ++++--- .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 37 +-- .../z_bmq/z_bmqa/z_bmqa_messageiterator.cpp | 2 +- .../z_bmq/z_bmqa/z_bmqa_messageiterator.h | 2 +- .../z_bmq/z_bmqa/z_bmqa_messageproperties.cpp | 1 - .../z_bmq/z_bmqa/z_bmqa_messageproperties.h | 2 - .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp | 64 ++++-- .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.h | 19 +- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp | 74 ++++-- src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h | 18 +- src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp | 1 - .../z_bmqt/z_bmqt_compressionalgorithmtype.h | 2 +- .../z_bmqt_compressionalgorithmtype.t.cpp | 2 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 36 +-- .../z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp | 3 +- .../z_bmq/z_bmqt/z_bmqt_messageeventtype.h | 3 +- src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp | 7 +- src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h | 4 +- .../z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 215 ++++++++++++------ .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp | 11 +- .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.h | 3 +- .../z_bmqt/z_bmqt_sessioneventtype.t.cpp | 21 +- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 17 +- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.h | 5 +- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp | 4 +- .../z_bmq/z_bmqt/z_bmqt_subscription.cpp | 192 +++++++++++----- src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h | 66 ++++-- src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp | 63 +++-- src/groups/z_bmq/z_bmqt/z_bmqt_uri.h | 21 +- 36 files changed, 661 insertions(+), 441 deletions(-) delete mode 100644 src/groups/z_bmq/z_bmqa/demo.h diff --git a/src/groups/z_bmq/z_bmqa/demo.h b/src/groups/z_bmq/z_bmqa/demo.h deleted file mode 100644 index 19acc34aa..000000000 --- a/src/groups/z_bmq/z_bmqa/demo.h +++ /dev/null @@ -1,104 +0,0 @@ -#include -#include -#include -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -const int K_QUEUE_ID = 1; -const char K_QUEUE_URI[] = "bmq://bmq.test.mem.priority/test-queue"; -const int K_NUM_MESSAGES = 5; - - enum QueueFlags { - e_ADMIN = (1 << 0) // The queue is opened in admin mode (Valid only - // for BlazingMQ admin tasks) - , - e_READ = (1 << 1) // The queue is opened for consuming messages - , - e_WRITE = (1 << 2) // The queue is opened for posting messages - , - e_ACK = (1 << 3) // Set to indicate interested in receiving - // 'ACK' events for all message posted -}; - - -void postEvent(const char* text, - z_bmqa_QueueId* queueId, - z_bmqa_Session* session){ - - z_bmqa_MessageEventBuilder* builder; - z_bmqa_MessageEventBuilder__create(&builder); - - z_bmqa_Session__loadMessageEventBuilder(session, &builder); - - z_bmqa_Message* message; - - z_bmqa_MessageEventBuilder__startMessage(builder, &message); - - z_bmqa_Message__setDataRef(message, text, (int)strlen(text)); - - z_bmqa_MessageEventBuilder__packMessage(builder, queueId); - - const z_bmqa_MessageEvent* messageEvent; - z_bmqa_MessageEventBuilder__messageEvent(builder, &messageEvent); - - z_bmqa_Session__post(session, messageEvent); - - z_bmqa_MessageEventBuilder__delete(&builder); - -} - - -void produce(z_bmqa_Session* session){ - z_bmqa_QueueId* queueId; - - z_bmqa_QueueId__createFromNumeric(&queueId, K_QUEUE_ID); - z_bmqa_Session__openQueueSync(session, - queueId, - K_QUEUE_URI, - e_WRITE); - - const char* messages[] = {"Hello world!", - "message 1", - "message 2", - "message 3", - "Good Bye!"}; - for(int idx = 0; idx < 5; ++idx){ - postEvent(messages[idx], queueId, session); - } - - z_bmqa_Session__closeQueueSync(session, queueId); - - z_bmqa_QueueId__delete(&queueId); -} - -int run_c_producer(){ - z_bmqa_Session* session; - z_bmqt_SessionOptions* options; - - z_bmqt_SessionOptions__create(&options); - z_bmqa_Session__create(&session, options); - - - //start the session - z_bmqa_Session__start(session, 1000); - - produce(session); - - //stop the session - z_bmqa_Session__stop(session); - - - z_bmqa_Session__delete(&session); - z_bmqt_SessionOptions__delete(&options); - - return 0; - -} - -#if defined(__cplusplus) -} -#endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp index 80e9622a7..5d2d08a91 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp @@ -1,10 +1,12 @@ #include #include -int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** status_obj) { +int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** status_obj) +{ using namespace BloombergLP; - bmqa::CloseQueueStatus* status_p = reinterpret_cast(*status_obj); + bmqa::CloseQueueStatus* status_p = + reinterpret_cast(*status_obj); delete status_p; *status_obj = NULL; diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h index b1482043b..14cef3e0e 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h @@ -10,7 +10,8 @@ extern "C" { typedef struct z_bmqa_ConfigureQueueStatus z_bmqa_ConfigureQueueStatus; -int z_bmqa_ConfigureQueueStatus__delete(z_bmqa_ConfigureQueueStatus** status_obj); +int z_bmqa_ConfigureQueueStatus__delete( + z_bmqa_ConfigureQueueStatus** status_obj); int z_bmqa_ConfigureQueueStatus__create( z_bmqa_ConfigureQueueStatus** status_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp index 77a1ada4f..c78d8ad82 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp @@ -1,2 +1,2 @@ -#include -#include \ No newline at end of file +#include +#include \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h index 6856e31d4..82b7798d0 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_message.h @@ -78,7 +78,7 @@ int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, z_bmqt_MessageGUID const** messageGUID_obj); int z_bmqa_Message__confirmationCookie( - const z_bmqa_Message* message_obj, + const z_bmqa_Message* message_obj, z_bmqa_MessageConfirmationCookie** cookie_obj); int z_bmqa_Message__ackStatus(const z_bmqa_Message* message_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp index 8c48a98eb..e741c234e 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp @@ -59,7 +59,7 @@ int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* event_obj, event_p->print(ss); bsl::string out_str = ss.str(); - *out = new char[out_str.length() + 1]; + *out = new char[out_str.length() + 1]; (*out)[out_str.length()] = '\0'; strcpy(*out, out_str.c_str()); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h index c4ac36a6a..774349060 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h @@ -18,7 +18,8 @@ int z_bmqa_MessageEvent__messageIterator( const z_bmqa_MessageEvent* event_obj, z_bmqa_MessageIterator** iterator_obj); -z_bmqt_MessageEventType::Enum z_bmqa_MessageEvent__type(const z_bmqa_MessageEvent* event_obj); +z_bmqt_MessageEventType::Enum +z_bmqa_MessageEvent__type(const z_bmqa_MessageEvent* event_obj); int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* event_obj, char** out); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp index dcaf3a05a..4f004e504 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp @@ -1,30 +1,36 @@ -#include -#include #include +#include +#include - - -int z_bmqa_MessageEventBuilder__delete(z_bmqa_MessageEventBuilder** builder_obj) { +int z_bmqa_MessageEventBuilder__delete( + z_bmqa_MessageEventBuilder** builder_obj) +{ using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_p = reinterpret_cast(*builder_obj); + bmqa::MessageEventBuilder* builder_p = + reinterpret_cast(*builder_obj); delete builder_p; *builder_obj = NULL; return 0; } -int z_bmqa_MessageEventBuilder__deleteConst(z_bmqa_MessageEventBuilder const** builder_obj) { +int z_bmqa_MessageEventBuilder__deleteConst( + z_bmqa_MessageEventBuilder const** builder_obj) +{ using namespace BloombergLP; - const bmqa::MessageEventBuilder* builder_p = reinterpret_cast(*builder_obj); + const bmqa::MessageEventBuilder* builder_p = + reinterpret_cast(*builder_obj); delete builder_p; *builder_obj = NULL; return 0; } -int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) { +int z_bmqa_MessageEventBuilder__create( + z_bmqa_MessageEventBuilder** builder_obj) +{ using namespace BloombergLP; bmqa::MessageEventBuilder* builder_p = new bmqa::MessageEventBuilder(); @@ -33,63 +39,88 @@ int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) return 0; } -int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** out_obj) { +int z_bmqa_MessageEventBuilder__startMessage( + z_bmqa_MessageEventBuilder* builder_obj, + z_bmqa_Message** out_obj) +{ using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + bmqa::MessageEventBuilder* builder_p = + reinterpret_cast(builder_obj); bmqa::Message* message_p = &builder_p->startMessage(); - *out_obj = reinterpret_cast(message_p); + *out_obj = reinterpret_cast(message_p); return 0; } -int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId) { +int z_bmqa_MessageEventBuilder__packMessage( + z_bmqa_MessageEventBuilder* builder_obj, + const z_bmqa_QueueId* queueId) +{ using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); - const bmqa::QueueId* queueId_p = reinterpret_cast(queueId); + bmqa::MessageEventBuilder* builder_p = + reinterpret_cast(builder_obj); + const bmqa::QueueId* queueId_p = reinterpret_cast( + queueId); return builder_p->packMessage(*queueId_p); } -int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj) { +int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj) +{ using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + bmqa::MessageEventBuilder* builder_p = + reinterpret_cast(builder_obj); builder_p->reset(); return 0; } -int z_bmqa_MessageEventBuilder__messageEvent(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_MessageEvent const** event_obj) { +int z_bmqa_MessageEventBuilder__messageEvent( + z_bmqa_MessageEventBuilder* builder_obj, + z_bmqa_MessageEvent const** event_obj) +{ using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + bmqa::MessageEventBuilder* builder_p = + reinterpret_cast(builder_obj); const bmqa::MessageEvent* event_p = &(builder_p->messageEvent()); *event_obj = reinterpret_cast(event_p); return 0; } -int z_bmqa_MessageEventBuilder__currentMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** message_obj) { +int z_bmqa_MessageEventBuilder__currentMessage( + z_bmqa_MessageEventBuilder* builder_obj, + z_bmqa_Message** message_obj) +{ using namespace BloombergLP; - bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + bmqa::MessageEventBuilder* builder_p = + reinterpret_cast(builder_obj); bmqa::Message* message_p = &(builder_p->currentMessage()); - *message_obj = reinterpret_cast(message_p); + *message_obj = reinterpret_cast(message_p); return 0; } -int z_bmqa_MessageEventBuilder__messageCount(const z_bmqa_MessageEventBuilder* builder_obj) { +int z_bmqa_MessageEventBuilder__messageCount( + const z_bmqa_MessageEventBuilder* builder_obj) +{ using namespace BloombergLP; - const bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::MessageEventBuilder* builder_p = + reinterpret_cast(builder_obj); return builder_p->messageCount(); } -int z_bmqa_MessageEventBuilder__messageEventSize(const z_bmqa_MessageEventBuilder* builder_obj) { +int z_bmqa_MessageEventBuilder__messageEventSize( + const z_bmqa_MessageEventBuilder* builder_obj) +{ using namespace BloombergLP; - const bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder_obj); + const bmqa::MessageEventBuilder* builder_p = + reinterpret_cast(builder_obj); return builder_p->messageEventSize(); } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index 8784bec32..69395bd18 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -1,11 +1,9 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER #define INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER - - -#include -#include #include +#include +#include #if defined(__cplusplus) extern "C" { @@ -13,25 +11,38 @@ extern "C" { typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; -int z_bmqa_MessageEventBuilder__delete(z_bmqa_MessageEventBuilder** builder_obj); +int z_bmqa_MessageEventBuilder__delete( + z_bmqa_MessageEventBuilder** builder_obj); -int z_bmqa_MessageEventBuilder__deleteConst(z_bmqa_MessageEventBuilder const** builder_obj); +int z_bmqa_MessageEventBuilder__deleteConst( + z_bmqa_MessageEventBuilder const** builder_obj); -int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj); +int z_bmqa_MessageEventBuilder__create( + z_bmqa_MessageEventBuilder** builder_obj); -int z_bmqa_MessageEventBuilder__startMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** out_obj); +int z_bmqa_MessageEventBuilder__startMessage( + z_bmqa_MessageEventBuilder* builder_obj, + z_bmqa_Message** out_obj); -int z_bmqa_MessageEventBuilder__packMessage(z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId); +int z_bmqa_MessageEventBuilder__packMessage( + z_bmqa_MessageEventBuilder* builder_obj, + const z_bmqa_QueueId* queueId); int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj); -int z_bmqa_MessageEventBuilder__messageEvent(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_MessageEvent const** event_obj); +int z_bmqa_MessageEventBuilder__messageEvent( + z_bmqa_MessageEventBuilder* builder_obj, + z_bmqa_MessageEvent const** event_obj); -int z_bmqa_MessageEventBuilder__currentMessage(z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** message_obj); +int z_bmqa_MessageEventBuilder__currentMessage( + z_bmqa_MessageEventBuilder* builder_obj, + z_bmqa_Message** message_obj); -int z_bmqa_MessageEventBuilder__messageCount(const z_bmqa_MessageEventBuilder* builder_obj); +int z_bmqa_MessageEventBuilder__messageCount( + const z_bmqa_MessageEventBuilder* builder_obj); -int z_bmqa_MessageEventBuilder__messageEventSize(const z_bmqa_MessageEventBuilder* builder_obj); +int z_bmqa_MessageEventBuilder__messageEventSize( + const z_bmqa_MessageEventBuilder* builder_obj); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp index abde7439f..803c2c726 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp @@ -48,7 +48,7 @@ int z_bmqa_MessageIterator__message( reinterpret_cast(messageIterator_obj); const z_bmqa_Message* message_p = reinterpret_cast( &messageIterator_p->message()); - + *message_obj = reinterpret_cast(message_p); return 0; diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h index 72cbea622..8c046985a 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h @@ -21,7 +21,7 @@ bool z_bmqa_MessageIterator__nextMessage( int z_bmqa_MessageIterator__message( const z_bmqa_MessageIterator* messageIterator_obj, - z_bmqa_Message const** message_obj); + z_bmqa_Message const** message_obj); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp index 5ff0f23ff..4d2240f40 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp @@ -1,3 +1,2 @@ #include #include - diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h index 845532437..b9b2823d5 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h @@ -3,6 +3,4 @@ typedef struct z_bmqa_MessageProperties z_bmqa_MessageProperties; - - #endif \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp index 1c8cbaf3a..7cca0570e 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp @@ -1,17 +1,20 @@ -#include #include +#include -int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj) { +int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj) +{ using namespace BloombergLP; - bmqa::OpenQueueStatus* status_p = reinterpret_cast(*status_obj); + bmqa::OpenQueueStatus* status_p = reinterpret_cast( + *status_obj); delete status_p; *status_obj = NULL; return 0; } -int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) { +int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) +{ using namespace BloombergLP; bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(); @@ -21,10 +24,13 @@ int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) { return 0; } -int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_OpenQueueStatus* other) { +int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, + const z_bmqa_OpenQueueStatus* other) +{ using namespace BloombergLP; - const bmqa::OpenQueueStatus* other_p = reinterpret_cast(other); + const bmqa::OpenQueueStatus* other_p = + reinterpret_cast(other); bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(*other_p); *status_obj = reinterpret_cast(status_p); @@ -33,43 +39,59 @@ int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, cons } int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, - const z_bmqa_QueueId* queueId, - int result, - const char* errorDescription) { + const z_bmqa_QueueId* queueId, + int result, + const char* errorDescription) +{ using namespace BloombergLP; - const bmqa::QueueId* queueId_p = reinterpret_cast(queueId); - const bsl::string errorDescription_str(errorDescription); - bmqt::OpenQueueResult::Enum result_enum = static_cast(result); - bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(*queueId_p, result_enum, errorDescription_str); + const bmqa::QueueId* queueId_p = reinterpret_cast( + queueId); + const bsl::string errorDescription_str(errorDescription); + bmqt::OpenQueueResult::Enum result_enum = + static_cast(result); + bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus( + *queueId_p, + result_enum, + errorDescription_str); *status_obj = reinterpret_cast(status_p); return 0; } -bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj) { +bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj) +{ using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + const bmqa::OpenQueueStatus* status_p = + reinterpret_cast(status_obj); return *status_p; } -int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj) { +int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, + z_bmqa_QueueId const** queueId_obj) +{ using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + const bmqa::OpenQueueStatus* status_p = + reinterpret_cast(status_obj); const bmqa::QueueId* queueId_p = &(status_p->queueId()); *queueId_obj = reinterpret_cast(queueId_p); return 0; } -int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj) { +int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj) +{ using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + const bmqa::OpenQueueStatus* status_p = + reinterpret_cast(status_obj); return status_p->result(); } -const char* z_bmqa_OpenQueueStatus__errorDescription(const z_bmqa_OpenQueueStatus* status_obj) { +const char* z_bmqa_OpenQueueStatus__errorDescription( + const z_bmqa_OpenQueueStatus* status_obj) +{ using namespace BloombergLP; - const bmqa::OpenQueueStatus* status_p = reinterpret_cast(status_obj); + const bmqa::OpenQueueStatus* status_p = + reinterpret_cast(status_obj); return status_p->errorDescription().c_str(); } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h index a6b1fbb7c..fbb833e73 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h @@ -1,8 +1,8 @@ #ifndef INCLUDED_Z_BMQA_OPENQUEUESTATUS #define INCLUDED_Z_BMQA_OPENQUEUESTATUS -#include #include +#include #if defined(__cplusplus) extern "C" { @@ -14,22 +14,23 @@ int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj); int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj); -int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_OpenQueueStatus* other); +int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, + const z_bmqa_OpenQueueStatus* other); int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, - const z_bmqa_QueueId* queueId, - int result, + const z_bmqa_QueueId* queueId, + int result, const char* errorDescription); -bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj); +bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj); -int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj); +int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, + z_bmqa_QueueId const** queueId_obj); int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj); -const char* z_bmqa_OpenQueueStatus__errorDescription(const z_bmqa_OpenQueueStatus* status_obj); - - +const char* z_bmqa_OpenQueueStatus__errorDescription( + const z_bmqa_OpenQueueStatus* status_obj); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp index caaaa3f48..e4aca9dc3 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp @@ -2,7 +2,8 @@ #include #include -int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj) { +int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj) +{ using namespace BloombergLP; bmqa::QueueId* queueId_p = reinterpret_cast(*queueId_obj); @@ -12,17 +13,20 @@ int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj) { return 0; } -int z_bmqa_QueueId__deleteConst(z_bmqa_QueueId const** queueId_obj) { +int z_bmqa_QueueId__deleteConst(z_bmqa_QueueId const** queueId_obj) +{ using namespace BloombergLP; - const bmqa::QueueId* queueId_p = reinterpret_cast(*queueId_obj); + const bmqa::QueueId* queueId_p = reinterpret_cast( + *queueId_obj); delete queueId_p; *queueId_obj = NULL; return 0; } -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) { +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) +{ using namespace BloombergLP; bmqa::QueueId* queueId_p = new bmqa::QueueId(); @@ -32,20 +36,27 @@ int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) { return 0; } -int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other) { +int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, + const z_bmqa_QueueId* other) +{ using namespace BloombergLP; - const bmqa::QueueId* other_p = reinterpret_cast(other); + const bmqa::QueueId* other_p = reinterpret_cast( + other); bmqa::QueueId* queueId_p = new bmqa::QueueId(*other_p); - *queueId_obj = reinterpret_cast(queueId_p); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } -int z_bmqa_QueueId__createFromCorrelationId(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId) { +int z_bmqa_QueueId__createFromCorrelationId( + z_bmqa_QueueId** queueId_obj, + const z_bmqt_CorrelationId* correlationId) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId); + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId); bmqa::QueueId* queueId_p = new bmqa::QueueId(*correlationId_p); *queueId_obj = reinterpret_cast(queueId_p); @@ -53,63 +64,76 @@ int z_bmqa_QueueId__createFromCorrelationId(z_bmqa_QueueId** queueId_obj, const return 0; } -int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, int64_t numeric) { +int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, + int64_t numeric) +{ using namespace BloombergLP; bmqa::QueueId* queueId_p = new bmqa::QueueId(numeric); - *queueId_obj = reinterpret_cast(queueId_p); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } -int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, void* pointer) { +int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, + void* pointer) +{ using namespace BloombergLP; bmqa::QueueId* queueId_p = new bmqa::QueueId(pointer); - *queueId_obj = reinterpret_cast(queueId_p); + *queueId_obj = reinterpret_cast(queueId_p); return 0; } -const z_bmqt_CorrelationId* z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj) { +const z_bmqt_CorrelationId* +z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj) +{ using namespace BloombergLP; - const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + const bmqa::QueueId* queueId_p = reinterpret_cast( + queueId_obj); const bmqt::CorrelationId* correlationId_p = &(queueId_p->correlationId()); return reinterpret_cast(correlationId_p); } -uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj) { +uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj) +{ using namespace BloombergLP; - const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + const bmqa::QueueId* queueId_p = reinterpret_cast( + queueId_obj); return queueId_p->flags(); } -const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId_obj) { +const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId_obj) +{ using namespace BloombergLP; - const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + const bmqa::QueueId* queueId_p = reinterpret_cast( + queueId_obj); const bmqt::Uri* uri_p = &(queueId_p->uri()); return reinterpret_cast(uri_p); - } -const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId_obj) { +const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId_obj) +{ using namespace BloombergLP; - const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + const bmqa::QueueId* queueId_p = reinterpret_cast( + queueId_obj); const bmqt::QueueOptions* options_p = &(queueId_p->options()); return reinterpret_cast(options_p); } -int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId_obj) { +int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId_obj) +{ using namespace BloombergLP; - const bmqa::QueueId* queueId_p = reinterpret_cast(queueId_obj); + const bmqa::QueueId* queueId_p = reinterpret_cast( + queueId_obj); return queueId_p->isValid(); } - diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h index 86b91ea49..f315253f7 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h @@ -1,10 +1,10 @@ #ifndef INCLUDED_Z_BMQA_QUEUEID #define INCLUDED_Z_BMQA_QUEUEID +#include #include #include #include -#include #if defined(__cplusplus) extern "C" { @@ -18,15 +18,21 @@ int z_bmqa_QueueId__deleteConst(z_bmqa_QueueId const** queueId_obj); int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj); -int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other); +int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, + const z_bmqa_QueueId* other); -int z_bmqa_QueueId__createFromCorrelationId(z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId); +int z_bmqa_QueueId__createFromCorrelationId( + z_bmqa_QueueId** queueId_obj, + const z_bmqt_CorrelationId* correlationId); -int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, int64_t numeric); +int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, + int64_t numeric); -int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, void* pointer); +int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, + void* pointer); -const z_bmqt_CorrelationId* z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj); +const z_bmqt_CorrelationId* +z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj); uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj); diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp index e265556d6..8f9f248dd 100644 --- a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp +++ b/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp @@ -42,7 +42,6 @@ static void test1_session() // run_c_producer(); } - // ============================================================================ // MAIN PROGRAM // ---------------------------------------------------------------------------- diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h index 4e35d1cbd..74778f680 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h @@ -54,7 +54,7 @@ struct z_bmqt_CompressionAlgorithmType { /// enumerators excluding "ec_" prefix will result in the function /// returning false and the specified `out` will not be touched. static bool fromAscii(z_bmqt_CompressionAlgorithmType::Enum* out, - const char* str); + const char* str); /// Return true incase of valid specified `str` i.e. a enumerator name /// with the "ec_" prefix excluded. Otherwise in case of invalid `str` diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp index f19b069b1..bb6397550 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp @@ -50,7 +50,7 @@ template static void enumToAsciiHelper(ARRAY (&data)[SIZE]) { for (size_t idx = 0; idx < SIZE; ++idx) { - const ToAsciiTestData& test = data[idx]; + const ToAsciiTestData& test = data[idx]; z_bmqt_CompressionAlgorithmType::Enum type = static_cast(test.d_type); const char* result = z_bmqt_CompressionAlgorithmType::toAscii(type); diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h index c123d3ff2..2d1473433 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -7,10 +7,8 @@ extern "C" { #endif - typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; - enum CorrelationId_Type { ec_NUMERIC // the 'CorrelationId' holds a 64-bit integer , @@ -22,16 +20,20 @@ enum CorrelationId_Type { , ec_UNSET // the 'CorrelationId' is not set , - ec_CORRELATIONID_ERROR // error + ec_CORRELATIONID_ERROR // error }; int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj); int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); -int z_bmqt_CorrelationId__createFromNumeric(z_bmqt_CorrelationId** correlationId_obj, int64_t numeric); +int z_bmqt_CorrelationId__createFromNumeric( + z_bmqt_CorrelationId** correlationId_obj, + int64_t numeric); -int z_bmqt_CorrelationId__createFromPointer(z_bmqt_CorrelationId** correlationId_obj, void* pointer); +int z_bmqt_CorrelationId__createFromPointer( + z_bmqt_CorrelationId** correlationId_obj, + void* pointer); int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlation_Id_obj); @@ -39,21 +41,29 @@ int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlation_Id_obj); int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlation_Id_obj); -int z_bmqt_CorrelationId__isUnset(const z_bmqt_CorrelationId* correlation_Id_obj); +int z_bmqt_CorrelationId__isUnset( + const z_bmqt_CorrelationId* correlation_Id_obj); -int z_bmqt_CorrelationId__isNumeric(const z_bmqt_CorrelationId* correlation_Id_obj); +int z_bmqt_CorrelationId__isNumeric( + const z_bmqt_CorrelationId* correlation_Id_obj); -int z_bmqt_CorrelationId__isPointer(const z_bmqt_CorrelationId* correlation_Id_obj); +int z_bmqt_CorrelationId__isPointer( + const z_bmqt_CorrelationId* correlation_Id_obj); -int z_bmqt_CorrelationId__isSharedPtr(const z_bmqt_CorrelationId* correlationId_obj); +int z_bmqt_CorrelationId__isSharedPtr( + const z_bmqt_CorrelationId* correlationId_obj); -int z_bmqt_CorrelationId__isAutoValue(const z_bmqt_CorrelationId* correlation_Id_obj); +int z_bmqt_CorrelationId__isAutoValue( + const z_bmqt_CorrelationId* correlation_Id_obj); -int64_t z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlation_Id_obj); +int64_t z_bmqt_CorrelationId__theNumeric( + const z_bmqt_CorrelationId* correlation_Id_obj); -void* z_bmqt_CorrelationId__thePointer(const z_bmqt_CorrelationId* correlation_Id_obj); +void* z_bmqt_CorrelationId__thePointer( + const z_bmqt_CorrelationId* correlation_Id_obj); -CorrelationId_Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlation_Id_obj); +CorrelationId_Type +z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlation_Id_obj); int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj); diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp index 8c658ed48..51851671b 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp @@ -10,7 +10,8 @@ z_bmqt_MessageEventType::toAscii(z_bmqt_MessageEventType::Enum value) static_cast(value)); } -bool z_bmqt_MessageEventType::fromAscii(z_bmqt_MessageEventType::Enum* out, const char* str) +bool z_bmqt_MessageEventType::fromAscii(z_bmqt_MessageEventType::Enum* out, + const char* str) { using namespace BloombergLP; bmqt::MessageEventType::Enum p; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h index 0a608d642..4bc8200eb 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h @@ -36,8 +36,7 @@ struct z_bmqt_MessageEventType { /// corresponding to the specified `str`, if valid, or return false and /// leave `out` untouched if `str` doesn't correspond to any value of /// the enum. - static bool fromAscii(z_bmqt_MessageEventType::Enum* out, - const char* str); + static bool fromAscii(z_bmqt_MessageEventType::Enum* out, const char* str); }; #if defined(__cplusplus) diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp index 92a45a772..7de304476 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp @@ -5,7 +5,8 @@ const char* z_bmqt_QueueFlags::toAscii(z_bmqt_QueueFlags::Enum value) { using namespace BloombergLP; - return bmqt::QueueFlags::toAscii(static_cast(value)); + return bmqt::QueueFlags::toAscii( + static_cast(value)); } bool z_bmqt_QueueFlags::fromAscii(z_bmqt_QueueFlags::Enum* out, @@ -13,7 +14,7 @@ bool z_bmqt_QueueFlags::fromAscii(z_bmqt_QueueFlags::Enum* out, { using namespace BloombergLP; bmqt::QueueFlags::Enum p; - bool result = bmqt::QueueFlags::fromAscii(&p, str); - *out = static_cast(p); + bool result = bmqt::QueueFlags::fromAscii(&p, str); + *out = static_cast(p); return result; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h b/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h index b3dfad319..525ee4762 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h @@ -12,14 +12,14 @@ struct z_bmqt_QueueFlags { // TYPES enum Enum { ec_ADMIN = (1 << 0) // The queue is opened in admin mode (Valid only - // for BlazingMQ admin tasks) + // for BlazingMQ admin tasks) , ec_READ = (1 << 1) // The queue is opened for consuming messages , ec_WRITE = (1 << 2) // The queue is opened for posting messages , ec_ACK = (1 << 3) // Set to indicate interested in receiving - // 'ACK' events for all message posted + // 'ACK' events for all message posted }; // PUBLIC CONSTANTS diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp index d275357b4..0523ecab0 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -4,17 +4,20 @@ #include #include -int z_bmqt_QueueOptions__delete(z_bmqt_QueueOptions** queueOptions_obj) { +int z_bmqt_QueueOptions__delete(z_bmqt_QueueOptions** queueOptions_obj) +{ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_p = reinterpret_cast(*queueOptions_obj); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast( + *queueOptions_obj); delete queueOptions_p; *queueOptions_obj = NULL; return 0; } -int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj) { +int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj) +{ using namespace BloombergLP; bmqt::QueueOptions* queueOptions_p = new bmqt::QueueOptions; @@ -23,9 +26,12 @@ int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj) { return 0; } -int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other) { +int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, + const z_bmqt_QueueOptions* other) +{ using namespace BloombergLP; - const bmqt::QueueOptions* other_p = reinterpret_cast(other); + const bmqt::QueueOptions* other_p = + reinterpret_cast(other); bmqt::QueueOptions* queueOptions_p = new bmqt::QueueOptions(*other_p); *queueOptions_obj = reinterpret_cast(queueOptions_p); @@ -33,163 +39,231 @@ int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, cons return 0; } - -//Modifiers -int z_bmqt_QueueOptions__setMaxUnconfirmedMessages(z_bmqt_QueueOptions* queueOptions_obj, int value) { +// Modifiers +int z_bmqt_QueueOptions__setMaxUnconfirmedMessages( + z_bmqt_QueueOptions* queueOptions_obj, + int value) +{ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast( + queueOptions_obj); queueOptions_p->setMaxUnconfirmedMessages(value); return 0; } -int z_bmqt_QueueOptions__setMaxUnconfirmedBytes(z_bmqt_QueueOptions* queueOptions_obj, int value) { +int z_bmqt_QueueOptions__setMaxUnconfirmedBytes( + z_bmqt_QueueOptions* queueOptions_obj, + int value) +{ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast( + queueOptions_obj); queueOptions_p->setMaxUnconfirmedBytes(value); return 0; } -int z_bmqt_QueueOptions__setConsumerPriority(z_bmqt_QueueOptions* queueOptions_obj, int value) { +int z_bmqt_QueueOptions__setConsumerPriority( + z_bmqt_QueueOptions* queueOptions_obj, + int value) +{ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast( + queueOptions_obj); queueOptions_p->setConsumerPriority(value); return 0; } -int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth(z_bmqt_QueueOptions* queueOptions_obj, int value) { +int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth( + z_bmqt_QueueOptions* queueOptions_obj, + int value) +{ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast( + queueOptions_obj); queueOptions_p->setSuspendsOnBadHostHealth(value); return 0; } -int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other) { +int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, + const z_bmqt_QueueOptions* other) +{ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); - const bmqt::QueueOptions* other_p = reinterpret_cast(other); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast( + queueOptions_obj); + const bmqt::QueueOptions* other_p = + reinterpret_cast(other); queueOptions_p->merge(*other_p); return 0; } -int z_bmqt_QueueOptions__addOrUpdateSubscription(z_bmqt_QueueOptions* queueOptions_obj, char** errorDescription, const z_bmqt_SubscriptionHandle* handle, const z_bmqt_Subscription* subscription){ +int z_bmqt_QueueOptions__addOrUpdateSubscription( + z_bmqt_QueueOptions* queueOptions_obj, + char** errorDescription, + const z_bmqt_SubscriptionHandle* handle, + const z_bmqt_Subscription* subscription) +{ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); - const bmqt::SubscriptionHandle* handle_p = reinterpret_cast(handle); - const bmqt::Subscription* subscription_p = reinterpret_cast(subscription); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast( + queueOptions_obj); + const bmqt::SubscriptionHandle* handle_p = + reinterpret_cast(handle); + const bmqt::Subscription* subscription_p = + reinterpret_cast(subscription); bsl::string error; - queueOptions_p->addOrUpdateSubscription(&error, *handle_p, *subscription_p); + queueOptions_p->addOrUpdateSubscription(&error, + *handle_p, + *subscription_p); - if(error.empty()) { + if (error.empty()) { *errorDescription = NULL; return 0; - } else { - *errorDescription = static_cast(calloc(error.size()+1, sizeof(char))); + } + else { + *errorDescription = static_cast( + calloc(error.size() + 1, sizeof(char))); strcpy(*errorDescription, error.c_str()); return 1; } } -int z_bmqt_QueueOptions__removeSubscription(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_SubscriptionHandle* handle){ +int z_bmqt_QueueOptions__removeSubscription( + z_bmqt_QueueOptions* queueOptions_obj, + const z_bmqt_SubscriptionHandle* handle) +{ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); - const bmqt::SubscriptionHandle* handle_p = reinterpret_cast(handle); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast( + queueOptions_obj); + const bmqt::SubscriptionHandle* handle_p = + reinterpret_cast(handle); queueOptions_p->removeSubscription(*handle_p); return 0; } -int z_bmqt_QueueOptions__removeAllSubscriptions(z_bmqt_QueueOptions* queueOptions_obj) { +int z_bmqt_QueueOptions__removeAllSubscriptions( + z_bmqt_QueueOptions* queueOptions_obj) +{ using namespace BloombergLP; - bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast( + queueOptions_obj); queueOptions_p->removeAllSubscriptions(); return 0; } -//Accessors -int z_bmqt_QueueOptions__maxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj) { +// Accessors +int z_bmqt_QueueOptions__maxUnconfirmedMessages( + const z_bmqt_QueueOptions* queueOptions_obj) +{ using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* queueOptions_p = + reinterpret_cast(queueOptions_obj); return queueOptions_p->maxUnconfirmedMessages(); } -int z_bmqt_QueueOptions__maxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj) { +int z_bmqt_QueueOptions__maxUnconfirmedBytes( + const z_bmqt_QueueOptions* queueOptions_obj) +{ using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* queueOptions_p = + reinterpret_cast(queueOptions_obj); return queueOptions_p->maxUnconfirmedBytes(); } -int z_bmqt_QueueOptions__consumerPriority(const z_bmqt_QueueOptions* queueOptions_obj) { +int z_bmqt_QueueOptions__consumerPriority( + const z_bmqt_QueueOptions* queueOptions_obj) +{ using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* queueOptions_p = + reinterpret_cast(queueOptions_obj); return queueOptions_p->consumerPriority(); } -bool z_bmqt_QueueOptions__suspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj) { +bool z_bmqt_QueueOptions__suspendsOnBadHostHealth( + const z_bmqt_QueueOptions* queueOptions_obj) +{ using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* queueOptions_p = + reinterpret_cast(queueOptions_obj); return queueOptions_p->suspendsOnBadHostHealth(); } - -bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages(const z_bmqt_QueueOptions* queueOptions_obj) { +bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages( + const z_bmqt_QueueOptions* queueOptions_obj) +{ using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* queueOptions_p = + reinterpret_cast(queueOptions_obj); return queueOptions_p->hasMaxUnconfirmedMessages(); } -bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes(const z_bmqt_QueueOptions* queueOptions_obj) { +bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes( + const z_bmqt_QueueOptions* queueOptions_obj) +{ using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* queueOptions_p = + reinterpret_cast(queueOptions_obj); return queueOptions_p->hasMaxUnconfirmedBytes(); } -bool z_bmqt_QueueOptions__hasConsumerPriority(const z_bmqt_QueueOptions* queueOptions_obj) { +bool z_bmqt_QueueOptions__hasConsumerPriority( + const z_bmqt_QueueOptions* queueOptions_obj) +{ using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* queueOptions_p = + reinterpret_cast(queueOptions_obj); return queueOptions_p->hasConsumerPriority(); } -bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth(const z_bmqt_QueueOptions* queueOptions_obj) { +bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth( + const z_bmqt_QueueOptions* queueOptions_obj) +{ using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* queueOptions_p = + reinterpret_cast(queueOptions_obj); return queueOptions_p->hasSuspendsOnBadHostHealth(); } - -//Experimental (Modifiers) -bool z_bmqt_QueueOptions__loadSubscription(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_Subscription** subscription, const z_bmqt_SubscriptionHandle* handle) { +// Experimental (Modifiers) +bool z_bmqt_QueueOptions__loadSubscription( + const z_bmqt_QueueOptions* queueOptions_obj, + z_bmqt_Subscription** subscription, + const z_bmqt_SubscriptionHandle* handle) +{ using namespace BloombergLP; - const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); - const bmqt::SubscriptionHandle* handle_p = reinterpret_cast(handle); + const bmqt::QueueOptions* queueOptions_p = + reinterpret_cast(queueOptions_obj); + const bmqt::SubscriptionHandle* handle_p = + reinterpret_cast(handle); bmqt::Subscription* subscription_p = new bmqt::Subscription(); bool success = queueOptions_p->loadSubscription(subscription_p, *handle_p); - - if(success) { + + if (success) { *subscription = reinterpret_cast(subscription_p); - } else { + } + else { delete subscription_p; *subscription = NULL; } @@ -197,22 +271,31 @@ bool z_bmqt_QueueOptions__loadSubscription(const z_bmqt_QueueOptions* queueOptio return success; } -int z_bmqt_QueueOptions__loadSubscriptions(const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_SubscrptionsSnapshot* snapshot) { +int z_bmqt_QueueOptions__loadSubscriptions( + const z_bmqt_QueueOptions* queueOptions_obj, + z_bmqt_SubscrptionsSnapshot* snapshot) +{ using namespace BloombergLP; bmqt::QueueOptions::SubscriptionsSnapshot vector; - const bmqt::QueueOptions* queueOptions_p = reinterpret_cast(queueOptions_obj); + const bmqt::QueueOptions* queueOptions_p = + reinterpret_cast(queueOptions_obj); queueOptions_p->loadSubscriptions(&vector); - snapshot->size = vector.size(); - snapshot->subscriptions = static_cast(calloc(vector.size(), sizeof(z_bmqt_HandleAndSubscrption))); + snapshot->size = vector.size(); + snapshot->subscriptions = static_cast( + calloc(vector.size(), sizeof(z_bmqt_HandleAndSubscrption))); - for(size_t i = 0; i < vector.size(); ++i) { - bmqt::SubscriptionHandle* handle_p = new bmqt::SubscriptionHandle(vector[i].first); - bmqt::Subscription* subscription_p = new bmqt::Subscription(vector[i].second); + for (size_t i = 0; i < vector.size(); ++i) { + bmqt::SubscriptionHandle* handle_p = new bmqt::SubscriptionHandle( + vector[i].first); + bmqt::Subscription* subscription_p = new bmqt::Subscription( + vector[i].second); - snapshot->subscriptions[i].handle = reinterpret_cast(handle_p); - snapshot->subscriptions[i].subscrption = reinterpret_cast(subscription_p); + snapshot->subscriptions[i].handle = + reinterpret_cast(handle_p); + snapshot->subscriptions[i].subscrption = + reinterpret_cast(subscription_p); } return 0; diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp index b99e51a99..18eef8da9 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp @@ -1,20 +1,21 @@ -#include #include - +#include const char* z_bmqt_SessionEventType::toAscii(z_bmqt_SessionEventType::Enum value) { using namespace BloombergLP; - return bmqt::SessionEventType::toAscii(static_cast(value)); + return bmqt::SessionEventType::toAscii( + static_cast(value)); } -bool z_bmqt_SessionEventType::fromAscii(z_bmqt_SessionEventType::Enum* out, const char* str) +bool z_bmqt_SessionEventType::fromAscii(z_bmqt_SessionEventType::Enum* out, + const char* str) { using namespace BloombergLP; bmqt::SessionEventType::Enum p; bool result = bmqt::SessionEventType::fromAscii(&p, str); - *out = static_cast(p); + *out = static_cast(p); return result; } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h index 0f2da805d..a00207c47 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h @@ -56,8 +56,7 @@ struct z_bmqt_SessionEventType { /// corresponding to the specified `str`, if valid, or return false and /// leave `out` untouched if `str` doesn't correspond to any value of /// the enum. - static bool fromAscii(z_bmqt_SessionEventType::Enum* out, - const char* str); + static bool fromAscii(z_bmqt_SessionEventType::Enum* out, const char* str); }; #if defined(__cplusplus) diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp index f33fc350d..ed0932d8e 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// z_bmqt_sessioneventtype.t.cpp -*-C++-*- -#include +// z_bmqt_sessioneventtype.t.cpp -*-C++-*- #include +#include // MWC #include @@ -40,11 +40,12 @@ static void test1_breathingTest() mwctst::TestHelper::printTestName("BREATHING TEST"); z_bmqt_SessionEventType::Enum obj; - bsl::string str; - bool res; + bsl::string str; + bool res; PV("Testing toAscii"); - str = z_bmqt_SessionEventType::toAscii(z_bmqt_SessionEventType::ec_CONNECTED); + str = z_bmqt_SessionEventType::toAscii( + z_bmqt_SessionEventType::ec_CONNECTED); ASSERT_EQ(str, "CONNECTED"); PV("Testing fromAscii"); @@ -76,7 +77,7 @@ static void test2_toAsciiTest() struct Test { z_bmqt_SessionEventType::Enum d_type; - const char* d_expected; + const char* d_expected; } k_DATA[] = { {z_bmqt_SessionEventType::ec_UNDEFINED, "UNDEFINED"}, {z_bmqt_SessionEventType::ec_CONNECTED, "CONNECTED"}, @@ -86,9 +87,11 @@ static void test2_toAsciiTest() {z_bmqt_SessionEventType::ec_STATE_RESTORED, "STATE_RESTORED"}, {z_bmqt_SessionEventType::ec_CONNECTION_TIMEOUT, "CONNECTION_TIMEOUT"}, {z_bmqt_SessionEventType::ec_QUEUE_OPEN_RESULT, "QUEUE_OPEN_RESULT"}, - {z_bmqt_SessionEventType::ec_QUEUE_REOPEN_RESULT, "QUEUE_REOPEN_RESULT"}, + {z_bmqt_SessionEventType::ec_QUEUE_REOPEN_RESULT, + "QUEUE_REOPEN_RESULT"}, {z_bmqt_SessionEventType::ec_QUEUE_CLOSE_RESULT, "QUEUE_CLOSE_RESULT"}, - {z_bmqt_SessionEventType::ec_SLOWCONSUMER_NORMAL, "SLOWCONSUMER_NORMAL"}, + {z_bmqt_SessionEventType::ec_SLOWCONSUMER_NORMAL, + "SLOWCONSUMER_NORMAL"}, {z_bmqt_SessionEventType::ec_SLOWCONSUMER_HIGHWATERMARK, "SLOWCONSUMER_HIGHWATERMARK"}, {z_bmqt_SessionEventType::ec_QUEUE_CONFIGURE_RESULT, @@ -107,7 +110,7 @@ static void test2_toAsciiTest() const size_t k_NUM_DATA = sizeof(k_DATA) / sizeof(*k_DATA); for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { - const Test& test = k_DATA[idx]; + const Test& test = k_DATA[idx]; const char* result = z_bmqt_SessionEventType::toAscii(test.d_type); ASSERT_EQ(strcmp(result, test.d_expected), 0); } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp index 14a503993..5b646362d 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -1,28 +1,33 @@ #include #include - -int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj) { +int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj) +{ using namespace BloombergLP; - bmqt::SessionOptions* options_p = reinterpret_cast(*options_obj); + bmqt::SessionOptions* options_p = reinterpret_cast( + *options_obj); delete options_p; *options_obj = NULL; return 0; } -int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj) { +int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj) +{ using namespace BloombergLP; bmqt::SessionOptions* options_p = new bmqt::SessionOptions(); *options_obj = reinterpret_cast(options_p); return 0; } -const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj) { +const char* +z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj) +{ using namespace BloombergLP; - const bmqt::SessionOptions* options_p = reinterpret_cast(options_obj); + const bmqt::SessionOptions* options_p = + reinterpret_cast(options_obj); return options_p->brokerUri().c_str(); } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h index 269e5bba3..08b6529d6 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h @@ -5,15 +5,14 @@ extern "C" { #endif - typedef struct z_bmqt_SessionOptions z_bmqt_SessionOptions; int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj); int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj); -const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj); - +const char* +z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp index 6f8ef3d54..c0b8bbdcb 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp @@ -48,12 +48,12 @@ static void test1_sessionOptions() { PV("CHECKING brokerUri()"); - bsl::string_view result = z_bmqt_SessionOptions__brokerUri(sessionOptions); + bsl::string_view result = z_bmqt_SessionOptions__brokerUri( + sessionOptions); ASSERT_EQ(sessionOptions_cpp.brokerUri(), result); } } - // ============================================================================ // MAIN PROGRAM // ---------------------------------------------------------------------------- diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp index 69c7e97dd..a88f2bc40 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp @@ -1,83 +1,122 @@ -#include #include #include #include +#include -int z_bmqt_SubscriptionHandle__create(z_bmqt_SubscriptionHandle** subscriptionHandle_obj, const z_bmqt_CorrelationId* cid){ +int z_bmqt_SubscriptionHandle__create( + z_bmqt_SubscriptionHandle** subscriptionHandle_obj, + const z_bmqt_CorrelationId* cid) +{ using namespace BloombergLP; - const bmqt::CorrelationId* correlationId = reinterpret_cast(cid); - bmqt::SubscriptionHandle* subscriptionHandle_p = new bmqt::SubscriptionHandle(*correlationId); - *subscriptionHandle_obj = reinterpret_cast(subscriptionHandle_p); + const bmqt::CorrelationId* correlationId = + reinterpret_cast(cid); + bmqt::SubscriptionHandle* subscriptionHandle_p = + new bmqt::SubscriptionHandle(*correlationId); + *subscriptionHandle_obj = reinterpret_cast( + subscriptionHandle_p); return 0; } -unsigned int z_bmqt_SubscriptionHandle__id(const z_bmqt_SubscriptionHandle* subscriptionHandle_obj){ +unsigned int z_bmqt_SubscriptionHandle__id( + const z_bmqt_SubscriptionHandle* subscriptionHandle_obj) +{ using namespace BloombergLP; - const bmqt::SubscriptionHandle* subscriptionHandle_p = reinterpret_cast(subscriptionHandle_obj); + const bmqt::SubscriptionHandle* subscriptionHandle_p = + reinterpret_cast( + subscriptionHandle_obj); return subscriptionHandle_p->id(); } /////// -int z_bmqt_SubscriptionExpression__create(z_bmqt_SubscriptionExpression** subscriptionExpression_obj){ +int z_bmqt_SubscriptionExpression__create( + z_bmqt_SubscriptionExpression** subscriptionExpression_obj) +{ using namespace BloombergLP; - bmqt::SubscriptionExpression* subscriptionExpression_p = new bmqt::SubscriptionExpression(); - *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_p); + bmqt::SubscriptionExpression* subscriptionExpression_p = + new bmqt::SubscriptionExpression(); + *subscriptionExpression_obj = + reinterpret_cast( + subscriptionExpression_p); return 0; } -int z_bmqt_SubscriptionExpression__createFromString(z_bmqt_SubscriptionExpression** subscriptionExpression_obj, const char* expression, SubscriptionExpressionEnum version){ +int z_bmqt_SubscriptionExpression__createFromString( + z_bmqt_SubscriptionExpression** subscriptionExpression_obj, + const char* expression, + SubscriptionExpressionEnum version) +{ using namespace BloombergLP; bmqt::SubscriptionExpression::Enum v; - switch(version) { - case SubscriptionExpressionEnum::e_NONE: v = bmqt::SubscriptionExpression::e_NONE; - case SubscriptionExpressionEnum::e_VERSION_1: v = bmqt::SubscriptionExpression::e_VERSION_1; - default: return 1; + switch (version) { + case SubscriptionExpressionEnum::e_NONE: + v = bmqt::SubscriptionExpression::e_NONE; + case SubscriptionExpressionEnum::e_VERSION_1: + v = bmqt::SubscriptionExpression::e_VERSION_1; + default: return 1; } - bmqt::SubscriptionExpression* subscriptionExpression_p = new bmqt::SubscriptionExpression(bsl::string(expression), v); + bmqt::SubscriptionExpression* subscriptionExpression_p = + new bmqt::SubscriptionExpression(bsl::string(expression), v); - *subscriptionExpression_obj = reinterpret_cast(subscriptionExpression_p); + *subscriptionExpression_obj = + reinterpret_cast( + subscriptionExpression_p); return 0; } -const char* z_bmqt_SubscriptionExpression__text(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ +const char* z_bmqt_SubscriptionExpression__text( + const z_bmqt_SubscriptionExpression* subscriptionExpression_obj) +{ using namespace BloombergLP; - const bmqt::SubscriptionExpression* subscriptionExpression_p = reinterpret_cast(subscriptionExpression_obj); + const bmqt::SubscriptionExpression* subscriptionExpression_p = + reinterpret_cast( + subscriptionExpression_obj); return subscriptionExpression_p->text().c_str(); } -SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ +SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version( + const z_bmqt_SubscriptionExpression* subscriptionExpression_obj) +{ using namespace BloombergLP; - const bmqt::SubscriptionExpression* subscriptionExpression_p = reinterpret_cast(subscriptionExpression_obj); - switch(subscriptionExpression_p->version()) { - case bmqt::SubscriptionExpression::e_NONE: return SubscriptionExpressionEnum::e_NONE; - case bmqt::SubscriptionExpression::e_VERSION_1: return SubscriptionExpressionEnum::e_VERSION_1; - default: break; + const bmqt::SubscriptionExpression* subscriptionExpression_p = + reinterpret_cast( + subscriptionExpression_obj); + switch (subscriptionExpression_p->version()) { + case bmqt::SubscriptionExpression::e_NONE: + return SubscriptionExpressionEnum::e_NONE; + case bmqt::SubscriptionExpression::e_VERSION_1: + return SubscriptionExpressionEnum::e_VERSION_1; + default: break; } return SubscriptionExpressionEnum::e_SUBSCRIPTIONEXPRESSION_ERROR; } -bool z_bmqt_SubscriptionExpression__isValid(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj){ +bool z_bmqt_SubscriptionExpression__isValid( + const z_bmqt_SubscriptionExpression* subscriptionExpression_obj) +{ using namespace BloombergLP; - const bmqt::SubscriptionExpression* subscriptionExpression_p = reinterpret_cast(subscriptionExpression_obj); + const bmqt::SubscriptionExpression* subscriptionExpression_p = + reinterpret_cast( + subscriptionExpression_obj); return subscriptionExpression_p->isValid(); } /////// -int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj){ +int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj) +{ using namespace BloombergLP; bmqt::Subscription* subscription_p = new bmqt::Subscription(); @@ -86,100 +125,143 @@ int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj){ return 0; } -int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, const z_bmqt_Subscription* other){ +int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, + const z_bmqt_Subscription* other) +{ using namespace BloombergLP; - const bmqt::Subscription* other_p = reinterpret_cast(other); + const bmqt::Subscription* other_p = + reinterpret_cast(other); bmqt::Subscription* subscription_p = new bmqt::Subscription(*other_p); *subscription_obj = reinterpret_cast(subscription_p); return 0; } -int z_bmqt_Subscription__setMaxUnconfirmedMessages(z_bmqt_Subscription* subscription_obj, int value){ +int z_bmqt_Subscription__setMaxUnconfirmedMessages( + z_bmqt_Subscription* subscription_obj, + int value) +{ using namespace BloombergLP; - bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + bmqt::Subscription* subscription_p = reinterpret_cast( + subscription_obj); subscription_p->setMaxUnconfirmedMessages(value); return 0; } -int z_bmqt_Subscription__setMaxUnconfirmedBytes(z_bmqt_Subscription* subscription_obj, int value){ +int z_bmqt_Subscription__setMaxUnconfirmedBytes( + z_bmqt_Subscription* subscription_obj, + int value) +{ using namespace BloombergLP; - bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + bmqt::Subscription* subscription_p = reinterpret_cast( + subscription_obj); subscription_p->setMaxUnconfirmedBytes(value); return 0; } -int z_bmqt_Subscription__setConsumerPriority(z_bmqt_Subscription* subscription_obj, int value){ +int z_bmqt_Subscription__setConsumerPriority( + z_bmqt_Subscription* subscription_obj, + int value) +{ using namespace BloombergLP; - bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + bmqt::Subscription* subscription_p = reinterpret_cast( + subscription_obj); subscription_p->setConsumerPriority(value); return 0; } -int z_bmqt_Subscription__setExpression(z_bmqt_Subscription* subscription_obj, const z_bmqt_SubscriptionExpression* value){ +int z_bmqt_Subscription__setExpression( + z_bmqt_Subscription* subscription_obj, + const z_bmqt_SubscriptionExpression* value) +{ using namespace BloombergLP; - bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); - const bmqt::SubscriptionExpression* expression_p = reinterpret_cast(value); + bmqt::Subscription* subscription_p = reinterpret_cast( + subscription_obj); + const bmqt::SubscriptionExpression* expression_p = + reinterpret_cast(value); subscription_p->setExpression(*expression_p); return 0; } -int z_bmqt_Subscription__maxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj){ +int z_bmqt_Subscription__maxUnconfirmedMessages( + const z_bmqt_Subscription* subscription_obj) +{ using namespace BloombergLP; - const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + const bmqt::Subscription* subscription_p = + reinterpret_cast(subscription_obj); return subscription_p->maxUnconfirmedMessages(); } -int z_bmqt_Subscription__maxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj){ +int z_bmqt_Subscription__maxUnconfirmedBytes( + const z_bmqt_Subscription* subscription_obj) +{ using namespace BloombergLP; - const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + const bmqt::Subscription* subscription_p = + reinterpret_cast(subscription_obj); return subscription_p->maxUnconfirmedBytes(); } -int z_bmqt_Subscription__consumerPriority(const z_bmqt_Subscription* subscription_obj){ +int z_bmqt_Subscription__consumerPriority( + const z_bmqt_Subscription* subscription_obj) +{ using namespace BloombergLP; - const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + const bmqt::Subscription* subscription_p = + reinterpret_cast(subscription_obj); return subscription_p->consumerPriority(); } -const z_bmqt_SubscriptionExpression* z_bmqt_Subscription__expression(const z_bmqt_Subscription* subscription_obj){ +const z_bmqt_SubscriptionExpression* +z_bmqt_Subscription__expression(const z_bmqt_Subscription* subscription_obj) +{ using namespace BloombergLP; - const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); - const bmqt::SubscriptionExpression* expression_p = &(subscription_p->expression()); + const bmqt::Subscription* subscription_p = + reinterpret_cast(subscription_obj); + const bmqt::SubscriptionExpression* expression_p = &( + subscription_p->expression()); - return reinterpret_cast(expression_p); + return reinterpret_cast( + expression_p); } -bool z_bmqt_Subscription__hasMaxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj){ +bool z_bmqt_Subscription__hasMaxUnconfirmedMessages( + const z_bmqt_Subscription* subscription_obj) +{ using namespace BloombergLP; - const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + const bmqt::Subscription* subscription_p = + reinterpret_cast(subscription_obj); return subscription_p->hasMaxUnconfirmedMessages(); } -bool z_bmqt_Subscription__hasMaxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj){ +bool z_bmqt_Subscription__hasMaxUnconfirmedBytes( + const z_bmqt_Subscription* subscription_obj) +{ using namespace BloombergLP; - const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + const bmqt::Subscription* subscription_p = + reinterpret_cast(subscription_obj); return subscription_p->hasMaxUnconfirmedBytes(); } -bool z_bmqt_Subscription__hasConsumerPriority(const z_bmqt_Subscription* subscription_obj){ +bool z_bmqt_Subscription__hasConsumerPriority( + const z_bmqt_Subscription* subscription_obj) +{ using namespace BloombergLP; - const bmqt::Subscription* subscription_p = reinterpret_cast(subscription_obj); + const bmqt::Subscription* subscription_p = + reinterpret_cast(subscription_obj); return subscription_p->hasConsumerPriority(); } \ No newline at end of file diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h index 36ecab0a1..e1dff9c71 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h @@ -1,8 +1,8 @@ #ifndef INCLUDED_Z_BMQT_SUBSCRIPTION #define INCLUDED_Z_BMQT_SUBSCRIPTION -#include #include +#include #if defined(__cplusplus) extern "C" { @@ -14,9 +14,12 @@ extern "C" { typedef struct z_bmqt_SubscriptionHandle z_bmqt_SubscriptionHandle; -int z_bmqt_SubscriptionHandle__create(z_bmqt_SubscriptionHandle** subscriptionHandle_obj, const z_bmqt_CorrelationId* cid); +int z_bmqt_SubscriptionHandle__create( + z_bmqt_SubscriptionHandle** subscriptionHandle_obj, + const z_bmqt_CorrelationId* cid); -unsigned int z_bmqt_SubscriptionHandle__id(const z_bmqt_SubscriptionHandle* subscriptionHandle_obj); +unsigned int z_bmqt_SubscriptionHandle__id( + const z_bmqt_SubscriptionHandle* subscriptionHandle_obj); // ============================ // class SubscriptionExpression @@ -33,15 +36,22 @@ enum SubscriptionExpressionEnum { e_SUBSCRIPTIONEXPRESSION_ERROR }; -int z_bmqt_SubscriptionExpression__create(z_bmqt_SubscriptionExpression** subscriptionExpression_obj); +int z_bmqt_SubscriptionExpression__create( + z_bmqt_SubscriptionExpression** subscriptionExpression_obj); -int z_bmqt_SubscriptionExpression__createFromString(z_bmqt_SubscriptionExpression** subscriptionExpression_obj, const char* expression, SubscriptionExpressionEnum version); +int z_bmqt_SubscriptionExpression__createFromString( + z_bmqt_SubscriptionExpression** subscriptionExpression_obj, + const char* expression, + SubscriptionExpressionEnum version); -const char* z_bmqt_SubscriptionExpression__text(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); +const char* z_bmqt_SubscriptionExpression__text( + const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); -SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); +SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version( + const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); -bool z_bmqt_SubscriptionExpression__isValid(const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); +bool z_bmqt_SubscriptionExpression__isValid( + const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); // ================== // class Subscription @@ -51,29 +61,45 @@ typedef struct z_bmqt_Subscription z_bmqt_Subscription; int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj); -int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, const z_bmqt_Subscription* other); +int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, + const z_bmqt_Subscription* other); -int z_bmqt_Subscription__setMaxUnconfirmedMessages(z_bmqt_Subscription* subscription_obj, int value); +int z_bmqt_Subscription__setMaxUnconfirmedMessages( + z_bmqt_Subscription* subscription_obj, + int value); -int z_bmqt_Subscription__setMaxUnconfirmedBytes(z_bmqt_Subscription* subscription_obj, int value); +int z_bmqt_Subscription__setMaxUnconfirmedBytes( + z_bmqt_Subscription* subscription_obj, + int value); -int z_bmqt_Subscription__setConsumerPriority(z_bmqt_Subscription* subscription_obj, int value); +int z_bmqt_Subscription__setConsumerPriority( + z_bmqt_Subscription* subscription_obj, + int value); -int z_bmqt_Subscription__setExpression(z_bmqt_Subscription* subscription_obj, const z_bmqt_SubscriptionExpression* value); +int z_bmqt_Subscription__setExpression( + z_bmqt_Subscription* subscription_obj, + const z_bmqt_SubscriptionExpression* value); -int z_bmqt_Subscription__maxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj); +int z_bmqt_Subscription__maxUnconfirmedMessages( + const z_bmqt_Subscription* subscription_obj); -int z_bmqt_Subscription__maxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj); +int z_bmqt_Subscription__maxUnconfirmedBytes( + const z_bmqt_Subscription* subscription_obj); -int z_bmqt_Subscription__consumerPriority(const z_bmqt_Subscription* subscription_obj); +int z_bmqt_Subscription__consumerPriority( + const z_bmqt_Subscription* subscription_obj); -const z_bmqt_SubscriptionExpression* z_bmqt_Subscription__expression(const z_bmqt_Subscription* subscription_obj); +const z_bmqt_SubscriptionExpression* +z_bmqt_Subscription__expression(const z_bmqt_Subscription* subscription_obj); -bool z_bmqt_Subscription__hasMaxUnconfirmedMessages(const z_bmqt_Subscription* subscription_obj); +bool z_bmqt_Subscription__hasMaxUnconfirmedMessages( + const z_bmqt_Subscription* subscription_obj); -bool z_bmqt_Subscription__hasMaxUnconfirmedBytes(const z_bmqt_Subscription* subscription_obj); +bool z_bmqt_Subscription__hasMaxUnconfirmedBytes( + const z_bmqt_Subscription* subscription_obj); -bool z_bmqt_Subscription__hasConsumerPriority(const z_bmqt_Subscription* subscription_obj); +bool z_bmqt_Subscription__hasConsumerPriority( + const z_bmqt_Subscription* subscription_obj); #if defined(__cplusplus) } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp index 3814cabfe..2909487d3 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp @@ -1,68 +1,85 @@ #include #include -int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy){ +int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy) +{ using namespace BloombergLP; bmqt::Uri* original_uri_p = reinterpret_cast(to_copy); - bmqt::Uri* copy = new bmqt::Uri(*original_uri_p); - *uri_obj = reinterpret_cast(copy); + bmqt::Uri* copy = new bmqt::Uri(*original_uri_p); + *uri_obj = reinterpret_cast(copy); return 0; } +// URIBUILDER -//URIBUILDER - - -int z_bmqt_UriBuilder__create(z_bmqt_UriBuilder** uribuilder_obj) { +int z_bmqt_UriBuilder__create(z_bmqt_UriBuilder** uribuilder_obj) +{ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_p = new bmqt::UriBuilder(); + bmqt::UriBuilder* uriBuilder_p = new bmqt::UriBuilder(); *uribuilder_obj = reinterpret_cast(uriBuilder_p); return 0; } -int z_bmqt_UriBuilder__createFromUri(z_bmqt_UriBuilder** uribuilder_obj, const z_bmqt_Uri* uri_obj) { +int z_bmqt_UriBuilder__createFromUri(z_bmqt_UriBuilder** uribuilder_obj, + const z_bmqt_Uri* uri_obj) +{ using namespace BloombergLP; - const bmqt::Uri* uri_p = reinterpret_cast(uri_obj); - bmqt::UriBuilder* uriBuilder_p = new bmqt::UriBuilder(*uri_p); + const bmqt::Uri* uri_p = reinterpret_cast(uri_obj); + bmqt::UriBuilder* uriBuilder_p = new bmqt::UriBuilder(*uri_p); *uribuilder_obj = reinterpret_cast(uriBuilder_p); return 0; } -int z_bmqt_UriBuilder__setDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ +int z_bmqt_UriBuilder__setDomain(z_bmqt_UriBuilder* uribuilder_obj, + const char* value) +{ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast( + uribuilder_obj); uriBuilder_p->setDomain(value); return 0; } -int z_bmqt_UriBuilder__setTier(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ +int z_bmqt_UriBuilder__setTier(z_bmqt_UriBuilder* uribuilder_obj, + const char* value) +{ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast( + uribuilder_obj); uriBuilder_p->setTier(value); return 0; } -int z_bmqt_UriBuilder__setQualifiedDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ +int z_bmqt_UriBuilder__setQualifiedDomain(z_bmqt_UriBuilder* uribuilder_obj, + const char* value) +{ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast( + uribuilder_obj); uriBuilder_p->setQualifiedDomain(value); return 0; } -int z_bmqt_UriBuilder__setQueue(z_bmqt_UriBuilder* uribuilder_obj, const char* value){ +int z_bmqt_UriBuilder__setQueue(z_bmqt_UriBuilder* uribuilder_obj, + const char* value) +{ using namespace BloombergLP; - bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uribuilder_obj); + bmqt::UriBuilder* uriBuilder_p = reinterpret_cast( + uribuilder_obj); uriBuilder_p->setQueue(value); return 0; } -int z_bmqt_UriBuilder_uri(z_bmqt_UriBuilder* uribuilder_obj, z_bmqt_Uri** uri_obj){ +int z_bmqt_UriBuilder_uri(z_bmqt_UriBuilder* uribuilder_obj, + z_bmqt_Uri** uri_obj) +{ using namespace BloombergLP; - const bmqt::UriBuilder* uriBuilder_p = reinterpret_cast(uri_obj); + const bmqt::UriBuilder* uriBuilder_p = reinterpret_cast( + uri_obj); bmqt::Uri* uri_p = new bmqt::Uri(); - int res = uriBuilder_p->uri(uri_p); // support error description ? - if(res != 0){ + int res = uriBuilder_p->uri(uri_p); // support error description ? + if (res != 0) { delete uri_p; return res; } diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.h b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.h index a043d7054..aad409736 100644 --- a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.h +++ b/src/groups/z_bmq/z_bmqt/z_bmqt_uri.h @@ -11,10 +11,8 @@ extern "C" { typedef struct z_bmqt_Uri z_bmqt_Uri; - int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy); - // ================ // class UriBuilder // ================ @@ -23,18 +21,23 @@ typedef struct z_bmqt_UriBuilder z_bmqt_UriBuilder; int z_bmqt_UriBuilder__create(z_bmqt_UriBuilder** uribuilder_obj); -int z_bmqt_UriBuilder__createFromUri(z_bmqt_UriBuilder** uribuilder_obj, const z_bmqt_Uri* uri_obj); - -int z_bmqt_UriBuilder__setDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value); +int z_bmqt_UriBuilder__createFromUri(z_bmqt_UriBuilder** uribuilder_obj, + const z_bmqt_Uri* uri_obj); -int z_bmqt_UriBuilder__setTier(z_bmqt_UriBuilder* uribuilder_obj, const char* value); +int z_bmqt_UriBuilder__setDomain(z_bmqt_UriBuilder* uribuilder_obj, + const char* value); -int z_bmqt_UriBuilder__setQualifiedDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value); +int z_bmqt_UriBuilder__setTier(z_bmqt_UriBuilder* uribuilder_obj, + const char* value); -int z_bmqt_UriBuilder__setQueue(z_bmqt_UriBuilder* uribuilder_obj, const char* value); +int z_bmqt_UriBuilder__setQualifiedDomain(z_bmqt_UriBuilder* uribuilder_obj, + const char* value); -int z_bmqt_UriBuilder_uri(z_bmqt_UriBuilder* uribuilder_obj, z_bmqt_Uri** uri_obj); +int z_bmqt_UriBuilder__setQueue(z_bmqt_UriBuilder* uribuilder_obj, + const char* value); +int z_bmqt_UriBuilder_uri(z_bmqt_UriBuilder* uribuilder_obj, + z_bmqt_Uri** uri_obj); #if defined(__cplusplus) } From eb918c7944da40173d4f719cd54f5c107250d8bb Mon Sep 17 00:00:00 2001 From: Simon-Sandrew Date: Fri, 26 Jan 2024 13:39:42 -0500 Subject: [PATCH 44/57] test --- test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 000000000..90bfcb510 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +this is a test From 3e7c9070abffdf7b2849fd276bb174c5efa2c14d Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 26 Jan 2024 14:10:03 -0500 Subject: [PATCH 45/57] Moved z_bmq into wrappers/z_bmq --- src/groups/CMakeLists.txt | 2 +- .../{ => wrappers}/z_bmq/CMakeLists.txt | 0 src/groups/{ => wrappers}/z_bmq/doc/z_bmq.txt | 0 .../{ => wrappers}/z_bmq/group/z_bmq.dep | 0 .../{ => wrappers}/z_bmq/group/z_bmq.mem | 0 .../{ => wrappers}/z_bmq/group/z_bmq.t.dep | 0 src/groups/wrappers/z_bmq/z-bmq.pc | 10 +++++ src/groups/wrappers/z_bmq/z_bmqConfig.cmake | 41 +++++++++++++++++++ .../{ => wrappers}/z_bmq/z_bmq_demo/demo.c | 0 .../z_bmq/z_bmqa/package/z_bmqa.dep | 0 .../z_bmq/z_bmqa/package/z_bmqa.mem | 0 .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.h | 0 .../z_bmqa/z_bmqa_configurequeuestatus.cpp | 0 .../z_bmqa/z_bmqa_configurequeuestatus.h | 0 .../z_bmqa/z_bmqa_confirmeventbuilder.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 0 .../z_bmq/z_bmqa/z_bmqa_event.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_event.h | 0 .../z_bmq/z_bmqa/z_bmqa_message.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_message.h | 0 .../z_bmq/z_bmqa/z_bmqa_messageevent.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_messageevent.h | 0 .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 0 .../z_bmq/z_bmqa/z_bmqa_messageiterator.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_messageiterator.h | 0 .../z_bmq/z_bmqa/z_bmqa_messageproperties.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_messageproperties.h | 0 .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.h | 0 .../z_bmq/z_bmqa/z_bmqa_queueid.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_queueid.h | 0 .../z_bmq/z_bmqa/z_bmqa_session.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_session.h | 0 .../z_bmq/z_bmqa/z_bmqa_session.t.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_sessionevent.cpp | 0 .../z_bmq/z_bmqa/z_bmqa_sessionevent.h | 0 .../z_bmq/z_bmqt/package/z_bmqt.dep | 0 .../z_bmq/z_bmqt/package/z_bmqt.mem | 0 .../z_bmqt_compressionalgorithmtype.cpp | 0 .../z_bmqt/z_bmqt_compressionalgorithmtype.h | 0 .../z_bmqt_compressionalgorithmtype.t.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 0 .../z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_messageeventtype.h | 0 .../z_bmqt/z_bmqt_messageeventtype.t.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_messageguid.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_messageguid.h | 0 .../z_bmq/z_bmqt/z_bmqt_queueflags.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_queueflags.h | 0 .../z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_queueoptions.h | 0 .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.h | 0 .../z_bmqt/z_bmqt_sessioneventtype.t.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_sessionoptions.h | 0 .../z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_subscription.cpp | 0 .../z_bmq/z_bmqt/z_bmqt_subscription.h | 0 .../z_bmq/z_bmqt/z_bmqt_types.h | 0 .../z_bmq/z_bmqt/z_bmqt_uri.cpp | 0 .../{ => wrappers}/z_bmq/z_bmqt/z_bmqt_uri.h | 0 65 files changed, 52 insertions(+), 1 deletion(-) rename src/groups/{ => wrappers}/z_bmq/CMakeLists.txt (100%) rename src/groups/{ => wrappers}/z_bmq/doc/z_bmq.txt (100%) rename src/groups/{ => wrappers}/z_bmq/group/z_bmq.dep (100%) rename src/groups/{ => wrappers}/z_bmq/group/z_bmq.mem (100%) rename src/groups/{ => wrappers}/z_bmq/group/z_bmq.t.dep (100%) create mode 100644 src/groups/wrappers/z_bmq/z-bmq.pc create mode 100644 src/groups/wrappers/z_bmq/z_bmqConfig.cmake rename src/groups/{ => wrappers}/z_bmq/z_bmq_demo/demo.c (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/package/z_bmqa.dep (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/package/z_bmqa.mem (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_event.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_event.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_message.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_message.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_messageevent.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_messageevent.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_messageiterator.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_messageproperties.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_queueid.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_queueid.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_session.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_session.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_session.t.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqa/z_bmqa_sessionevent.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/package/z_bmqt.dep (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/package/z_bmqt.mem (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_correlationid.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_correlationid.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_messageeventtype.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_messageeventtype.t.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_messageguid.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_messageguid.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_queueflags.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_queueflags.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_queueoptions.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_sessionoptions.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_subscription.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_subscription.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_types.h (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_uri.cpp (100%) rename src/groups/{ => wrappers}/z_bmq/z_bmqt/z_bmqt_uri.h (100%) diff --git a/src/groups/CMakeLists.txt b/src/groups/CMakeLists.txt index fcbff14a0..d40e75572 100644 --- a/src/groups/CMakeLists.txt +++ b/src/groups/CMakeLists.txt @@ -4,4 +4,4 @@ add_subdirectory(mwc) add_subdirectory(bmq) add_subdirectory(mqb) -add_subdirectory(z_bmq) +add_subdirectory(wrappers/z_bmq) diff --git a/src/groups/z_bmq/CMakeLists.txt b/src/groups/wrappers/z_bmq/CMakeLists.txt similarity index 100% rename from src/groups/z_bmq/CMakeLists.txt rename to src/groups/wrappers/z_bmq/CMakeLists.txt diff --git a/src/groups/z_bmq/doc/z_bmq.txt b/src/groups/wrappers/z_bmq/doc/z_bmq.txt similarity index 100% rename from src/groups/z_bmq/doc/z_bmq.txt rename to src/groups/wrappers/z_bmq/doc/z_bmq.txt diff --git a/src/groups/z_bmq/group/z_bmq.dep b/src/groups/wrappers/z_bmq/group/z_bmq.dep similarity index 100% rename from src/groups/z_bmq/group/z_bmq.dep rename to src/groups/wrappers/z_bmq/group/z_bmq.dep diff --git a/src/groups/z_bmq/group/z_bmq.mem b/src/groups/wrappers/z_bmq/group/z_bmq.mem similarity index 100% rename from src/groups/z_bmq/group/z_bmq.mem rename to src/groups/wrappers/z_bmq/group/z_bmq.mem diff --git a/src/groups/z_bmq/group/z_bmq.t.dep b/src/groups/wrappers/z_bmq/group/z_bmq.t.dep similarity index 100% rename from src/groups/z_bmq/group/z_bmq.t.dep rename to src/groups/wrappers/z_bmq/group/z_bmq.t.dep diff --git a/src/groups/wrappers/z_bmq/z-bmq.pc b/src/groups/wrappers/z_bmq/z-bmq.pc new file mode 100644 index 000000000..305b17912 --- /dev/null +++ b/src/groups/wrappers/z_bmq/z-bmq.pc @@ -0,0 +1,10 @@ +prefix=/usr/local +libdir=${prefix}//home/jon/cs/bb/simon-fork/blazingmq +includedir=${prefix}/include + +Name: z-bmq +Description: z_bmq +Version: 0.0.0 +Requires.private: bmq bsl +Libs: -L${libdir} -lz_bmq +Cflags: -I${includedir} diff --git a/src/groups/wrappers/z_bmq/z_bmqConfig.cmake b/src/groups/wrappers/z_bmq/z_bmqConfig.cmake new file mode 100644 index 000000000..3dbf955cd --- /dev/null +++ b/src/groups/wrappers/z_bmq/z_bmqConfig.cmake @@ -0,0 +1,41 @@ + +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was uorConfig.cmake.in ######## + +get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../../../../../usr/local" ABSOLUTE) + +macro(set_and_check _var _file) + set(${_var} "${_file}") + if(NOT EXISTS "${_file}") + message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") + endif() +endmacro() + +macro(check_required_components _NAME) + foreach(comp ${${_NAME}_FIND_COMPONENTS}) + if(NOT ${_NAME}_${comp}_FOUND) + if(${_NAME}_FIND_REQUIRED_${comp}) + set(${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() + +#################################################################################### + +include(CMakeFindDependencyMacro) + +if(NOT TARGET z_bmq) + if(NOT WIN32) + find_dependency(Threads) + endif() + + foreach(dep bmq;bsl) + find_dependency(${dep}) + endforeach() + + include(${CMAKE_CURRENT_LIST_DIR}/z_bmqTargets.cmake) +endif() + +check_required_components(z_bmq) diff --git a/src/groups/z_bmq/z_bmq_demo/demo.c b/src/groups/wrappers/z_bmq/z_bmq_demo/demo.c similarity index 100% rename from src/groups/z_bmq/z_bmq_demo/demo.c rename to src/groups/wrappers/z_bmq/z_bmq_demo/demo.c diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.dep b/src/groups/wrappers/z_bmq/z_bmqa/package/z_bmqa.dep similarity index 100% rename from src/groups/z_bmq/z_bmqa/package/z_bmqa.dep rename to src/groups/wrappers/z_bmq/z_bmqa/package/z_bmqa.dep diff --git a/src/groups/z_bmq/z_bmqa/package/z_bmqa.mem b/src/groups/wrappers/z_bmq/z_bmqa/package/z_bmqa.mem similarity index 100% rename from src/groups/z_bmq/z_bmqa/package/z_bmqa.mem rename to src/groups/wrappers/z_bmq/z_bmqa/package/z_bmqa.mem diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_event.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_event.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_event.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_event.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_event.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_event.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_event.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_message.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_message.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_messageevent.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_messageiterator.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_messageproperties.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_queueid.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_queueid.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_session.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_session.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.t.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_session.t.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.t.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp diff --git a/src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h similarity index 100% rename from src/groups/z_bmq/z_bmqa/z_bmqa_sessionevent.h rename to src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.dep b/src/groups/wrappers/z_bmq/z_bmqt/package/z_bmqt.dep similarity index 100% rename from src/groups/z_bmq/z_bmqt/package/z_bmqt.dep rename to src/groups/wrappers/z_bmq/z_bmqt/package/z_bmqt.dep diff --git a/src/groups/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/wrappers/z_bmq/z_bmqt/package/z_bmqt.mem similarity index 100% rename from src/groups/z_bmq/z_bmqt/package/z_bmqt.mem rename to src/groups/wrappers/z_bmq/z_bmqt/package/z_bmqt.mem diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.t.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_correlationid.h rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageeventtype.h similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.h rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageeventtype.h diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.t.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageeventtype.t.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_messageeventtype.t.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageeventtype.t.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_messageguid.h rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueflags.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueflags.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueflags.h similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_queueflags.h rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueflags.h diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.h similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_queueoptions.h rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.h diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.t.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.h similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.h rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.h diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.t.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_subscription.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.h similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_subscription.h rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.h diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_types.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_types.h similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_types.h rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_types.h diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_uri.cpp similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_uri.cpp rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_uri.cpp diff --git a/src/groups/z_bmq/z_bmqt/z_bmqt_uri.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_uri.h similarity index 100% rename from src/groups/z_bmq/z_bmqt/z_bmqt_uri.h rename to src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_uri.h From a6d0ffc91c7750b7b823cda7cf8e62f83c73648c Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 26 Jan 2024 14:11:30 -0500 Subject: [PATCH 46/57] Removed z_bmq_demo --- src/groups/wrappers/z_bmq/z_bmq_demo/demo.c | 83 --------------------- 1 file changed, 83 deletions(-) delete mode 100644 src/groups/wrappers/z_bmq/z_bmq_demo/demo.c diff --git a/src/groups/wrappers/z_bmq/z_bmq_demo/demo.c b/src/groups/wrappers/z_bmq/z_bmq_demo/demo.c deleted file mode 100644 index d75f39ee8..000000000 --- a/src/groups/wrappers/z_bmq/z_bmq_demo/demo.c +++ /dev/null @@ -1,83 +0,0 @@ -#include -#include -#include -#include - -const int K_QUEUE_ID = 1; -const char K_QUEUE_URL[] = "bmq://bmq.test.mem.priority/test-queue"; -const int K_NUM_MESSAGES = 5; - - enum QueueFlags { - e_ADMIN = (1 << 0) // The queue is opened in admin mode (Valid only - // for BlazingMQ admin tasks) - , - e_READ = (1 << 1) // The queue is opened for consuming messages - , - e_WRITE = (1 << 2) // The queue is opened for posting messages - , - e_ACK = (1 << 3) // Set to indicate interested in receiving - // 'ACK' events for all message posted -}; - - -void postEvent(const char** text, - z_bmqa_QueueId* queueId, - z_bmqa_Session* session){ - - z_bmqa_MessageEventBuilder* builder; - z_bmqa_MessageEventBuilder__create(builder); - - z_bmqa_Session__loadMessageEventBuilder(session, builder); - - z_bmqa_Message* message; - z_bmqa_MessageEventBuilder__startMessage(builder, message); - - z_bmqa_Message_setDataRef(message, text, strlen(text)); - - z_bmqa_MessageEventBuilder__packMessage(builder, queueId); - - const z_bmqa_MessageEvent* messageEvent; - z_bmqa_MessageEventBuilder__messageEvent(builder, messageEvent); - - z_bmqa_Session__post(session, messageEvent); -} - - -void produce(z_bmqa_Session* session){ - z_bmqa_QueueId* queueId; - - z_bmqa_QueueId__createFromNumeric(queueId, K_QUEUE_ID); - z_bmqa_Session__openQueueSync(session, - queueId, - K_QUEUE_URL, - e_WRITE); - - const char*** messages = {"Hello world!", - "message 1", - "message 2", - "message 3", - "Good Bye!"}; - for(int idx = 0; idx < 5; ++idx){ - postEvent(messages[idx], queueId, session); - } - - z_bmqa_Session__closeQueueSync(session, queueId); -} - -int main(){ - z_bmqa_Session* session; - z_bmqt_SessionOptions* options; - - z_bmqt_SessionOptions__create(&options); - z_bmqa_Session__create(&session, &options); - - - //start the session - z_bmqa_Session__start(session, 1000); - - produce(session); - - //stop the session - z_bmqa_Session__stop(session); - -} \ No newline at end of file From a234e0c2fbba63303711c50b0b3f748c28280a9c Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 26 Jan 2024 14:49:22 -0500 Subject: [PATCH 47/57] Addressed some comments from the december PR --- src/groups/wrappers/z_bmq/doc/z_bmq.txt | 2 +- .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp | 2 ++ .../z_bmqa/z_bmqa_configurequeuestatus.cpp | 2 ++ .../z_bmqa/z_bmqa_confirmeventbuilder.cpp | 17 ++--------- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 5 +--- .../wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp | 22 ++++---------- .../wrappers/z_bmq/z_bmqa/z_bmqa_message.h | 10 +++---- .../z_bmq/z_bmqa/z_bmqa_messageevent.cpp | 2 ++ .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 17 ++--------- .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 5 +--- .../z_bmq/z_bmqa/z_bmqa_messageiterator.cpp | 22 +++++++------- .../z_bmq/z_bmqa/z_bmqa_messageiterator.h | 2 +- .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp | 4 ++- .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.h | 2 +- .../wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp | 14 ++------- .../wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h | 2 -- .../wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp | 2 ++ .../z_bmq/z_bmqa/z_bmqa_sessionevent.cpp | 6 ++++ .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 20 +++---------- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 30 +++++++++---------- .../z_bmq/z_bmqt/z_bmqt_messageguid.cpp | 14 ++------- .../z_bmq/z_bmqt/z_bmqt_messageguid.h | 3 -- .../z_bmq/z_bmqt/z_bmqt_queueoptions.cpp | 2 ++ .../z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp | 2 ++ 24 files changed, 76 insertions(+), 133 deletions(-) diff --git a/src/groups/wrappers/z_bmq/doc/z_bmq.txt b/src/groups/wrappers/z_bmq/doc/z_bmq.txt index abc7e2acd..ae191a077 100644 --- a/src/groups/wrappers/z_bmq/doc/z_bmq.txt +++ b/src/groups/wrappers/z_bmq/doc/z_bmq.txt @@ -1,4 +1,4 @@ - bmq.txt + z_bmq.txt @PURPOSE: Public SDK API for the BlazingMQ framework. diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp index 5d2d08a91..fcf6f3f38 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp @@ -5,6 +5,8 @@ int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** status_obj) { using namespace BloombergLP; + BSLS_ASSERT(status_obj != NULL); + bmqa::CloseQueueStatus* status_p = reinterpret_cast(*status_obj); delete status_p; diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp index bd641359e..21a82b1ca 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp @@ -6,6 +6,8 @@ int z_bmqa_ConfigureQueueStatus__delete( { using namespace BloombergLP; + BSLS_ASSERT(status_obj != NULL); + bmqa::ConfigureQueueStatus* status_p = reinterpret_cast(*status_obj); delete status_p; diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp index cdf3b4eec..dea17a2d6 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp @@ -6,6 +6,8 @@ int z_bmqa_ConfirmEventBuilder__delete( { using namespace BloombergLP; + BSLS_ASSERT(builder_obj != NULL); + bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(*builder_obj); delete builder_p; @@ -14,19 +16,6 @@ int z_bmqa_ConfirmEventBuilder__delete( return 0; } -int z_bmqa_ConfirmEventBuilder__deleteConst( - z_bmqa_ConfirmEventBuilder const** builder_obj) -{ - using namespace BloombergLP; - - const bmqa::ConfirmEventBuilder* builder_p = - reinterpret_cast(*builder_obj); - delete builder_p; - *builder_obj = NULL; - - return 0; -} - int z_bmqa_ConfirmEventBuilder__create( z_bmqa_ConfirmEventBuilder** builder_obj) { @@ -86,7 +75,7 @@ int z_bmqa_ConfirmEventBuilder__messageCount( } int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, - z_bmqt_Blob const** blob_obj) + const z_bmqt_Blob** blob_obj) { using namespace BloombergLP; diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index cc17801c6..c24bb6a43 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -15,9 +15,6 @@ typedef struct z_bmqa_MessageConfirmationCookie int z_bmqa_ConfirmEventBuilder__delete( z_bmqa_ConfirmEventBuilder** builder_obj); -int z_bmqa_ConfirmEventBuilder__deleteConst( - z_bmqa_ConfirmEventBuilder const** builder_obj); - int z_bmqa_ConfirmEventBuilder__create( z_bmqa_ConfirmEventBuilder** builder_obj); @@ -36,7 +33,7 @@ int z_bmqa_ConfirmEventBuilder__messageCount( int z_bmqa_ConfirmEventBuilder__blob( const z_bmqa_ConfirmEventBuilder* builder_obj, - z_bmqt_Blob const** blob_obj); + const z_bmqt_Blob** blob_obj); #if defined(__cplusplus) } diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp index 3b6b47597..f4527a44c 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -9,19 +9,9 @@ int z_bmqa_Message__delete(z_bmqa_Message** message_obj) { using namespace BloombergLP; - bmqa::Message* message_p = reinterpret_cast(*message_obj); - delete message_p; - *message_obj = NULL; - - return 0; -} + BSLS_ASSERT(message_obj != NULL); -int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj) -{ - using namespace BloombergLP; - - const bmqa::Message* message_p = reinterpret_cast( - *message_obj); + bmqa::Message* message_p = reinterpret_cast(*message_obj); delete message_p; *message_obj = NULL; @@ -137,7 +127,7 @@ int z_bmqa_Message__clone(const z_bmqa_Message* message_obj, } int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, - z_bmqa_QueueId const** queueId_obj) + const z_bmqa_QueueId** queueId_obj) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( @@ -150,7 +140,7 @@ int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, int z_bmqa_Message__correlationId( const z_bmqa_Message* message_obj, - z_bmqt_CorrelationId const** correlationId_obj) + const z_bmqt_CorrelationId** correlationId_obj) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( @@ -163,7 +153,7 @@ int z_bmqa_Message__correlationId( int z_bmqa_Message__subscriptionHandle( const z_bmqa_Message* message_obj, - z_bmqt_SubscriptionHandle const** subscription_obj) + const z_bmqt_SubscriptionHandle** subscription_obj) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( @@ -199,7 +189,7 @@ const char* z_bmqa_Message__groupId(const z_bmqa_Message* message_obj) #endif int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, - z_bmqt_MessageGUID const** messageGUID_obj) + const z_bmqt_MessageGUID** messageGUID_obj) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h index 82b7798d0..7b61b2521 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h @@ -20,8 +20,6 @@ typedef struct z_bmqa_MessageConfirmationCookie int z_bmqa_Message__delete(z_bmqa_Message** message_obj); -int z_bmqa_Message__deleteConst(z_bmqa_Message const** message_obj); - int z_bmqa_Message__create(z_bmqa_Message** message_obj); int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, @@ -55,15 +53,15 @@ int z_bmqa_Message__clone(const z_bmqa_Message* message_obj, z_bmqa_Message** other_obj); int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, - z_bmqa_QueueId const** queueId_obj); + const z_bmqa_QueueId** queueId_obj); int z_bmqa_Message__correlationId( const z_bmqa_Message* message_obj, - z_bmqt_CorrelationId const** correlationId_obj); + const z_bmqt_CorrelationId** correlationId_obj); int z_bmqa_Message__subscriptionHandle( const z_bmqa_Message* message_obj, - z_bmqt_SubscriptionHandle const** subscription_obj); + const z_bmqt_SubscriptionHandle** subscription_obj); z_bmqt_CompressionAlgorithmType::Enum z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message_obj); @@ -75,7 +73,7 @@ const char* z_bmqa_Message__groupId(const z_bmqa_Message* message_obj); #endif int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, - z_bmqt_MessageGUID const** messageGUID_obj); + const z_bmqt_MessageGUID** messageGUID_obj); int z_bmqa_Message__confirmationCookie( const z_bmqa_Message* message_obj, diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp index e741c234e..f3ae58b30 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp @@ -7,6 +7,8 @@ int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj) { using namespace BloombergLP; + BSLS_ASSERT(event_obj != NULL); + bmqa::MessageEvent* event_p = reinterpret_cast( *event_obj); delete event_p; diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp index 4f004e504..f855257bb 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp @@ -7,6 +7,8 @@ int z_bmqa_MessageEventBuilder__delete( { using namespace BloombergLP; + BSLS_ASSERT(builder_obj != NULL); + bmqa::MessageEventBuilder* builder_p = reinterpret_cast(*builder_obj); delete builder_p; @@ -15,19 +17,6 @@ int z_bmqa_MessageEventBuilder__delete( return 0; } -int z_bmqa_MessageEventBuilder__deleteConst( - z_bmqa_MessageEventBuilder const** builder_obj) -{ - using namespace BloombergLP; - - const bmqa::MessageEventBuilder* builder_p = - reinterpret_cast(*builder_obj); - delete builder_p; - *builder_obj = NULL; - - return 0; -} - int z_bmqa_MessageEventBuilder__create( z_bmqa_MessageEventBuilder** builder_obj) { @@ -79,7 +68,7 @@ int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj) int z_bmqa_MessageEventBuilder__messageEvent( z_bmqa_MessageEventBuilder* builder_obj, - z_bmqa_MessageEvent const** event_obj) + const z_bmqa_MessageEvent** event_obj) { using namespace BloombergLP; diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index 69395bd18..a94aa7d14 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -14,9 +14,6 @@ typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; int z_bmqa_MessageEventBuilder__delete( z_bmqa_MessageEventBuilder** builder_obj); -int z_bmqa_MessageEventBuilder__deleteConst( - z_bmqa_MessageEventBuilder const** builder_obj); - int z_bmqa_MessageEventBuilder__create( z_bmqa_MessageEventBuilder** builder_obj); @@ -32,7 +29,7 @@ int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj); int z_bmqa_MessageEventBuilder__messageEvent( z_bmqa_MessageEventBuilder* builder_obj, - z_bmqa_MessageEvent const** event_obj); + const z_bmqa_MessageEvent** event_obj); int z_bmqa_MessageEventBuilder__currentMessage( z_bmqa_MessageEventBuilder* builder_obj, diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp index 803c2c726..c36988a71 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp @@ -1,28 +1,30 @@ #include #include -int z_bmqa_MessageIterator__create( +int z_bmqa_MessageIterator__delete( z_bmqa_MessageIterator** messageIterator_obj) { using namespace BloombergLP; - bmqa::MessageIterator* messageIterator_p = new bmqa::MessageIterator(); + BSLS_ASSERT(messageIterator_obj != NULL); - *messageIterator_obj = reinterpret_cast( - messageIterator_p); + bmqa::MessageIterator* messageIterator_p = + reinterpret_cast(*messageIterator_obj); + delete messageIterator_p; + *messageIterator_obj = NULL; return 0; } -int z_bmqa_MessageIterator__delete( +int z_bmqa_MessageIterator__create( z_bmqa_MessageIterator** messageIterator_obj) { using namespace BloombergLP; - bmqa::MessageIterator* messageIterator_p = - reinterpret_cast(messageIterator_obj); - delete messageIterator_p; - *messageIterator_obj = NULL; + bmqa::MessageIterator* messageIterator_p = new bmqa::MessageIterator(); + + *messageIterator_obj = reinterpret_cast( + messageIterator_p); return 0; } @@ -40,7 +42,7 @@ bool z_bmqa_MessageIterator__nextMessage( int z_bmqa_MessageIterator__message( const z_bmqa_MessageIterator* messageIterator_obj, - z_bmqa_Message const** message_obj) + const z_bmqa_Message** message_obj) { using namespace BloombergLP; diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h index 8c046985a..012211c66 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h @@ -21,7 +21,7 @@ bool z_bmqa_MessageIterator__nextMessage( int z_bmqa_MessageIterator__message( const z_bmqa_MessageIterator* messageIterator_obj, - z_bmqa_Message const** message_obj); + const z_bmqa_Message** message_obj); #if defined(__cplusplus) } diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp index 7cca0570e..bd12ee45e 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp @@ -5,6 +5,8 @@ int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj) { using namespace BloombergLP; + BSLS_ASSERT(status_obj != NULL); + bmqa::OpenQueueStatus* status_p = reinterpret_cast( *status_obj); delete status_p; @@ -68,7 +70,7 @@ bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj) } int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, - z_bmqa_QueueId const** queueId_obj) + const z_bmqa_QueueId** queueId_obj) { using namespace BloombergLP; const bmqa::OpenQueueStatus* status_p = diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h index fbb833e73..ded5912a0 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h @@ -25,7 +25,7 @@ int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj); int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, - z_bmqa_QueueId const** queueId_obj); + const z_bmqa_QueueId** queueId_obj); int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp index e4aca9dc3..c9ff9cc33 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp @@ -6,19 +6,9 @@ int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj) { using namespace BloombergLP; - bmqa::QueueId* queueId_p = reinterpret_cast(*queueId_obj); - delete queueId_p; - *queueId_obj = NULL; - - return 0; -} + BSLS_ASSERT(queueId_obj != NULL); -int z_bmqa_QueueId__deleteConst(z_bmqa_QueueId const** queueId_obj) -{ - using namespace BloombergLP; - - const bmqa::QueueId* queueId_p = reinterpret_cast( - *queueId_obj); + bmqa::QueueId* queueId_p = reinterpret_cast(*queueId_obj); delete queueId_p; *queueId_obj = NULL; diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h index f315253f7..173ff864a 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h @@ -14,8 +14,6 @@ typedef struct z_bmqa_QueueId z_bmqa_QueueId; int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj); -int z_bmqa_QueueId__deleteConst(z_bmqa_QueueId const** queueId_obj); - int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj); int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp index 4dea8d48a..82b346ddf 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -103,6 +103,8 @@ int z_bmqa_Session__delete(z_bmqa_Session** session_obj) { using namespace BloombergLP; + BSLS_ASSERT(session_obj != NULL); + bmqa::Session* session_p = reinterpret_cast(*session_obj); delete session_p; *session_obj = NULL; diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp index 262270a54..2346899c6 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp @@ -5,6 +5,12 @@ int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** event_obj) { using namespace BloombergLP; + BSLS_ASSERT(event_obj != NULL); + + bmqa::SessionEvent* event_p = reinterpret_cast(*event_obj); + delete event_p; + *event_obj = NULL; + return 0; } diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp index dddf4fc8d..358d030eb 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -5,6 +5,8 @@ int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj) { using namespace BloombergLP; + BSLS_ASSERT(correlationId_obj != NULL); + bmqt::CorrelationId* correlationId_p = reinterpret_cast(*correlationId_obj); delete correlationId_p; @@ -147,28 +149,14 @@ void* z_bmqt_CorrelationId__thePointer( return correlationId_p->thePointer(); } -CorrelationId_Type +z_bmqt_CorrelationId::Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId_obj); - switch (correlationId_p->type()) { - case bmqt::CorrelationId::Type::e_NUMERIC: - return CorrelationId_Type::ec_NUMERIC; - case bmqt::CorrelationId::Type::e_POINTER: - return CorrelationId_Type::ec_POINTER; - case bmqt::CorrelationId::Type::e_SHARED_PTR: - return CorrelationId_Type::ec_SHARED_PTR; - case bmqt::CorrelationId::Type::e_AUTO_VALUE: - return CorrelationId_Type::ec_AUTO_VALUE; - case bmqt::CorrelationId::Type::e_UNSET: - return CorrelationId_Type::ec_UNSET; - default: break; - } - - return CorrelationId_Type::ec_CORRELATIONID_ERROR; + return static_cast(correlationId_p->type()); } int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj) diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h index 2d1473433..b260f9db5 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -7,21 +7,19 @@ extern "C" { #endif -typedef struct z_bmqt_CorrelationId z_bmqt_CorrelationId; - -enum CorrelationId_Type { - ec_NUMERIC // the 'CorrelationId' holds a 64-bit integer - , - ec_POINTER // the 'CorrelationId' holds a raw pointer - , - ec_SHARED_PTR // the 'CorrelationId' holds a shared pointer - , - ec_AUTO_VALUE // the 'CorrelationId' holds an auto value - , - ec_UNSET // the 'CorrelationId' is not set - , - ec_CORRELATIONID_ERROR // error -}; +typedef struct z_bmqt_CorrelationId { + enum Type { + ec_NUMERIC // the 'CorrelationId' holds a 64-bit integer + , + ec_POINTER // the 'CorrelationId' holds a raw pointer + , + ec_SHARED_PTR // the 'CorrelationId' holds a shared pointer + , + ec_AUTO_VALUE // the 'CorrelationId' holds an auto value + , + ec_UNSET // the 'CorrelationId' is not set + }; +} z_bmqt_CorrelationId; int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj); @@ -62,7 +60,7 @@ int64_t z_bmqt_CorrelationId__theNumeric( void* z_bmqt_CorrelationId__thePointer( const z_bmqt_CorrelationId* correlation_Id_obj); -CorrelationId_Type +z_bmqt_CorrelationId::Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlation_Id_obj); int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj); diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp index e52633cc5..1e12569bd 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp @@ -7,6 +7,8 @@ int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj) { using namespace BloombergLP; + BSLS_ASSERT(messageGUID_obj != NULL); + bmqt::MessageGUID* messageGUID_p = reinterpret_cast( *messageGUID_obj); delete messageGUID_p; @@ -15,18 +17,6 @@ int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj) return 0; } -int z_bmqt_MessageGUID__deleteConst(z_bmqt_MessageGUID const** messageGUID_obj) -{ - using namespace BloombergLP; - - const bmqt::MessageGUID* messageGUID_p = - reinterpret_cast(*messageGUID_obj); - delete messageGUID_p; - *messageGUID_obj = NULL; - - return 0; -} - int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj) { using namespace BloombergLP; diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h index 9f845ac79..fa091c5c7 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h @@ -5,9 +5,6 @@ typedef struct z_bmqt_MessageGUID z_bmqt_MessageGUID; int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj); -int z_bmqt_MessageGUID__deleteConst( - z_bmqt_MessageGUID const** messageGUID_obj); - int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj); int z_bmqt_MessageGUID__toString(const z_bmqt_MessageGUID* messageGUID_obj, diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp index 0523ecab0..a13deaeb3 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.cpp @@ -8,6 +8,8 @@ int z_bmqt_QueueOptions__delete(z_bmqt_QueueOptions** queueOptions_obj) { using namespace BloombergLP; + BSLS_ASSERT(queueOptions_obj != NULL); + bmqt::QueueOptions* queueOptions_p = reinterpret_cast( *queueOptions_obj); delete queueOptions_p; diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp index 5b646362d..88ed338c0 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.cpp @@ -5,6 +5,8 @@ int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj) { using namespace BloombergLP; + BSLS_ASSERT(options_obj != NULL); + bmqt::SessionOptions* options_p = reinterpret_cast( *options_obj); delete options_p; From 4962ecaf6d5cb64712392ba17b6de0d739a0c5b8 Mon Sep 17 00:00:00 2001 From: Jonathan Adotey Date: Fri, 26 Jan 2024 15:03:38 -0500 Subject: [PATCH 48/57] Formatted z_bmqa_sessionevent.cpp --- src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp index 2346899c6..9d4a0e53d 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp @@ -7,7 +7,8 @@ int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** event_obj) BSLS_ASSERT(event_obj != NULL); - bmqa::SessionEvent* event_p = reinterpret_cast(*event_obj); + bmqa::SessionEvent* event_p = reinterpret_cast( + *event_obj); delete event_p; *event_obj = NULL; From bcd302806dc1cd4c7baed3b8482239c0c5fa82fc Mon Sep 17 00:00:00 2001 From: jonathanadotey77 <113726648+jonathanadotey77@users.noreply.github.com> Date: Tue, 6 Feb 2024 16:11:46 -0500 Subject: [PATCH 49/57] Updates (#7) * Updated toString methods, updated correlationId, and added tests for correlationId * Fixed mem leaks in producer and consumer * Moved c_wrapper tutorial * Added propertytype and move includes to be withing the extern C declaration * Fixed messageproperties.h --------- Co-authored-by: Jonathan Adotey Co-authored-by: Jonathan Adotey --- .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.h | 6 +- .../z_bmqa/z_bmqa_configurequeuestatus.h | 6 +- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 6 +- .../wrappers/z_bmq/z_bmqa/z_bmqa_event.h | 4 +- .../wrappers/z_bmq/z_bmqa/z_bmqa_message.h | 8 +- .../z_bmq/z_bmqa/z_bmqa_messageevent.cpp | 3 +- .../z_bmq/z_bmqa/z_bmqa_messageevent.h | 6 +- .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 6 +- .../z_bmq/z_bmqa/z_bmqa_messageiterator.h | 6 +- .../z_bmq/z_bmqa/z_bmqa_messageproperties.cpp | 77 ++++ .../z_bmq/z_bmqa/z_bmqa_messageproperties.h | 39 +- .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.h | 6 +- .../wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h | 8 +- .../wrappers/z_bmq/z_bmqa/z_bmqa_session.h | 8 +- .../z_bmq/z_bmqa/z_bmqa_sessionevent.cpp | 3 +- .../z_bmq/z_bmqa/z_bmqa_sessionevent.h | 8 +- .../wrappers/z_bmq/z_bmqt/package/z_bmqt.mem | 1 + .../z_bmqt/z_bmqt_compressionalgorithmtype.h | 8 + .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 92 ++++- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 37 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.t.cpp | 355 ++++++++++++++++++ .../z_bmq/z_bmqt/z_bmqt_messageguid.cpp | 59 ++- .../z_bmq/z_bmqt/z_bmqt_messageguid.h | 22 ++ .../z_bmq/z_bmqt/z_bmqt_propertytype.cpp | 22 ++ .../z_bmq/z_bmqt/z_bmqt_propertytype.h | 58 +++ .../z_bmq/z_bmqt/z_bmqt_queueoptions.h | 8 +- .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.h | 4 +- .../z_bmq/z_bmqt/z_bmqt_subscription.h | 6 +- .../wrappers/z_bmq/z_bmqt/z_bmqt_types.h | 4 +- src/tutorials/CMakeLists.txt | 3 +- src/tutorials/c_wrapper/CMakeLists.txt | 4 - .../c_wrapper/hello_world/CMakeLists.txt | 4 + .../c_wrapper/{ => hello_world}/consumer.cpp | 17 +- .../c_wrapper/{ => hello_world}/producer.cpp | 70 ++-- 34 files changed, 839 insertions(+), 135 deletions(-) create mode 100644 src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.t.cpp create mode 100644 src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.cpp create mode 100644 src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.h delete mode 100644 src/tutorials/c_wrapper/CMakeLists.txt create mode 100644 src/tutorials/c_wrapper/hello_world/CMakeLists.txt rename src/tutorials/c_wrapper/{ => hello_world}/consumer.cpp (96%) rename src/tutorials/c_wrapper/{ => hello_world}/producer.cpp (66%) diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h index 21b746a5f..1be34aacd 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h @@ -1,13 +1,13 @@ #ifndef INCLUDED_Z_BMQA_CLOSEQUEUESTATUS #define INCLUDED_Z_BMQA_CLOSEQUEUESTATUS -#include -#include - #if defined(__cplusplus) extern "C" { #endif +#include +#include + typedef struct z_bmqa_CloseQueueStatus z_bmqa_CloseQueueStatus; int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** status_obj); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h index 14cef3e0e..7cf1dfbad 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h @@ -1,13 +1,13 @@ #ifndef INCLUDED_Z_BMQA_CONFIGUREQUEUESTATUS #define INCLUDED_Z_BMQA_CONFIGUREQUEUESTATUS -#include -#include - #if defined(__cplusplus) extern "C" { #endif +#include +#include + typedef struct z_bmqa_ConfigureQueueStatus z_bmqa_ConfigureQueueStatus; int z_bmqa_ConfigureQueueStatus__delete( diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index c24bb6a43..7014ba971 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -1,13 +1,13 @@ #ifndef INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER #define INCLUDED_Z_BMQA_CONFIRMEVENTBUILDER -#include -#include - #if defined(__cplusplus) extern "C" { #endif +#include +#include + typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_event.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_event.h index cc68d6129..7094853f5 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_event.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_event.h @@ -1,12 +1,12 @@ #ifndef INCLUDED_Z_BMQA_EVENT #define INCLUDED_Z_BMQA_EVENT -#include - #if defined(__cplusplus) extern "C" { #endif +#include + typedef struct z_bmqa_Event z_bmqa_Event; int z_bmqa_Event__create(z_bmqa_Event** event_obj); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h index 7b61b2521..06d4099b7 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h @@ -1,6 +1,10 @@ #ifndef INCLUDED_Z_BMQA_MESSAGE #define INCLUDED_Z_BMQA_MESSAGE +#if defined(__cplusplus) +extern "C" { +#endif + #include #include #include @@ -9,10 +13,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - typedef struct z_bmqa_Message z_bmqa_Message; typedef struct z_bmqa_MessageConfirmationCookie diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp index f3ae58b30..e4f25b7dc 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp @@ -61,8 +61,7 @@ int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* event_obj, event_p->print(ss); bsl::string out_str = ss.str(); - *out = new char[out_str.length() + 1]; - (*out)[out_str.length()] = '\0'; + *out = new char[out_str.length() + 1]; strcpy(*out, out_str.c_str()); return 0; diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h index 774349060..dbdf03322 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h @@ -1,13 +1,13 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEEVENT #define INCLUDED_Z_BMQA_MESSAGEEVENT -#include -#include - #if defined(__cplusplus) extern "C" { #endif +#include +#include + typedef struct z_bmqa_MessageEvent z_bmqa_MessageEvent; int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index a94aa7d14..549f9ecbf 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -1,14 +1,14 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER #define INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER - -#include -#include #include #if defined(__cplusplus) extern "C" { #endif +#include +#include + typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; int z_bmqa_MessageEventBuilder__delete( diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h index 012211c66..91a965cb9 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h @@ -1,13 +1,13 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEITERATOR #define INCLUDED_Z_BMQA_MESSAGEITERATOR -#include -#include - #if defined(__cplusplus) extern "C" { #endif +#include +#include + typedef struct z_bmqa_MessageIterator z_bmqa_MessageIterator; int z_bmqa_MessageIterator__create( diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp index 4d2240f40..d09f871b2 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp @@ -1,2 +1,79 @@ #include +#include #include + +const int z_bmqa_MessageProperties::k_MAX_NUM_PROPERTIES = + BloombergLP::bmqa::MessageProperties::k_MAX_NUM_PROPERTIES; + +const int z_bmqa_MessageProperties::k_MAX_PROPERTIES_AREA_LENGTH = + BloombergLP::bmqa::MessageProperties::k_MAX_PROPERTIES_AREA_LENGTH; + +const int z_bmqa_MessageProperties::k_MAX_PROPERTY_NAME_LENGTH = + BloombergLP::bmqa::MessageProperties::k_MAX_PROPERTY_NAME_LENGTH; + +const int z_bmqa_MessageProperties::k_MAX_PROPERTY_VALUE_LENGTH = + BloombergLP::bmqa::MessageProperties::k_MAX_PROPERTY_VALUE_LENGTH; + +int z_bmqa_MessageProperties__delete(z_bmqa_MessageProperties** properties_obj) +{ + using namespace BloombergLP; + + BSLS_ASSERT(properties_obj != NULL); + + bmqa::MessageProperties* properties_p = + reinterpret_cast(*properties_obj); + delete properties_p; + *properties_obj = NULL; + + return 0; +} + +int z_bmqa_MessageProperties__create(z_bmqa_MessageProperties** properties_obj) +{ + using namespace BloombergLP; + + bmqa::MessageProperties* properties_p = new bmqa::MessageProperties(); + *properties_obj = reinterpret_cast( + properties_p); + + return 0; +} + +int z_bmqa_MessageProperties__createCopy( + z_bmqa_MessageProperties** properties_obj, + const z_bmqa_MessageProperties* other) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* other_p = + reinterpret_cast(other); + bmqa::MessageProperties* properties_p = new bmqa::MessageProperties( + *other_p); + *properties_obj = reinterpret_cast( + properties_p); + + return 0; +} + +int z_bmqa_MessageProperties__setPropertyAsBool( + z_bmqa_MessageProperties* properties_obj, + const char* name, + bool value) +{ + using namespace BloombergLP; + + bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + bsl::string name_str(name); + return properties_p->setPropertyAsBool(name_str, value); +} + +int z_bmqa_MessageProperties__totalSize( + const z_bmqa_MessageProperties* properties_obj) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + return properties_p->totalSize(); +} \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h index b9b2823d5..e6a6db840 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h @@ -1,6 +1,43 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEPROPERTIES #define INCLUDED_Z_BMQA_MESSAGEPROPERTIES -typedef struct z_bmqa_MessageProperties z_bmqa_MessageProperties; +#if defined(__cplusplus) +extern "C" { +#endif + +#include + +typedef struct z_bmqa_MessageProperties { + static const int k_MAX_NUM_PROPERTIES; + static const int k_MAX_PROPERTIES_AREA_LENGTH; + static const int k_MAX_PROPERTY_NAME_LENGTH; + static const int k_MAX_PROPERTY_VALUE_LENGTH; +} z_bmqa_MessageProperties; + +int z_bmqa_MessageProperties__delete( + z_bmqa_MessageProperties** properties_obj); + +int z_bmqa_MessageProperties__create( + z_bmqa_MessageProperties** properties_obj); + +int z_bmqa_MessageProperties__createCopy( + z_bmqa_MessageProperties** properties_obj, + const z_bmqa_MessageProperties* other); + +int z_bmqa_MessageProperties__(z_bmqa_MessageProperties* properties_obj); + +int z_bmqa_MessageProperties__(z_bmqa_MessageProperties* properties_obj); + +int z_bmqa_MessageProperties__setPropertyAsBool( + z_bmqa_MessageProperties* properties_obj, + const char* name, + bool value); + +int z_bmqa_MessageProperties__totalSize( + const z_bmqa_MessageProperties* properties_obj); + +#if defined(__cplusplus) +} +#endif #endif \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h index ded5912a0..680720b4a 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h @@ -1,13 +1,13 @@ #ifndef INCLUDED_Z_BMQA_OPENQUEUESTATUS #define INCLUDED_Z_BMQA_OPENQUEUESTATUS -#include -#include - #if defined(__cplusplus) extern "C" { #endif +#include +#include + typedef struct z_bmqa_OpenQueueStatus z_bmqa_OpenQueueStatus; int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h index 173ff864a..72a69b383 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h @@ -1,15 +1,15 @@ #ifndef INCLUDED_Z_BMQA_QUEUEID #define INCLUDED_Z_BMQA_QUEUEID +#if defined(__cplusplus) +extern "C" { +#endif + #include #include #include #include -#if defined(__cplusplus) -extern "C" { -#endif - typedef struct z_bmqa_QueueId z_bmqa_QueueId; int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h index 3a9867a8d..99d3381f1 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h @@ -1,6 +1,10 @@ #ifndef INCLUDED_Z_BMQA_SESSION #define INCLUDED_Z_BMQA_SESSION +#if defined(__cplusplus) +extern "C" { +#endif + #include #include #include @@ -15,10 +19,6 @@ #include #include -#if defined(__cplusplus) -extern "C" { -#endif - typedef struct z_bmqa_SessionEventHandler z_bmqa_SessionEventHandler; typedef void (*z_bmqa_OnSessionEventCb)( diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp index 9d4a0e53d..54d6ac2d1 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp @@ -108,8 +108,7 @@ int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* event_obj, ss << *event_p; bsl::string out_str = ss.str(); - *out = new char[out_str.length() + 1]; - (*out)[out_str.length()] = '\0'; + *out = new char[out_str.length() + 1]; strcpy(*out, out_str.c_str()); return 0; diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h index e20f0b425..c1aebe9ef 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h @@ -1,14 +1,14 @@ #ifndef INCLUDED_Z_BMQA_SESSIONEVENT #define INCLUDED_Z_BMQA_SESSIONEVENT -#include -#include -#include - #if defined(__cplusplus) extern "C" { #endif +#include +#include +#include + typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** event_obj); diff --git a/src/groups/wrappers/z_bmq/z_bmqt/package/z_bmqt.mem b/src/groups/wrappers/z_bmq/z_bmqt/package/z_bmqt.mem index 7276c1d7e..62ed81658 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/package/z_bmqt.mem +++ b/src/groups/wrappers/z_bmq/z_bmqt/package/z_bmqt.mem @@ -2,6 +2,7 @@ z_bmqt_compressionalgorithmtype z_bmqt_correlationid z_bmqt_messageeventtype z_bmqt_messageguid +z_bmqt_propertytype z_bmqt_queueflags z_bmqt_queueoptions z_bmqt_sessioneventtype diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h index 74778f680..a8e7e35bc 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h @@ -1,6 +1,10 @@ #ifndef INCLUDED_Z_BMQT_COMPRESSIONALGORITHMTYPE #define INCLUDED_Z_BMQT_COMPRESSIONALGORITHMTYPE +#if defined(__cplusplus) +extern "C" { +#endif + #include struct z_bmqt_CompressionAlgorithmType { @@ -62,4 +66,8 @@ struct z_bmqt_CompressionAlgorithmType { static bool isValid(const char* str); }; +#if defined(__cplusplus) +} +#endif + #endif \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp index 358d030eb..93c61ccb2 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj) @@ -25,8 +27,23 @@ int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj) return 0; } -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, - int64_t numeric) +int z_bmqt_CorrelationId__createCopy(z_bmqt_CorrelationId** correlationId_obj, + const z_bmqt_CorrelationId* other_obj) +{ + using namespace BloombergLP; + + const bmqt::CorrelationId* other_p = + reinterpret_cast(other_obj); + bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(*other_p); + *correlationId_obj = reinterpret_cast( + correlationId_p); + + return 0; +} + +int z_bmqt_CorrelationId__createFromNumeric( + z_bmqt_CorrelationId** correlationId_obj, + int64_t numeric) { using namespace BloombergLP; @@ -36,8 +53,9 @@ int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, return 0; } -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj, - void* pointer) +int z_bmqt_CorrelationId__createFromPointer( + z_bmqt_CorrelationId** correlationId_obj, + void* pointer) { using namespace BloombergLP; @@ -79,7 +97,7 @@ int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlationId_obj, return 0; } -int z_bmqt_CorrelationId__isUnset( +bool z_bmqt_CorrelationId__isUnset( const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; @@ -89,7 +107,7 @@ int z_bmqt_CorrelationId__isUnset( return correlationId_p->isUnset(); } -int z_bmqt_CorrelationId__isNumeric( +bool z_bmqt_CorrelationId__isNumeric( const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; @@ -99,7 +117,7 @@ int z_bmqt_CorrelationId__isNumeric( return correlationId_p->isNumeric(); } -int z_bmqt_CorrelationId__isPointer( +bool z_bmqt_CorrelationId__isPointer( const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; @@ -109,17 +127,7 @@ int z_bmqt_CorrelationId__isPointer( return correlationId_p->isPointer(); } -int z_bmqt_CorrelationId__isSharedPtr( - const z_bmqt_CorrelationId* correlationId_obj) -{ - using namespace BloombergLP; - const bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); - - return correlationId_p->isSharedPtr(); -} - -int z_bmqt_CorrelationId__isAutoValue( +bool z_bmqt_CorrelationId__isAutoValue( const z_bmqt_CorrelationId* correlationId_obj) { using namespace BloombergLP; @@ -168,5 +176,53 @@ int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj) *correlationId_obj = reinterpret_cast( correlationId_p); + return 0; +} + +int z_bmqt_CorrelationId__compare(const z_bmqt_CorrelationId* a, + const z_bmqt_CorrelationId* b) +{ + using namespace BloombergLP; + + const bmqt::CorrelationId* a_p = + reinterpret_cast(a); + const bmqt::CorrelationId* b_p = + reinterpret_cast(b); + + if (*a_p == *b_p) { + return 0; + } + + return *a_p < *b_p ? -1 : 1; +} + +int z_bmqt_CorrelationId__assign(z_bmqt_CorrelationId** dst, + const z_bmqt_CorrelationId* src) +{ + using namespace BloombergLP; + + bmqt::CorrelationId* dst_p = reinterpret_cast(*dst); + const bmqt::CorrelationId* src_p = + reinterpret_cast(src); + + *dst_p = *src_p; + + return 0; +} + +int z_bmqt_CorrelationId__toString( + const z_bmqt_CorrelationId* correlationId_obj, + char** out) +{ + using namespace BloombergLP; + + bsl::ostringstream ss; + const bmqt::CorrelationId* correlationId_p = + reinterpret_cast(correlationId_obj); + ss << *correlationId_p; + bsl::string out_str = ss.str(); + *out = new char[out_str.length() + 1]; + strcpy(*out, out_str.c_str()); + return 0; } \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h index b260f9db5..8eed6451d 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -1,12 +1,13 @@ #ifndef INCLUDED_Z_BMQA_CORRELATIONID #define INCLUDED_Z_BMQA_CORRELATIONID -#include - #if defined(__cplusplus) extern "C" { #endif +#include +#include + typedef struct z_bmqt_CorrelationId { enum Type { ec_NUMERIC // the 'CorrelationId' holds a 64-bit integer @@ -25,6 +26,9 @@ int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj); int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); +int z_bmqt_CorrelationId__createCopy(z_bmqt_CorrelationId** correlationId_obj, + const z_bmqt_CorrelationId* other_obj); + int z_bmqt_CorrelationId__createFromNumeric( z_bmqt_CorrelationId** correlationId_obj, int64_t numeric); @@ -35,23 +39,22 @@ int z_bmqt_CorrelationId__createFromPointer( int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlation_Id_obj); -int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlation_Id_obj); +int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlation_Id_obj, + int64_t numeric); -int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlation_Id_obj); +int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlation_Id_obj, + void* pointer); -int z_bmqt_CorrelationId__isUnset( +bool z_bmqt_CorrelationId__isUnset( const z_bmqt_CorrelationId* correlation_Id_obj); -int z_bmqt_CorrelationId__isNumeric( +bool z_bmqt_CorrelationId__isNumeric( const z_bmqt_CorrelationId* correlation_Id_obj); -int z_bmqt_CorrelationId__isPointer( +bool z_bmqt_CorrelationId__isPointer( const z_bmqt_CorrelationId* correlation_Id_obj); -int z_bmqt_CorrelationId__isSharedPtr( - const z_bmqt_CorrelationId* correlationId_obj); - -int z_bmqt_CorrelationId__isAutoValue( +bool z_bmqt_CorrelationId__isAutoValue( const z_bmqt_CorrelationId* correlation_Id_obj); int64_t z_bmqt_CorrelationId__theNumeric( @@ -61,10 +64,20 @@ void* z_bmqt_CorrelationId__thePointer( const z_bmqt_CorrelationId* correlation_Id_obj); z_bmqt_CorrelationId::Type -z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlation_Id_obj); +z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj); int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj); +int z_bmqt_CorrelationId__compare(const z_bmqt_CorrelationId* a, + const z_bmqt_CorrelationId* b); + +int z_bmqt_CorrelationId__assign(z_bmqt_CorrelationId** dst, + const z_bmqt_CorrelationId* src); + +int z_bmqt_CorrelationId__toString( + const z_bmqt_CorrelationId* correlationId_obj, + char** out); + #if defined(__cplusplus) } #endif diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.t.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.t.cpp new file mode 100644 index 000000000..987861810 --- /dev/null +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.t.cpp @@ -0,0 +1,355 @@ +// Copyright 2014-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// z_bmqt_correlationid.t.cpp -*-C++-*- +#include +#include + +// MWC +#include + +// BDE +#include +#include +#include +#include +#include +#include + +// TEST DRIVER +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +static const bmqt::CorrelationId& +toCppType(const z_bmqt_CorrelationId* correlationId) +{ + return *(reinterpret_cast(correlationId)); +} + +static void test1_breathingTest() +// ------------------------------------------------------------------------ +// BREATHING TEST +// +// Concerns: +// Exercise the basic functionality of the component. +// +// Plan: +// +// Testing: +// Basic functionality +// ------------------------------------------------------------------------ +{ + mwctst::TestHelper::printTestName("BREATHING TEST"); + + // An object for testing pointers + bsl::string foo("foo", s_allocator_p); + bsl::string* fooPtr = &foo; + + PV("Test unset correlationId"); + z_bmqt_CorrelationId* unset; + z_bmqt_CorrelationId__create(&unset); + ASSERT_EQ(z_bmqt_CorrelationId__isUnset(unset), true); + z_bmqt_CorrelationId__delete(&unset); + + PV("Test initialization by Int64"); + z_bmqt_CorrelationId* id; + z_bmqt_CorrelationId__createFromNumeric(&id, -1); + ASSERT_EQ(z_bmqt_CorrelationId__isNumeric(id), true); + ASSERT_EQ(z_bmqt_CorrelationId__isPointer(id), false); + ASSERT_EQ(z_bmqt_CorrelationId__isUnset(id), false); + ASSERT_EQ(-1, z_bmqt_CorrelationId__theNumeric(id)); + + PV("Test initialization by integer"); + bsls::Types::Int64 numeric = 0x5a5a5a5a5a5a5a5a; + z_bmqt_CorrelationId* numericId; + z_bmqt_CorrelationId__createFromNumeric(&numericId, numeric); + ASSERT_EQ(z_bmqt_CorrelationId__isPointer(numericId), false); + ASSERT_EQ(numeric, z_bmqt_CorrelationId__theNumeric(numericId)); + + PV("Test copy constructor"); + z_bmqt_CorrelationId* newNumericId; + z_bmqt_CorrelationId__createCopy(&newNumericId, numericId); + ASSERT_EQ(z_bmqt_CorrelationId__isPointer(newNumericId), false); + ASSERT_EQ(numeric, z_bmqt_CorrelationId__theNumeric(newNumericId)); + + PV("Test initialization by pointer"); + bmqt::CorrelationId ptrId(fooPtr); + ASSERT_EQ(ptrId.isPointer(), true); + ASSERT_EQ(fooPtr, ptrId.thePointer()); + + PV("Test copy constructor"); + bmqt::CorrelationId newPtrId(ptrId); + ASSERT_EQ(newPtrId.isPointer(), true); + ASSERT_EQ(fooPtr, newPtrId.thePointer()); + + PV("Test 'Set' methods"); + z_bmqt_CorrelationId__setPointer(id, fooPtr); + ASSERT_EQ(toCppType(id), bmqt::CorrelationId(fooPtr)); + + z_bmqt_CorrelationId__setNumeric(id, numeric); + ASSERT_EQ(toCppType(id), bmqt::CorrelationId(numeric)); + + PV("Test 'makeUnset' method"); + z_bmqt_CorrelationId__makeUnset(id); + ASSERT_EQ(toCppType(id), bmqt::CorrelationId()); + ASSERT_EQ(z_bmqt_CorrelationId__isUnset(id), true); + + z_bmqt_CorrelationId__delete(&id); + z_bmqt_CorrelationId__delete(&newNumericId); + z_bmqt_CorrelationId__delete(&numericId); +} + +static void test2_copyAndAssign() +// ------------------------------------------------------------------------ +// TEST COPY AND ASSIGN +// +// Concerns: +// Test copy and assignment of the object. +// +// Plan: +// +// Testing: +// ------------------------------------------------------------------------ +{ + mwctst::TestHelper::printTestName("COPY AND ASSIGN"); + + // An object for testing pointers + char fooPtr[4] = {'f', 'o', 'o', '\0'}; + + // conversions to bmqt::CorrelationId and back + bsls::Types::Int64 numeric = 0xA5A5A5A5A5A5A5A5; + void* ptr = fooPtr + 1; + + z_bmqt_CorrelationId* numericId = NULL; + z_bmqt_CorrelationId* ptrId = NULL; + z_bmqt_CorrelationId__createFromNumeric(&numericId, numeric); + z_bmqt_CorrelationId__createFromPointer(&ptrId, ptr); + + PV("Test copy") + { + z_bmqt_CorrelationId* numericIdCopy = NULL; + z_bmqt_CorrelationId__createCopy(&numericIdCopy, numericId); + ASSERT_EQ(z_bmqt_CorrelationId__isPointer(numericIdCopy), false); + ASSERT_EQ(z_bmqt_CorrelationId__theNumeric(numericIdCopy), numeric); + + z_bmqt_CorrelationId* ptrIdCopy = NULL; + z_bmqt_CorrelationId__createCopy(&ptrIdCopy, ptrId); + ASSERT_EQ(z_bmqt_CorrelationId__isPointer(ptrIdCopy), true); + ASSERT_EQ(z_bmqt_CorrelationId__thePointer(ptrIdCopy), ptr); + + z_bmqt_CorrelationId__delete(&numericIdCopy); + z_bmqt_CorrelationId__delete(&ptrIdCopy); + } + + PV("Test assignment"); + { + z_bmqt_CorrelationId* numericIdCopy = NULL; + z_bmqt_CorrelationId__create(&numericIdCopy); + z_bmqt_CorrelationId__assign(&numericIdCopy, numericId); + ASSERT_EQ(z_bmqt_CorrelationId__isPointer(numericIdCopy), false); + ASSERT_EQ(z_bmqt_CorrelationId__theNumeric(numericIdCopy), numeric); + + z_bmqt_CorrelationId* ptrIdCopy = NULL; + z_bmqt_CorrelationId__create(&ptrIdCopy); + z_bmqt_CorrelationId__assign(&ptrIdCopy, ptrId); + ASSERT_EQ(z_bmqt_CorrelationId__isPointer(ptrIdCopy), true); + ASSERT_EQ(z_bmqt_CorrelationId__thePointer(ptrIdCopy), ptr); + + z_bmqt_CorrelationId__delete(&numericIdCopy); + z_bmqt_CorrelationId__delete(&ptrIdCopy); + } + + z_bmqt_CorrelationId__delete(&numericId); + z_bmqt_CorrelationId__delete(&ptrId); +} + +static void test3_compare() +// ------------------------------------------------------------------------ +// TEST COMPARE +// +// Concerns: +// Test comparing two objects. +// +// Plan: +// +// Testing: +// ------------------------------------------------------------------------ +{ + mwctst::TestHelper::printTestName("COMPARE"); + + // Test compare operator + bmqt::CorrelationIdLess less; + const int val1 = 1; + const int val4 = 4; + int* intPtr1 = new int(val1); + int* intPtr4 = new int(val4); + + z_bmqt_CorrelationId* numericId1; + z_bmqt_CorrelationId* numericId4; + z_bmqt_CorrelationId* ptrId1; + z_bmqt_CorrelationId* ptrId4; + z_bmqt_CorrelationId* autoId1; + z_bmqt_CorrelationId* autoId2; + + z_bmqt_CorrelationId__createFromNumeric(&numericId1, val1); + z_bmqt_CorrelationId__createFromNumeric(&numericId4, val4); + z_bmqt_CorrelationId__createFromPointer(&ptrId1, intPtr1); + z_bmqt_CorrelationId__createFromPointer(&ptrId4, intPtr4); + z_bmqt_CorrelationId__autoValue(&autoId1); + z_bmqt_CorrelationId__autoValue(&autoId2); + + ASSERT_LT(z_bmqt_CorrelationId__compare(numericId1, numericId4), 0); + ASSERT_GT(z_bmqt_CorrelationId__compare(numericId4, numericId1), 0); + + ASSERT_LT(z_bmqt_CorrelationId__compare(ptrId1, ptrId4), 0); + ASSERT_GT(z_bmqt_CorrelationId__compare(ptrId4, ptrId1), 0); + + ASSERT_LT(z_bmqt_CorrelationId__compare(autoId1, autoId2), 0); + ASSERT_GT(z_bmqt_CorrelationId__compare(autoId2, autoId1), 0); + + ASSERT_LT(z_bmqt_CorrelationId__compare(numericId1, ptrId1), 0); + ASSERT_GT(z_bmqt_CorrelationId__compare(ptrId1, numericId1), 0); + + ASSERT_LT(z_bmqt_CorrelationId__compare(numericId4, ptrId1), 0); + ASSERT_GT(z_bmqt_CorrelationId__compare(ptrId4, numericId1), 0); + + ASSERT_LT(z_bmqt_CorrelationId__compare(numericId1, autoId1), 0); + ASSERT_GT(z_bmqt_CorrelationId__compare(autoId1, numericId1), 0); + + z_bmqt_CorrelationId__delete(&numericId1); + z_bmqt_CorrelationId__delete(&numericId4); + z_bmqt_CorrelationId__delete(&ptrId1); + z_bmqt_CorrelationId__delete(&ptrId4); + z_bmqt_CorrelationId__delete(&autoId1); + z_bmqt_CorrelationId__delete(&autoId2); + + delete intPtr1; + delete intPtr4; +} + +static void test4_autoValue() +// ------------------------------------------------------------------------ +// TEST AUTO VALUE +// +// Concerns: +// Test correlation ids with automatic value. +// +// Plan: +// +// Testing: +// ------------------------------------------------------------------------ +{ + mwctst::TestHelper::printTestName("AUTO VALUE"); + + z_bmqt_CorrelationId* auto1 = NULL; + z_bmqt_CorrelationId* auto2 = NULL; + + z_bmqt_CorrelationId__autoValue(&auto1); + z_bmqt_CorrelationId__autoValue(&auto2); + + ASSERT_EQ(z_bmqt_CorrelationId__isAutoValue(auto1), true); + + ASSERT_EQ(z_bmqt_CorrelationId__compare(auto1, auto1), 0); + ASSERT_NE(z_bmqt_CorrelationId__compare(auto1, auto2), 0); + + z_bmqt_CorrelationId__delete(&auto1); + z_bmqt_CorrelationId__delete(&auto2); +} + +static void test5_toStringTest() +{ + mwctst::TestHelper::printTestName("TO STRING"); + + PV("Testing print"); + char fooPtr[4] = {'f', 'o', 'o', '\0'}; + int64_t numeric = 0x5a5a5a5a5a5a5a5a; + size_t t = bmqt::CorrelationId::e_NUMERIC; + + for (; t < z_bmqt_CorrelationId::ec_UNSET + 1; ++t) { + if (t == z_bmqt_CorrelationId::ec_SHARED_PTR) { + // No shared ptr for C + continue; + } + z_bmqt_CorrelationId* obj = NULL; + char* out; + mwcu::MemOutStream patStream(s_allocator_p); + mwcu::MemOutStream objStream(s_allocator_p); + switch (t) { + case z_bmqt_CorrelationId::ec_NUMERIC: { + z_bmqt_CorrelationId__createFromNumeric(&obj, numeric); + patStream << "[ numeric = " << numeric << " ]"; + } break; + case z_bmqt_CorrelationId::ec_POINTER: { + z_bmqt_CorrelationId__createFromPointer(&obj, fooPtr); + patStream << bsl::noshowbase << std::hex; + patStream << "[ pointer = 0x" << reinterpret_cast(fooPtr) + << " ]"; + } break; + case z_bmqt_CorrelationId::ec_AUTO_VALUE: { + z_bmqt_CorrelationId__autoValue(&obj); + patStream << "[ autoValue = 1 ]"; + } break; + case z_bmqt_CorrelationId::ec_UNSET: { + // obj has e_UNSET type + z_bmqt_CorrelationId__create(&obj); + patStream << "[ \"* unset *\" ]"; + } break; + default: { + BSLS_ASSERT_OPT(false && "Unknown correlationId type"); + } + } + + z_bmqt_CorrelationId__toString(obj, &out); + + objStream.write(out, strlen(out)); + ASSERT_EQ(objStream.str(), patStream.str()); + delete[] out; + + z_bmqt_CorrelationId__delete(&obj); + } +} + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 5: test5_toStringTest(); break; + case 4: test4_autoValue(); break; + case 3: test3_compare(); break; + case 2: test2_copyAndAssign(); break; + case 1: test1_breathingTest(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + + return 0; +} diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp index 1e12569bd..1a291da92 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp @@ -27,6 +27,60 @@ int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj) return 0; } +int z_bmqt_MessageGUID__fromBinary(z_bmqt_MessageGUID* messageGUID_obj, + unsigned const char* buffer) +{ + using namespace BloombergLP; + + bmqt::MessageGUID* messageGUID_p = reinterpret_cast( + messageGUID_obj); + + return 0; +} + +int z_bmqt_MessageGUID__fromHex(z_bmqt_MessageGUID* messageGUID_obj, + const char* buffer) +{ + using namespace BloombergLP; + + bmqt::MessageGUID* messageGUID_p = reinterpret_cast( + messageGUID_obj); + + return 0; +} + +bool z_bmqt_MessageGUID__isUnset(const z_bmqt_MessageGUID* messageGUID_obj) +{ + using namespace BloombergLP; + + const bmqt::MessageGUID* messageGUID_p = + reinterpret_cast(messageGUID_obj); + + return messageGUID_p->isUnset(); +} + +int z_bmqt_MessageGUID__toBinary(const z_bmqt_MessageGUID* messageGUID_obj, + unsigned char* destination) +{ + using namespace BloombergLP; + + const bmqt::MessageGUID* messageGUID_p = + reinterpret_cast(messageGUID_obj); + + return 0; +} + +int z_bmqt_MessageGUID__toHex(const z_bmqt_MessageGUID* messageGUID_obj, + char* destination) +{ + using namespace BloombergLP; + + const bmqt::MessageGUID* messageGUID_p = + reinterpret_cast(messageGUID_obj); + + return 0; +} + int z_bmqt_MessageGUID__toString(const z_bmqt_MessageGUID* messageGUID_obj, char** out) { @@ -36,9 +90,8 @@ int z_bmqt_MessageGUID__toString(const z_bmqt_MessageGUID* messageGUID_obj, const bmqt::MessageGUID* messageGUID_p = reinterpret_cast(messageGUID_obj); ss << *messageGUID_p; - bsl::string out_str = ss.str(); - *out = new char[out_str.length() + 1]; - (*out)[out_str.length()] = '\0'; + bsl::string out_str = ss.str(); + *out = new char[out_str.length() + 1]; strcpy(*out, out_str.c_str()); return 0; diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h index fa091c5c7..86b65c569 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h @@ -1,13 +1,35 @@ #ifndef INCLUDED_Z_BMQT_MESSAGEGUID #define INCLUDED_Z_BMQT_MESSAGEGUID +#if defined(__cplusplus) +extern "C" { +#endif + typedef struct z_bmqt_MessageGUID z_bmqt_MessageGUID; int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj); int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj); +int z_bmqt_MessageGUID__fromBinary(z_bmqt_MessageGUID* messageGUID_obj, + const unsigned char* buffer); + +int z_bmqt_MessageGUID__fromHex(z_bmqt_MessageGUID* messageGUID_obj, + const char* buffer); + +bool z_bmqt_MessageGUID__isUnset(const z_bmqt_MessageGUID* messageGUID_obj); + +int z_bmqt_MessageGUID__toBinary(const z_bmqt_MessageGUID* messageGUID_obj, + unsigned char* destination); + +int z_bmqt_MessageGUID__toHex(const z_bmqt_MessageGUID* messageGUID_obj, + char* destination); + int z_bmqt_MessageGUID__toString(const z_bmqt_MessageGUID* messageGUID_obj, char** out); +#if defined(__cplusplus) +} +#endif + #endif \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.cpp new file mode 100644 index 000000000..ad5212b64 --- /dev/null +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.cpp @@ -0,0 +1,22 @@ +#include +#include + +const char* z_bmqt_PropertyType::toAscii(z_bmqt_PropertyType::Enum value) +{ + using namespace BloombergLP; + + return bmqt::PropertyType::toAscii( + static_cast(value)); +} + +bool z_bmqt_PropertyType::fromAscii(z_bmqt_PropertyType::Enum* out, + const char* str) +{ + using namespace BloombergLP; + + bmqt::PropertyType::Enum p; + bool result = bmqt::PropertyType::fromAscii(&p, str); + *out = static_cast(p); + + return result; +} diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.h new file mode 100644 index 000000000..1db6af841 --- /dev/null +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.h @@ -0,0 +1,58 @@ +#ifndef INCLUDED_Z_BMQT_PROPERTYTYPE +#define INCLUDED_Z_BMQT_PROPERTYTYPE + +#if defined(__cplusplus) +extern "C" { +#endif + +#include + +struct z_bmqt_PropertyType { + // TYPES + enum Enum { + ec_UNDEFINED = 0, + ec_BOOL = 1, + ec_CHAR = 2, + ec_SHORT = 3, + ec_INT32 = 4, + ec_INT64 = 5, + ec_STRING = 6, + ec_BINARY = 7 + }; + + // CONSTANTS + + /// NOTE: This value must always be equal to the lowest type in the + /// enum because it is being used as a lower bound to verify that a + /// Property's `type` field is a supported type. + static const int k_LOWEST_SUPPORTED_PROPERTY_TYPE = ec_BOOL; + + /// NOTE: This value must always be equal to the highest type in the + /// enum because it is being used as an upper bound to verify a + /// Property's `type` field is a supported type. + static const int k_HIGHEST_SUPPORTED_PROPERTY_TYPE = ec_BINARY; + + // CLASS METHODS + + /// Return the non-modifiable string representation corresponding to the + /// specified enumeration `value`, if it exists, and a unique (error) + /// string otherwise. The string representation of `value` matches its + /// corresponding enumerator name with the `ec_` prefix elided. Note + /// that specifying a `value` that does not match any of the enumerators + /// will result in a string representation that is distinct from any of + /// those corresponding to the enumerators, but is otherwise + /// unspecified. + static const char* toAscii(z_bmqt_PropertyType::Enum value); + + /// Return true and fills the specified `out` with the enum value + /// corresponding to the specified `str`, if valid, or return false and + /// leave `out` untouched if `str` doesn't correspond to any value of + /// the enum. + static bool fromAscii(z_bmqt_PropertyType::Enum* out, const char* str); +}; + +#if defined(__cplusplus) +} +#endif + +#endif \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.h index 3708a1d05..4b984de8b 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -1,14 +1,14 @@ #ifndef INCLUDED_Z_BMQT_QUEUEOPTIONS #define INCLUDED_Z_BMQT_QUEUEOPTIONS -#include -#include -#include - #if defined(__cplusplus) extern "C" { #endif +#include +#include +#include + typedef struct z_bmqt_QueueOptions z_bmqt_QueueOptions; typedef struct z_bmqt_HandleAndSubscrption { diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h index a00207c47..ff5b1e022 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h @@ -1,12 +1,12 @@ #ifndef INCLUDED_Z_BMQT_SESSIONEVENTTYPE #define INCLUDED_Z_BMQT_SESSIONEVENTTYPE -#include - #if defined(__cplusplus) extern "C" { #endif +#include + struct z_bmqt_SessionEventType { // TYPES enum Enum { diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.h index e1dff9c71..5f79b4f7a 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.h @@ -1,13 +1,13 @@ #ifndef INCLUDED_Z_BMQT_SUBSCRIPTION #define INCLUDED_Z_BMQT_SUBSCRIPTION -#include -#include - #if defined(__cplusplus) extern "C" { #endif +#include +#include + // ======================== // class SubscriptionHandle // ======================== diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_types.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_types.h index d6617b056..b857afb14 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_types.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_types.h @@ -1,12 +1,12 @@ #ifndef INCLUDED_Z_BMQT_TYPES #define INCLUDED_Z_BMQT_TYPES -#include - #if defined(__cplusplus) extern "C" { #endif +#include + typedef const char* z_bmqt_String; typedef struct z_bmqt_Blob z_bmqt_Blob; diff --git a/src/tutorials/CMakeLists.txt b/src/tutorials/CMakeLists.txt index 0d7238214..8dae19dea 100644 --- a/src/tutorials/CMakeLists.txt +++ b/src/tutorials/CMakeLists.txt @@ -66,4 +66,5 @@ add_custom_target("tutorials") add_subdirectory("advanced") add_subdirectory("hello_world") add_subdirectory("subscriptions") -add_subdirectory("c_wrapper") \ No newline at end of file +add_subdirectory("c_wrapper/advanced") +add_subdirectory("c_wrapper/hello_world") \ No newline at end of file diff --git a/src/tutorials/c_wrapper/CMakeLists.txt b/src/tutorials/c_wrapper/CMakeLists.txt deleted file mode 100644 index 875e43c2b..000000000 --- a/src/tutorials/c_wrapper/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# tutorial::c_wrapper -# --------------------- - -bmq_add_tutorial("c_wrapper") diff --git a/src/tutorials/c_wrapper/hello_world/CMakeLists.txt b/src/tutorials/c_wrapper/hello_world/CMakeLists.txt new file mode 100644 index 000000000..eea782af2 --- /dev/null +++ b/src/tutorials/c_wrapper/hello_world/CMakeLists.txt @@ -0,0 +1,4 @@ +# tutorial::c_hello_world +# --------------------- + +bmq_add_tutorial("c_hello_world") diff --git a/src/tutorials/c_wrapper/consumer.cpp b/src/tutorials/c_wrapper/hello_world/consumer.cpp similarity index 96% rename from src/tutorials/c_wrapper/consumer.cpp rename to src/tutorials/c_wrapper/hello_world/consumer.cpp index 310a5e568..9b1ffd8c8 100644 --- a/src/tutorials/c_wrapper/consumer.cpp +++ b/src/tutorials/c_wrapper/hello_world/consumer.cpp @@ -40,10 +40,10 @@ #include #include #include -#include #include #include #include +#include // SYSTEM #include @@ -111,6 +111,7 @@ void onMessageEvent(const z_bmqa_MessageEvent* messageEvent, void* data) } delete[] messageGUID_str; + delete[] data; } // Confirm reception of the messages so that it can be deleted from the @@ -130,6 +131,8 @@ void onMessageEvent(const z_bmqa_MessageEvent* messageEvent, void* data) z_bmqa_ConfirmEventBuilder__reset(confirmBuilder); } + + z_bmqa_MessageIterator__delete(&msgIter); } else { const char* eventType = z_bmqt_MessageEventType::toAscii( @@ -148,13 +151,14 @@ void onSessionEvent(const z_bmqa_SessionEvent* sessionEvent, void* data) char* out; z_bmqa_SessionEvent__toString(sessionEvent, &out); bsl::cout << "Got session event: " << bsl::string(out) << "\n"; - delete [] out; + delete[] out; } void setSession(void* args, void* eventHandlerData) { - SetSessionArgs* args_p = static_cast(args); - z_bmqa_Session** session_p = static_cast(eventHandlerData); + SetSessionArgs* args_p = static_cast(args); + z_bmqa_Session** session_p = static_cast( + eventHandlerData); *session_p = args_p->session; } @@ -232,7 +236,6 @@ static void consume(z_bmqa_Session* session) bsl::cerr << "Queue ['" << k_QUEUE_URL << "'] has been shut down " << "gracefully and is now closed.\n"; - // Must delete all objects z_bmqa_QueueId__delete(&queueId); z_bmqt_QueueOptions__delete(&options); @@ -263,7 +266,9 @@ int main(BSLS_ANNOTATION_UNUSED int argc, SetSessionArgs setSessionArgs; setSessionArgs.session = session; - z_bmqa_SessionEventHandler__callCustomFunction(eventHandler, setSession, &setSessionArgs); + z_bmqa_SessionEventHandler__callCustomFunction(eventHandler, + setSession, + &setSessionArgs); int rc = z_bmqa_Session__start((z_bmqa_Session*)(session), 0); if (rc != 0) { diff --git a/src/tutorials/c_wrapper/producer.cpp b/src/tutorials/c_wrapper/hello_world/producer.cpp similarity index 66% rename from src/tutorials/c_wrapper/producer.cpp rename to src/tutorials/c_wrapper/hello_world/producer.cpp index e70ef29c9..bb079698f 100644 --- a/src/tutorials/c_wrapper/producer.cpp +++ b/src/tutorials/c_wrapper/hello_world/producer.cpp @@ -1,14 +1,14 @@ -#include -#include -#include +#include +#include #include +#include #include -#include -#include +#include +#include -const int K_QUEUE_ID = 1; -const char K_QUEUE_URI[] = "bmq://bmq.test.mem.priority/test-queue"; -const int K_NUM_MESSAGES = 5; +const int K_QUEUE_ID = 1; +const char K_QUEUE_URI[] = "bmq://bmq.test.mem.priority/test-queue"; +const int K_NUM_MESSAGES = 5; enum QueueFlags { e_ADMIN = (1 << 0) // The queue is opened in admin mode (Valid only @@ -19,24 +19,23 @@ enum QueueFlags { e_WRITE = (1 << 2) // The queue is opened for posting messages , e_ACK = (1 << 3) // Set to indicate interested in receiving - // 'ACK' events for all message posted + // 'ACK' events for all message posted }; - -void postEvent(const char* text, +void postEvent(const char* text, z_bmqa_QueueId* queueId, - z_bmqa_Session* session){ - + z_bmqa_Session* session) +{ z_bmqa_MessageEventBuilder* builder; z_bmqa_MessageEventBuilder__create(&builder); z_bmqa_Session__loadMessageEventBuilder(session, builder); z_bmqa_Message* message; - + z_bmqa_MessageEventBuilder__startMessage(builder, &message); - z_bmqa_Message__setDataRef(message, text, (int)strlen(text)); + z_bmqa_Message__setDataRef(message, text, (int)strlen(text)); z_bmqa_MessageEventBuilder__packMessage(builder, queueId); @@ -48,54 +47,53 @@ void postEvent(const char* text, z_bmqa_MessageEventBuilder__delete(&builder); } - -void produce(z_bmqa_Session* session){ - z_bmqa_QueueId* queueId; - z_bmqa_OpenQueueStatus* openStatus; +void produce(z_bmqa_Session* session) +{ + z_bmqa_QueueId* queueId; + z_bmqa_OpenQueueStatus* openStatus; z_bmqa_CloseQueueStatus* closeStatus; - z_bmqa_QueueId__createFromNumeric(&queueId, K_QUEUE_ID); z_bmqa_Session__openQueueSync(session, - queueId, - K_QUEUE_URI, - e_WRITE, - &openStatus); + queueId, + K_QUEUE_URI, + e_WRITE, + &openStatus); const char* messages[] = {"Hello world!", - "message 4", - "message 5", - "message 6", - "Good Bye!"}; - for(int idx = 0; idx < 5; ++idx){ + "message 1", + "message 2", + "message 3", + "Good Bye!"}; + for (int idx = 0; idx < 5; ++idx) { postEvent(messages[idx], queueId, session); } z_bmqa_Session__closeQueueSync(session, queueId, 0, &closeStatus); z_bmqa_QueueId__delete(&queueId); + z_bmqa_OpenQueueStatus__delete(&openStatus); + z_bmqa_CloseQueueStatus__delete(&closeStatus); } -int main(){ - z_bmqa_Session* session; +int main() +{ + z_bmqa_Session* session; z_bmqt_SessionOptions* options; z_bmqt_SessionOptions__create(&options); z_bmqa_Session__create(&session, options); - - //start the session + // start the session z_bmqa_Session__start(session, 1000); produce(session); - //stop the session + // stop the session z_bmqa_Session__stop(session); - z_bmqa_Session__delete(&session); z_bmqt_SessionOptions__delete(&options); return 0; - } From 5a7cb363269d7e4f5bfbe54fbaa2994931bd65e9 Mon Sep 17 00:00:00 2001 From: Simon Sandrew <64385077+Simon-Sandrew@users.noreply.github.com> Date: Tue, 6 Feb 2024 21:18:52 +0000 Subject: [PATCH 50/57] Fixing the buidl --- src/tutorials/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tutorials/CMakeLists.txt b/src/tutorials/CMakeLists.txt index 8dae19dea..d824ad499 100644 --- a/src/tutorials/CMakeLists.txt +++ b/src/tutorials/CMakeLists.txt @@ -66,5 +66,5 @@ add_custom_target("tutorials") add_subdirectory("advanced") add_subdirectory("hello_world") add_subdirectory("subscriptions") -add_subdirectory("c_wrapper/advanced") +# add_subdirectory("c_wrapper /advanced") - this will be added later add_subdirectory("c_wrapper/hello_world") \ No newline at end of file From 5325161451aafce16be7a14be5fee9e837c74440 Mon Sep 17 00:00:00 2001 From: kaanlus <120061216+kaanlus@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:00:18 -0500 Subject: [PATCH 51/57] Made basic test for z_bmqa_sessionevent, not tested yet (#8) --- .../z_bmq/z_bmqa/z_bmqa_sessionevent.t.cpp | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.t.cpp diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.t.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.t.cpp new file mode 100644 index 000000000..6a891ee14 --- /dev/null +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.t.cpp @@ -0,0 +1,58 @@ +// Copyright 2014-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bmqa_sessionevent.t.cpp -*-C++-*- +#include + +// TEST DRIVER +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +static void test1_breathingTest() +{ + mwctst::TestHelper::printTestName("BREATHING TEST"); + + z_bmqa_SessionEvent * obj; + z_bmqa_SessionEvent__create(&obj); + + +} + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 1: test1_breathingTest(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +} From a0e317b83a698524f2571533dca85ff2ee1db086 Mon Sep 17 00:00:00 2001 From: Simon Sandrew <64385077+Simon-Sandrew@users.noreply.github.com> Date: Fri, 15 Mar 2024 16:24:38 -0400 Subject: [PATCH 52/57] Fork (#10) * Add files via upload * Add files via upload * changes * Delete src/docstring_replace.py * Delete src/function_comments.py --------- Co-authored-by: Fatih Orhan <56280631+FatihOrhan0@users.noreply.github.com> --- .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.h | 74 +++++++ .../z_bmqa/z_bmqa_configurequeuestatus.h | 94 ++++++++- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 173 ++++++++++++++++ .../z_bmq/z_bmqt/z_bmqt_messageguid.h | 70 +++++++ .../z_bmq/z_bmqt/z_bmqt_queueoptions.h | 191 +++++++++++++++++- .../z_bmq/z_bmqt/z_bmqt_sessionoptions.h | 27 +++ .../z_bmq/z_bmqt/z_bmqt_subscription.h | 177 ++++++++++++++++ src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_uri.h | 76 ++++++- 8 files changed, 878 insertions(+), 4 deletions(-) diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h index 1be34aacd..636f4fda8 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h @@ -10,26 +10,100 @@ extern "C" { typedef struct z_bmqa_CloseQueueStatus z_bmqa_CloseQueueStatus; +/** + * @brief Deletes the memory allocated for a pointer to a bmqa::CloseQueueStatus object. + * + * This function deallocates the memory pointed to by the input pointer to a bmqa::CloseQueueStatus object and sets the pointer to NULL. + * + * @param status_obj A pointer to a pointer to a bmqa::CloseQueueStatus object. + * Upon successful completion, this pointer will be set to NULL. + * @return Returns 0 upon successful deletion. + */ int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** status_obj); +/** + * @brief Creates a new bmqa::CloseQueueStatus object. + * + * This function creates a new bmqa::CloseQueueStatus object and assigns its pointer to the provided pointer. + * + * @param status_obj A pointer to a pointer to a bmqa::CloseQueueStatus object. + * Upon successful completion, this pointer will hold the newly created CloseQueueStatus object. + * @return Returns 0 upon successful creation. + */ int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** status_obj); +/** + * @brief Creates a copy of a bmqa::CloseQueueStatus object. + * + * This function creates a copy of the specified bmqa::CloseQueueStatus object and assigns its pointer to the provided pointer. + * + * @param status_obj A pointer to a pointer to a bmqa::CloseQueueStatus object. + * Upon successful completion, this pointer will hold the newly created copy of the CloseQueueStatus object. + * @param other A pointer to a constant bmqa::CloseQueueStatus object to copy. + * @return Returns 0 upon successful creation. + */ int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, const z_bmqa_CloseQueueStatus* other); +/** + * @brief Creates a bmqa::CloseQueueStatus object with specified parameters. + * + * This function creates a new bmqa::CloseQueueStatus object with the specified parameters and assigns its pointer to the provided pointer. + * + * @param status_obj A pointer to a pointer to a bmqa::CloseQueueStatus object. + * Upon successful completion, this pointer will hold the newly created CloseQueueStatus object. + * @param queueId A pointer to a constant z_bmqa_QueueId object representing the queue identifier. + * @param result An integer representing the result of the close operation. + * @param errorDescription A pointer to a constant character string representing the error description. + * @return Returns 0 upon successful creation. + */ int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** status_obj, const z_bmqa_QueueId* queueId, int result, const char* errorDescription); +/** + * @brief Converts a CloseQueueStatus object to a boolean value. + * + * This function converts the specified CloseQueueStatus object to a boolean value. + * + * @param status_obj A pointer to a constant z_bmqa_CloseQueueStatus object to convert. + * @return Returns true if the CloseQueueStatus object indicates success, false otherwise. + */ bool z_bmqa_CloseQueueStatus__toBool( const z_bmqa_CloseQueueStatus* status_obj); +/** + * @brief Retrieves the queue identifier from a CloseQueueStatus object. + * + * This function retrieves the queue identifier from the specified CloseQueueStatus object. + * + * @param status_obj A pointer to a constant z_bmqa_CloseQueueStatus object. + * @param queueId_obj A pointer to a pointer to a constant z_bmqa_QueueId object. + * Upon successful completion, this pointer will hold the queue identifier. + * @return Returns 0 upon successful retrieval of the queue identifier. + */ int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj); +/** + * @brief Retrieves the result of a close queue operation from a CloseQueueStatus object. + * + * This function retrieves the result of the close queue operation from the specified CloseQueueStatus object. + * + * @param status_obj A pointer to a constant z_bmqa_CloseQueueStatus object. + * @return Returns an integer representing the result of the close queue operation. + */ int z_bmqa_CloseQueueStatus__result(const z_bmqa_CloseQueueStatus* status_obj); +/** + * @brief Retrieves the error description from a CloseQueueStatus object. + * + * This function retrieves the error description from the specified CloseQueueStatus object. + * + * @param status_obj A pointer to a constant z_bmqa_CloseQueueStatus object. + * @return Returns a pointer to a constant character string representing the error description. + */ const char* z_bmqa_CloseQueueStatus__errorDescription( const z_bmqa_CloseQueueStatus* status_obj); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h index 7cf1dfbad..969279816 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h @@ -10,32 +10,124 @@ extern "C" { typedef struct z_bmqa_ConfigureQueueStatus z_bmqa_ConfigureQueueStatus; +/** + * @brief Deletes a z_bmqa_ConfigureQueueStatus object. + * + * This function deletes the z_bmqa_ConfigureQueueStatus object pointed to by 'status_obj'. + * Upon successful completion, the memory pointed to by 'status_obj' will be deallocated, + * and 'status_obj' will be set to NULL. + * + * @param status_obj A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object to be deleted. + * + * @return Returns 0 upon successful deletion. + */ int z_bmqa_ConfigureQueueStatus__delete( z_bmqa_ConfigureQueueStatus** status_obj); +/** + * @brief Creates a new z_bmqa_ConfigureQueueStatus object. + * + * This function creates a new z_bmqa_ConfigureQueueStatus object and stores + * a pointer to it in the memory pointed to by 'status_obj'. + * + * @param status_obj A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object where + * the newly created object will be stored. + * + * @return Returns 0 upon successful creation. + */ int z_bmqa_ConfigureQueueStatus__create( z_bmqa_ConfigureQueueStatus** status_obj); +/** + * @brief Creates a copy of a z_bmqa_ConfigureQueueStatus object. + * + * This function creates a deep copy of the input z_bmqa_ConfigureQueueStatus object 'other' + * and stores it in the memory pointed to by 'status_obj'. Upon successful completion, + * the pointer 'status_obj' will point to the newly created copy. + * + * @param status_obj A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object where + * the copy will be stored. Upon successful completion, this pointer + * will point to the newly created copy. + * @param other A pointer to a z_bmqa_ConfigureQueueStatus object which will be copied. + * + * @return Returns 0 upon successful creation of the copy. + */ int z_bmqa_ConfigureQueueStatus__createCopy( z_bmqa_ConfigureQueueStatus** status_obj, const z_bmqa_ConfigureQueueStatus* other); +/** + * @brief Creates a z_bmqa_ConfigureQueueStatus object with provided parameters. + * + * This function creates a new z_bmqa_ConfigureQueueStatus object with the provided + * 'queueId', 'result', and 'errorDescription', and stores a pointer to it in the memory + * pointed to by 'status_obj'. + * + * @param status_obj A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object where + * the newly created object will be stored. + * @param queueId A pointer to a z_bmqa_QueueId object representing the queue ID. + * @param result An integer representing the result. + * @param errorDescription A string representing the error description. + * + * @return Returns 0 upon successful creation. + */ int z_bmqa_ConfigureQueueStatus__createFull( z_bmqa_ConfigureQueueStatus** status_obj, const z_bmqa_QueueId* queueId, int result, const char* errorDescription); +/** + * @brief Converts a z_bmqa_ConfigureQueueStatus object to a boolean value. + * + * This function converts the z_bmqa_ConfigureQueueStatus object 'status_obj' to a boolean value. + * + * @param status_obj A pointer to a z_bmqa_ConfigureQueueStatus object to be converted. + * + * @return Returns true if the status object represents true, otherwise false. + */ bool z_bmqa_ConfigureQueueStatus__toBool( const z_bmqa_ConfigureQueueStatus* status_obj); +/** + * @brief Retrieves the queue ID from a z_bmqa_ConfigureQueueStatus object. + * + * This function retrieves the queue ID from the z_bmqa_ConfigureQueueStatus object 'status_obj'. + * + * @param status_obj A pointer to a z_bmqa_ConfigureQueueStatus object from which the queue ID + * will be retrieved. + * @param queueId_obj A pointer to a pointer to a z_bmqa_QueueId object where the retrieved + * queue ID will be stored. + * + * @return Returns 0 upon successful retrieval. + */ int z_bmqa_ConfigureQueueStatus__queueId( const z_bmqa_ConfigureQueueStatus* status_obj, z_bmqa_QueueId const** queueId_obj); +/** + * @brief Retrieves the result from a z_bmqa_ConfigureQueueStatus object. + * + * This function retrieves the result from the z_bmqa_ConfigureQueueStatus object 'status_obj'. + * + * @param status_obj A pointer to a z_bmqa_ConfigureQueueStatus object from which the result + * will be retrieved. + * + * @return Returns the result integer. + */ int z_bmqa_ConfigureQueueStatus__result( const z_bmqa_ConfigureQueueStatus* status_obj); +/** + * @brief Retrieves the error description from a z_bmqa_ConfigureQueueStatus object. + * + * This function retrieves the error description from the z_bmqa_ConfigureQueueStatus object 'status_obj'. + * + * @param status_obj A pointer to a z_bmqa_ConfigureQueueStatus object from which the error description + * will be retrieved. + * + * @return Returns a pointer to the error description string. + */ const char* z_bmqa_ConfigureQueueStatus__errorDescription( const z_bmqa_ConfigureQueueStatus* status_obj); @@ -43,4 +135,4 @@ const char* z_bmqa_ConfigureQueueStatus__errorDescription( } #endif -#endif \ No newline at end of file +#endif diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h index 8eed6451d..daf642ed4 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -22,58 +22,231 @@ typedef struct z_bmqt_CorrelationId { }; } z_bmqt_CorrelationId; +/** + * @brief Deletes the memory allocated for a pointer to a bmqt::CorrelationId object. + * + * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object. + * Upon successful completion, this pointer will be set to NULL. + * @return Returns 0 upon successful deletion. + */ int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj); +/** + * @brief Creates a new bmqt::CorrelationId object and assigns its pointer to the provided pointer. + * + * This function dynamically allocates memory for a new bmqt::CorrelationId object and assigns its pointer to the provided pointer. + * + * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object. + * Upon successful completion, this pointer will be set to point to the newly allocated bmqt::CorrelationId object. + * @return Returns 0 upon successful creation. + */ int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); +/** + * @brief Creates a copy of a bmqt::CorrelationId object. + * + * This function creates a deep copy of the input bmqt::CorrelationId object 'other_obj' + * and stores it in the memory pointed to by 'correlationId_obj'. Upon successful completion, + * the pointer 'correlationId_obj' will point to the newly created copy. + * + * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object where + * the copy will be stored. Upon successful completion, this pointer + * will point to the newly created copy. + * @param other_obj A pointer to a bmqt::CorrelationId object which will be copied. + * + * @return Returns 0 upon successful creation of the copy. + */ int z_bmqt_CorrelationId__createCopy(z_bmqt_CorrelationId** correlationId_obj, const z_bmqt_CorrelationId* other_obj); +/** + * @brief Creates a new correlation ID from a numeric value. + * + * This function allocates memory for a new bmqt::CorrelationId object initialized with the provided numeric value. + * The pointer to the created object is stored in 'correlationId_obj'. + * + * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object. + * Upon successful completion, this pointer will hold the address of the newly created object. + * @param numeric The numeric value used to initialize the new correlation ID object. + * @return Returns 0 upon successful creation of the correlation ID object. + */ int z_bmqt_CorrelationId__createFromNumeric( z_bmqt_CorrelationId** correlationId_obj, int64_t numeric); +/** + * @brief Creates a bmqt::CorrelationId object from a pointer. + * + * This function creates a bmqt::CorrelationId object using the provided pointer and assigns it to the input pointer to a bmqt::CorrelationId object. + * + * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object. + * Upon successful completion, this pointer will point to the newly created bmqt::CorrelationId object. + * @param pointer The pointer used to create the bmqt::CorrelationId object. + * @return Returns 0 upon successful creation. + */ int z_bmqt_CorrelationId__createFromPointer( z_bmqt_CorrelationId** correlationId_obj, void* pointer); +/** + * @brief Makes a bmqt::CorrelationId object unset. + * + * This function invokes the 'makeUnset' method of the input bmqt::CorrelationId object. + * + * @param correlationId_obj A pointer to a bmqt::CorrelationId object. + * This object will be made unset upon successful completion. + * + * @return Returns 0 upon successful invocation of 'makeUnset' on the bmqt::CorrelationId object. + */ int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlation_Id_obj); +/** + * @brief Sets the numeric value for a bmqt::CorrelationId object. + * + * @param correlationId_obj A pointer to a bmqt::CorrelationId object. + * @param numeric The numeric value to be set for the bmqt::CorrelationId object. + * @return Returns 0 upon successful completion. + */ int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlation_Id_obj, int64_t numeric); +/** + * @brief Sets a pointer within a bmqt::CorrelationId object. + * + * This function sets a pointer within the given bmqt::CorrelationId object to the specified value. + * + * @param correlationId_obj A pointer to a bmqt::CorrelationId object. + * @param pointer The pointer value to be set within the bmqt::CorrelationId object. + * + * @return Returns 0 upon successful completion. + */ int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlation_Id_obj, void* pointer); +/** + * @brief Checks if the correlation ID is unset. + * + * This function checks if the correlation ID pointed to by the input pointer is unset. + * + * @param correlationId_obj A pointer to a constant z_bmqt_CorrelationId object. + * @return Returns true if the correlation ID is unset, false otherwise. + */ bool z_bmqt_CorrelationId__isUnset( const z_bmqt_CorrelationId* correlation_Id_obj); +/** + * @brief Checks if the given correlation ID is numeric. + * + * This function checks whether the correlation ID pointed to by 'correlationId_obj' is numeric. + * + * @param correlationId_obj A pointer to a z_bmqt_CorrelationId object. + * @return Returns true if the correlation ID is numeric, false otherwise. + */ bool z_bmqt_CorrelationId__isNumeric( const z_bmqt_CorrelationId* correlation_Id_obj); +/** + * @brief Checks if the given object is a pointer. + * + * @param correlationId_obj A pointer to a const z_bmqt_CorrelationId object. + * @return Returns true if the object is a pointer; otherwise, returns false. + */ bool z_bmqt_CorrelationId__isPointer( const z_bmqt_CorrelationId* correlation_Id_obj); +/** + * @brief Checks if the correlation ID is an auto-generated value. + * + * This function checks whether the given correlation ID is an auto-generated value. + * + * @param correlationId_obj A pointer to a constant z_bmqt_CorrelationId object. + * @return Returns true if the correlation ID is auto-generated, false otherwise. + */ bool z_bmqt_CorrelationId__isAutoValue( const z_bmqt_CorrelationId* correlation_Id_obj); +/** + * @brief Retrieves the numeric value of a CorrelationId. + * + * This function retrieves the numeric value of the specified CorrelationId object. + * + * @param correlationId_obj A pointer to a const z_bmqt_CorrelationId object from which to retrieve the numeric value. + * @return Returns the numeric value of the CorrelationId. + */ int64_t z_bmqt_CorrelationId__theNumeric( const z_bmqt_CorrelationId* correlation_Id_obj); +/** + * @brief Returns the pointer stored within a bmqt::CorrelationId object. + * + * This function returns the pointer stored within the input bmqt::CorrelationId object. + * + * @param correlationId_obj A pointer to a bmqt::CorrelationId object. + * + * @return Returns the pointer stored within the bmqt::CorrelationId object. + */ void* z_bmqt_CorrelationId__thePointer( const z_bmqt_CorrelationId* correlation_Id_obj); +/** + * @brief Retrieves the type of a z_bmqt_CorrelationId object. + * + * This function returns the type of the z_bmqt_CorrelationId object specified by 'correlationId_obj'. + * + * @param correlationId_obj A pointer to a z_bmqt_CorrelationId object. + * @return Returns the type of the z_bmqt_CorrelationId object. + */ z_bmqt_CorrelationId::Type z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj); +/** + * @brief Generates an auto value for a bmqt::CorrelationId object and assigns it to a pointer. + * + * This function creates a new bmqt::CorrelationId object with an auto-generated value and assigns it to the pointer provided. + * + * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object. + * Upon successful completion, this pointer will hold the auto-generated correlation ID. + * @return Returns 0 upon successful generation of the auto value. + */ int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj); +/** + * @brief Compares two z_bmqt_CorrelationId objects. + * + * This function compares two z_bmqt_CorrelationId objects and returns an integer value indicating their relative order. + * + * @param a Pointer to the first z_bmqt_CorrelationId object. + * @param b Pointer to the second z_bmqt_CorrelationId object. + * @return Returns 0 if the z_bmqt_CorrelationId objects are equal, a negative value if 'a' is less than 'b', and a positive value if 'a' is greater than 'b'. + */ int z_bmqt_CorrelationId__compare(const z_bmqt_CorrelationId* a, const z_bmqt_CorrelationId* b); +/** + * @brief Assigns the value of one bmqt::CorrelationId object to another. + * + * This function assigns the value of the bmqt::CorrelationId object pointed to by 'src' to the bmqt::CorrelationId object pointed to by 'dst'. + * + * @param dst A pointer to a pointer to a bmqt::CorrelationId object where the value will be assigned. + * @param src A pointer to a const bmqt::CorrelationId object from which the value will be copied. + * + * @return Returns 0 upon successful assignment. + */ int z_bmqt_CorrelationId__assign(z_bmqt_CorrelationId** dst, const z_bmqt_CorrelationId* src); +/** + * @brief Converts a bmqt::CorrelationId object to a string representation. + * + * This function converts the given bmqt::CorrelationId object to a string representation and stores it in the output buffer. + * The memory for the output buffer is allocated dynamically and should be deallocated by the caller. + * + * @param correlationId_obj A pointer to a bmqt::CorrelationId object to be converted to a string. + * @param out A pointer to a pointer to a character buffer where the string representation will be stored. + * Upon successful completion, this pointer will point to the dynamically allocated buffer containing the string. + * The caller is responsible for deallocating the memory allocated for this buffer. + * @return Returns 0 upon successful conversion. + */ int z_bmqt_CorrelationId__toString( const z_bmqt_CorrelationId* correlationId_obj, char** out); diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h index 86b65c569..06c09f9d5 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.h @@ -7,24 +7,94 @@ extern "C" { typedef struct z_bmqt_MessageGUID z_bmqt_MessageGUID; +/** + * @brief Deletes the memory allocated for a pointer to a bmqt::MessageGUID object. + * + * @param messageGUID_obj A pointer to a pointer to a bmqt::MessageGUID object. + * Upon successful completion, this pointer will be set to NULL. + * @return Returns 0 upon successful deletion. + */ int z_bmqt_MessageGUID__delete(z_bmqt_MessageGUID** messageGUID_obj); +/** + * @brief Allocates memory for a pointer to a bmqt::MessageGUID object. + * + * This function allocates memory for a bmqt::MessageGUID object and assigns the pointer to the input pointer 'messageGUID_obj'. + * + * @param messageGUID_obj A pointer to a pointer to a bmqt::MessageGUID object. + * Upon successful completion, this pointer will point to the newly allocated bmqt::MessageGUID object. + * @return Returns 0 upon successful memory allocation. + */ int z_bmqt_MessageGUID__create(z_bmqt_MessageGUID** messageGUID_obj); +/** + * @brief Converts binary data to a bmqt::MessageGUID object. + * + * @param messageGUID_obj A pointer to a bmqt::MessageGUID object where the converted data will be stored. + * @param buffer The binary data buffer to convert into a bmqt::MessageGUID object. + * @return Returns 0 upon successful conversion. + */ int z_bmqt_MessageGUID__fromBinary(z_bmqt_MessageGUID* messageGUID_obj, const unsigned char* buffer); +/** + * @brief Converts a hexadecimal string to a bmqt::MessageGUID object. + * + * This function converts a hexadecimal string representation of a bmqt::MessageGUID object + * into the corresponding bmqt::MessageGUID object pointed to by 'messageGUID_obj'. + * + * @param messageGUID_obj A pointer to a bmqt::MessageGUID object where the converted + * MessageGUID will be stored. + * @param buffer A null-terminated string containing the hexadecimal representation + * of the MessageGUID. + * + * @return Returns 0 upon successful conversion. + */ int z_bmqt_MessageGUID__fromHex(z_bmqt_MessageGUID* messageGUID_obj, const char* buffer); +/** + * @brief Checks if a bmqt::MessageGUID object is unset. + * + * @param messageGUID_obj A pointer to a bmqt::MessageGUID object. + * @return Returns true if the given bmqt::MessageGUID object is unset, false otherwise. + */ bool z_bmqt_MessageGUID__isUnset(const z_bmqt_MessageGUID* messageGUID_obj); +/** + * @brief Converts a bmqt::MessageGUID object to its binary representation. + * + * @param messageGUID_obj A pointer to a bmqt::MessageGUID object to be converted to binary. + * @param destination A pointer to an unsigned char buffer where the binary representation will be stored. + * + * @returns Returns 0 upon successful conversion. + */ int z_bmqt_MessageGUID__toBinary(const z_bmqt_MessageGUID* messageGUID_obj, unsigned char* destination); +/** + * @brief Converts a bmqt::MessageGUID object to its hexadecimal representation. + * + * This function converts the given bmqt::MessageGUID object to its hexadecimal representation and stores it in the provided destination buffer. + * + * @param messageGUID_obj A pointer to a bmqt::MessageGUID object to be converted. + * @param destination A pointer to the destination buffer where the hexadecimal representation will be stored. + * @return Returns 0 upon successful conversion. + */ int z_bmqt_MessageGUID__toHex(const z_bmqt_MessageGUID* messageGUID_obj, char* destination); +/** + * @brief Converts a bmqt::MessageGUID object to a string representation. + * + * This function converts the given bmqt::MessageGUID object to a string representation and stores it in the output buffer. + * + * @param messageGUID_obj A pointer to a bmqt::MessageGUID object to be converted. + * @param out A pointer to a pointer to a character buffer where the string representation will be stored. + * Upon successful completion, this pointer will be set to point to the allocated memory containing the string. + * The caller is responsible for freeing the memory allocated for the string. + * @return Returns 0 upon successful conversion. + */ int z_bmqt_MessageGUID__toString(const z_bmqt_MessageGUID* messageGUID_obj, char** out); diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.h index 4b984de8b..55bd283ba 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_queueoptions.h @@ -21,78 +21,265 @@ typedef struct z_bmqt_SubscrptionsSnapshot { z_bmqt_HandleAndSubscrption* subscriptions; } z_bmqt_SubscrptionsSnapshot; +/** + * @brief Deletes the memory allocated for a pointer to a bmqt::QueueOptions object. + * + * @param queueOptions_obj A pointer to a pointer to a bmqt::QueueOptions object. + * Upon successful completion, this pointer will be set to NULL. + * @return Returns 0 upon successful deletion. + */ int z_bmqt_QueueOptions__delete(z_bmqt_QueueOptions** queueOptions_obj); +/** + * @brief Creates a new bmqt::QueueOptions object and assigns it to the provided pointer. + * + * This function allocates memory for a new bmqt::QueueOptions object and assigns it to the pointer provided as 'queueOptions_obj'. + * + * @param queueOptions_obj A pointer to a pointer to a bmqt::QueueOptions object. + * Upon successful completion, this pointer will point to the newly allocated bmqt::QueueOptions object. + * @return Returns 0 upon successful creation. + */ int z_bmqt_QueueOptions__create(z_bmqt_QueueOptions** queueOptions_obj); +/** + * @brief Creates a copy of the provided z_bmqt::QueueOptions object. + * + * This function creates a deep copy of the z_bmqt::QueueOptions object 'other' and assigns it to a new memory location. + * + * @param queueOptions_obj A pointer to a pointer to a z_bmqt::QueueOptions object where the copy will be stored. + * @param other A const pointer to a z_bmqt::QueueOptions object that will be copied. + * + * @return Returns 0 upon successful creation of the copy. + */ int z_bmqt_QueueOptions__createCopy(z_bmqt_QueueOptions** queueOptions_obj, const z_bmqt_QueueOptions* other); -// Modifiers +/** + * @brief Sets the maximum number of unconfirmed messages for a QueueOptions object. + * + * This function sets the maximum number of unconfirmed messages allowed for a given QueueOptions object. + * + * @param queueOptions_obj A pointer to a QueueOptions object. + * @param value The maximum number of unconfirmed messages to set. + * + * @return Returns 0 upon successful completion. + */ int z_bmqt_QueueOptions__setMaxUnconfirmedMessages( z_bmqt_QueueOptions* queueOptions_obj, int value); +/** + * @brief Sets the maximum number of unconfirmed bytes for a z_bmqt_QueueOptions object. + * + * @param queueOptions_obj A pointer to a z_bmqt_QueueOptions object. + * @param value The maximum number of unconfirmed bytes to set. + * + * @returns Returns 0 upon successful completion. + */ int z_bmqt_QueueOptions__setMaxUnconfirmedBytes( z_bmqt_QueueOptions* queueOptions_obj, int value); +/** + * @brief Sets the consumer priority value in the provided QueueOptions object. + * + * @param queueOptions_obj A pointer to a QueueOptions object. + * @param value The value to set as the consumer priority. + * + * @return Returns 0 upon successful completion. + */ int z_bmqt_QueueOptions__setConsumerPriority( z_bmqt_QueueOptions* queueOptions_obj, int value); +/** + * @brief Sets the option to suspend queue operations upon detecting bad host health. + * + * This function sets the option to suspend queue operations upon detecting bad host health. + * + * @param queueOptions_obj A pointer to a z_bmqt_QueueOptions object. + * @param value The value indicating whether to suspend queue operations on bad host health. + * A non-zero value indicates suspending, while zero indicates not suspending. + * + * @return Returns 0 upon successful completion. + */ int z_bmqt_QueueOptions__setSuspendsOnBadHostHealth( z_bmqt_QueueOptions* queueOptions_obj, int value); +/** + * @brief Merges the properties of another z_bmqt_QueueOptions object into the current z_bmqt_QueueOptions object. + * + * This function merges the properties of another z_bmqt_QueueOptions object ('other') into the current z_bmqt_QueueOptions object ('queueOptions_obj'). + * + * @param queueOptions_obj A pointer to the z_bmqt_QueueOptions object to merge into. Upon successful completion, this object will contain the merged properties. + * @param other A pointer to the z_bmqt_QueueOptions object whose properties will be merged into 'queueOptions_obj'. + * + * @return Returns 0 upon successful completion. + */ int z_bmqt_QueueOptions__merge(z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_QueueOptions* other); // Pass in an an uninitialized char** for errorDescription, the pointer will be // set to NULL if there is no error, otherwise it will set to an appropriately // sized string that is allocated on the heap + +/** + * @brief Adds or updates a subscription to the queue options. + * + * This function adds or updates a subscription to the provided queue options object. + * If the operation is successful, the error description pointer will be set to NULL. + * If an error occurs, the error description pointer will be allocated memory for the error message. + * + * @param queueOptions_obj A pointer to the queue options object to which the subscription will be added or updated. + * @param errorDescription A pointer to a pointer to a character array where the error description will be stored if an error occurs. + * Upon successful completion, this pointer will be set to NULL. + * @param handle A pointer to the subscription handle. + * @param subscription A pointer to the subscription object. + * @return Returns 0 upon successful addition or update of the subscription. + * Returns 1 if an error occurs, and sets the error description accordingly. + */ int z_bmqt_QueueOptions__addOrUpdateSubscription( z_bmqt_QueueOptions* queueOptions_obj, char** errorDescription, const z_bmqt_SubscriptionHandle* handle, const z_bmqt_Subscription* subscription); +/** + * @brief Removes a subscription from the queue options. + * + * This function removes a subscription identified by the provided handle from the given queue options object. + * + * @param queueOptions_obj A pointer to a z_bmqt_QueueOptions object from which the subscription will be removed. + * @param handle A pointer to a z_bmqt_SubscriptionHandle object representing the handle of the subscription to be removed. + * + * @return Returns 0 upon successful removal of the subscription. + */ int z_bmqt_QueueOptions__removeSubscription( z_bmqt_QueueOptions* queueOptions_obj, const z_bmqt_SubscriptionHandle* handle); +/** + * @brief Removes all subscriptions from a QueueOptions object. + * + * This function removes all subscriptions associated with the provided QueueOptions object. + * + * @param queueOptions_obj A pointer to a QueueOptions object from which all subscriptions will be removed. + * + * @return Returns 0 upon successful removal of all subscriptions. + */ int z_bmqt_QueueOptions__removeAllSubscriptions( z_bmqt_QueueOptions* queueOptions_obj); -// Accessors +/** + * @brief Retrieves the maximum number of unconfirmed messages allowed by the specified QueueOptions. + * + * @param queueOptions_obj A pointer to a constant z_bmqt_QueueOptions object from which to retrieve the maximum number of unconfirmed messages. + * @return Returns the maximum number of unconfirmed messages allowed by the specified QueueOptions. + */ int z_bmqt_QueueOptions__maxUnconfirmedMessages( const z_bmqt_QueueOptions* queueOptions_obj); +/** + * @brief Retrieves the maximum number of unconfirmed bytes allowed in the queue options. + * + * This function returns the maximum number of unconfirmed bytes allowed in the queue options. + * + * @param queueOptions_obj A pointer to a constant z_bmqt_QueueOptions object from which to retrieve the maximum unconfirmed bytes. + * @return Returns the maximum number of unconfirmed bytes allowed in the queue options. + */ int z_bmqt_QueueOptions__maxUnconfirmedBytes( const z_bmqt_QueueOptions* queueOptions_obj); +/** + * @brief Retrieves the consumer priority from the queue options. + * + * This function returns the consumer priority from the specified queue options. + * + * @param queueOptions_obj A pointer to a constant z_bmqt_QueueOptions object from which to retrieve the consumer priority. + * @return Returns the consumer priority specified in the queue options. + */ int z_bmqt_QueueOptions__consumerPriority( const z_bmqt_QueueOptions* queueOptions_obj); +/** + * @brief Checks whether the queue suspends on bad host health. + * + * This function checks whether the queue suspends on bad host health as specified in the queue options. + * + * @param queueOptions_obj A pointer to a constant z_bmqt_QueueOptions object from which to retrieve the suspension status. + * @return Returns true if the queue suspends on bad host health, false otherwise. + */ bool z_bmqt_QueueOptions__suspendsOnBadHostHealth( const z_bmqt_QueueOptions* queueOptions_obj); +/** + * @brief Checks whether the queue options specify a maximum number of unconfirmed messages. + * + * This function checks whether the queue options specify a maximum number of unconfirmed messages. + * + * @param queueOptions_obj A pointer to a constant z_bmqt_QueueOptions object from which to retrieve the information. + * @return Returns true if the queue options specify a maximum number of unconfirmed messages, false otherwise. + */ bool z_bmqt_QueueOptions__hasMaxUnconfirmedMessages( const z_bmqt_QueueOptions* queueOptions_obj); +/** + * @brief Checks whether the queue options specify a maximum number of unconfirmed bytes. + * + * This function checks whether the queue options specify a maximum number of unconfirmed bytes. + * + * @param queueOptions_obj A pointer to a constant z_bmqt_QueueOptions object from which to retrieve the information. + * @return Returns true if the queue options specify a maximum number of unconfirmed bytes, false otherwise. + */ bool z_bmqt_QueueOptions__hasMaxUnconfirmedBytes( const z_bmqt_QueueOptions* queueOptions_obj); +/** + * @brief Checks whether the queue options specify a consumer priority. + * + * This function checks whether the queue options specify a consumer priority. + * + * @param queueOptions_obj A pointer to a constant z_bmqt_QueueOptions object from which to retrieve the information. + * @return Returns true if the queue options specify a consumer priority, false otherwise. + */ bool z_bmqt_QueueOptions__hasConsumerPriority( const z_bmqt_QueueOptions* queueOptions_obj); +/** + * @brief Checks whether the queue options specify suspension on bad host health. + * + * This function checks whether the queue options specify suspension on bad host health. + * + * @param queueOptions_obj A pointer to a constant z_bmqt_QueueOptions object from which to retrieve the information. + * @return Returns true if the queue options specify suspension on bad host health, false otherwise. + */ bool z_bmqt_QueueOptions__hasSuspendsOnBadHostHealth( const z_bmqt_QueueOptions* queueOptions_obj); // Experimental (Modifiers) +/** + * @brief Loads a subscription into the queue options. + * + * This function attempts to load a subscription into the specified queue options using the provided subscription handle. + * + * @param queueOptions_obj A pointer to a constant z_bmqt_QueueOptions object where the subscription will be loaded. + * @param subscription A pointer to a pointer to a z_bmqt_Subscription object. Upon successful completion, this pointer will be set to the loaded subscription. + * @param handle A pointer to a constant z_bmqt_SubscriptionHandle object specifying the handle of the subscription to load. + * @return Returns true if the subscription was successfully loaded into the queue options, false otherwise. + */ bool z_bmqt_QueueOptions__loadSubscription( const z_bmqt_QueueOptions* queueOptions_obj); +/** + * @brief Loads subscriptions snapshot into the queue options. + * + * This function loads a snapshot of subscriptions into the specified queue options. + * + * @param queueOptions_obj A pointer to a constant z_bmqt_QueueOptions object where the subscriptions will be loaded. + * @param snapshot A pointer to a z_bmqt_SubscrptionsSnapshot object where the subscriptions snapshot will be stored. + * @return Returns 0 upon successful completion. + */ int z_bmqt_QueueOptions__loadSubscriptions( const z_bmqt_QueueOptions* queueOptions_obj, z_bmqt_SubscrptionsSnapshot* snapshot); diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.h index 08b6529d6..c31ed9fb2 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessionoptions.h @@ -7,10 +7,37 @@ extern "C" { typedef struct z_bmqt_SessionOptions z_bmqt_SessionOptions; +/** + * @brief Deletes a session options object. + * + * This function deallocates the memory allocated for a pointer to a bmqt::SessionOptions object. + * + * @param options_obj A pointer to a pointer to a bmqt::SessionOptions object. + * Upon successful completion, this pointer will be set to NULL. + * @return Returns 0 upon successful deletion. + */ int z_bmqt_SessionOptions__delete(z_bmqt_SessionOptions** options_obj); +/** + * @brief Creates a new session options object. + * + * This function creates a new bmqt::SessionOptions object and assigns its pointer to the provided pointer. + * + * @param options_obj A pointer to a pointer to a bmqt::SessionOptions object. + * Upon successful completion, this pointer will hold the newly created session options object. + * @return Returns 0 upon successful creation. + */ int z_bmqt_SessionOptions__create(z_bmqt_SessionOptions** options_obj); +/** + * @brief Retrieves the broker URI from the session options. + * + * This function returns the broker URI from the specified session options. + * + * @param options_obj A pointer to a constant z_bmqt_SessionOptions object from which to retrieve the broker URI. + * @return Returns a pointer to a constant character string representing the broker URI. + * The returned pointer may become invalid if the underlying session options object is modified or destroyed. + */ const char* z_bmqt_SessionOptions__brokerUri(const z_bmqt_SessionOptions* options_obj); diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.h index 5f79b4f7a..541b78c00 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.h @@ -14,10 +14,28 @@ extern "C" { typedef struct z_bmqt_SubscriptionHandle z_bmqt_SubscriptionHandle; +/** + * @brief Creates a new subscription handle object. + * + * This function creates a new z_bmqt_SubscriptionHandle object and assigns its pointer to the provided pointer. + * + * @param subscriptionHandle_obj A pointer to a pointer to a z_bmqt_SubscriptionHandle object. + * Upon successful completion, this pointer will hold the newly created subscription handle object. + * @param cid A pointer to a constant z_bmqt_CorrelationId object used to initialize the subscription handle. + * @return Returns 0 upon successful creation. + */ int z_bmqt_SubscriptionHandle__create( z_bmqt_SubscriptionHandle** subscriptionHandle_obj, const z_bmqt_CorrelationId* cid); +/** + * @brief Retrieves the ID of the subscription handle. + * + * This function returns the ID of the specified subscription handle. + * + * @param subscriptionHandle_obj A pointer to a constant z_bmqt_SubscriptionHandle object from which to retrieve the ID. + * @return Returns the ID of the subscription handle. + */ unsigned int z_bmqt_SubscriptionHandle__id( const z_bmqt_SubscriptionHandle* subscriptionHandle_obj); @@ -36,20 +54,66 @@ enum SubscriptionExpressionEnum { e_SUBSCRIPTIONEXPRESSION_ERROR }; + +/** + * @brief Creates a new subscription expression object. + * + * This function creates a new z_bmqt_SubscriptionExpression object and assigns its pointer to the provided pointer. + * + * @param subscriptionExpression_obj A pointer to a pointer to a z_bmqt_SubscriptionExpression object. + * Upon successful completion, this pointer will hold the newly created subscription expression object. + * @return Returns 0 upon successful creation. + */ int z_bmqt_SubscriptionExpression__create( z_bmqt_SubscriptionExpression** subscriptionExpression_obj); +/** + * @brief Creates a new subscription expression object from a string. + * + * This function creates a new z_bmqt_SubscriptionExpression object from the provided string expression and version. + * + * @param subscriptionExpression_obj A pointer to a pointer to a z_bmqt_SubscriptionExpression object. + * Upon successful completion, this pointer will hold the newly created subscription expression object. + * @param expression A pointer to a constant character string representing the subscription expression. + * @param version The version of the subscription expression. + * @return Returns 0 upon successful creation, 1 if an unsupported version is provided. + */ int z_bmqt_SubscriptionExpression__createFromString( z_bmqt_SubscriptionExpression** subscriptionExpression_obj, const char* expression, SubscriptionExpressionEnum version); +/** + * @brief Retrieves the text of the subscription expression. + * + * This function returns the text of the specified subscription expression. + * + * @param subscriptionExpression_obj A pointer to a constant z_bmqt_SubscriptionExpression object from which to retrieve the text. + * @return Returns a pointer to a constant character string representing the text of the subscription expression. + * The returned pointer may become invalid if the underlying subscription expression object is modified or destroyed. + */ const char* z_bmqt_SubscriptionExpression__text( const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); +/** + * @brief Retrieves the version of the subscription expression. + * + * This function returns the version of the specified subscription expression. + * + * @param subscriptionExpression_obj A pointer to a constant z_bmqt_SubscriptionExpression object from which to retrieve the version. + * @return Returns the version of the subscription expression. + */ SubscriptionExpressionEnum z_bmqt_SubscriptionExpression__version( const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); +/** + * @brief Checks whether the subscription expression is valid. + * + * This function checks whether the specified subscription expression is valid. + * + * @param subscriptionExpression_obj A pointer to a constant z_bmqt_SubscriptionExpression object to check for validity. + * @return Returns true if the subscription expression is valid, false otherwise. + */ bool z_bmqt_SubscriptionExpression__isValid( const z_bmqt_SubscriptionExpression* subscriptionExpression_obj); @@ -59,45 +123,158 @@ bool z_bmqt_SubscriptionExpression__isValid( typedef struct z_bmqt_Subscription z_bmqt_Subscription; +/** + * @brief Creates a new subscription object. + * + * This function creates a new z_bmqt_Subscription object and assigns its pointer to the provided pointer. + * + * @param subscription_obj A pointer to a pointer to a z_bmqt_Subscription object. + * Upon successful completion, this pointer will hold the newly created subscription object. + * @return Returns 0 upon successful creation. + */ + int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj); +/** + * @brief Creates a copy of a subscription object. + * + * This function creates a copy of the specified z_bmqt_Subscription object and assigns its pointer to the provided pointer. + * + * @param subscription_obj A pointer to a pointer to a z_bmqt_Subscription object. + * Upon successful completion, this pointer will hold the newly created copy of the subscription object. + * @param other A pointer to a constant z_bmqt_Subscription object to copy. + * @return Returns 0 upon successful creation. + */ int z_bmqt_Subscription__createCopy(z_bmqt_Subscription** subscription_obj, const z_bmqt_Subscription* other); +/** + * @brief Sets the maximum number of unconfirmed messages for a subscription. + * + * This function sets the maximum number of unconfirmed messages for the specified subscription. + * + * @param subscription_obj A pointer to a z_bmqt_Subscription object for which to set the maximum number of unconfirmed messages. + * @param value The value representing the maximum number of unconfirmed messages to set. + * @return Returns 0 upon successful setting. + */ int z_bmqt_Subscription__setMaxUnconfirmedMessages( z_bmqt_Subscription* subscription_obj, int value); +/** + * @brief Sets the maximum number of unconfirmed bytes for a subscription. + * + * This function sets the maximum number of unconfirmed bytes for the specified subscription. + * + * @param subscription_obj A pointer to a z_bmqt_Subscription object for which to set the maximum number of unconfirmed bytes. + * @param value The value representing the maximum number of unconfirmed bytes to set. + * @return Returns 0 upon successful setting. + */ int z_bmqt_Subscription__setMaxUnconfirmedBytes( z_bmqt_Subscription* subscription_obj, int value); +/** + * @brief Sets the consumer priority for a subscription. + * + * This function sets the consumer priority for the specified subscription. + * + * @param subscription_obj A pointer to a z_bmqt_Subscription object for which to set the consumer priority. + * @param value The value representing the consumer priority to set. + * @return Returns 0 upon successful setting. + */ int z_bmqt_Subscription__setConsumerPriority( z_bmqt_Subscription* subscription_obj, int value); +/** + * @brief Sets the subscription expression for a subscription. + * + * This function sets the subscription expression for the specified subscription. + * + * @param subscription_obj A pointer to a z_bmqt_Subscription object for which to set the subscription expression. + * @param value A pointer to a constant z_bmqt_SubscriptionExpression object representing the subscription expression to set. + * @return Returns 0 upon successful setting. + */ int z_bmqt_Subscription__setExpression( z_bmqt_Subscription* subscription_obj, const z_bmqt_SubscriptionExpression* value); +/** + * @brief Retrieves the maximum number of unconfirmed messages for a subscription. + * + * This function returns the maximum number of unconfirmed messages for the specified subscription. + * + * @param subscription_obj A pointer to a constant z_bmqt_Subscription object from which to retrieve the maximum number of unconfirmed messages. + * @return Returns the maximum number of unconfirmed messages for the subscription. + */ int z_bmqt_Subscription__maxUnconfirmedMessages( const z_bmqt_Subscription* subscription_obj); +/** + * @brief Retrieves the maximum number of unconfirmed bytes for a subscription. + * + * This function returns the maximum number of unconfirmed bytes for the specified subscription. + * + * @param subscription_obj A pointer to a constant z_bmqt_Subscription object from which to retrieve the maximum number of unconfirmed bytes. + * @return Returns the maximum number of unconfirmed bytes for the subscription. + */ int z_bmqt_Subscription__maxUnconfirmedBytes( const z_bmqt_Subscription* subscription_obj); +/** + * @brief Retrieves the consumer priority for a subscription. + * + * This function returns the consumer priority for the specified subscription. + * + * @param subscription_obj A pointer to a constant z_bmqt_Subscription object from which to retrieve the consumer priority. + * @return Returns the consumer priority for the subscription. + */ int z_bmqt_Subscription__consumerPriority( const z_bmqt_Subscription* subscription_obj); +/** + * @brief Retrieves the subscription expression for a subscription. + * + * This function returns a pointer to the subscription expression for the specified subscription. + * + * @param subscription_obj A pointer to a constant z_bmqt_Subscription object from which to retrieve the subscription expression. + * @return Returns a pointer to a constant z_bmqt_SubscriptionExpression object representing the subscription expression. + * The returned pointer may become invalid if the underlying subscription object is modified or destroyed. + */ const z_bmqt_SubscriptionExpression* z_bmqt_Subscription__expression(const z_bmqt_Subscription* subscription_obj); +/** + * @brief Checks whether the subscription specifies a maximum number of unconfirmed messages. + * + * This function checks whether the specified subscription specifies a maximum number of unconfirmed messages. + * + * @param subscription_obj A pointer to a constant z_bmqt_Subscription object to check. + * @return Returns true if the subscription specifies a maximum number of unconfirmed messages, false otherwise. + */ bool z_bmqt_Subscription__hasMaxUnconfirmedMessages( const z_bmqt_Subscription* subscription_obj); +/** + * @brief Checks whether the subscription specifies a maximum number of unconfirmed bytes. + * + * This function checks whether the specified subscription specifies a maximum number of unconfirmed bytes. + * + * @param subscription_obj A pointer to a constant z_bmqt_Subscription object to check. + * @return Returns true if the subscription specifies a maximum number of unconfirmed bytes, false otherwise. + */ bool z_bmqt_Subscription__hasMaxUnconfirmedBytes( const z_bmqt_Subscription* subscription_obj); +/** + * @brief Checks whether the subscription specifies a consumer priority. + * + * This function checks whether the specified subscription specifies a consumer priority. + * + * @param subscription_obj A pointer to a constant z_bmqt_Subscription object to check. + * @return Returns true if the subscription specifies a consumer priority, false otherwise. + */ bool z_bmqt_Subscription__hasConsumerPriority( const z_bmqt_Subscription* subscription_obj); diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_uri.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_uri.h index aad409736..0f5f33fd6 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_uri.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_uri.h @@ -11,6 +11,16 @@ extern "C" { typedef struct z_bmqt_Uri z_bmqt_Uri; +/** + * @brief Creates a copy of a URI object. + * + * This function creates a copy of the specified z_bmqt_Uri object and assigns its pointer to the provided pointer. + * + * @param uri_obj A pointer to a pointer to a z_bmqt_Uri object. + * Upon successful completion, this pointer will hold the newly created copy of the URI object. + * @param to_copy A pointer to a z_bmqt_Uri object to copy. + * @return Returns 0 upon successful creation. + */ int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy); // ================ @@ -19,23 +29,87 @@ int z_bmqt_Uri_create(z_bmqt_Uri** uri_obj, z_bmqt_Uri* to_copy); typedef struct z_bmqt_UriBuilder z_bmqt_UriBuilder; +/** + * @brief Creates a new URI builder object. + * + * This function creates a new z_bmqt_UriBuilder object and assigns its pointer to the provided pointer. + * + * @param uribuilder_obj A pointer to a pointer to a z_bmqt_UriBuilder object. + * Upon successful completion, this pointer will hold the newly created URI builder object. + * @return Returns 0 upon successful creation. + */ int z_bmqt_UriBuilder__create(z_bmqt_UriBuilder** uribuilder_obj); +/** + * @brief Creates a URI builder object from an existing URI. + * + * This function creates a new z_bmqt_UriBuilder object initialized with the specified URI and assigns its pointer to the provided pointer. + * + * @param uribuilder_obj A pointer to a pointer to a z_bmqt_UriBuilder object. + * Upon successful completion, this pointer will hold the newly created URI builder object. + * @param uri_obj A pointer to a constant z_bmqt_Uri object from which to create the URI builder. + * @return Returns 0 upon successful creation. + */ int z_bmqt_UriBuilder__createFromUri(z_bmqt_UriBuilder** uribuilder_obj, const z_bmqt_Uri* uri_obj); - +/** + * @brief Sets the domain for a URI builder. + * + * This function sets the domain for the specified URI builder. + * + * @param uribuilder_obj A pointer to a z_bmqt_UriBuilder object for which to set the domain. + * @param value A pointer to a constant character string representing the domain to set. + * @return Returns 0 upon successful setting. + */ int z_bmqt_UriBuilder__setDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value); +/** + * @brief Sets the tier for a URI builder. + * + * This function sets the tier for the specified URI builder. + * + * @param uribuilder_obj A pointer to a z_bmqt_UriBuilder object for which to set the tier. + * @param value A pointer to a constant character string representing the tier to set. + * @return Returns 0 upon successful setting. + */ int z_bmqt_UriBuilder__setTier(z_bmqt_UriBuilder* uribuilder_obj, const char* value); +/** + * @brief Sets the qualified domain for a URI builder. + * + * This function sets the qualified domain for the specified URI builder. + * + * @param uribuilder_obj A pointer to a z_bmqt_UriBuilder object for which to set the qualified domain. + * @param value A pointer to a constant character string representing the qualified domain to set. + * @return Returns 0 upon successful setting. + */ int z_bmqt_UriBuilder__setQualifiedDomain(z_bmqt_UriBuilder* uribuilder_obj, const char* value); +/** + * @brief Sets the queue name for a URI builder. + * + * This function sets the queue name for the specified URI builder. + * + * @param uribuilder_obj A pointer to a z_bmqt_UriBuilder object for which to set the queue name. + * @param value A pointer to a constant character string representing the queue name to set. + * @return Returns 0 upon successful setting. + */ int z_bmqt_UriBuilder__setQueue(z_bmqt_UriBuilder* uribuilder_obj, const char* value); +/** + * @brief Retrieves the URI built by a URI builder. + * + * This function retrieves the URI built by the specified URI builder. + * + * @param uribuilder_obj A pointer to a z_bmqt_UriBuilder object to build the URI from. + * @param uri_obj A pointer to a pointer to a z_bmqt_Uri object. + * Upon successful completion, this pointer will hold the newly created URI object. + * @return Returns 0 upon successful retrieval of the URI. + */ int z_bmqt_UriBuilder_uri(z_bmqt_UriBuilder* uribuilder_obj, z_bmqt_Uri** uri_obj); From 31aabe505be1790518de49dc50d8d4604f31271f Mon Sep 17 00:00:00 2001 From: kaanlus <120061216+kaanlus@users.noreply.github.com> Date: Fri, 15 Mar 2024 16:35:40 -0400 Subject: [PATCH 53/57] Kaan Changes (#11) * Made basic test for z_bmqa_sessionevent, not tested yet * Message Event Builder Test * Worked on QueueId test * Wrote Doxygen documentation for each function in message.h --- .../wrappers/z_bmq/z_bmqa/z_bmqa_message.h | 226 ++++++++++++++++ .../z_bmqa/z_bmqa_messageeventbuilder.t.cpp | 65 +++++ .../z_bmq/z_bmqa/z_bmqa_queueid.t.cpp | 249 ++++++++++++++++++ 3 files changed, 540 insertions(+) create mode 100644 src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.t.cpp create mode 100644 src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.t.cpp diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h index 06d4099b7..a01806c36 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h @@ -18,85 +18,311 @@ typedef struct z_bmqa_Message z_bmqa_Message; typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; +/** + * @brief Deletes the memory allocated for a pointer to a bmqa::Message object. + * + * This function deallocates the memory pointed to by the input pointer to a bmqa::Message object and sets the pointer to NULL. + * It ensures that the memory is properly released and the pointer is reset, preventing memory leaks and dangling pointer issues. + * + * @param message_obj A pointer to a pointer to a bmqa::Message object. + * Upon successful completion, this pointer will be set to NULL. + * @return Returns 0 upon successful deletion. + */ + int z_bmqa_Message__delete(z_bmqa_Message** message_obj); + +/** + * @brief Allocates memory and creates a new bmqa::Message object, setting the input pointer to point to it. + * + * This function dynamically allocates memory for a new bmqa::Message object and initializes it. The input pointer is then updated to point to this new object. This allows for the creation of bmqa::Message objects without direct handling of memory allocation by the caller. + * + * @param message_obj A pointer to a pointer to a z_bmqa_Message object. Upon successful completion, this pointer will be updated to point to the newly created bmqa::Message object. + * @return Returns 0 upon successful creation of the object. + */ int z_bmqa_Message__create(z_bmqa_Message** message_obj); + +/** + * @brief Sets the data reference for a bmqa::Message object with given data and length. + * + * This function assigns a data reference to an existing bmqa::Message object. The data is not copied; instead, the message object is pointed to the provided data, making the operation efficient. It is crucial that the data remains valid for the lifetime of the message object or until the data reference is reset or changed. + * + * @param message_obj A pointer to an existing z_bmqa_Message object to which the data reference will be set. + * @param data A constant character pointer to the data to be referenced by the message object. + * @param length The length of the data in bytes. + * @return Returns 0 upon successful update of the data reference. + */ int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length); + +/** + * @brief Sets the properties of a bmqa::Message object using a reference to a z_bmqa_MessageProperties object. + * + * This function updates the properties of a specified bmqa::Message object by taking a reference to a z_bmqa_MessageProperties object. It allows for the modification of message properties without directly accessing or modifying the internal structure of the message object, promoting encapsulation and data integrity. + * + * @param message_obj A pointer to the z_bmqa_Message object whose properties are to be set. + * @param properties_obj A constant pointer to a z_bmqa_MessageProperties object containing the new properties to be applied to the message. + * @return Returns 0 upon successful update of the message properties. + */ int z_bmqa_Message__setPropertiesRef( z_bmqa_Message* message_obj, const z_bmqa_MessageProperties* properties_obj); + +/** + * @brief Clears the properties of a bmqa::Message object. + * + * This function resets the properties of the specified bmqa::Message object to their default state. It is useful for reusing a message object without carrying over the properties from a previous usage, ensuring that the message is in a clean state before setting new properties or data. + * + * @param message_obj A pointer to the z_bmqa_Message object whose properties are to be cleared. + * @return Returns 0 upon successful clearing of the message properties. + */ + int z_bmqa_Message__clearPropertiesRef(z_bmqa_Message* message_obj); +/** + * @brief Sets the correlation ID for a bmqa::Message object using a reference to a z_bmqt_CorrelationId. + * + * This function assigns a specific correlation ID to the given bmqa::Message object, facilitating the tracking and matching of messages within a system. By using a correlation ID, applications can easily correlate responses with their corresponding requests, improving the traceability and management of message flows. + * + * @param message_obj A pointer to the z_bmqa_Message object to which the correlation ID is to be set. + * @param correlationId A constant pointer to a z_bmqt_CorrelationId object that contains the correlation ID to be assigned to the message. + * @return Returns 0 upon successful assignment of the correlation ID. + */ + int z_bmqa_Message__setCorrelationId( z_bmqa_Message* message_obj, const z_bmqt_CorrelationId* correlationId); +/** + * @brief Sets the compression algorithm type for a bmqa::Message object. + * + * This function configures the compression algorithm used by a bmqa::Message object, allowing for efficient data transmission by selecting an appropriate compression type. By specifying the compression algorithm, users can optimize the message size and performance for their specific networking or storage requirements. + * + * @param message_obj A pointer to the z_bmqa_Message object for which the compression algorithm is to be set. + * @param value The compression algorithm type, represented as a value from the z_bmqt_CompressionAlgorithmType::Enum enumeration, to be applied to the message. + * @return Returns 0 upon successful setting of the compression algorithm type. + */ + int z_bmqa_Message__setCompressionAlgorithmType( z_bmqa_Message* message_obj, z_bmqt_CompressionAlgorithmType::Enum value); #ifdef BMQ_ENABLE_MSG_GROUPID +/** + * @brief Assigns a group ID to a bmqa::Message object. + * + * This function sets a group ID for the specified bmqa::Message object, allowing messages to be categorized or grouped according to the provided identifier. The use of group IDs facilitates message filtering and processing based on group membership, enhancing the organization and handling of messages within a system. + * + * @param message_obj A pointer to the z_bmqa_Message object to which the group ID is to be assigned. + * @param groupId A string representing the group ID to be set for the message. This identifier can be used to group messages for processing or categorization purposes. + * @return Returns 0 upon successful assignment of the group ID. + */ + + int z_bmqa_Message__setGroupId(z_bmqa_Message* message_obj, const char* groupId); +/** + * @brief Clears the group ID of a bmqa::Message object. + * + * This function removes any group ID previously assigned to the specified bmqa::Message object, effectively resetting its group categorization to default. It is useful for repurposing a message object for a different group or removing its association with any group, ensuring the message is in a neutral state for new operations. + * + * @param message_obj A pointer to the z_bmqa_Message object whose group ID is to be cleared. + * @return Returns 0 upon successful clearing of the group ID. + */ + int z_bmqa_Message__clearGroupId(z_bmqa_Message* message_obj); #endif +/** + * @brief Clones a bmqa::Message object, creating a new instance with the same content. + * + * This function creates a new bmqa::Message object that is a clone of the specified message object. The new object contains the same data and properties as the original, allowing for independent manipulation or transmission of the cloned message. It is useful in scenarios where a copy of a message needs to be sent or processed separately from the original. + * + * @param message_obj A constant pointer to the z_bmqa_Message object to be cloned. + * @param other_obj A pointer to a pointer to a z_bmqa_Message object. Upon successful completion, this pointer will be updated to point to the newly cloned message object. + * @return Returns 0 upon successful cloning of the message object. + */ + int z_bmqa_Message__clone(const z_bmqa_Message* message_obj, z_bmqa_Message** other_obj); +/** + * @brief Retrieves the queue ID associated with a bmqa::Message object. + * + * This function provides access to the queue ID of the specified bmqa::Message object. The queue ID is an identifier that can be used to determine the message's intended destination or source within a messaging system. By obtaining the queue ID, applications can make routing decisions or perform analytics based on the message flow. + * + * @param message_obj A constant pointer to the z_bmqa_Message object from which the queue ID is to be retrieved. + * @param queueId_obj A pointer to a pointer to a z_bmqa_QueueId. Upon successful completion, this pointer will be updated to point to the queue ID associated with the message. + * @return Returns 0 upon successful retrieval of the queue ID. + */ + int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, const z_bmqa_QueueId** queueId_obj); +/** + * @brief Retrieves the correlation ID associated with a bmqa::Message object. + * + * This function accesses the correlation ID of the specified bmqa::Message object, providing a mechanism to track and associate messages within a system. Correlation IDs are crucial for linking requests with their responses or for grouping related messages together. This feature enhances the ability to monitor and analyze message flows, improving system integration and communication tracking. + * + * @param message_obj A constant pointer to the z_bmqa_Message object from which the correlation ID is to be retrieved. + * @param correlationId_obj A pointer to a pointer to a z_bmqt_CorrelationId. Upon successful completion, this pointer will be updated to point to the correlation ID associated with the message. + * @return Returns 0 upon successful retrieval of the correlation ID. + */ + int z_bmqa_Message__correlationId( const z_bmqa_Message* message_obj, const z_bmqt_CorrelationId** correlationId_obj); +/** + * @brief Retrieves the subscription handle associated with a bmqa::Message object. + * + * This function provides access to the subscription handle of the specified bmqa::Message object, facilitating the management and identification of subscriptions in messaging systems. Subscription handles are used to uniquely identify a subscription, allowing for operations such as modifying, querying, or canceling subscriptions based on the handle. This feature is particularly useful in systems that support complex subscription models and need to efficiently manage multiple message streams. + * + * @param message_obj A constant pointer to the z_bmqa_Message object from which the subscription handle is to be retrieved. + * @param subscription_obj A pointer to a pointer to a z_bmqt_SubscriptionHandle. Upon successful completion, this pointer will be updated to point to the subscription handle associated with the message. + * @return Returns 0 upon successful retrieval of the subscription handle. + */ + int z_bmqa_Message__subscriptionHandle( const z_bmqa_Message* message_obj, const z_bmqt_SubscriptionHandle** subscription_obj); +/** + * @brief Retrieves the compression algorithm type set for a bmqa::Message object. + * + * This function returns the compression algorithm type that has been configured for the specified bmqa::Message object. It enables the caller to understand how the message data is compressed, facilitating appropriate decompression or processing steps on the receiver's side. This information is crucial for applications that need to handle message payloads efficiently, especially when working with large data sets or in bandwidth-constrained environments. + * + * @param message_obj A constant pointer to the z_bmqa_Message object from which the compression algorithm type is to be retrieved. + * @return Returns the compression algorithm type as a value of the z_bmqt_CompressionAlgorithmType::Enum enumeration, indicating how the message data is compressed. + */ + z_bmqt_CompressionAlgorithmType::Enum z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message_obj); #ifdef BMQ_ENABLE_MSG_GROUPID +/** + * @brief Retrieves the group ID associated with a bmqa::Message object. + * + * This function returns the group ID of the specified bmqa::Message object as a string. The group ID is an identifier used to categorize or group messages for processing or routing purposes. By accessing the group ID, applications can perform actions based on the group to which a message belongs, such as filtering messages, performing group-specific processing, or routing messages to appropriate destinations based on their group ID. + * + * @param message_obj A constant pointer to the z_bmqa_Message object from which the group ID is to be retrieved. + * @return Returns a pointer to a constant character string representing the group ID of the message. This string remains valid as long as the message object is not destroyed or modified. + */ + const char* z_bmqa_Message__groupId(const z_bmqa_Message* message_obj); #endif +/** + * @brief Retrieves the message GUID (Globally Unique Identifier) associated with a bmqa::Message object. + * + * This function provides access to the message GUID of the specified bmqa::Message object. A message GUID is a unique identifier for a message, ensuring that each message can be distinctly identified across different components and systems. This feature is particularly useful in tracking, logging, and auditing message flows, as it allows for precise identification and correlation of messages. + * + * @param message_obj A constant pointer to the z_bmqa_Message object from which the message GUID is to be retrieved. + * @param messageGUID_obj A pointer to a pointer to a z_bmqt_MessageGUID. Upon successful completion, this pointer will be updated to point to the message GUID associated with the message. + * @return Returns 0 upon successful retrieval of the message GUID. + */ + int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, const z_bmqt_MessageGUID** messageGUID_obj); +/** + * @brief Retrieves and duplicates the confirmation cookie associated with a bmqa::Message object. + * + * This function allocates a new confirmation cookie, copying the contents from the confirmation cookie associated with the specified bmqa::Message object. A confirmation cookie is typically used to acknowledge the receipt or processing of a message, providing a mechanism for tracking message status and ensuring reliable communication. By duplicating the confirmation cookie, this function allows for the safe transmission or storage of the cookie independently of the original message. + * + * @param message_obj A constant pointer to the z_bmqa_Message object from which the confirmation cookie is to be duplicated. + * @param cookie_obj A pointer to a pointer to a z_bmqa_MessageConfirmationCookie. Upon successful completion, this pointer will be updated to point to the newly allocated confirmation cookie. + * @return Returns 0 upon successful duplication of the confirmation cookie. + */ + int z_bmqa_Message__confirmationCookie( const z_bmqa_Message* message_obj, z_bmqa_MessageConfirmationCookie** cookie_obj); +/** + * @brief Retrieves the acknowledgment status of a bmqa::Message object. + * + * This function returns the acknowledgment status for the specified bmqa::Message object. The acknowledgment status indicates whether the message has been acknowledged by the receiver, which can be crucial for ensuring message delivery and handling in systems that require confirmation of message processing. This information helps in managing the flow of messages, particularly in reliable messaging systems where it's important to track the delivery status of each message. + * + * @param message_obj A constant pointer to the z_bmqa_Message object from which the acknowledgment status is to be retrieved. + * @return Returns an integer representing the acknowledgment status of the message. The specific meanings of different values are defined by the implementation and should be documented accordingly. + */ + int z_bmqa_Message__ackStatus(const z_bmqa_Message* message_obj); + +/** + * @brief Retrieves the data contained in a bmqa::Message object, formatted as a hexadecimal string. + * + * This function extracts the data from the specified bmqa::Message object and converts it into a hexadecimal string representation. This is useful for debugging or logging purposes, where viewing the raw message data in a human-readable format can be invaluable. The function allocates memory for the hexadecimal string and sets the provided buffer pointer to point to this memory. The caller is responsible for freeing this memory after use. + * + * @param message_obj A constant pointer to the z_bmqa_Message object from which the data is to be retrieved. + * @param buffer A pointer to a character pointer. Upon successful completion, this pointer will be updated to point to a newly allocated string containing the hexadecimal representation of the message data. The caller is responsible for freeing this memory. + * @return Returns an integer indicating the result of the data retrieval operation. A return value of 0 typically indicates success, while other values may indicate errors. + */ + // Add once we figure out how to handle Blobs in C // int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, z_bdlbb_Blob* // blob); int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, char** buffer); +/** + * @brief Retrieves the size of the data contained within a bmqa::Message object. + * + * This function returns the size, in bytes, of the data payload within the specified bmqa::Message object. It allows for the assessment of the message's data payload size, which can be crucial for understanding the message's footprint, especially in contexts where bandwidth or storage efficiency is a concern. + * + * @param message_obj A constant pointer to the z_bmqa_Message object from which the data size is to be determined. + * @return Returns an integer representing the size of the data contained within the message, measured in bytes. + */ + int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj); +/** + * @brief Checks if a bmqa::Message object contains properties. + * + * This function determines whether the specified bmqa::Message object has properties set. Properties in a message can include metadata such as headers, routing information, or any other key-value pairs that provide context or control how the message should be handled. Knowing whether a message includes such properties is useful for conditional processing or routing decisions. + * + * @param message_obj A constant pointer to the z_bmqa_Message object to be checked for properties. + * @return Returns true if the message object contains properties; otherwise, returns false. + */ + bool z_bmqa_Message__hasProperties(const z_bmqa_Message* message_obj); #ifdef BMQ_ENABLE_MSG_GROUPID +/** + * @brief Checks if a bmqa::Message object has a group ID assigned. + * + * This function determines whether the specified bmqa::Message object has a group ID assigned to it. A group ID is used to categorize or group messages for various purposes, such as routing, filtering, or processing. Identifying whether a message is part of a specific group can be crucial for systems that implement group-based messaging logic. + * + * @param message_obj A constant pointer to the z_bmqa_Message object to be checked for a group ID. + * @return Returns true if the message object has a group ID assigned; otherwise, returns false. + */ + bool z_bmqa_Message__hasGroupId(const z_bmqa_Message* message_obj); #endif +/** + * @brief Loads the properties of a bmqa::Message object into a provided buffer. + * + * This function extracts the properties from the specified bmqa::Message object and loads them into a user-provided buffer. The properties might include metadata like headers, routing information, or other key-value pairs that provide additional context or instructions on how the message should be handled. This mechanism allows for the direct manipulation or inspection of message properties outside of the message object itself. + * + * @param message_obj A constant pointer to the z_bmqa_Message object from which properties are to be loaded. + * @param buffer A pointer to a z_bmqa_MessageProperties structure where the message properties will be stored. The caller must ensure that this buffer is appropriately allocated before calling this function. + * @return Returns an integer indicating the result of the properties loading operation. A return value of 0 typically indicates success, while other values may indicate errors. + */ + int z_bmqa_Message__loadProperties(const z_bmqa_Message* message_obj, z_bmqa_MessageProperties* buffer); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.t.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.t.cpp new file mode 100644 index 000000000..9eecb4272 --- /dev/null +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.t.cpp @@ -0,0 +1,65 @@ +// Copyright 2014-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// z_bmqa_messageeventbuilder.t.cpp -*-C++-*- +#include + +// TEST DRIVER +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +static void test1_breathingTest() +{ + s_ignoreCheckDefAlloc = true; + // Can't ensure no default memory is allocated because a default + // QueueId is instantiated and that uses the default allocator to + // allocate memory for an automatically generated CorrelationId. + + mwctst::TestHelper::printTestName("BREATHING TEST"); + + z_bmqa_MessageEventBuilder * obj; + z_bmqa_MessageEventBuilder__create(&obj); + + z_bmqa_MessageEventBuilder__delete(&obj); +} + + + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 1: test1_breathingTest(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +} diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.t.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.t.cpp new file mode 100644 index 000000000..722977299 --- /dev/null +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.t.cpp @@ -0,0 +1,249 @@ +// Copyright 2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bmqa_queueid.t.cpp -*-C++-*- +#include + +// BMQ +#include +#include +#include +#include +#include +#include +#include + +// BDE +#include +#include +#include + +// TEST DRIVER +#include + +// CONVENIENCE +using namespace BloombergLP; +using namespace bsl; + +// ============================================================================ +// TESTS +// ---------------------------------------------------------------------------- + +static void test1_breathingTest() +// ------------------------------------------------------------------------ +// BREATHING TEST +// +// Concerns: +// Exercise basic functionality before beginning testing in earnest. +// Probe that functionality to discover basic errors. +// +// Testing: +// Basic functionality. +// ------------------------------------------------------------------------ +{ + mwctst::TestHelper::printTestName("BREATHING TEST"); + + const bmqt::QueueOptions k_NULL_OPTIONS( + bmqt::QueueOptions() + .setMaxUnconfirmedMessages(0) + .setMaxUnconfirmedBytes(0) + .setConsumerPriority(bmqp::Protocol::k_CONSUMER_PRIORITY_INVALID)); + + PV("Default Constructor"); + { + + //bmqa::QueueId obj(s_allocator_p); + z_bmqa_QueueId * obj; + z_bmqa_QueueId__create(&obj); + + ASSERT_EQ(obj.isValid(), false); + z_bmqa_QueueId__delete(&obj); + + } + + PV("Valued Constructor - correlationId"); + { + const bsls::Types::Int64 id = 5; + const bmqt::CorrelationId corrId(id); + + bmqa::QueueId obj(corrId, s_allocator_p); + ASSERT_EQ(obj.correlationId(), corrId); + ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); + ASSERT_EQ(obj.uri(), bmqt::Uri(s_allocator_p)); + ASSERT_EQ(obj.options(), k_NULL_OPTIONS); + ASSERT_EQ(obj.isValid(), false); + } + + PV("Valued Constructor - numeric"); + { + const bsls::Types::Int64 id = 5; + + bmqa::QueueId obj(id, s_allocator_p); + ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(id)); + ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); + ASSERT_EQ(obj.uri(), bmqt::Uri(s_allocator_p)); + ASSERT_EQ(obj.options(), k_NULL_OPTIONS); + ASSERT_EQ(obj.isValid(), false); + } + + PV("Valued Constructor - void ptr"); + { + const char* buffer = "1234"; + void* ptr = static_cast(const_cast(buffer)); + + bmqa::QueueId obj(ptr, s_allocator_p); + ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(ptr)); + ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); + ASSERT_EQ(obj.uri(), bmqt::Uri(s_allocator_p)); + ASSERT_EQ(obj.options(), k_NULL_OPTIONS); + ASSERT_EQ(obj.isValid(), false); + } + + PV("Valued Constructor - shared ptr to void"); + { + const int k_VALUE = 11; + + bsl::shared_ptr sptr; + sptr.createInplace(s_allocator_p, k_VALUE); + + bmqa::QueueId obj(sptr, s_allocator_p); + ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(sptr)); + ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); + ASSERT_EQ(obj.uri(), bmqt::Uri(s_allocator_p)); + ASSERT_EQ(obj.options(), k_NULL_OPTIONS); + ASSERT_EQ(obj.isValid(), false); + } + + PV("Copy Constructor"); + { + const bsls::Types::Int64 id = 5; + + bmqa::QueueId obj1(id, s_allocator_p); + bmqa::QueueId obj2(obj1, s_allocator_p); + ASSERT_EQ(obj1.correlationId(), obj2.correlationId()); + ASSERT_EQ(obj1.flags(), obj2.flags()); + ASSERT_EQ(obj1.uri(), obj2.uri()); + ASSERT_EQ(obj1.options(), obj2.options()); + ASSERT_EQ(obj1.isValid(), obj2.isValid()); + } + + PV("Assignment Operator"); + { + const bsls::Types::Int64 id = 5; + + bmqa::QueueId obj1(id, s_allocator_p); + bmqa::QueueId obj2(s_allocator_p); + obj2 = obj1; + ASSERT_EQ(obj1.correlationId(), obj2.correlationId()); + ASSERT_EQ(obj1.flags(), obj2.flags()); + ASSERT_EQ(obj1.uri(), obj2.uri()); + ASSERT_EQ(obj1.options(), obj2.options()); + ASSERT_EQ(obj1.isValid(), obj2.isValid()); + } + + PV("Uri Method"); + { + const bsls::Types::Int64 id = 5; + const char k_QUEUE_URL[] = "bmq://ts.trades.myapp.~bt/my.queue?id=foo"; + + bmqa::QueueId obj(id, s_allocator_p); + ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(id)); + ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); + ASSERT_EQ(obj.uri(), bmqt::Uri(s_allocator_p)); + ASSERT_EQ(obj.options(), k_NULL_OPTIONS); + ASSERT_EQ(obj.isValid(), false); + + // Convert to bmqimp::Queue + bsl::shared_ptr& queue = + reinterpret_cast&>(obj); + + // Set uri to impl object + const bmqt::Uri uri(k_QUEUE_URL, s_allocator_p); + ASSERT_EQ(uri.isValid(), true); + + queue->setUri(uri); + + ASSERT_EQ(obj.uri().asString(), k_QUEUE_URL); + } +} + +static void test2_comparison() +// ------------------------------------------------------------------------ +// COMPARISION +// +// Concerns: +// Exercise 'bmqa::QueueId' comparison operators +// +// Plan: +// 1) Create two different 'bmqa::QueueId' objects and verify that they +// do not compare equal. +// 2) Create two default 'bmqa::QueueId' objects and verify that they +// compare equal, then create two different ones, assign one to the +// other, and verify that they compare equal. +// +// Testing: +// bool operator==(const bmqa::QueueId& lhs, const bmqa::QueueId& rhs); +// bool operator!=(const bmqa::QueueId& lhs, const bmqa::QueueId& rhs); +// ------------------------------------------------------------------------ +{ + mwctst::TestHelper::printTestName("COMPARISON"); + + PV("Inequality"); + { + const bsls::Types::Int64 k_ID = 18; + + bmqa::QueueId obj1(k_ID, s_allocator_p); + bmqa::QueueId obj2(k_ID, s_allocator_p); + ASSERT_NE(obj1, obj2); + } + + PV("Equality"); + { + // Different defaults are never equal + ASSERT_NE(bmqa::QueueId(s_allocator_p), bmqa::QueueId(s_allocator_p)); + + // Assignment makes equal + const bsls::Types::Int64 k_ID1 = 5; + const bsls::Types::Int64 k_ID2 = 11; + + bmqa::QueueId obj1(k_ID1, s_allocator_p); + bmqa::QueueId obj2(k_ID2, s_allocator_p); + BSLS_ASSERT_OPT(obj1 != obj2); + + obj1 = obj2; + ASSERT_EQ(obj1, obj2); + } +} + +// ============================================================================ +// MAIN PROGRAM +// ---------------------------------------------------------------------------- + +int main(int argc, char* argv[]) +{ + TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + + switch (_testCase) { + case 0: + case 2: test2_comparison(); break; + case 1: test1_breathingTest(); break; + default: { + cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; + s_testStatus = -1; + } break; + } + + TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_ALLOC); +} From eef80128c0b8886a2bb7ea1e95c34fa9402f1229 Mon Sep 17 00:00:00 2001 From: thuloj <91489322+thuloj@users.noreply.github.com> Date: Fri, 15 Mar 2024 16:35:55 -0400 Subject: [PATCH 54/57] aaryaman changesbob (#12) * rewrote setProperty functions for char, short, int32, int64, string, and binary, including headers * done with some headers * did get headers for bool,char,short,int32,int64 * did headers for getPropertyAsString & Binary, then did the getProperty(Or) headers until String, still have to do binary. did implementations for all these headers in C as well * did getPropertyAsBinaryOr, assuming client provides size * learned underlying rep of bsl string - simplified these functions * messageproperties done I believe, waiting on review * changes to roperty * examples --- src/applications/bmqbrkr/etc/etc | 1 + .../z_bmq/z_bmqa/z_bmqa_messageproperties.cpp | 339 ++++++++++++++++++ .../z_bmq/z_bmqa/z_bmqa_messageproperties.h | 117 ++++++ 3 files changed, 457 insertions(+) create mode 120000 src/applications/bmqbrkr/etc/etc diff --git a/src/applications/bmqbrkr/etc/etc b/src/applications/bmqbrkr/etc/etc new file mode 120000 index 000000000..b9902dd7d --- /dev/null +++ b/src/applications/bmqbrkr/etc/etc @@ -0,0 +1 @@ +/Users/aaryaman/Documents/bmq/blazingmq/src/applications/bmqbrkr/etc \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp index d09f871b2..6878e1060 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp @@ -14,6 +14,33 @@ const int z_bmqa_MessageProperties::k_MAX_PROPERTY_NAME_LENGTH = const int z_bmqa_MessageProperties::k_MAX_PROPERTY_VALUE_LENGTH = BloombergLP::bmqa::MessageProperties::k_MAX_PROPERTY_VALUE_LENGTH; +void z_bmqa_MessageProperties__clear( + z_bmqa_MessageProperties* properties_obj) +{ + using namespace BloombergLP; + + bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + properties_p->clear(); +} + +bool z_bmqa_MessageProperties__remove( + z_bmqa_MessageProperties* properties_obj, + const char* name, + Enum *buffer) +{ + using namespace BloombergLP; + + bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + //can I just use Enum like this? + bsl::string name_str(name); + // bmqt::PropertyType::Enum enum_transform = buffer; + // return properties_p->remove(name_str, buffer); +} + int z_bmqa_MessageProperties__delete(z_bmqa_MessageProperties** properties_obj) { using namespace BloombergLP; @@ -68,6 +95,107 @@ int z_bmqa_MessageProperties__setPropertyAsBool( return properties_p->setPropertyAsBool(name_str, value); } +int z_bmqa_MessageProperties__setPropertyAsChar( + z_bmqa_MessageProperties* properties_obj, + const char* name, + char value) +{ + using namespace BloombergLP; + + bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->setPropertyAsChar(name_str,value); +} + +int z_bmqa_MessageProperties__setPropertyAsShort( + z_bmqa_MessageProperties* properties_obj, + const char* name, + short value) +{ + using namespace BloombergLP; + + bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->setPropertyAsShort(name_str,value); +} + +int z_bmqa_MessageProperties__setPropertyAsInt32( + z_bmqa_MessageProperties* properties_obj, + const char* name, + int32_t value) +{ + using namespace BloombergLP; + + bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->setPropertyAsInt32(name_str,value); +} + + +int z_bmqa_MessageProperties__setPropertyAsInt64( + z_bmqa_MessageProperties* properties_obj, + const char* name, + long long value) +{ + using namespace BloombergLP; + + bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->setPropertyAsInt64(name_str,value); +} + +//needs rigorous testing to see if value conversion to bsl::string is needed, or we use the char* value +int z_bmqa_MessageProperties__setPropertyAsString( + z_bmqa_MessageProperties* properties_obj, + const char* name, + const char* value) +{ + using namespace BloombergLP; + + bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + bsl::string val_str(value); + return properties_p->setPropertyAsString(name_str,val_str); +} + +int z_bmqa_MessageProperties__setPropertyAsBinary( + z_bmqa_MessageProperties* properties_obj, + const char* name, + const char* value, + int size) +{ + using namespace BloombergLP; + + bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + bsl::vector val_vec(value, value+size); + return properties_p->setPropertyAsBinary(name_str,val_vec); +} + + +int z_bmqa_MessageProperties__numProperties( + const z_bmqa_MessageProperties* properties_obj) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + return properties_p->numProperties(); +} + int z_bmqa_MessageProperties__totalSize( const z_bmqa_MessageProperties* properties_obj) { @@ -76,4 +204,215 @@ int z_bmqa_MessageProperties__totalSize( const bmqa::MessageProperties* properties_p = reinterpret_cast(properties_obj); return properties_p->totalSize(); +} + +bool z_bmqa_MessageProperties__getPropertyAsBool( + const z_bmqa_MessageProperties* properties_obj, + const char* name) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->getPropertyAsBool(name_str); +} + +char z_bmqa_MessageProperties__getPropertyAsChar( + const z_bmqa_MessageProperties* properties_obj, + const char* name) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->getPropertyAsChar(name_str); +} + +short z_bmqa_MessageProperties__getPropertyAsShort( + const z_bmqa_MessageProperties* properties_obj, + const char* name) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->getPropertyAsShort(name_str); +} + +int32_t z_bmqa_MessageProperties__getPropertyAsInt32( + const z_bmqa_MessageProperties* properties_obj, + const char* name) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->getPropertyAsInt32(name_str); +} + +long long z_bmqa_MessageProperties__getPropertyAsInt64( + const z_bmqa_MessageProperties* properties_obj, + const char* name) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->getPropertyAsInt64(name_str); +} + +//docstring needs to include freeing cStr +const char* z_bmqa_MessageProperties__getPropertyAsString( + const z_bmqa_MessageProperties* properties_obj, + const char* name) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + const bsl::string& propertyAsBSLString = properties_p->getPropertyAsString(name_str); + return propertyAsBSLString.c_str(); +} + + +//docstring needs to include freeing cBinVec +const char* z_bmqa_MessageProperties__getPropertyAsBinary( + const z_bmqa_MessageProperties* properties_obj, + const char* name) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + bsl::vector propertyAsBSLVec = properties_p->getPropertyAsBinary(name_str); + int n = propertyAsBSLVec.size(); + char* cBinVec = (char*)calloc(n, sizeof(char)); + for(int i = 0; i < n; i++) { + cBinVec[i] = propertyAsBSLVec[i]; + } + return cBinVec; +} + +bool z_bmqa_MessageProperties__getPropertyAsBoolOr( + const z_bmqa_MessageProperties* properties_obj, + const char* name, + bool value) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->getPropertyAsBoolOr(name_str, value); +} + +char z_bmqa_MessageProperties__getPropertyAsCharOr( + const z_bmqa_MessageProperties* properties_obj, + const bsl::string& name, + char value) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->getPropertyAsCharOr(name_str, value); +} + +char z_bmqa_MessageProperties__getPropertyAsShortOr( + const z_bmqa_MessageProperties* properties_obj, + const bsl::string& name, + short value) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->getPropertyAsShortOr(name_str, value); +} + +int32_t z_bmqa_MessageProperties__getPropertyAsInt32Or( + const z_bmqa_MessageProperties* properties_obj, + const bsl::string& name, + int32_t value) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->getPropertyAsInt32Or(name_str, value); +} + +long long z_bmqa_MessageProperties__getPropertyAsInt64Or( + const z_bmqa_MessageProperties* properties_obj, + const bsl::string& name, + long long value) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + return properties_p->getPropertyAsInt64Or(name_str, value); +} + + +const char* z_bmqa_MessageProperties__getPropertyAsStringOr( + const z_bmqa_MessageProperties* properties_obj, + const char* name, + const char* value) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + bsl::string value_str(value); + const bsl::string& propertyAsBSLStringOr = properties_p->getPropertyAsStringOr(name_str, value_str); + return propertyAsBSLStringOr.c_str(); +} + +const char* z_bmqa_MessageProperties__getPropertyAsBinaryOr( + const z_bmqa_MessageProperties* properties_obj, + const char* name, + const char* value, + int size) +{ + using namespace BloombergLP; + + const bmqa::MessageProperties* properties_p = + reinterpret_cast(properties_obj); + + bsl::string name_str(name); + bsl::vector value_vec(value, value + size); + bsl::vector propertyAsBSLVec = properties_p->getPropertyAsBinaryOr(name_str, value_vec); + int n = propertyAsBSLVec.size(); + char* cBinVec = (char*)calloc(n, sizeof(char)); + for(int i = 0; i < n; i++) { + cBinVec[i] = propertyAsBSLVec[i]; + } + + return cBinVec; } \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h index e6a6db840..8615d8819 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h @@ -14,6 +14,25 @@ typedef struct z_bmqa_MessageProperties { static const int k_MAX_PROPERTY_VALUE_LENGTH; } z_bmqa_MessageProperties; +enum Enum { + e_UNDEFINED = 0, + e_BOOL = 1, + e_CHAR = 2, + e_SHORT = 3, + e_INT32 = 4, + e_INT64 = 5, + e_STRING = 6, + e_BINARY = 7 +}; + +void z_bmqa_MessageProperties__clear( + z_bmqa_MessageProperties* properties_obj); + +bool z_bmqa_MessageProperties__remove( + z_bmqa_MessageProperties* properties_obj, + const char* name, + Enum *buffer); + int z_bmqa_MessageProperties__delete( z_bmqa_MessageProperties** properties_obj); @@ -33,9 +52,107 @@ int z_bmqa_MessageProperties__setPropertyAsBool( const char* name, bool value); +int z_bmqa_MessageProperties__setPropertyAsChar( + z_bmqa_MessageProperties* properties_obj, + const char* name, + char value); + +int z_bmqa_MessageProperties__setPropertyAsShort( + z_bmqa_MessageProperties* properties_obj, + const char* name, + short value); + +int z_bmqa_MessageProperties__setPropertyAsInt32( + z_bmqa_MessageProperties* properties_obj, + const char* name, + int32_t value); + +int z_bmqa_MessageProperties__setPropertyAsInt64( + z_bmqa_MessageProperties* properties_obj, + const char* name, + long long value); + +int z_bmqa_MessageProperties__setPropertyAsString( + z_bmqa_MessageProperties* properties_obj, + const char* name, + char* value); + +int z_bmqa_MessageProperties__setPropertyAsBinary( + z_bmqa_MessageProperties* properties_obj, + const char* name, + const char* value, + int size); + +int z_bmqa_MessageProperties__numProperties( + const z_bmqa_MessageProperties* properties_obj); + int z_bmqa_MessageProperties__totalSize( const z_bmqa_MessageProperties* properties_obj); +bool z_bmqa_MessageProperties__getPropertyAsBool( + const z_bmqa_MessageProperties* properties_obj, + const char* name); + +char z_bmqa_MessageProperties__getPropertyAsChar( + const z_bmqa_MessageProperties* properties_obj, + const char* name); + +short z_bmqa_MessageProperties__getPropertyAsShort( + const z_bmqa_MessageProperties* properties_obj, + const char* name); + +int32_t z_bmqa_MessageProperties__getPropertyAsInt32( + const z_bmqa_MessageProperties* properties_obj, + const char* name); + +long long z_bmqa_MessageProperties__getPropertyAsInt64( + const z_bmqa_MessageProperties* properties_obj, + const char* name); + +const char* z_bmqa_MessageProperties__getPropertyAsString( + const z_bmqa_MessageProperties* properties_obj, + const char* name); + +const char* z_bmqa_MessageProperties__getPropertyAsBinary( + const z_bmqa_MessageProperties* properties_obj, + const char* name); + +bool z_bmqa_MessageProperties__getPropertyAsBoolOr( + const z_bmqa_MessageProperties* properties_obj, + const char* name, + bool value); + +char z_bmqa_MessageProperties__getPropertyAsCharOr( + const z_bmqa_MessageProperties* properties_obj, + const bsl::string& name, + char value); + +char z_bmqa_MessageProperties__getPropertyAsShortOr( + const z_bmqa_MessageProperties* properties_obj, + const bsl::string& name, + short value); + +int32_t z_bmqa_MessageProperties__getPropertyAsInt32Or( + const z_bmqa_MessageProperties* properties_obj, + const bsl::string& name, + int32_t value); + +long long z_bmqa_MessageProperties__getPropertyAsInt64Or( + const z_bmqa_MessageProperties* properties_obj, + const bsl::string& name, + long long value); + +const char* z_bmqa_MessageProperties__getPropertyAsStringOr( + const z_bmqa_MessageProperties* properties_obj, + const char* name, + const char* value); + +const char* z_bmqa_MessageProperties__getPropertyAsBinaryOr( + const z_bmqa_MessageProperties* properties_obj, + const char* name, + const char* value, + int size); + #if defined(__cplusplus) } #endif From 75781940e5e00b002d1f94c24df5cb9285df6718 Mon Sep 17 00:00:00 2001 From: Simon Sandrew <64385077+Simon-Sandrew@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:35:14 -0400 Subject: [PATCH 55/57] comments (#13) * Add files via upload * Add files via upload * changes * Delete src/docstring_replace.py * Delete src/function_comments.py * final comments * final --------- Co-authored-by: Fatih Orhan <56280631+FatihOrhan0@users.noreply.github.com> --- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 86 ++++- .../wrappers/z_bmq/z_bmqa/z_bmqa_message.h | 342 +++++++++--------- .../z_bmq/z_bmqa/z_bmqa_messageevent.h | 51 +++ .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 100 ++++- .../z_bmq/z_bmqa/z_bmqa_messageiterator.h | 40 +- .../z_bmq/z_bmqa/z_bmqa_messageproperties.h | 309 ++++++++++++++-- .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.h | 81 ++++- .../wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h | 106 +++++- .../wrappers/z_bmq/z_bmqa/z_bmqa_session.h | 255 +++++++++++-- .../z_bmq/z_bmqa/z_bmqa_sessionevent.h | 72 +++- 10 files changed, 1208 insertions(+), 234 deletions(-) diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index 7014ba971..a001303fe 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -12,31 +12,109 @@ typedef struct z_bmqa_ConfirmEventBuilder z_bmqa_ConfirmEventBuilder; typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; +/** + * @brief Deletes a z_bmqa_ConfirmEventBuilder object. + * + * This function deletes the z_bmqa_ConfirmEventBuilder object pointed to by 'builder_obj'. + * Upon successful completion, the memory pointed to by 'builder_obj' will be deallocated, + * and 'builder_obj' will be set to NULL. + * + * @param builder_obj A pointer to a pointer to a z_bmqa_ConfirmEventBuilder object to be deleted. + * + * @return Returns 0 upon successful deletion. + */ int z_bmqa_ConfirmEventBuilder__delete( z_bmqa_ConfirmEventBuilder** builder_obj); +/** + * @brief Creates a new z_bmqa_ConfirmEventBuilder object. + * + * This function creates a new z_bmqa_ConfirmEventBuilder object and stores + * a pointer to it in the memory pointed to by 'builder_obj'. + * + * @param builder_obj A pointer to a pointer to a z_bmqa_ConfirmEventBuilder object where + * the newly created object will be stored. + * + * @return Returns 0 upon successful creation. + */ int z_bmqa_ConfirmEventBuilder__create( z_bmqa_ConfirmEventBuilder** builder_obj); +/** + * @brief Adds a message confirmation to the z_bmqa_ConfirmEventBuilder object. + * + * This function adds a message confirmation represented by the z_bmqa_Message object 'message' + * to the z_bmqa_ConfirmEventBuilder object 'builder_obj'. + * + * @param builder_obj A pointer to a z_bmqa_ConfirmEventBuilder object to which the message + * confirmation will be added. + * @param message A pointer to a z_bmqa_Message object representing the message confirmation. + * + * @return Returns 0 upon successful addition of the message confirmation. + */ int z_bmqa_ConfirmEventBuilder__addMessageConfirmation( z_bmqa_ConfirmEventBuilder* builder_obj, const z_bmqa_Message* message); +/** + * @brief Adds a message confirmation with a cookie to the z_bmqa_ConfirmEventBuilder object. + * + * This function adds a message confirmation represented by the z_bmqa_MessageConfirmationCookie + * object 'cookie' to the z_bmqa_ConfirmEventBuilder object 'builder_obj'. + * + * @param builder_obj A pointer to a z_bmqa_ConfirmEventBuilder object to which the message + * confirmation will be added. + * @param cookie A pointer to a z_bmqa_MessageConfirmationCookie object representing + * the message confirmation with a cookie. + * + * @return Returns 0 upon successful addition of the message confirmation. + */ int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie( z_bmqa_ConfirmEventBuilder* builder_obj, const z_bmqa_MessageConfirmationCookie* cookie); +/** + * @brief Resets the z_bmqa_ConfirmEventBuilder object. + * + * This function resets the z_bmqa_ConfirmEventBuilder object 'builder_obj' to its initial state. + * + * @param builder_obj A pointer to a z_bmqa_ConfirmEventBuilder object to be reset. + * + * @return Returns 0 upon successful reset. + */ int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj); +/** + * @brief Retrieves the message count from the z_bmqa_ConfirmEventBuilder object. + * + * This function retrieves the count of message confirmations from the + * z_bmqa_ConfirmEventBuilder object 'builder_obj'. + * + * @param builder_obj A pointer to a z_bmqa_ConfirmEventBuilder object from which the message count + * will be retrieved. + * + * @return Returns the count of message confirmations. + */ int z_bmqa_ConfirmEventBuilder__messageCount( const z_bmqa_ConfirmEventBuilder* builder_obj); -int z_bmqa_ConfirmEventBuilder__blob( - const z_bmqa_ConfirmEventBuilder* builder_obj, - const z_bmqt_Blob** blob_obj); +/** + * @brief Retrieves the blob from the z_bmqa_ConfirmEventBuilder object. + * + * This function retrieves the blob from the z_bmqa_ConfirmEventBuilder object 'builder_obj'. + * + * @param builder_obj A pointer to a z_bmqa_ConfirmEventBuilder object from which the blob + * will be retrieved. + * @param blob_obj A pointer to a pointer to a z_bmqt_Blob object where the retrieved blob + * will be stored. + * + * @return Returns 0 upon successful retrieval. + */ +int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, + const z_bmqt_Blob** blob_obj); #if defined(__cplusplus) } #endif -#endif \ No newline at end of file +#endif diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h index a01806c36..878eb1eb3 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h @@ -19,94 +19,101 @@ typedef struct z_bmqa_MessageConfirmationCookie z_bmqa_MessageConfirmationCookie; /** - * @brief Deletes the memory allocated for a pointer to a bmqa::Message object. - * - * This function deallocates the memory pointed to by the input pointer to a bmqa::Message object and sets the pointer to NULL. - * It ensures that the memory is properly released and the pointer is reset, preventing memory leaks and dangling pointer issues. + * @brief Deletes a z_bmqa_Message object. + * + * This function deletes the z_bmqa_Message object pointed to by 'message_obj'. + * Upon successful completion, the memory pointed to by 'message_obj' will be deallocated, + * and 'message_obj' will be set to NULL. + * + * @param message_obj A pointer to a pointer to a z_bmqa_Message object to be deleted. * - * @param message_obj A pointer to a pointer to a bmqa::Message object. - * Upon successful completion, this pointer will be set to NULL. * @return Returns 0 upon successful deletion. */ - int z_bmqa_Message__delete(z_bmqa_Message** message_obj); - /** - * @brief Allocates memory and creates a new bmqa::Message object, setting the input pointer to point to it. - * - * This function dynamically allocates memory for a new bmqa::Message object and initializes it. The input pointer is then updated to point to this new object. This allows for the creation of bmqa::Message objects without direct handling of memory allocation by the caller. + * @brief Creates a new z_bmqa_Message object. + * + * This function creates a new z_bmqa_Message object and stores + * a pointer to it in the memory pointed to by 'message_obj'. * - * @param message_obj A pointer to a pointer to a z_bmqa_Message object. Upon successful completion, this pointer will be updated to point to the newly created bmqa::Message object. - * @return Returns 0 upon successful creation of the object. + * @param message_obj A pointer to a pointer to a z_bmqa_Message object where + * the newly created object will be stored. + * + * @return Returns 0 upon successful creation. */ int z_bmqa_Message__create(z_bmqa_Message** message_obj); - /** - * @brief Sets the data reference for a bmqa::Message object with given data and length. - * - * This function assigns a data reference to an existing bmqa::Message object. The data is not copied; instead, the message object is pointed to the provided data, making the operation efficient. It is crucial that the data remains valid for the lifetime of the message object or until the data reference is reset or changed. - * - * @param message_obj A pointer to an existing z_bmqa_Message object to which the data reference will be set. - * @param data A constant character pointer to the data to be referenced by the message object. - * @param length The length of the data in bytes. - * @return Returns 0 upon successful update of the data reference. + * @brief Sets the data of a z_bmqa_Message object. + * + * This function sets the data of the z_bmqa_Message object 'message_obj' to the + * provided 'data' with the given 'length'. + * + * @param message_obj A pointer to a z_bmqa_Message object. + * @param data A pointer to the data. + * @param length The length of the data. + * + * @return Returns 0 upon successful operation. */ int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, const char* data, int length); - /** - * @brief Sets the properties of a bmqa::Message object using a reference to a z_bmqa_MessageProperties object. - * - * This function updates the properties of a specified bmqa::Message object by taking a reference to a z_bmqa_MessageProperties object. It allows for the modification of message properties without directly accessing or modifying the internal structure of the message object, promoting encapsulation and data integrity. + * @brief Sets the properties of a z_bmqa_Message object. + * + * This function sets the properties of the z_bmqa_Message object 'message_obj' to + * the provided properties object 'properties_obj'. + * + * @param message_obj A pointer to a z_bmqa_Message object. + * @param properties_obj A pointer to a z_bmqa_MessageProperties object representing + * the properties. * - * @param message_obj A pointer to the z_bmqa_Message object whose properties are to be set. - * @param properties_obj A constant pointer to a z_bmqa_MessageProperties object containing the new properties to be applied to the message. - * @return Returns 0 upon successful update of the message properties. + * @return Returns 0 upon successful operation. */ int z_bmqa_Message__setPropertiesRef( z_bmqa_Message* message_obj, const z_bmqa_MessageProperties* properties_obj); - /** - * @brief Clears the properties of a bmqa::Message object. - * - * This function resets the properties of the specified bmqa::Message object to their default state. It is useful for reusing a message object without carrying over the properties from a previous usage, ensuring that the message is in a clean state before setting new properties or data. + * @brief Clears the properties of a z_bmqa_Message object. + * + * This function clears the properties of the z_bmqa_Message object 'message_obj'. * - * @param message_obj A pointer to the z_bmqa_Message object whose properties are to be cleared. - * @return Returns 0 upon successful clearing of the message properties. + * @param message_obj A pointer to a z_bmqa_Message object. + * + * @return Returns 0 upon successful operation. */ - int z_bmqa_Message__clearPropertiesRef(z_bmqa_Message* message_obj); /** - * @brief Sets the correlation ID for a bmqa::Message object using a reference to a z_bmqt_CorrelationId. - * - * This function assigns a specific correlation ID to the given bmqa::Message object, facilitating the tracking and matching of messages within a system. By using a correlation ID, applications can easily correlate responses with their corresponding requests, improving the traceability and management of message flows. + * @brief Sets the correlation ID of a z_bmqa_Message object. + * + * This function sets the correlation ID of the z_bmqa_Message object 'message_obj' + * to the provided correlation ID 'correlationId'. + * + * @param message_obj A pointer to a z_bmqa_Message object. + * @param correlationId A pointer to a z_bmqt_CorrelationId object representing + * the correlation ID. * - * @param message_obj A pointer to the z_bmqa_Message object to which the correlation ID is to be set. - * @param correlationId A constant pointer to a z_bmqt_CorrelationId object that contains the correlation ID to be assigned to the message. - * @return Returns 0 upon successful assignment of the correlation ID. + * @return Returns 0 upon successful operation. */ - int z_bmqa_Message__setCorrelationId( z_bmqa_Message* message_obj, const z_bmqt_CorrelationId* correlationId); /** - * @brief Sets the compression algorithm type for a bmqa::Message object. - * - * This function configures the compression algorithm used by a bmqa::Message object, allowing for efficient data transmission by selecting an appropriate compression type. By specifying the compression algorithm, users can optimize the message size and performance for their specific networking or storage requirements. + * @brief Sets the compression algorithm type of a z_bmqa_Message object. + * + * This function sets the compression algorithm type of the z_bmqa_Message object + * 'message_obj' to the provided value 'value'. + * + * @param message_obj A pointer to a z_bmqa_Message object. + * @param value The compression algorithm type value. * - * @param message_obj A pointer to the z_bmqa_Message object for which the compression algorithm is to be set. - * @param value The compression algorithm type, represented as a value from the z_bmqt_CompressionAlgorithmType::Enum enumeration, to be applied to the message. - * @return Returns 0 upon successful setting of the compression algorithm type. + * @return Returns 0 upon successful operation. */ - int z_bmqa_Message__setCompressionAlgorithmType( z_bmqa_Message* message_obj, z_bmqt_CompressionAlgorithmType::Enum value); @@ -114,215 +121,226 @@ int z_bmqa_Message__setCompressionAlgorithmType( #ifdef BMQ_ENABLE_MSG_GROUPID /** - * @brief Assigns a group ID to a bmqa::Message object. - * - * This function sets a group ID for the specified bmqa::Message object, allowing messages to be categorized or grouped according to the provided identifier. The use of group IDs facilitates message filtering and processing based on group membership, enhancing the organization and handling of messages within a system. + * @brief Sets the group ID of a z_bmqa_Message object. + * + * This function sets the group ID of the z_bmqa_Message object 'message_obj' to + * the provided 'groupId'. * - * @param message_obj A pointer to the z_bmqa_Message object to which the group ID is to be assigned. - * @param groupId A string representing the group ID to be set for the message. This identifier can be used to group messages for processing or categorization purposes. - * @return Returns 0 upon successful assignment of the group ID. + * @param message_obj A pointer to a z_bmqa_Message object. + * @param groupId A pointer to a string representing the group ID. + * + * @return Returns 0 upon successful operation. */ - - int z_bmqa_Message__setGroupId(z_bmqa_Message* message_obj, const char* groupId); /** - * @brief Clears the group ID of a bmqa::Message object. - * - * This function removes any group ID previously assigned to the specified bmqa::Message object, effectively resetting its group categorization to default. It is useful for repurposing a message object for a different group or removing its association with any group, ensuring the message is in a neutral state for new operations. + * @brief Clears the group ID of a z_bmqa_Message object. + * + * This function clears the group ID of the z_bmqa_Message object 'message_obj'. + * + * @param message_obj A pointer to a z_bmqa_Message object. * - * @param message_obj A pointer to the z_bmqa_Message object whose group ID is to be cleared. - * @return Returns 0 upon successful clearing of the group ID. + * @return Returns 0 upon successful operation. */ - int z_bmqa_Message__clearGroupId(z_bmqa_Message* message_obj); #endif /** - * @brief Clones a bmqa::Message object, creating a new instance with the same content. - * - * This function creates a new bmqa::Message object that is a clone of the specified message object. The new object contains the same data and properties as the original, allowing for independent manipulation or transmission of the cloned message. It is useful in scenarios where a copy of a message needs to be sent or processed separately from the original. + * @brief Creates a copy of a z_bmqa_Message object. + * + * This function creates a copy of the z_bmqa_Message object 'message_obj' and stores + * it in the memory pointed to by 'other_obj'. + * + * @param message_obj A pointer to a const z_bmqa_Message object to be copied. + * @param other_obj A pointer to a pointer to a z_bmqa_Message object where + * the copy will be stored. * - * @param message_obj A constant pointer to the z_bmqa_Message object to be cloned. - * @param other_obj A pointer to a pointer to a z_bmqa_Message object. Upon successful completion, this pointer will be updated to point to the newly cloned message object. - * @return Returns 0 upon successful cloning of the message object. + * @return Returns 0 upon successful creation of the copy. */ - int z_bmqa_Message__clone(const z_bmqa_Message* message_obj, z_bmqa_Message** other_obj); /** - * @brief Retrieves the queue ID associated with a bmqa::Message object. - * - * This function provides access to the queue ID of the specified bmqa::Message object. The queue ID is an identifier that can be used to determine the message's intended destination or source within a messaging system. By obtaining the queue ID, applications can make routing decisions or perform analytics based on the message flow. + * @brief Retrieves the queue ID from a z_bmqa_Message object. + * + * This function retrieves the queue ID from the z_bmqa_Message object 'message_obj' + * and stores it in the memory pointed to by 'queueId_obj'. * - * @param message_obj A constant pointer to the z_bmqa_Message object from which the queue ID is to be retrieved. - * @param queueId_obj A pointer to a pointer to a z_bmqa_QueueId. Upon successful completion, this pointer will be updated to point to the queue ID associated with the message. - * @return Returns 0 upon successful retrieval of the queue ID. + * @param message_obj A pointer to a const z_bmqa_Message object. + * @param queueId_obj A pointer to a pointer to a const z_bmqa_QueueId object + * where the queue ID will be stored. + * + * @return Returns 0 upon successful retrieval. */ - int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, const z_bmqa_QueueId** queueId_obj); /** - * @brief Retrieves the correlation ID associated with a bmqa::Message object. - * - * This function accesses the correlation ID of the specified bmqa::Message object, providing a mechanism to track and associate messages within a system. Correlation IDs are crucial for linking requests with their responses or for grouping related messages together. This feature enhances the ability to monitor and analyze message flows, improving system integration and communication tracking. + * @brief Retrieves the correlation ID from a z_bmqa_Message object. + * + * This function retrieves the correlation ID from the z_bmqa_Message object 'message_obj' + * and stores it in the memory pointed to by 'correlationId_obj'. + * + * @param message_obj A pointer to a const z_bmqa_Message object. + * @param correlationId_obj A pointer to a pointer to a const z_bmqt_CorrelationId object + * where the correlation ID will be stored. * - * @param message_obj A constant pointer to the z_bmqa_Message object from which the correlation ID is to be retrieved. - * @param correlationId_obj A pointer to a pointer to a z_bmqt_CorrelationId. Upon successful completion, this pointer will be updated to point to the correlation ID associated with the message. - * @return Returns 0 upon successful retrieval of the correlation ID. + * @return Returns 0 upon successful retrieval. */ - int z_bmqa_Message__correlationId( const z_bmqa_Message* message_obj, const z_bmqt_CorrelationId** correlationId_obj); /** - * @brief Retrieves the subscription handle associated with a bmqa::Message object. - * - * This function provides access to the subscription handle of the specified bmqa::Message object, facilitating the management and identification of subscriptions in messaging systems. Subscription handles are used to uniquely identify a subscription, allowing for operations such as modifying, querying, or canceling subscriptions based on the handle. This feature is particularly useful in systems that support complex subscription models and need to efficiently manage multiple message streams. + * @brief Retrieves the subscription handle from a z_bmqa_Message object. + * + * This function retrieves the subscription handle from the z_bmqa_Message object 'message_obj' + * and stores it in the memory pointed to by 'subscription_obj'. + * + * @param message_obj A pointer to a const z_bmqa_Message object. + * @param subscription_obj A pointer to a pointer to a const z_bmqt_SubscriptionHandle object + * where the subscription handle will be stored. * - * @param message_obj A constant pointer to the z_bmqa_Message object from which the subscription handle is to be retrieved. - * @param subscription_obj A pointer to a pointer to a z_bmqt_SubscriptionHandle. Upon successful completion, this pointer will be updated to point to the subscription handle associated with the message. - * @return Returns 0 upon successful retrieval of the subscription handle. + * @return Returns 0 upon successful retrieval. */ - int z_bmqa_Message__subscriptionHandle( const z_bmqa_Message* message_obj, const z_bmqt_SubscriptionHandle** subscription_obj); /** - * @brief Retrieves the compression algorithm type set for a bmqa::Message object. - * - * This function returns the compression algorithm type that has been configured for the specified bmqa::Message object. It enables the caller to understand how the message data is compressed, facilitating appropriate decompression or processing steps on the receiver's side. This information is crucial for applications that need to handle message payloads efficiently, especially when working with large data sets or in bandwidth-constrained environments. + * @brief Retrieves the compression algorithm type from a z_bmqa_Message object. + * + * This function retrieves the compression algorithm type from the z_bmqa_Message object 'message_obj'. * - * @param message_obj A constant pointer to the z_bmqa_Message object from which the compression algorithm type is to be retrieved. - * @return Returns the compression algorithm type as a value of the z_bmqt_CompressionAlgorithmType::Enum enumeration, indicating how the message data is compressed. + * @param message_obj A pointer to a const z_bmqa_Message object. + * + * @return The compression algorithm type of the message. */ - z_bmqt_CompressionAlgorithmType::Enum z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message_obj); #ifdef BMQ_ENABLE_MSG_GROUPID /** - * @brief Retrieves the group ID associated with a bmqa::Message object. - * - * This function returns the group ID of the specified bmqa::Message object as a string. The group ID is an identifier used to categorize or group messages for processing or routing purposes. By accessing the group ID, applications can perform actions based on the group to which a message belongs, such as filtering messages, performing group-specific processing, or routing messages to appropriate destinations based on their group ID. + * @brief Retrieves the group ID from a z_bmqa_Message object. + * + * This function retrieves the group ID from the z_bmqa_Message object 'message_obj'. * - * @param message_obj A constant pointer to the z_bmqa_Message object from which the group ID is to be retrieved. - * @return Returns a pointer to a constant character string representing the group ID of the message. This string remains valid as long as the message object is not destroyed or modified. + * @param message_obj A pointer to a const z_bmqa_Message object. + * + * @return A pointer to a string representing the group ID. */ - const char* z_bmqa_Message__groupId(const z_bmqa_Message* message_obj); #endif /** - * @brief Retrieves the message GUID (Globally Unique Identifier) associated with a bmqa::Message object. - * - * This function provides access to the message GUID of the specified bmqa::Message object. A message GUID is a unique identifier for a message, ensuring that each message can be distinctly identified across different components and systems. This feature is particularly useful in tracking, logging, and auditing message flows, as it allows for precise identification and correlation of messages. + * @brief Retrieves the message GUID from a z_bmqa_Message object. * - * @param message_obj A constant pointer to the z_bmqa_Message object from which the message GUID is to be retrieved. - * @param messageGUID_obj A pointer to a pointer to a z_bmqt_MessageGUID. Upon successful completion, this pointer will be updated to point to the message GUID associated with the message. - * @return Returns 0 upon successful retrieval of the message GUID. + * This function retrieves the message GUID from the z_bmqa_Message object 'message_obj' + * and stores it in the memory pointed to by 'messageGUID_obj'. + * + * @param message_obj A pointer to a const z_bmqa_Message object. + * @param messageGUID_obj A pointer to a pointer to a const z_bmqt_MessageGUID object + * where the message GUID will be stored. + * + * @return Returns 0 upon successful retrieval. */ - int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, const z_bmqt_MessageGUID** messageGUID_obj); /** - * @brief Retrieves and duplicates the confirmation cookie associated with a bmqa::Message object. - * - * This function allocates a new confirmation cookie, copying the contents from the confirmation cookie associated with the specified bmqa::Message object. A confirmation cookie is typically used to acknowledge the receipt or processing of a message, providing a mechanism for tracking message status and ensuring reliable communication. By duplicating the confirmation cookie, this function allows for the safe transmission or storage of the cookie independently of the original message. + * @brief Retrieves the confirmation cookie from a z_bmqa_Message object. + * + * This function retrieves the confirmation cookie from the z_bmqa_Message object 'message_obj' + * and stores it in the memory pointed to by 'cookie_obj'. + * + * @param message_obj A pointer to a const z_bmqa_Message object. + * @param cookie_obj A pointer to a pointer to a z_bmqa_MessageConfirmationCookie object + * where the confirmation cookie will be stored. * - * @param message_obj A constant pointer to the z_bmqa_Message object from which the confirmation cookie is to be duplicated. - * @param cookie_obj A pointer to a pointer to a z_bmqa_MessageConfirmationCookie. Upon successful completion, this pointer will be updated to point to the newly allocated confirmation cookie. - * @return Returns 0 upon successful duplication of the confirmation cookie. + * @return Returns 0 upon successful retrieval. */ - int z_bmqa_Message__confirmationCookie( const z_bmqa_Message* message_obj, z_bmqa_MessageConfirmationCookie** cookie_obj); /** - * @brief Retrieves the acknowledgment status of a bmqa::Message object. - * - * This function returns the acknowledgment status for the specified bmqa::Message object. The acknowledgment status indicates whether the message has been acknowledged by the receiver, which can be crucial for ensuring message delivery and handling in systems that require confirmation of message processing. This information helps in managing the flow of messages, particularly in reliable messaging systems where it's important to track the delivery status of each message. + * @brief Retrieves the acknowledgment status from a z_bmqa_Message object. + * + * This function retrieves the acknowledgment status from the z_bmqa_Message object 'message_obj'. * - * @param message_obj A constant pointer to the z_bmqa_Message object from which the acknowledgment status is to be retrieved. - * @return Returns an integer representing the acknowledgment status of the message. The specific meanings of different values are defined by the implementation and should be documented accordingly. + * @param message_obj A pointer to a const z_bmqa_Message object. + * + * @return The acknowledgment status of the message. */ - int z_bmqa_Message__ackStatus(const z_bmqa_Message* message_obj); - /** - * @brief Retrieves the data contained in a bmqa::Message object, formatted as a hexadecimal string. - * - * This function extracts the data from the specified bmqa::Message object and converts it into a hexadecimal string representation. This is useful for debugging or logging purposes, where viewing the raw message data in a human-readable format can be invaluable. The function allocates memory for the hexadecimal string and sets the provided buffer pointer to point to this memory. The caller is responsible for freeing this memory after use. + * @brief Retrieves the data from a z_bmqa_Message object. + * + * This function retrieves the data from the z_bmqa_Message object 'message_obj' + * and stores it in the memory pointed to by 'buffer'. + * + * @param message_obj A pointer to a const z_bmqa_Message object. + * @param buffer A pointer to a pointer to a character buffer where the data + * will be stored. * - * @param message_obj A constant pointer to the z_bmqa_Message object from which the data is to be retrieved. - * @param buffer A pointer to a character pointer. Upon successful completion, this pointer will be updated to point to a newly allocated string containing the hexadecimal representation of the message data. The caller is responsible for freeing this memory. - * @return Returns an integer indicating the result of the data retrieval operation. A return value of 0 typically indicates success, while other values may indicate errors. + * @return Returns 0 upon successful retrieval. */ - -// Add once we figure out how to handle Blobs in C -// int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, z_bdlbb_Blob* -// blob); - int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, char** buffer); /** - * @brief Retrieves the size of the data contained within a bmqa::Message object. - * - * This function returns the size, in bytes, of the data payload within the specified bmqa::Message object. It allows for the assessment of the message's data payload size, which can be crucial for understanding the message's footprint, especially in contexts where bandwidth or storage efficiency is a concern. + * @brief Retrieves the size of the data from a z_bmqa_Message object. * - * @param message_obj A constant pointer to the z_bmqa_Message object from which the data size is to be determined. - * @return Returns an integer representing the size of the data contained within the message, measured in bytes. + * This function retrieves the size of the data from the z_bmqa_Message object 'message_obj'. + * + * @param message_obj A pointer to a const z_bmqa_Message object. + * + * @return The size of the data. */ - int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj); /** - * @brief Checks if a bmqa::Message object contains properties. - * - * This function determines whether the specified bmqa::Message object has properties set. Properties in a message can include metadata such as headers, routing information, or any other key-value pairs that provide context or control how the message should be handled. Knowing whether a message includes such properties is useful for conditional processing or routing decisions. + * @brief Checks if a z_bmqa_Message object has properties. + * + * This function checks if the z_bmqa_Message object 'message_obj' has properties. * - * @param message_obj A constant pointer to the z_bmqa_Message object to be checked for properties. - * @return Returns true if the message object contains properties; otherwise, returns false. + * @param message_obj A pointer to a const z_bmqa_Message object. + * + * @return Returns true if the message has properties, false otherwise. */ - bool z_bmqa_Message__hasProperties(const z_bmqa_Message* message_obj); #ifdef BMQ_ENABLE_MSG_GROUPID /** - * @brief Checks if a bmqa::Message object has a group ID assigned. - * - * This function determines whether the specified bmqa::Message object has a group ID assigned to it. A group ID is used to categorize or group messages for various purposes, such as routing, filtering, or processing. Identifying whether a message is part of a specific group can be crucial for systems that implement group-based messaging logic. + * @brief Checks if a z_bmqa_Message object has a group ID. + * + * This function checks if the z_bmqa_Message object 'message_obj' has a group ID. * - * @param message_obj A constant pointer to the z_bmqa_Message object to be checked for a group ID. - * @return Returns true if the message object has a group ID assigned; otherwise, returns false. + * @param message_obj A pointer to a const z_bmqa_Message object. + * + * @return Returns true if the message has a group ID, false otherwise. */ - bool z_bmqa_Message__hasGroupId(const z_bmqa_Message* message_obj); #endif /** - * @brief Loads the properties of a bmqa::Message object into a provided buffer. - * - * This function extracts the properties from the specified bmqa::Message object and loads them into a user-provided buffer. The properties might include metadata like headers, routing information, or other key-value pairs that provide additional context or instructions on how the message should be handled. This mechanism allows for the direct manipulation or inspection of message properties outside of the message object itself. + * @brief Loads the properties from a z_bmqa_Message object into a buffer. * - * @param message_obj A constant pointer to the z_bmqa_Message object from which properties are to be loaded. - * @param buffer A pointer to a z_bmqa_MessageProperties structure where the message properties will be stored. The caller must ensure that this buffer is appropriately allocated before calling this function. - * @return Returns an integer indicating the result of the properties loading operation. A return value of 0 typically indicates success, while other values may indicate errors. + * This function loads the properties from the z_bmqa_Message object 'message_obj' + * into the buffer pointed to by 'buffer'. + * + * @param message_obj A pointer to a const z_bmqa_Message object. + * @param buffer A pointer to a z_bmqa_MessageProperties object where + * the properties will be loaded. + * + * @return Returns 0 upon successful loading of properties. */ - int z_bmqa_Message__loadProperties(const z_bmqa_Message* message_obj, z_bmqa_MessageProperties* buffer); @@ -330,4 +348,4 @@ int z_bmqa_Message__loadProperties(const z_bmqa_Message* message_obj, } #endif -#endif \ No newline at end of file +#endif diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h index dbdf03322..f4cb75d7a 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h @@ -10,17 +10,68 @@ extern "C" { typedef struct z_bmqa_MessageEvent z_bmqa_MessageEvent; +/** + * @brief Deletes a z_bmqa_MessageEvent object. + * + * This function deallocates memory for the z_bmqa_MessageEvent object. + * + * @param event_obj A pointer to a pointer to the z_bmqa_MessageEvent object to be deleted. + * + * @return Returns 0 upon successful deletion. + */ int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj); +/** + * @brief Creates a new z_bmqa_MessageEvent object. + * + * This function creates a new z_bmqa_MessageEvent object. + * + * @param event_obj A pointer to a pointer to the z_bmqa_MessageEvent object to be created. + * + * @return Returns 0 upon successful creation. + */ int z_bmqa_MessageEvent__create(z_bmqa_MessageEvent** event_obj); +/** + * @brief Retrieves the message iterator associated with a z_bmqa_MessageEvent object. + * + * This function retrieves the message iterator associated with the z_bmqa_MessageEvent object + * and stores it in the memory pointed to by 'iterator_obj'. + * + * @param event_obj A pointer to a const z_bmqa_MessageEvent object. + * @param iterator_obj A pointer to a pointer to a z_bmqa_MessageIterator object + * where the message iterator will be stored. + * + * @return Returns 0 upon successful retrieval. + */ int z_bmqa_MessageEvent__messageIterator( const z_bmqa_MessageEvent* event_obj, z_bmqa_MessageIterator** iterator_obj); +/** + * @brief Retrieves the message event type of a z_bmqa_MessageEvent object. + * + * This function retrieves the message event type of the z_bmqa_MessageEvent object. + * + * @param event_obj A pointer to a const z_bmqa_MessageEvent object. + * + * @return The message event type of the message event. + */ z_bmqt_MessageEventType::Enum z_bmqa_MessageEvent__type(const z_bmqa_MessageEvent* event_obj); +/** + * @brief Converts a z_bmqa_MessageEvent object to a string. + * + * This function converts the z_bmqa_MessageEvent object 'event_obj' to a string + * and stores the string in the memory pointed to by 'out'. + * + * @param event_obj A pointer to a const z_bmqa_MessageEvent object. + * @param out A pointer to a pointer to a character buffer where the string + * representation of the message event will be stored. + * + * @return Returns 0 upon successful conversion. + */ int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* event_obj, char** out); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index 549f9ecbf..6ee7486ec 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -1,6 +1,5 @@ #ifndef INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER #define INCLUDED_Z_BMQA_MESSAGEEVENTBUILDER -#include #if defined(__cplusplus) extern "C" { @@ -8,36 +7,125 @@ extern "C" { #include #include +#include typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; -int z_bmqa_MessageEventBuilder__delete( - z_bmqa_MessageEventBuilder** builder_obj); +/** + * @brief Deletes a z_bmqa_MessageEventBuilder object. + * + * This function deallocates memory for the z_bmqa_MessageEventBuilder object. + * + * @param builder_obj A pointer to a pointer to the z_bmqa_MessageEventBuilder object to be deleted. + * + * @return Returns 0 upon successful deletion. + */ +int z_bmqa_MessageEventBuilder__delete(z_bmqa_MessageEventBuilder** builder_obj); -int z_bmqa_MessageEventBuilder__create( - z_bmqa_MessageEventBuilder** builder_obj); +/** + * @brief Creates a new z_bmqa_MessageEventBuilder object. + * + * This function creates a new z_bmqa_MessageEventBuilder object. + * + * @param builder_obj A pointer to a pointer to the z_bmqa_MessageEventBuilder object to be created. + * + * @return Returns 0 upon successful creation. + */ +int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj); +/** + * @brief Starts a new message in the message event builder. + * + * This function starts a new message in the message event builder and returns a pointer to the + * created z_bmqa_Message object. + * + * @param builder_obj A pointer to the z_bmqa_MessageEventBuilder object. + * @param out_obj A pointer to a pointer to a z_bmqa_Message object where the created message + * will be stored. + * + * @return Returns 0 upon successful creation of the message. + */ int z_bmqa_MessageEventBuilder__startMessage( z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** out_obj); +/** + * @brief Packs the current message in the message event builder. + * + * This function packs the current message in the message event builder with the specified queue ID. + * + * @param builder_obj A pointer to the z_bmqa_MessageEventBuilder object. + * @param queueId A pointer to the z_bmqa_QueueId object representing the queue ID to pack + * the message with. + * + * @return Returns 0 upon successful packing of the message. + */ int z_bmqa_MessageEventBuilder__packMessage( z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_QueueId* queueId); +/** + * @brief Resets the message event builder. + * + * This function resets the message event builder, clearing all previously added messages. + * + * @param builder_obj A pointer to the z_bmqa_MessageEventBuilder object. + * + * @return Returns 0 upon successful reset. + */ int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj); +/** + * @brief Retrieves the message event from the message event builder. + * + * This function retrieves the message event from the message event builder. + * + * @param builder_obj A pointer to the z_bmqa_MessageEventBuilder object. + * @param event_obj A pointer to a pointer to a z_bmqa_MessageEvent object where the retrieved + * message event will be stored. + * + * @return Returns 0 upon successful retrieval of the message event. + */ int z_bmqa_MessageEventBuilder__messageEvent( z_bmqa_MessageEventBuilder* builder_obj, const z_bmqa_MessageEvent** event_obj); +/** + * @brief Retrieves the current message being built in the message event builder. + * + * This function retrieves the current message being built in the message event builder. + * + * @param builder_obj A pointer to the z_bmqa_MessageEventBuilder object. + * @param message_obj A pointer to a pointer to a z_bmqa_Message object where the retrieved + * message will be stored. + * + * @return Returns 0 upon successful retrieval of the current message. + */ int z_bmqa_MessageEventBuilder__currentMessage( z_bmqa_MessageEventBuilder* builder_obj, z_bmqa_Message** message_obj); +/** + * @brief Retrieves the number of messages in the message event builder. + * + * This function retrieves the number of messages in the message event builder. + * + * @param builder_obj A pointer to the const z_bmqa_MessageEventBuilder object. + * + * @return The number of messages in the message event builder. + */ int z_bmqa_MessageEventBuilder__messageCount( const z_bmqa_MessageEventBuilder* builder_obj); +/** + * @brief Retrieves the size of the message event in bytes. + * + * This function retrieves the size of the message event in bytes. + * + * @param builder_obj A pointer to the const z_bmqa_MessageEventBuilder object. + * + * @return The size of the message event in bytes. + */ int z_bmqa_MessageEventBuilder__messageEventSize( const z_bmqa_MessageEventBuilder* builder_obj); @@ -45,4 +133,4 @@ int z_bmqa_MessageEventBuilder__messageEventSize( } #endif -#endif \ No newline at end of file +#endif diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h index 91a965cb9..f8dd4bef9 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h @@ -10,15 +10,53 @@ extern "C" { typedef struct z_bmqa_MessageIterator z_bmqa_MessageIterator; +/** + * @brief Creates a new message iterator object. + * + * This function creates a new message iterator object. + * + * @param messageIterator_obj A pointer to a pointer to the z_bmqa_MessageIterator object to be created. + * + * @return Returns 0 upon successful creation. + */ int z_bmqa_MessageIterator__create( z_bmqa_MessageIterator** messageIterator_obj); +/** + * @brief Deletes a message iterator object. + * + * This function deallocates memory for the message iterator object. + * + * @param messageIterator_obj A pointer to a pointer to the z_bmqa_MessageIterator object to be deleted. + * + * @return Returns 0 upon successful deletion. + */ int z_bmqa_MessageIterator__delete( z_bmqa_MessageIterator** messageIterator_obj); +/** + * @brief Advances to the next message in the iterator. + * + * This function advances to the next message in the iterator. + * + * @param messageIterator_obj A pointer to the z_bmqa_MessageIterator object. + * + * @return Returns true if there is another message in the iterator, otherwise returns false. + */ bool z_bmqa_MessageIterator__nextMessage( z_bmqa_MessageIterator* messageIterator_obj); +/** + * @brief Retrieves the current message from the iterator. + * + * This function retrieves the current message from the iterator. + * + * @param messageIterator_obj A pointer to the const z_bmqa_MessageIterator object. + * @param message_obj A pointer to a pointer to a const z_bmqa_Message object where the retrieved + * message will be stored. + * + * @return Returns 0 upon successful retrieval of the message. + */ int z_bmqa_MessageIterator__message( const z_bmqa_MessageIterator* messageIterator_obj, const z_bmqa_Message** message_obj); @@ -27,4 +65,4 @@ int z_bmqa_MessageIterator__message( } #endif -#endif \ No newline at end of file +#endif diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h index 8615d8819..b98cb36ac 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h @@ -25,133 +25,388 @@ enum Enum { e_BINARY = 7 }; +/** + * @brief Clears the message properties. + * + * This function clears the message properties. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object to be cleared. + */ void z_bmqa_MessageProperties__clear( z_bmqa_MessageProperties* properties_obj); +/** + * @brief Removes a property from the message properties. + * + * This function removes a property from the message properties. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property to be removed. + * @param buffer A pointer to an Enum buffer. + * @return Returns true if the property is successfully removed, false otherwise. + */ bool z_bmqa_MessageProperties__remove( z_bmqa_MessageProperties* properties_obj, const char* name, Enum *buffer); +/** + * @brief Deletes the message properties object. + * + * This function deletes the message properties object. + * + * @param properties_obj A pointer to a pointer to a z_bmqa_MessageProperties object. + * @return Returns 0 upon successful deletion. + */ int z_bmqa_MessageProperties__delete( z_bmqa_MessageProperties** properties_obj); + +/** + * @brief Creates a new message properties object. + * + * This function creates a new message properties object. + * + * @param properties_obj A pointer to a pointer to a z_bmqa_MessageProperties object where the new object will be stored. + * @return Returns 0 upon successful creation. + */ int z_bmqa_MessageProperties__create( z_bmqa_MessageProperties** properties_obj); +/** + * @brief Creates a copy of a message properties object. + * + * This function creates a copy of a message properties object. + * + * @param properties_obj A pointer to a pointer to a z_bmqa_MessageProperties object where the copy will be stored. + * @param other A pointer to a z_bmqa_MessageProperties object to be copied. + * @return Returns 0 upon successful creation of the copy. + */ int z_bmqa_MessageProperties__createCopy( z_bmqa_MessageProperties** properties_obj, const z_bmqa_MessageProperties* other); -int z_bmqa_MessageProperties__(z_bmqa_MessageProperties* properties_obj); - -int z_bmqa_MessageProperties__(z_bmqa_MessageProperties* properties_obj); - +/** + * @brief Sets a property as a boolean value. + * + * This function sets a property as a boolean value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The boolean value of the property. + * @return Returns 0 upon successful setting of the property. + */ int z_bmqa_MessageProperties__setPropertyAsBool( z_bmqa_MessageProperties* properties_obj, const char* name, bool value); +/** + * @brief Sets a property as a character value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The character value of the property. + * @return Returns 0 upon successful setting of the property. + */ int z_bmqa_MessageProperties__setPropertyAsChar( - z_bmqa_MessageProperties* properties_obj, - const char* name, + z_bmqa_MessageProperties* properties_obj, + const char* name, char value); +/** + * @brief Sets a property as a short value. + * + * This function sets a property as a short value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The short value of the property. + * @return Returns 0 upon successful setting of the property. + */ int z_bmqa_MessageProperties__setPropertyAsShort( z_bmqa_MessageProperties* properties_obj, const char* name, short value); +/** + * @brief Sets a property as a 32-bit integer value. + * + * This function sets a property as a 32-bit integer value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The 32-bit integer value of the property. + * @return Returns 0 upon successful setting of the property. + */ int z_bmqa_MessageProperties__setPropertyAsInt32( z_bmqa_MessageProperties* properties_obj, const char* name, int32_t value); +/** + * @brief Sets a property as a 64-bit integer value. + * + * This function sets a property as a 64-bit integer value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The 64-bit integer value of the property. + * @return Returns 0 upon successful setting of the property. + */ int z_bmqa_MessageProperties__setPropertyAsInt64( z_bmqa_MessageProperties* properties_obj, const char* name, long long value); +/** + * @brief Sets a property as a string value. + * + * This function sets a property as a string value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The string value of the property. + * @return Returns 0 upon successful setting of the property. + */ int z_bmqa_MessageProperties__setPropertyAsString( z_bmqa_MessageProperties* properties_obj, const char* name, - char* value); - + const char* value); + +/** + * @brief Sets a property as a binary value. + * + * This function sets a property as a binary value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The binary value of the property. + * @param size The size of the binary value. + * @return Returns 0 upon successful setting of the property. + */ int z_bmqa_MessageProperties__setPropertyAsBinary( z_bmqa_MessageProperties* properties_obj, const char* name, - const char* value, + const char* value, int size); - +/** + * @brief Retrieves the number of properties in the message properties object. + * + * This function retrieves the number of properties in the message properties object. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @return Returns the number of properties. + */ int z_bmqa_MessageProperties__numProperties( - const z_bmqa_MessageProperties* properties_obj); - + const z_bmqa_MessageProperties* properties_obj); + +/** + * @brief Retrieves the total size of the message properties object. + * + * This function retrieves the total size of the message properties object. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @return Returns the total size of the message properties object. + */ int z_bmqa_MessageProperties__totalSize( const z_bmqa_MessageProperties* properties_obj); +/** + * @brief Retrieves a property as a boolean value. + * + * This function retrieves a property as a boolean value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @return Returns the boolean value of the property. + */ bool z_bmqa_MessageProperties__getPropertyAsBool( const z_bmqa_MessageProperties* properties_obj, const char* name); +/** + * @brief Retrieves a property as a character value. + * + * This function retrieves a property as a character value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @return Returns the character value of the property. + */ char z_bmqa_MessageProperties__getPropertyAsChar( const z_bmqa_MessageProperties* properties_obj, const char* name); +/** + * @brief Retrieves a property as a short value. + * + * This function retrieves a property as a short value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @return Returns the short value of the property. + */ short z_bmqa_MessageProperties__getPropertyAsShort( const z_bmqa_MessageProperties* properties_obj, const char* name); +/** + * @brief Retrieves a property as a 32-bit integer value. + * + * This function retrieves a property as a 32-bit integer value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @return Returns the 32-bit integer value of the property. + */ int32_t z_bmqa_MessageProperties__getPropertyAsInt32( const z_bmqa_MessageProperties* properties_obj, const char* name); +/** + * @brief Retrieves a property as a 64-bit integer value. + * + * This function retrieves a property as a 64-bit integer value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @return Returns the 64-bit integer value of the property. + */ long long z_bmqa_MessageProperties__getPropertyAsInt64( const z_bmqa_MessageProperties* properties_obj, const char* name); +/** + * @brief Retrieves a property as a string value. + * + * This function retrieves a property as a string value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @return Returns the string value of the property. + */ const char* z_bmqa_MessageProperties__getPropertyAsString( const z_bmqa_MessageProperties* properties_obj, const char* name); +/** + * @brief Retrieves a property as a binary value. + * + * This function retrieves a property as a binary value. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @return Returns the binary value of the property. + */ const char* z_bmqa_MessageProperties__getPropertyAsBinary( const z_bmqa_MessageProperties* properties_obj, const char* name); +/** + * @brief Retrieves a property as a boolean value, or returns a default value if the property does not exist. + * + * This function retrieves a property as a boolean value, or returns a default value if the property does not exist. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The default value to return if the property does not exist. + * @return Returns the boolean value of the property if it exists, otherwise returns the default value. + */ bool z_bmqa_MessageProperties__getPropertyAsBoolOr( const z_bmqa_MessageProperties* properties_obj, const char* name, bool value); +/** + * @brief Retrieves a property as a character value, or returns a default value if the property does not exist. + * + * This function retrieves a property as a character value, or returns a default value if the property does not exist. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The default value to return if the property does not exist. + * @return Returns the character value of the property if it exists, otherwise returns the default value. + */ char z_bmqa_MessageProperties__getPropertyAsCharOr( const z_bmqa_MessageProperties* properties_obj, - const bsl::string& name, - char value); - -char z_bmqa_MessageProperties__getPropertyAsShortOr( + const char* name, + char value); + +/** + * @brief Retrieves a property as a short value, or returns a default value if the property does not exist. + * + * This function retrieves a property as a short value, or returns a default value if the property does not exist. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The default value to return if the property does not exist. + * @return Returns the short value of the property if it exists, otherwise returns the default value. + */ +short z_bmqa_MessageProperties__getPropertyAsShortOr( const z_bmqa_MessageProperties* properties_obj, - const bsl::string& name, - short value); - + const char* name, + short value); + +/** + * @brief Retrieves a property as a 32-bit integer value, or returns a default value if the property does not exist. + * + * This function retrieves a property as a 32-bit integer value, or returns a default value if the property does not exist. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The default value to return if the property does not exist. + * @return Returns the 32-bit integer value of the property if it exists, otherwise returns the default value. + */ int32_t z_bmqa_MessageProperties__getPropertyAsInt32Or( const z_bmqa_MessageProperties* properties_obj, - const bsl::string& name, - int32_t value); - + const char* name, + int32_t value); + +/** + * @brief Retrieves a property as a 64-bit integer value, or returns a default value if the property does not exist. + * + * This function retrieves a property as a 64-bit integer value, or returns a default value if the property does not exist. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The default value to return if the property does not exist. + * @return Returns the 64-bit integer value of the property if it exists, otherwise returns the default value. + */ long long z_bmqa_MessageProperties__getPropertyAsInt64Or( const z_bmqa_MessageProperties* properties_obj, - const bsl::string& name, + const char* name, long long value); +/** + * @brief Retrieves a property as a string value, or returns a default value if the property does not exist. + * + * This function retrieves a property as a string value, or returns a default value if the property does not exist. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The default value to return if the property does not exist. + * @return Returns the string value of the property if it exists, otherwise returns the default value. + */ const char* z_bmqa_MessageProperties__getPropertyAsStringOr( const z_bmqa_MessageProperties* properties_obj, const char* name, - const char* value); - + const char* value); + +/** + * @brief Retrieves a property as a binary value, or returns a default value if the property does not exist. + * + * This function retrieves a property as a binary value, or returns a default value if the property does not exist. + * + * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param name The name of the property. + * @param value The default value to return if the property does not exist. + * @return Returns the binary value of the property if it exists, otherwise returns the default value. + */ const char* z_bmqa_MessageProperties__getPropertyAsBinaryOr( const z_bmqa_MessageProperties* properties_obj, const char* name, - const char* value, - int size); + const char* value); #if defined(__cplusplus) } diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h index 680720b4a..ff7ca2e61 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h @@ -10,25 +10,102 @@ extern "C" { typedef struct z_bmqa_OpenQueueStatus z_bmqa_OpenQueueStatus; +/** + * @brief Deletes an open queue status object. + * + * This function deallocates memory for the open queue status object. + * + * @param status_obj A pointer to a pointer to the z_bmqa_OpenQueueStatus object to be deleted. + * + * @return Returns 0 upon successful deletion. + */ int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj); +/** + * @brief Creates a new open queue status object. + * + * This function creates a new open queue status object. + * + * @param status_obj A pointer to a pointer to the z_bmqa_OpenQueueStatus object to be created. + * + * @return Returns 0 upon successful creation. + */ int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj); +/** + * @brief Creates a copy of an open queue status object. + * + * This function creates a copy of an existing open queue status object. + * + * @param status_obj A pointer to a pointer to the z_bmqa_OpenQueueStatus object where the copy will be stored. + * @param other A pointer to the const z_bmqa_OpenQueueStatus object to be copied. + * + * @return Returns 0 upon successful creation of the copy. + */ int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_OpenQueueStatus* other); +/** + * @brief Creates an open queue status object with full information. + * + * This function creates an open queue status object with full information. + * + * @param status_obj A pointer to a pointer to the z_bmqa_OpenQueueStatus object to be created. + * @param queueId A pointer to the const z_bmqa_QueueId object representing the queue ID. + * @param result The result of the operation. + * @param errorDescription The error description. + * + * @return Returns 0 upon successful creation of the object. + */ int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, const z_bmqa_QueueId* queueId, int result, - const char* errorDescription); + const char* errorDescription); +/** + * @brief Converts an open queue status object to a boolean value. + * + * This function converts an open queue status object to a boolean value. + * + * @param status_obj A pointer to the const z_bmqa_OpenQueueStatus object. + * + * @return Returns true if the status object is valid, false otherwise. + */ bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj); +/** + * @brief Retrieves the queue ID from an open queue status object. + * + * This function retrieves the queue ID from an open queue status object. + * + * @param status_obj A pointer to the const z_bmqa_OpenQueueStatus object. + * @param queueId_obj A pointer to a pointer to the const z_bmqa_QueueId object to store the queue ID. + * + * @return Returns 0 upon successful retrieval. + */ int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, const z_bmqa_QueueId** queueId_obj); +/** + * @brief Retrieves the result from an open queue status object. + * + * This function retrieves the result from an open queue status object. + * + * @param status_obj A pointer to the const z_bmqa_OpenQueueStatus object. + * + * @return Returns the result of the operation. + */ int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj); +/** + * @brief Retrieves the error description from an open queue status object. + * + * This function retrieves the error description from an open queue status object. + * + * @param status_obj A pointer to the const z_bmqa_OpenQueueStatus object. + * + * @return Returns a pointer to the error description string. + */ const char* z_bmqa_OpenQueueStatus__errorDescription( const z_bmqa_OpenQueueStatus* status_obj); @@ -36,4 +113,4 @@ const char* z_bmqa_OpenQueueStatus__errorDescription( } #endif -#endif \ No newline at end of file +#endif diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h index 72a69b383..cb36d3f40 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h @@ -12,36 +12,140 @@ extern "C" { typedef struct z_bmqa_QueueId z_bmqa_QueueId; +/** + * @brief Deletes a queue ID object. + * + * This function deallocates memory for the queue ID object. + * + * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object to be deleted. + * + * @return Returns 0 upon successful deletion. + */ int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj); +/** + * @brief Creates a new queue ID object. + * + * This function creates a new queue ID object. + * + * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object to be created. + * + * @return Returns 0 upon successful creation. + */ int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj); +/** + * @brief Creates a copy of a queue ID object. + * + * This function creates a copy of an existing queue ID object. + * + * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object where the copy will be stored. + * @param other A pointer to the const z_bmqa_QueueId object to be copied. + * + * @return Returns 0 upon successful creation of the copy. + */ int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, const z_bmqa_QueueId* other); +/** + * @brief Creates a queue ID object from a correlation ID. + * + * This function creates a queue ID object from a correlation ID. + * + * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object to be created. + * @param correlationId A pointer to the const z_bmqt_CorrelationId object representing the correlation ID. + * + * @return Returns 0 upon successful creation of the object. + */ int z_bmqa_QueueId__createFromCorrelationId( z_bmqa_QueueId** queueId_obj, const z_bmqt_CorrelationId* correlationId); +/** + * @brief Creates a queue ID object from a numeric value. + * + * This function creates a queue ID object from a numeric value. + * + * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object to be created. + * @param numeric The numeric value for the queue ID. + * + * @return Returns 0 upon successful creation of the object. + */ int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, int64_t numeric); +/** + * @brief Creates a queue ID object from a pointer. + * + * This function creates a queue ID object from a pointer. + * + * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object to be created. + * @param pointer The pointer value for the queue ID. + * + * @return Returns 0 upon successful creation of the object. + */ int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, void* pointer); +/** + * @brief Retrieves the correlation ID from a queue ID object. + * + * This function retrieves the correlation ID from a queue ID object. + * + * @param queueId_obj A pointer to the const z_bmqa_QueueId object. + * @param queueId_obj A pointer to a pointer to the const z_bmqt_CorrelationId object to store the correlation ID. + * + * @return Returns 0 upon successful retrieval. + */ const z_bmqt_CorrelationId* z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj); +/** + * @brief Retrieves the flags from a queue ID object. + * + * This function retrieves the flags from a queue ID object. + * + * @param queueId_obj A pointer to the const z_bmqa_QueueId object. + * + * @return Returns the flags associated with the queue ID. + */ uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj); +/** + * @brief Retrieves the URI from a queue ID object. + * + * This function retrieves the URI from a queue ID object. + * + * @param queueId_obj A pointer to the const z_bmqa_QueueId object. + * + * @return Returns a pointer to the const z_bmqt_Uri object representing the URI. + */ const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId_obj); +/** + * @brief Retrieves the options from a queue ID object. + * + * This function retrieves the options from a queue ID object. + * + * @param queueId_obj A pointer to the const z_bmqa_QueueId object. + * + * @return Returns a pointer to the const z_bmqt_QueueOptions object representing the options. + */ const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId_obj); +/** + * @brief Checks if a queue ID object is valid. + * + * This function checks if a queue ID object is valid. + * + * @param queueId_obj A pointer to the const z_bmqa_QueueId object. + * + * @return Returns 1 if the queue ID is valid, 0 otherwise. + */ int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId_obj); #if defined(__cplusplus) } #endif -#endif \ No newline at end of file +#endif diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h index 99d3381f1..8fd5c7833 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h @@ -1,3 +1,8 @@ +/** + * @file z_bmqa_session.h + * @brief This file contains the declaration of the z_bmqa_Session structure and related functions. + */ + #ifndef INCLUDED_Z_BMQA_SESSION #define INCLUDED_Z_BMQA_SESSION @@ -24,18 +29,39 @@ typedef struct z_bmqa_SessionEventHandler z_bmqa_SessionEventHandler; typedef void (*z_bmqa_OnSessionEventCb)( const z_bmqa_SessionEvent* sessionEvent, void* data); + typedef void (*z_bmqa_OnMessageEventCb)( const z_bmqa_MessageEvent* messageEvent, void* data); + typedef void (*z_bmqa_SessionEventHandlerMemberFunction)(void* args, void* data); +/** + * @brief Creates a new SessionEventHandler object. + * + * @param eventHandler_obj Pointer to store the created SessionEventHandler object. + * @param onSessionEventCb Callback function for session events. + * @param onMessageEventCb Callback function for message events. + * @param dataSize Size of additional data to be stored with the event handler. + * + * @return Returns 0 upon successful creation. + */ int z_bmqa_SessionEventHandler__create( z_bmqa_SessionEventHandler** eventHandler_obj, - z_bmqa_OnSessionEventCb onSessionEvent, - z_bmqa_OnMessageEventCb onMessageEvent, + z_bmqa_OnSessionEventCb onSessionEventCb, + z_bmqa_OnMessageEventCb onMessageEventCb, uint64_t dataSize); +/** + * @brief Calls a custom function within the SessionEventHandler. + * + * @param eventHandler_obj Pointer to the SessionEventHandler object. + * @param cb Custom function to be called. + * @param args Arguments for the custom function. + * + * @return Returns 0 upon successful execution. + */ int z_bmqa_SessionEventHandler__callCustomFunction( z_bmqa_SessionEventHandler* eventHandler_obj, z_bmqa_SessionEventHandlerMemberFunction cb, @@ -43,121 +69,290 @@ int z_bmqa_SessionEventHandler__callCustomFunction( typedef struct z_bmqa_Session z_bmqa_Session; +/** + * @brief Deletes a Session object. + * + * @param session_obj Pointer to the Session object to be deleted. + * + * @return Returns 0 upon successful deletion. + */ int z_bmqa_Session__delete(z_bmqa_Session** session_obj); +/** + * @brief Creates a new Session object. + * + * @param session_obj Pointer to store the created Session object. + * @param options Pointer to the SessionOptions object for configuring the session. + * + * @return Returns 0 upon successful creation. + */ int z_bmqa_Session__create(z_bmqa_Session** session_obj, const z_bmqt_SessionOptions* options); +/** + * @brief Creates a new Session object asynchronously. + * + * @param session_obj Pointer to store the created Session object. + * @param eventHandler Event handler for handling session events. + * @param options Pointer to the SessionOptions object for configuring the session. + * + * @return Returns 0 upon successful creation. + */ int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, z_bmqa_SessionEventHandler* eventHandler, const z_bmqt_SessionOptions* options); +/** + * @brief Starts a session synchronously. + * + * @param session_obj Pointer to the Session object to start. + * @param timeoutMs Timeout duration for starting the session. + * + * @return Returns 0 upon successful start. + */ int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs); +/** + * @brief Starts a session asynchronously. + * + * @param session_obj Pointer to the Session object to start. + * @param timeoutMs Timeout duration for starting the session. + * + * @return Returns 0 upon successful start. + */ int z_bmqa_Session__startAsync(z_bmqa_Session* session_obj, int64_t timeoutMs); +/** + * @brief Stops a session synchronously. + * + * @param session_obj Pointer to the Session object to stop. + * + * @return Returns 0 upon successful stop. + */ int z_bmqa_Session__stop(z_bmqa_Session* session_obj); +/** + * @brief Stops a session asynchronously. + * + * @param session_obj Pointer to the Session object to stop. + * + * @return Returns 0 upon successful stop. + */ int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj); +/** + * @brief Finalizes the stopping of a session. + * + * @param session_obj Pointer to the Session object. + * + * @return Returns 0 upon successful finalization. + */ int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj); +/** + * @brief Loads a MessageEventBuilder into the Session. + * + * @param session_obj Pointer to the Session object. + * @param builder Pointer to the MessageEventBuilder object to load. + * + * @return Returns 0 upon successful loading. + */ int z_bmqa_Session__loadMessageEventBuilder( z_bmqa_Session* session_obj, z_bmqa_MessageEventBuilder* builder); +/** + * @brief Loads a ConfirmEventBuilder into the Session. + * + * @param session_obj Pointer to the Session object. + * @param builder Pointer to the ConfirmEventBuilder object to load. + * + * @return Returns 0 upon successful loading. + */ int z_bmqa_Session__loadConfirmEventBuilder( z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder* builder); +/** + * @brief Loads MessageProperties into the Session. + * + * @param session_obj Pointer to the Session object. + * @param buffer Pointer to store the loaded MessageProperties. + * + * @return Returns 0 upon successful loading. + */ int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, z_bmqa_MessageProperties** buffer); -// int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, -// z_bmqa_QueueId** queueId, -// const z_bmqt_Uri* uri); - -int z_bmqa_Session__getQueueIdWithCorrelationId( - z_bmqa_Session* session_obj, - z_bmqa_QueueId** queueId, - const z_bmqt_CorrelationId* correlationId); - +/** + * @brief Opens a queue synchronously. + * + * @param session_obj Pointer to the Session object. + * @param queueId Pointer to the QueueId object. + * @param uri URI for the queue. + * @param flags Flags for opening the queue. + * @param status Pointer to store the OpenQueueStatus object. + * + * @return Returns 0 upon successful opening. + */ int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, const char* uri, uint64_t flags, z_bmqa_OpenQueueStatus** status); +/** + * @brief Configures a queue synchronously. + * + * @param session_obj Pointer to the Session object. + * @param queueId Pointer to the QueueId object. + * @param options Pointer to the QueueOptions object. + * @param timeoutMs Timeout duration for configuring the queue. + * @param status + * * @param status Pointer to store the ConfigureQueueStatus object. + * + * @return Returns 0 upon successful configuration. + */ int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, const z_bmqt_QueueOptions* options, int64_t timeoutMs, z_bmqa_ConfigureQueueStatus** status); +/** + * @brief Closes a queue synchronously. + * + * @param session_obj Pointer to the Session object. + * @param queueId Pointer to the QueueId object. + * @param timeoutMs Timeout duration for closing the queue. + * @param status Pointer to store the CloseQueueStatus object. + * + * @return Returns 0 upon successful closing. + */ int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, z_bmqa_QueueId* queueId, int64_t timeoutMs, z_bmqa_CloseQueueStatus** status); -int z_bmqa_Session__closeQueueAsync(z_bmqa_Session* session_obj, - z_bmqa_QueueId* queueId, - int64_t timeout); - -int z_bmqa_Session_nextEvent(z_bmqa_Session* session_obj, - z_bmqa_Event** event_obj, - int64_t timeout); - +/** + * @brief Posts a message event to the session. + * + * @param session_obj Pointer to the Session object. + * @param event Pointer to the MessageEvent object to post. + * + * @return Returns 0 upon successful posting. + */ int z_bmqa_Session__post(z_bmqa_Session* session_obj, const z_bmqa_MessageEvent* event); +/** + * @brief Confirms a message. + * + * @param session_obj Pointer to the Session object. + * @param message Pointer to the Message object to confirm. + * + * @return Returns 0 upon successful confirmation. + */ int z_bmqa_Session__confirmMessage(z_bmqa_Session* session_obj, const z_bmqa_Message* message); +/** + * @brief Confirms a message with a cookie. + * + * @param session_obj Pointer to the Session object. + * @param cookie Pointer to the MessageConfirmationCookie object. + * + * @return Returns 0 upon successful confirmation. + */ int z_bmqa_Session__confirmMessageWithCookie( z_bmqa_Session* session_obj, const z_bmqa_MessageConfirmationCookie* cookie); +/** + * @brief Confirms multiple messages using a ConfirmEventBuilder. + * + * @param session_obj Pointer to the Session object. + * @param builder Pointer to the ConfirmEventBuilder object containing the messages to confirm. + * + * @return Returns 0 upon successful confirmation. + */ int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, z_bmqa_ConfirmEventBuilder* builder); #if defined(__cplusplus) } -#include -#include -#include -#include - +/** + * @brief Custom session event handler class. + * + * This class provides custom handling of session and message events. + */ class z_bmqa_CustomSessionEventHandler : BloombergLP::bmqa::SessionEventHandler { private: - z_bmqa_OnSessionEventCb onSessionEventCb; - z_bmqa_OnMessageEventCb onMessageEventCb; - void* data; - uint64_t mSize; + z_bmqa_OnSessionEventCb onSessionEventCb; /**< Callback function for session events. */ + z_bmqa_OnMessageEventCb onMessageEventCb; /**< Callback function for message events. */ + void* data; /**< Custom data pointer. */ + uint64_t mSize; /**< Size of the custom data. */ - BloombergLP::bslmt::Mutex mutex; + BloombergLP::bslmt::Mutex mutex; /**< Mutex for thread safety. */ public: + /** + * @brief Constructor for z_bmqa_CustomSessionEventHandler. + * + * @param onSessionEventCb Callback function for session events. + * @param onMessageEventCb Callback function for message events. + * @param mSize Size of the custom data. + */ z_bmqa_CustomSessionEventHandler(z_bmqa_OnSessionEventCb onSessionEventCb, z_bmqa_OnMessageEventCb onMessageEventCb, uint64_t mSize); + /** + * @brief Destructor for z_bmqa_CustomSessionEventHandler. + */ ~z_bmqa_CustomSessionEventHandler(); + /** + * @brief Handles session events. + * + * @param sessionEvent Session event object. + */ void onSessionEvent(const BloombergLP::bmqa::SessionEvent& sessionEvent); + /** + * @brief Handles message events. + * + * @param messageEvent Message event object. + */ void onMessageEvent(const BloombergLP::bmqa::MessageEvent& messageEvent); + /** + * @brief Calls a custom member function with provided arguments. + * + * @param function Custom member function to call. + * @param args Arguments to pass to the custom member function. + */ void callCustomFunction(z_bmqa_SessionEventHandlerMemberFunction function, void* args); + /** + * @brief Locks the mutex for thread safety. + */ void lock(); + /** + * @brief Unlocks the mutex. + */ void unlock(); + /** + * @brief Tries to lock the mutex. + */ void tryLock(); }; #endif -#endif \ No newline at end of file +#endif + diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h index c1aebe9ef..c154d0674 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h @@ -9,31 +9,100 @@ extern "C" { #include #include +/** + * @brief Represents a session event. + */ typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; +/** + * @brief Deletes a session event object. + * + * @param event_obj A pointer to a pointer to the session event object to be deleted. + * + * @return Returns 0 upon successful deletion. + */ int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** event_obj); +/** + * @brief Creates a new session event object. + * + * @param event_obj A pointer to a pointer to store the created session event object. + * + * @return Returns 0 upon successful creation. + */ int z_bmqa_SessionEvent__create(z_bmqa_SessionEvent** event_obj); +/** + * @brief Creates a copy of a session event object. + * + * @param event_obj A pointer to a pointer to store the copied session event object. + * @param other A pointer to the session event object to be copied. + * + * @return Returns 0 upon successful creation of the copy. + */ int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** event_obj, const z_bmqa_SessionEvent* other); +/** + * @brief Retrieves the type of the session event. + * + * @param event_obj A pointer to the session event object. + * + * @return Returns the type of the session event. + */ z_bmqt_SessionEventType::Enum z_bmqa_SessionEvent__type(const z_bmqa_SessionEvent* event_obj); +/** + * @brief Retrieves the correlation ID associated with the session event. + * + * @param event_obj A pointer to the session event object. + * @param correlationId_obj A pointer to a pointer to store the retrieved correlation ID. + * + * @return Returns 0 upon successful retrieval. + */ int z_bmqa_SessionEvent__correlationId( const z_bmqa_SessionEvent* event_obj, z_bmqt_CorrelationId const** correlationId_obj); -// Generates NEW queueId +/** + * @brief Retrieves the queue ID associated with the session event. + * + * @param event_obj A pointer to the session event object. + * @param queueId_obj A pointer to a pointer to store the retrieved queue ID. + * + * @return Returns 0 upon successful retrieval. + */ int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* event_obj, z_bmqa_QueueId** queueId_obj); +/** + * @brief Retrieves the status code associated with the session event. + * + * @param event_obj A pointer to the session event object. + * + * @return Returns the status code of the session event. + */ int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* event_obj); +/** + * @brief Retrieves the error description associated with the session event. + * + * @param event_obj A pointer to the session event object. + * + * @return Returns a pointer to the error description string. + */ const char* z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* event_obj); +/** + * @brief Converts the session event object to a string representation. + * + * @param event_obj A pointer to the session event object. + * @param out A pointer to a pointer to store the string representation. + * + * @return Returns 0 upon successful conversion. + */ int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* event_obj, char** out); @@ -42,3 +111,4 @@ int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* event_obj, #endif #endif +` \ No newline at end of file From e5639c06029969a7e8a388b2c2a9f79d20cb5143 Mon Sep 17 00:00:00 2001 From: Simon Sandrew <64385077+Simon-Sandrew@users.noreply.github.com> Date: Tue, 16 Apr 2024 16:45:56 -0400 Subject: [PATCH 56/57] Update src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h Co-authored-by: Yuan Jing Vincent Yan Signed-off-by: Simon Sandrew <64385077+Simon-Sandrew@users.noreply.github.com> --- src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h index 8fd5c7833..671f28b69 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h @@ -208,8 +208,7 @@ int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, * @param queueId Pointer to the QueueId object. * @param options Pointer to the QueueOptions object. * @param timeoutMs Timeout duration for configuring the queue. - * @param status - * * @param status Pointer to store the ConfigureQueueStatus object. + * @param status Pointer to store the ConfigureQueueStatus object. * * @return Returns 0 upon successful configuration. */ From 88adfad7e36b9862e0258bc7276a97c96106f254 Mon Sep 17 00:00:00 2001 From: Simon Sandrew <64385077+Simon-Sandrew@users.noreply.github.com> Date: Wed, 17 Apr 2024 14:29:31 -0400 Subject: [PATCH 57/57] Fork (#16) * Add files via upload * Add files via upload * changes * Delete src/docstring_replace.py * Delete src/function_comments.py * final comments * final * deleted external files * towards future commits * pr feedbakc --------- Co-authored-by: Fatih Orhan <56280631+FatihOrhan0@users.noreply.github.com> --- src/applications/bmqbrkr/etc/etc | 1 - src/groups/wrappers/z_bmq/CMakeLists.txt | 2 - src/groups/wrappers/z_bmq/z-bmq.pc | 10 -- src/groups/wrappers/z_bmq/z_bmqConfig.cmake | 41 ----- .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp | 36 ++--- .../z_bmq/z_bmqa/z_bmqa_closequeuestatus.h | 32 ++-- .../z_bmqa/z_bmqa_configurequeuestatus.cpp | 36 ++--- .../z_bmqa/z_bmqa_configurequeuestatus.h | 54 +++---- .../z_bmqa/z_bmqa_confirmeventbuilder.cpp | 32 ++-- .../z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h | 46 +++--- .../wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp | 104 ++++++------- .../wrappers/z_bmq/z_bmqa/z_bmqa_message.h | 142 +++++++++--------- .../z_bmq/z_bmqa/z_bmqa_messageevent.cpp | 29 ++-- .../z_bmq/z_bmqa/z_bmqa_messageevent.h | 22 +-- .../z_bmqa/z_bmqa_messageeventbuilder.cpp | 46 +++--- .../z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h | 46 +++--- .../z_bmq/z_bmqa/z_bmqa_messageiterator.cpp | 24 +-- .../z_bmq/z_bmqa/z_bmqa_messageiterator.h | 20 +-- .../z_bmq/z_bmqa/z_bmqa_messageproperties.cpp | 116 +++++++------- .../z_bmq/z_bmqa/z_bmqa_messageproperties.h | 112 +++++++------- .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp | 40 ++--- .../z_bmq/z_bmqa/z_bmqa_openqueuestatus.h | 36 ++--- .../wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp | 48 +++--- .../wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h | 46 +++--- .../wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp | 104 ++++++------- .../wrappers/z_bmq/z_bmqa/z_bmqa_session.h | 83 +++++----- .../z_bmq/z_bmqa/z_bmqa_sessionevent.cpp | 40 ++--- .../z_bmq/z_bmqa/z_bmqa_sessionevent.h | 36 ++--- .../z_bmq/z_bmqa/z_bmqa_sessionevent.t.cpp | 2 - .../z_bmqt_compressionalgorithmtype.cpp | 9 +- .../z_bmqt/z_bmqt_compressionalgorithmtype.h | 6 +- .../z_bmq/z_bmqt/z_bmqt_correlationid.cpp | 74 ++++----- .../z_bmq/z_bmqt/z_bmqt_correlationid.h | 60 ++++---- .../z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp | 6 +- .../z_bmq/z_bmqt/z_bmqt_messageguid.cpp | 10 +- .../z_bmq/z_bmqt/z_bmqt_propertytype.cpp | 6 +- .../z_bmq/z_bmqt/z_bmqt_sessioneventtype.h | 9 ++ .../z_bmq/z_bmqt/z_bmqt_subscription.cpp | 4 - test.txt | 1 - 39 files changed, 757 insertions(+), 814 deletions(-) delete mode 120000 src/applications/bmqbrkr/etc/etc delete mode 100644 src/groups/wrappers/z_bmq/z-bmq.pc delete mode 100644 src/groups/wrappers/z_bmq/z_bmqConfig.cmake delete mode 100644 test.txt diff --git a/src/applications/bmqbrkr/etc/etc b/src/applications/bmqbrkr/etc/etc deleted file mode 120000 index b9902dd7d..000000000 --- a/src/applications/bmqbrkr/etc/etc +++ /dev/null @@ -1 +0,0 @@ -/Users/aaryaman/Documents/bmq/blazingmq/src/applications/bmqbrkr/etc \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/CMakeLists.txt b/src/groups/wrappers/z_bmq/CMakeLists.txt index eb384990f..9bfeec1aa 100644 --- a/src/groups/wrappers/z_bmq/CMakeLists.txt +++ b/src/groups/wrappers/z_bmq/CMakeLists.txt @@ -5,7 +5,5 @@ # Add the libbmq group library only installing the public headers add_library(z_bmq) -target_compile_definitions(z_bmq PRIVATE "MWC_INTERNAL_USAGE") - target_bmq_style_uor( z_bmq ) diff --git a/src/groups/wrappers/z_bmq/z-bmq.pc b/src/groups/wrappers/z_bmq/z-bmq.pc deleted file mode 100644 index 305b17912..000000000 --- a/src/groups/wrappers/z_bmq/z-bmq.pc +++ /dev/null @@ -1,10 +0,0 @@ -prefix=/usr/local -libdir=${prefix}//home/jon/cs/bb/simon-fork/blazingmq -includedir=${prefix}/include - -Name: z-bmq -Description: z_bmq -Version: 0.0.0 -Requires.private: bmq bsl -Libs: -L${libdir} -lz_bmq -Cflags: -I${includedir} diff --git a/src/groups/wrappers/z_bmq/z_bmqConfig.cmake b/src/groups/wrappers/z_bmq/z_bmqConfig.cmake deleted file mode 100644 index 3dbf955cd..000000000 --- a/src/groups/wrappers/z_bmq/z_bmqConfig.cmake +++ /dev/null @@ -1,41 +0,0 @@ - -####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### -####### Any changes to this file will be overwritten by the next CMake run #### -####### The input file was uorConfig.cmake.in ######## - -get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../../../../../usr/local" ABSOLUTE) - -macro(set_and_check _var _file) - set(${_var} "${_file}") - if(NOT EXISTS "${_file}") - message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") - endif() -endmacro() - -macro(check_required_components _NAME) - foreach(comp ${${_NAME}_FIND_COMPONENTS}) - if(NOT ${_NAME}_${comp}_FOUND) - if(${_NAME}_FIND_REQUIRED_${comp}) - set(${_NAME}_FOUND FALSE) - endif() - endif() - endforeach() -endmacro() - -#################################################################################### - -include(CMakeFindDependencyMacro) - -if(NOT TARGET z_bmq) - if(NOT WIN32) - find_dependency(Threads) - endif() - - foreach(dep bmq;bsl) - find_dependency(${dep}) - endforeach() - - include(${CMAKE_CURRENT_LIST_DIR}/z_bmqTargets.cmake) -endif() - -check_required_components(z_bmq) diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp index fcf6f3f38..97c755239 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.cpp @@ -1,32 +1,32 @@ #include #include -int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** status_obj) +int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** closeQueueStatus) { using namespace BloombergLP; - BSLS_ASSERT(status_obj != NULL); + BSLS_ASSERT(closeQueueStatus != NULL); bmqa::CloseQueueStatus* status_p = - reinterpret_cast(*status_obj); + reinterpret_cast(*closeQueueStatus); delete status_p; - *status_obj = NULL; + *closeQueueStatus = NULL; return 0; } -int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** status_obj) +int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** closeQueueStatus) { using namespace BloombergLP; bmqa::CloseQueueStatus* status_p = new bmqa::CloseQueueStatus(); - *status_obj = reinterpret_cast(status_p); + *closeQueueStatus = reinterpret_cast(status_p); return 0; } -int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, +int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** closeQueueStatus, const z_bmqa_CloseQueueStatus* other) { using namespace BloombergLP; @@ -35,12 +35,12 @@ int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, reinterpret_cast(other); bmqa::CloseQueueStatus* status_p = new bmqa::CloseQueueStatus(*other_p); - *status_obj = reinterpret_cast(status_p); + *closeQueueStatus = reinterpret_cast(status_p); return 0; } -int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** status_obj, +int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** closeQueueStatus, const z_bmqa_QueueId* queueId, int result, const char* errorDescription) @@ -56,44 +56,44 @@ int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** status_obj, *queueId_p, result_enum, errorDescription_str); - *status_obj = reinterpret_cast(status_p); + *closeQueueStatus = reinterpret_cast(status_p); return 0; } -bool z_bmqa_CloseQueueStatus__toBool(const z_bmqa_CloseQueueStatus* status_obj) +bool z_bmqa_CloseQueueStatus__toBool(const z_bmqa_CloseQueueStatus* closeQueueStatus) { using namespace BloombergLP; const bmqa::CloseQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(closeQueueStatus); return *status_p; } -int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, +int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* closeQueueStatus, z_bmqa_QueueId const** queueId_obj) { using namespace BloombergLP; const bmqa::CloseQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(closeQueueStatus); const bmqa::QueueId* queueId_p = &(status_p->queueId()); *queueId_obj = reinterpret_cast(queueId_p); return 0; } -int z_bmqa_CloseQueueStatus__result(const z_bmqa_CloseQueueStatus* status_obj) +int z_bmqa_CloseQueueStatus__result(const z_bmqa_CloseQueueStatus* closeQueueStatus) { using namespace BloombergLP; const bmqa::CloseQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(closeQueueStatus); return status_p->result(); } const char* z_bmqa_CloseQueueStatus__errorDescription( - const z_bmqa_CloseQueueStatus* status_obj) + const z_bmqa_CloseQueueStatus* closeQueueStatus) { using namespace BloombergLP; const bmqa::CloseQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(closeQueueStatus); return status_p->errorDescription().c_str(); } \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h index 636f4fda8..41f912575 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_closequeuestatus.h @@ -15,34 +15,34 @@ typedef struct z_bmqa_CloseQueueStatus z_bmqa_CloseQueueStatus; * * This function deallocates the memory pointed to by the input pointer to a bmqa::CloseQueueStatus object and sets the pointer to NULL. * - * @param status_obj A pointer to a pointer to a bmqa::CloseQueueStatus object. + * @param closeQueueStatus A pointer to a pointer to a bmqa::CloseQueueStatus object. * Upon successful completion, this pointer will be set to NULL. * @return Returns 0 upon successful deletion. */ -int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** status_obj); +int z_bmqa_CloseQueueStatus__delete(z_bmqa_CloseQueueStatus** closeQueueStatus); /** * @brief Creates a new bmqa::CloseQueueStatus object. * * This function creates a new bmqa::CloseQueueStatus object and assigns its pointer to the provided pointer. * - * @param status_obj A pointer to a pointer to a bmqa::CloseQueueStatus object. + * @param closeQueueStatus A pointer to a pointer to a bmqa::CloseQueueStatus object. * Upon successful completion, this pointer will hold the newly created CloseQueueStatus object. * @return Returns 0 upon successful creation. */ -int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** status_obj); +int z_bmqa_CloseQueueStatus__create(z_bmqa_CloseQueueStatus** closeQueueStatus); /** * @brief Creates a copy of a bmqa::CloseQueueStatus object. * * This function creates a copy of the specified bmqa::CloseQueueStatus object and assigns its pointer to the provided pointer. * - * @param status_obj A pointer to a pointer to a bmqa::CloseQueueStatus object. + * @param closeQueueStatus A pointer to a pointer to a bmqa::CloseQueueStatus object. * Upon successful completion, this pointer will hold the newly created copy of the CloseQueueStatus object. * @param other A pointer to a constant bmqa::CloseQueueStatus object to copy. * @return Returns 0 upon successful creation. */ -int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, +int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** closeQueueStatus, const z_bmqa_CloseQueueStatus* other); /** @@ -50,14 +50,14 @@ int z_bmqa_CloseQueueStatus__createCopy(z_bmqa_CloseQueueStatus** status_obj, * * This function creates a new bmqa::CloseQueueStatus object with the specified parameters and assigns its pointer to the provided pointer. * - * @param status_obj A pointer to a pointer to a bmqa::CloseQueueStatus object. + * @param closeQueueStatus A pointer to a pointer to a bmqa::CloseQueueStatus object. * Upon successful completion, this pointer will hold the newly created CloseQueueStatus object. * @param queueId A pointer to a constant z_bmqa_QueueId object representing the queue identifier. * @param result An integer representing the result of the close operation. * @param errorDescription A pointer to a constant character string representing the error description. * @return Returns 0 upon successful creation. */ -int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** status_obj, +int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** closeQueueStatus, const z_bmqa_QueueId* queueId, int result, const char* errorDescription); @@ -67,23 +67,23 @@ int z_bmqa_CloseQueueStatus__createFull(z_bmqa_CloseQueueStatus** status_obj, * * This function converts the specified CloseQueueStatus object to a boolean value. * - * @param status_obj A pointer to a constant z_bmqa_CloseQueueStatus object to convert. + * @param closeQueueStatus A pointer to a constant z_bmqa_CloseQueueStatus object to convert. * @return Returns true if the CloseQueueStatus object indicates success, false otherwise. */ bool z_bmqa_CloseQueueStatus__toBool( - const z_bmqa_CloseQueueStatus* status_obj); + const z_bmqa_CloseQueueStatus* closeQueueStatus); /** * @brief Retrieves the queue identifier from a CloseQueueStatus object. * * This function retrieves the queue identifier from the specified CloseQueueStatus object. * - * @param status_obj A pointer to a constant z_bmqa_CloseQueueStatus object. + * @param closeQueueStatus A pointer to a constant z_bmqa_CloseQueueStatus object. * @param queueId_obj A pointer to a pointer to a constant z_bmqa_QueueId object. * Upon successful completion, this pointer will hold the queue identifier. * @return Returns 0 upon successful retrieval of the queue identifier. */ -int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, +int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* closeQueueStatus, z_bmqa_QueueId const** queueId_obj); /** @@ -91,21 +91,21 @@ int z_bmqa_CloseQueueStatus__queueId(const z_bmqa_CloseQueueStatus* status_obj, * * This function retrieves the result of the close queue operation from the specified CloseQueueStatus object. * - * @param status_obj A pointer to a constant z_bmqa_CloseQueueStatus object. + * @param closeQueueStatus A pointer to a constant z_bmqa_CloseQueueStatus object. * @return Returns an integer representing the result of the close queue operation. */ -int z_bmqa_CloseQueueStatus__result(const z_bmqa_CloseQueueStatus* status_obj); +int z_bmqa_CloseQueueStatus__result(const z_bmqa_CloseQueueStatus* closeQueueStatus); /** * @brief Retrieves the error description from a CloseQueueStatus object. * * This function retrieves the error description from the specified CloseQueueStatus object. * - * @param status_obj A pointer to a constant z_bmqa_CloseQueueStatus object. + * @param closeQueueStatus A pointer to a constant z_bmqa_CloseQueueStatus object. * @return Returns a pointer to a constant character string representing the error description. */ const char* z_bmqa_CloseQueueStatus__errorDescription( - const z_bmqa_CloseQueueStatus* status_obj); + const z_bmqa_CloseQueueStatus* closeQueueStatus); #if defined(__cplusplus) } diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp index 21a82b1ca..1c8e45d28 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.cpp @@ -2,34 +2,34 @@ #include int z_bmqa_ConfigureQueueStatus__delete( - z_bmqa_ConfigureQueueStatus** status_obj) + z_bmqa_ConfigureQueueStatus** configureQueueStatus) { using namespace BloombergLP; - BSLS_ASSERT(status_obj != NULL); + BSLS_ASSERT(configureQueueStatus != NULL); bmqa::ConfigureQueueStatus* status_p = - reinterpret_cast(*status_obj); + reinterpret_cast(*configureQueueStatus); delete status_p; - *status_obj = NULL; + *configureQueueStatus = NULL; return 0; } int z_bmqa_ConfigureQueueStatus__create( - z_bmqa_ConfigureQueueStatus** status_obj) + z_bmqa_ConfigureQueueStatus** configureQueueStatus) { using namespace BloombergLP; bmqa::ConfigureQueueStatus* status_p = new bmqa::ConfigureQueueStatus(); - *status_obj = reinterpret_cast(status_p); + *configureQueueStatus = reinterpret_cast(status_p); return 0; } int z_bmqa_ConfigureQueueStatus__createCopy( - z_bmqa_ConfigureQueueStatus** status_obj, + z_bmqa_ConfigureQueueStatus** configureQueueStatus, const z_bmqa_ConfigureQueueStatus* other) { using namespace BloombergLP; @@ -39,13 +39,13 @@ int z_bmqa_ConfigureQueueStatus__createCopy( bmqa::ConfigureQueueStatus* status_p = new bmqa::ConfigureQueueStatus( *other_p); - *status_obj = reinterpret_cast(status_p); + *configureQueueStatus = reinterpret_cast(status_p); return 0; } int z_bmqa_ConfigureQueueStatus__createFull( - z_bmqa_ConfigureQueueStatus** status_obj, + z_bmqa_ConfigureQueueStatus** configureQueueStatus, const z_bmqa_QueueId* queueId, int result, const char* errorDescription) @@ -61,27 +61,27 @@ int z_bmqa_ConfigureQueueStatus__createFull( *queueId_p, result_enum, errorDescription_str); - *status_obj = reinterpret_cast(status_p); + *configureQueueStatus = reinterpret_cast(status_p); return 0; } bool z_bmqa_ConfigureQueueStatus__toBool( - const z_bmqa_ConfigureQueueStatus* status_obj) + const z_bmqa_ConfigureQueueStatus* configureQueueStatus) { using namespace BloombergLP; const bmqa::ConfigureQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(configureQueueStatus); return *status_p; } int z_bmqa_ConfigureQueueStatus__queueId( - const z_bmqa_ConfigureQueueStatus* status_obj, + const z_bmqa_ConfigureQueueStatus* configureQueueStatus, z_bmqa_QueueId const** queueId_obj) { using namespace BloombergLP; const bmqa::ConfigureQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(configureQueueStatus); const bmqa::QueueId* queueId_p = &(status_p->queueId()); *queueId_obj = reinterpret_cast(queueId_p); @@ -89,19 +89,19 @@ int z_bmqa_ConfigureQueueStatus__queueId( } int z_bmqa_ConfigureQueueStatus__result( - const z_bmqa_ConfigureQueueStatus* status_obj) + const z_bmqa_ConfigureQueueStatus* configureQueueStatus) { using namespace BloombergLP; const bmqa::ConfigureQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(configureQueueStatus); return status_p->result(); } const char* z_bmqa_ConfigureQueueStatus__errorDescription( - const z_bmqa_ConfigureQueueStatus* status_obj) + const z_bmqa_ConfigureQueueStatus* configureQueueStatus) { using namespace BloombergLP; const bmqa::ConfigureQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(configureQueueStatus); return status_p->errorDescription().c_str(); } \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h index 969279816..4a44068fb 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_configurequeuestatus.h @@ -13,39 +13,39 @@ typedef struct z_bmqa_ConfigureQueueStatus z_bmqa_ConfigureQueueStatus; /** * @brief Deletes a z_bmqa_ConfigureQueueStatus object. * - * This function deletes the z_bmqa_ConfigureQueueStatus object pointed to by 'status_obj'. - * Upon successful completion, the memory pointed to by 'status_obj' will be deallocated, - * and 'status_obj' will be set to NULL. + * This function deletes the z_bmqa_ConfigureQueueStatus object pointed to by 'configureQueueStatus'. + * Upon successful completion, the memory pointed to by 'configureQueueStatus' will be deallocated, + * and 'configureQueueStatus' will be set to NULL. * - * @param status_obj A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object to be deleted. + * @param configureQueueStatus A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object to be deleted. * * @return Returns 0 upon successful deletion. */ int z_bmqa_ConfigureQueueStatus__delete( - z_bmqa_ConfigureQueueStatus** status_obj); + z_bmqa_ConfigureQueueStatus** configureQueueStatus); /** * @brief Creates a new z_bmqa_ConfigureQueueStatus object. * * This function creates a new z_bmqa_ConfigureQueueStatus object and stores - * a pointer to it in the memory pointed to by 'status_obj'. + * a pointer to it in the memory pointed to by 'configureQueueStatus'. * - * @param status_obj A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object where + * @param configureQueueStatus A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object where * the newly created object will be stored. * * @return Returns 0 upon successful creation. */ int z_bmqa_ConfigureQueueStatus__create( - z_bmqa_ConfigureQueueStatus** status_obj); + z_bmqa_ConfigureQueueStatus** configureQueueStatus); /** * @brief Creates a copy of a z_bmqa_ConfigureQueueStatus object. * * This function creates a deep copy of the input z_bmqa_ConfigureQueueStatus object 'other' - * and stores it in the memory pointed to by 'status_obj'. Upon successful completion, - * the pointer 'status_obj' will point to the newly created copy. + * and stores it in the memory pointed to by 'configureQueueStatus'. Upon successful completion, + * the pointer 'configureQueueStatus' will point to the newly created copy. * - * @param status_obj A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object where + * @param configureQueueStatus A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object where * the copy will be stored. Upon successful completion, this pointer * will point to the newly created copy. * @param other A pointer to a z_bmqa_ConfigureQueueStatus object which will be copied. @@ -53,7 +53,7 @@ int z_bmqa_ConfigureQueueStatus__create( * @return Returns 0 upon successful creation of the copy. */ int z_bmqa_ConfigureQueueStatus__createCopy( - z_bmqa_ConfigureQueueStatus** status_obj, + z_bmqa_ConfigureQueueStatus** configureQueueStatus, const z_bmqa_ConfigureQueueStatus* other); /** @@ -61,9 +61,9 @@ int z_bmqa_ConfigureQueueStatus__createCopy( * * This function creates a new z_bmqa_ConfigureQueueStatus object with the provided * 'queueId', 'result', and 'errorDescription', and stores a pointer to it in the memory - * pointed to by 'status_obj'. + * pointed to by 'configureQueueStatus'. * - * @param status_obj A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object where + * @param configureQueueStatus A pointer to a pointer to a z_bmqa_ConfigureQueueStatus object where * the newly created object will be stored. * @param queueId A pointer to a z_bmqa_QueueId object representing the queue ID. * @param result An integer representing the result. @@ -72,7 +72,7 @@ int z_bmqa_ConfigureQueueStatus__createCopy( * @return Returns 0 upon successful creation. */ int z_bmqa_ConfigureQueueStatus__createFull( - z_bmqa_ConfigureQueueStatus** status_obj, + z_bmqa_ConfigureQueueStatus** configureQueueStatus, const z_bmqa_QueueId* queueId, int result, const char* errorDescription); @@ -80,21 +80,21 @@ int z_bmqa_ConfigureQueueStatus__createFull( /** * @brief Converts a z_bmqa_ConfigureQueueStatus object to a boolean value. * - * This function converts the z_bmqa_ConfigureQueueStatus object 'status_obj' to a boolean value. + * This function converts the z_bmqa_ConfigureQueueStatus object 'configureQueueStatus' to a boolean value. * - * @param status_obj A pointer to a z_bmqa_ConfigureQueueStatus object to be converted. + * @param configureQueueStatus A pointer to a z_bmqa_ConfigureQueueStatus object to be converted. * * @return Returns true if the status object represents true, otherwise false. */ bool z_bmqa_ConfigureQueueStatus__toBool( - const z_bmqa_ConfigureQueueStatus* status_obj); + const z_bmqa_ConfigureQueueStatus* configureQueueStatus); /** * @brief Retrieves the queue ID from a z_bmqa_ConfigureQueueStatus object. * - * This function retrieves the queue ID from the z_bmqa_ConfigureQueueStatus object 'status_obj'. + * This function retrieves the queue ID from the z_bmqa_ConfigureQueueStatus object 'configureQueueStatus'. * - * @param status_obj A pointer to a z_bmqa_ConfigureQueueStatus object from which the queue ID + * @param configureQueueStatus A pointer to a z_bmqa_ConfigureQueueStatus object from which the queue ID * will be retrieved. * @param queueId_obj A pointer to a pointer to a z_bmqa_QueueId object where the retrieved * queue ID will be stored. @@ -102,34 +102,34 @@ bool z_bmqa_ConfigureQueueStatus__toBool( * @return Returns 0 upon successful retrieval. */ int z_bmqa_ConfigureQueueStatus__queueId( - const z_bmqa_ConfigureQueueStatus* status_obj, + const z_bmqa_ConfigureQueueStatus* configureQueueStatus, z_bmqa_QueueId const** queueId_obj); /** * @brief Retrieves the result from a z_bmqa_ConfigureQueueStatus object. * - * This function retrieves the result from the z_bmqa_ConfigureQueueStatus object 'status_obj'. + * This function retrieves the result from the z_bmqa_ConfigureQueueStatus object 'configureQueueStatus'. * - * @param status_obj A pointer to a z_bmqa_ConfigureQueueStatus object from which the result + * @param configureQueueStatus A pointer to a z_bmqa_ConfigureQueueStatus object from which the result * will be retrieved. * * @return Returns the result integer. */ int z_bmqa_ConfigureQueueStatus__result( - const z_bmqa_ConfigureQueueStatus* status_obj); + const z_bmqa_ConfigureQueueStatus* configureQueueStatus); /** * @brief Retrieves the error description from a z_bmqa_ConfigureQueueStatus object. * - * This function retrieves the error description from the z_bmqa_ConfigureQueueStatus object 'status_obj'. + * This function retrieves the error description from the z_bmqa_ConfigureQueueStatus object 'configureQueueStatus'. * - * @param status_obj A pointer to a z_bmqa_ConfigureQueueStatus object from which the error description + * @param configureQueueStatus A pointer to a z_bmqa_ConfigureQueueStatus object from which the error description * will be retrieved. * * @return Returns a pointer to the error description string. */ const char* z_bmqa_ConfigureQueueStatus__errorDescription( - const z_bmqa_ConfigureQueueStatus* status_obj); + const z_bmqa_ConfigureQueueStatus* configureQueueStatus); #if defined(__cplusplus) } diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp index dea17a2d6..5b24d3c6c 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.cpp @@ -2,85 +2,85 @@ #include int z_bmqa_ConfirmEventBuilder__delete( - z_bmqa_ConfirmEventBuilder** builder_obj) + z_bmqa_ConfirmEventBuilder** confirmEventBuilder) { using namespace BloombergLP; - BSLS_ASSERT(builder_obj != NULL); + BSLS_ASSERT(confirmEventBuilder != NULL); bmqa::ConfirmEventBuilder* builder_p = - reinterpret_cast(*builder_obj); + reinterpret_cast(*confirmEventBuilder); delete builder_p; - *builder_obj = NULL; + *confirmEventBuilder = NULL; return 0; } int z_bmqa_ConfirmEventBuilder__create( - z_bmqa_ConfirmEventBuilder** builder_obj) + z_bmqa_ConfirmEventBuilder** confirmEventBuilder) { using namespace BloombergLP; bmqa::ConfirmEventBuilder* builder_p = new bmqa::ConfirmEventBuilder(); - *builder_obj = reinterpret_cast(builder_p); + *confirmEventBuilder = reinterpret_cast(builder_p); return 0; } int z_bmqa_ConfirmEventBuilder__addMessageConfirmation( - z_bmqa_ConfirmEventBuilder* builder_obj, + z_bmqa_ConfirmEventBuilder* confirmEventBuilder, const z_bmqa_Message* message) { using namespace BloombergLP; bmqa::ConfirmEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(confirmEventBuilder); const bmqa::Message* message_p = reinterpret_cast( message); return builder_p->addMessageConfirmation(*message_p); } int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie( - z_bmqa_ConfirmEventBuilder* builder_obj, + z_bmqa_ConfirmEventBuilder* confirmEventBuilder, const z_bmqa_MessageConfirmationCookie* cookie) { using namespace BloombergLP; bmqa::ConfirmEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(confirmEventBuilder); const bmqa::MessageConfirmationCookie* cookie_p = reinterpret_cast(cookie); return builder_p->addMessageConfirmation(*cookie_p); } -int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj) +int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* confirmEventBuilder) { using namespace BloombergLP; bmqa::ConfirmEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(confirmEventBuilder); builder_p->reset(); return 0; } int z_bmqa_ConfirmEventBuilder__messageCount( - const z_bmqa_ConfirmEventBuilder* builder_obj) + const z_bmqa_ConfirmEventBuilder* confirmEventBuilder) { using namespace BloombergLP; const bmqa::ConfirmEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(confirmEventBuilder); return builder_p->messageCount(); } -int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, +int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* confirmEventBuilder, const z_bmqt_Blob** blob_obj) { using namespace BloombergLP; const bmqa::ConfirmEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(confirmEventBuilder); const bdlbb::Blob* blob_p = &(builder_p->blob()); *blob_obj = reinterpret_cast(blob_p); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h index a001303fe..d8951a56e 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_confirmeventbuilder.h @@ -15,54 +15,54 @@ typedef struct z_bmqa_MessageConfirmationCookie /** * @brief Deletes a z_bmqa_ConfirmEventBuilder object. * - * This function deletes the z_bmqa_ConfirmEventBuilder object pointed to by 'builder_obj'. - * Upon successful completion, the memory pointed to by 'builder_obj' will be deallocated, - * and 'builder_obj' will be set to NULL. + * This function deletes the z_bmqa_ConfirmEventBuilder object pointed to by 'confirmEventBuilder'. + * Upon successful completion, the memory pointed to by 'confirmEventBuilder' will be deallocated, + * and 'confirmEventBuilder' will be set to NULL. * - * @param builder_obj A pointer to a pointer to a z_bmqa_ConfirmEventBuilder object to be deleted. + * @param confirmEventBuilder A pointer to a pointer to a z_bmqa_ConfirmEventBuilder object to be deleted. * * @return Returns 0 upon successful deletion. */ int z_bmqa_ConfirmEventBuilder__delete( - z_bmqa_ConfirmEventBuilder** builder_obj); + z_bmqa_ConfirmEventBuilder** confirmEventBuilder); /** * @brief Creates a new z_bmqa_ConfirmEventBuilder object. * * This function creates a new z_bmqa_ConfirmEventBuilder object and stores - * a pointer to it in the memory pointed to by 'builder_obj'. + * a pointer to it in the memory pointed to by 'confirmEventBuilder'. * - * @param builder_obj A pointer to a pointer to a z_bmqa_ConfirmEventBuilder object where + * @param confirmEventBuilder A pointer to a pointer to a z_bmqa_ConfirmEventBuilder object where * the newly created object will be stored. * * @return Returns 0 upon successful creation. */ int z_bmqa_ConfirmEventBuilder__create( - z_bmqa_ConfirmEventBuilder** builder_obj); + z_bmqa_ConfirmEventBuilder** confirmEventBuilder); /** * @brief Adds a message confirmation to the z_bmqa_ConfirmEventBuilder object. * * This function adds a message confirmation represented by the z_bmqa_Message object 'message' - * to the z_bmqa_ConfirmEventBuilder object 'builder_obj'. + * to the z_bmqa_ConfirmEventBuilder object 'confirmEventBuilder'. * - * @param builder_obj A pointer to a z_bmqa_ConfirmEventBuilder object to which the message + * @param confirmEventBuilder A pointer to a z_bmqa_ConfirmEventBuilder object to which the message * confirmation will be added. * @param message A pointer to a z_bmqa_Message object representing the message confirmation. * * @return Returns 0 upon successful addition of the message confirmation. */ int z_bmqa_ConfirmEventBuilder__addMessageConfirmation( - z_bmqa_ConfirmEventBuilder* builder_obj, + z_bmqa_ConfirmEventBuilder* confirmEventBuilder, const z_bmqa_Message* message); /** * @brief Adds a message confirmation with a cookie to the z_bmqa_ConfirmEventBuilder object. * * This function adds a message confirmation represented by the z_bmqa_MessageConfirmationCookie - * object 'cookie' to the z_bmqa_ConfirmEventBuilder object 'builder_obj'. + * object 'cookie' to the z_bmqa_ConfirmEventBuilder object 'confirmEventBuilder'. * - * @param builder_obj A pointer to a z_bmqa_ConfirmEventBuilder object to which the message + * @param confirmEventBuilder A pointer to a z_bmqa_ConfirmEventBuilder object to which the message * confirmation will be added. * @param cookie A pointer to a z_bmqa_MessageConfirmationCookie object representing * the message confirmation with a cookie. @@ -70,47 +70,47 @@ int z_bmqa_ConfirmEventBuilder__addMessageConfirmation( * @return Returns 0 upon successful addition of the message confirmation. */ int z_bmqa_ConfirmEventBuilder__addMessageConfirmationWithCookie( - z_bmqa_ConfirmEventBuilder* builder_obj, + z_bmqa_ConfirmEventBuilder* confirmEventBuilder, const z_bmqa_MessageConfirmationCookie* cookie); /** * @brief Resets the z_bmqa_ConfirmEventBuilder object. * - * This function resets the z_bmqa_ConfirmEventBuilder object 'builder_obj' to its initial state. + * This function resets the z_bmqa_ConfirmEventBuilder object 'confirmEventBuilder' to its initial state. * - * @param builder_obj A pointer to a z_bmqa_ConfirmEventBuilder object to be reset. + * @param confirmEventBuilder A pointer to a z_bmqa_ConfirmEventBuilder object to be reset. * * @return Returns 0 upon successful reset. */ -int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* builder_obj); +int z_bmqa_ConfirmEventBuilder__reset(z_bmqa_ConfirmEventBuilder* confirmEventBuilder); /** * @brief Retrieves the message count from the z_bmqa_ConfirmEventBuilder object. * * This function retrieves the count of message confirmations from the - * z_bmqa_ConfirmEventBuilder object 'builder_obj'. + * z_bmqa_ConfirmEventBuilder object 'confirmEventBuilder'. * - * @param builder_obj A pointer to a z_bmqa_ConfirmEventBuilder object from which the message count + * @param confirmEventBuilder A pointer to a z_bmqa_ConfirmEventBuilder object from which the message count * will be retrieved. * * @return Returns the count of message confirmations. */ int z_bmqa_ConfirmEventBuilder__messageCount( - const z_bmqa_ConfirmEventBuilder* builder_obj); + const z_bmqa_ConfirmEventBuilder* confirmEventBuilder); /** * @brief Retrieves the blob from the z_bmqa_ConfirmEventBuilder object. * - * This function retrieves the blob from the z_bmqa_ConfirmEventBuilder object 'builder_obj'. + * This function retrieves the blob from the z_bmqa_ConfirmEventBuilder object 'confirmEventBuilder'. * - * @param builder_obj A pointer to a z_bmqa_ConfirmEventBuilder object from which the blob + * @param confirmEventBuilder A pointer to a z_bmqa_ConfirmEventBuilder object from which the blob * will be retrieved. * @param blob_obj A pointer to a pointer to a z_bmqt_Blob object where the retrieved blob * will be stored. * * @return Returns 0 upon successful retrieval. */ -int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* builder_obj, +int z_bmqa_ConfirmEventBuilder__blob(z_bmqa_ConfirmEventBuilder* confirmEventBuilder, const z_bmqt_Blob** blob_obj); #if defined(__cplusplus) diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp index f4527a44c..8723b8f91 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.cpp @@ -5,48 +5,48 @@ #include #include -int z_bmqa_Message__delete(z_bmqa_Message** message_obj) +int z_bmqa_Message__delete(z_bmqa_Message** message) { using namespace BloombergLP; - BSLS_ASSERT(message_obj != NULL); + BSLS_ASSERT(message != NULL); - bmqa::Message* message_p = reinterpret_cast(*message_obj); + bmqa::Message* message_p = reinterpret_cast(*message); delete message_p; - *message_obj = NULL; + *message = NULL; return 0; } -int z_bmqa_Message__create(z_bmqa_Message** message_obj) +int z_bmqa_Message__create(z_bmqa_Message** message) { using namespace BloombergLP; bmqa::Message* message_p = new bmqa::Message(); - *message_obj = reinterpret_cast(message_p); + *message = reinterpret_cast(message_p); return 0; } -int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, +int z_bmqa_Message__setDataRef(z_bmqa_Message* message, const char* data, int length) { using namespace BloombergLP; - bmqa::Message* message_p = reinterpret_cast(message_obj); + bmqa::Message* message_p = reinterpret_cast(message); message_p->setDataRef(data, length); return 0; } int z_bmqa_Message__setPropertiesRef( - z_bmqa_Message* message_obj, + z_bmqa_Message* message, const z_bmqa_MessageProperties* properties_obj) { using namespace BloombergLP; - bmqa::Message* message_p = reinterpret_cast(message_obj); + bmqa::Message* message_p = reinterpret_cast(message); const bmqa::MessageProperties* properties_p = reinterpret_cast(properties_obj); message_p->setPropertiesRef(properties_p); @@ -54,20 +54,20 @@ int z_bmqa_Message__setPropertiesRef( return 0; } -int z_bmqa_Message__clearPropertiesRef(z_bmqa_Message* message_obj) +int z_bmqa_Message__clearPropertiesRef(z_bmqa_Message* message) { using namespace BloombergLP; - bmqa::Message* message_p = reinterpret_cast(message_obj); + bmqa::Message* message_p = reinterpret_cast(message); message_p->clearPropertiesRef(); return 0; } -int z_bmqa_Message__setCorrelationId(z_bmqa_Message* message_obj, +int z_bmqa_Message__setCorrelationId(z_bmqa_Message* message, const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; - bmqa::Message* message_p = reinterpret_cast(message_obj); + bmqa::Message* message_p = reinterpret_cast(message); const bmqt::CorrelationId* correlationId_p = reinterpret_cast(correlationId); message_p->setCorrelationId(*correlationId_p); @@ -76,11 +76,11 @@ int z_bmqa_Message__setCorrelationId(z_bmqa_Message* message_obj, } int z_bmqa_Message__setCompressionAlgorithmType( - z_bmqa_Message* message_obj, + z_bmqa_Message* message, z_bmqt_CompressionAlgorithmType::Enum value) { using namespace BloombergLP; - bmqa::Message* message_p = reinterpret_cast(message_obj); + bmqa::Message* message_p = reinterpret_cast(message); bmqt::CompressionAlgorithmType::Enum compressionType = static_cast(value); message_p->setCompressionAlgorithmType(compressionType); @@ -90,21 +90,21 @@ int z_bmqa_Message__setCompressionAlgorithmType( #ifdef BMQ_ENABLE_MSG_GROUPID -int z_bmqa_Message__setGroupId(z_bmqa_Message* message_obj, +int z_bmqa_Message__setGroupId(z_bmqa_Message* message, const char* groupId) { using namespace BloombergLP; - bmqa::Message* message_p = reinterpret_cast(message_obj); + bmqa::Message* message_p = reinterpret_cast(message); bsl::string groupId_str(groupId); message_p->setGroupId(groupId_str); return 0; } -int z_bmqa_Message__clearGroupId(z_bmqa_Message* message_obj) +int z_bmqa_Message__clearGroupId(z_bmqa_Message* message) { using namespace BloombergLP; - bmqa::Message* message_p = reinterpret_cast(message_obj); + bmqa::Message* message_p = reinterpret_cast(message); message_p->clearGroupId(); return 0; @@ -112,12 +112,12 @@ int z_bmqa_Message__clearGroupId(z_bmqa_Message* message_obj) #endif -int z_bmqa_Message__clone(const z_bmqa_Message* message_obj, +int z_bmqa_Message__clone(const z_bmqa_Message* message, z_bmqa_Message** other_obj) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); bmqa::Message* other_p = new bmqa::Message(); *other_p = message_p->clone(); @@ -126,12 +126,12 @@ int z_bmqa_Message__clone(const z_bmqa_Message* message_obj, return 0; } -int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, +int z_bmqa_Message__queueId(const z_bmqa_Message* message, const z_bmqa_QueueId** queueId_obj) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); *queueId_obj = reinterpret_cast( &(message_p->queueId())); @@ -139,12 +139,12 @@ int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, } int z_bmqa_Message__correlationId( - const z_bmqa_Message* message_obj, + const z_bmqa_Message* message, const z_bmqt_CorrelationId** correlationId_obj) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); *correlationId_obj = reinterpret_cast( &(message_p->correlationId())); @@ -152,12 +152,12 @@ int z_bmqa_Message__correlationId( } int z_bmqa_Message__subscriptionHandle( - const z_bmqa_Message* message_obj, + const z_bmqa_Message* message, const z_bmqt_SubscriptionHandle** subscription_obj) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); *subscription_obj = reinterpret_cast( &(message_p->subscriptionHandle())); @@ -165,11 +165,11 @@ int z_bmqa_Message__subscriptionHandle( } z_bmqt_CompressionAlgorithmType::Enum -z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message_obj) +z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); return static_cast( message_p->compressionAlgorithmType()); @@ -177,23 +177,23 @@ z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message_obj) #ifdef BMQ_ENABLE_MSG_GROUPID -const char* z_bmqa_Message__groupId(const z_bmqa_Message* message_obj) +const char* z_bmqa_Message__groupId(const z_bmqa_Message* message) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); return message_p->groupId().c_str(); } #endif -int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, +int z_bmqa_Message__messageGUID(const z_bmqa_Message* message, const z_bmqt_MessageGUID** messageGUID_obj) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); *messageGUID_obj = reinterpret_cast( &(message_p->messageGUID())); @@ -201,12 +201,12 @@ int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, } int z_bmqa_Message__confirmationCookie( - const z_bmqa_Message* message_obj, + const z_bmqa_Message* message, z_bmqa_MessageConfirmationCookie** cookie_obj) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); bmqa::MessageConfirmationCookie* cookie_p = new bmqa::MessageConfirmationCookie(message_p->confirmationCookie()); *cookie_obj = reinterpret_cast( @@ -215,27 +215,19 @@ int z_bmqa_Message__confirmationCookie( return 0; } -int z_bmqa_Message__ackStatus(const z_bmqa_Message* message_obj) +int z_bmqa_Message__ackStatus(const z_bmqa_Message* message) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); return message_p->ackStatus(); } -// Add once we figure out how to handle Blobs in C -// int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, z_bdlbb_Blob* -// blob) { -// using namespace BloombergLP; -// const bmqa::Message* message_p = reinterpret_cast(message_obj); -// } - -int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, char** buffer) +int z_bmqa_Message__getData(const z_bmqa_Message* message, char** buffer) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); bdlbb::Blob data; int rc = message_p->getData(&data); @@ -249,41 +241,41 @@ int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, char** buffer) return rc; } -int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj) +int z_bmqa_Message__dataSize(const z_bmqa_Message* message) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); return message_p->dataSize(); } -bool z_bmqa_Message__hasProperties(const z_bmqa_Message* message_obj) +bool z_bmqa_Message__hasProperties(const z_bmqa_Message* message) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); return message_p->hasProperties(); } #ifdef BMQ_ENABLE_MSG_GROUPID -bool z_bmqa_Message__hasGroupId(const z_bmqa_Message* message_obj) +bool z_bmqa_Message__hasGroupId(const z_bmqa_Message* message) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); return message_p->hasGroupId(); } #endif -int z_bmqa_Message__loadProperties(const z_bmqa_Message* message_obj, +int z_bmqa_Message__loadProperties(const z_bmqa_Message* message, z_bmqa_MessageProperties* buffer) { using namespace BloombergLP; const bmqa::Message* message_p = reinterpret_cast( - message_obj); + message); bmqa::MessageProperties* buffer_p = reinterpret_cast(buffer); return message_p->loadProperties(buffer_p); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h index 878eb1eb3..f76a5642f 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_message.h @@ -21,101 +21,101 @@ typedef struct z_bmqa_MessageConfirmationCookie /** * @brief Deletes a z_bmqa_Message object. * - * This function deletes the z_bmqa_Message object pointed to by 'message_obj'. - * Upon successful completion, the memory pointed to by 'message_obj' will be deallocated, - * and 'message_obj' will be set to NULL. + * This function deletes the z_bmqa_Message object pointed to by 'message'. + * Upon successful completion, the memory pointed to by 'message' will be deallocated, + * and 'message' will be set to NULL. * - * @param message_obj A pointer to a pointer to a z_bmqa_Message object to be deleted. + * @param message A pointer to a pointer to a z_bmqa_Message object to be deleted. * * @return Returns 0 upon successful deletion. */ -int z_bmqa_Message__delete(z_bmqa_Message** message_obj); +int z_bmqa_Message__delete(z_bmqa_Message** message); /** * @brief Creates a new z_bmqa_Message object. * * This function creates a new z_bmqa_Message object and stores - * a pointer to it in the memory pointed to by 'message_obj'. + * a pointer to it in the memory pointed to by 'message'. * - * @param message_obj A pointer to a pointer to a z_bmqa_Message object where + * @param message A pointer to a pointer to a z_bmqa_Message object where * the newly created object will be stored. * * @return Returns 0 upon successful creation. */ -int z_bmqa_Message__create(z_bmqa_Message** message_obj); +int z_bmqa_Message__create(z_bmqa_Message** message); /** * @brief Sets the data of a z_bmqa_Message object. * - * This function sets the data of the z_bmqa_Message object 'message_obj' to the + * This function sets the data of the z_bmqa_Message object 'message' to the * provided 'data' with the given 'length'. * - * @param message_obj A pointer to a z_bmqa_Message object. + * @param message A pointer to a z_bmqa_Message object. * @param data A pointer to the data. * @param length The length of the data. * * @return Returns 0 upon successful operation. */ -int z_bmqa_Message__setDataRef(z_bmqa_Message* message_obj, +int z_bmqa_Message__setDataRef(z_bmqa_Message* message, const char* data, int length); /** * @brief Sets the properties of a z_bmqa_Message object. * - * This function sets the properties of the z_bmqa_Message object 'message_obj' to + * This function sets the properties of the z_bmqa_Message object 'message' to * the provided properties object 'properties_obj'. * - * @param message_obj A pointer to a z_bmqa_Message object. + * @param message A pointer to a z_bmqa_Message object. * @param properties_obj A pointer to a z_bmqa_MessageProperties object representing * the properties. * * @return Returns 0 upon successful operation. */ int z_bmqa_Message__setPropertiesRef( - z_bmqa_Message* message_obj, + z_bmqa_Message* message, const z_bmqa_MessageProperties* properties_obj); /** * @brief Clears the properties of a z_bmqa_Message object. * - * This function clears the properties of the z_bmqa_Message object 'message_obj'. + * This function clears the properties of the z_bmqa_Message object 'message'. * - * @param message_obj A pointer to a z_bmqa_Message object. + * @param message A pointer to a z_bmqa_Message object. * * @return Returns 0 upon successful operation. */ -int z_bmqa_Message__clearPropertiesRef(z_bmqa_Message* message_obj); +int z_bmqa_Message__clearPropertiesRef(z_bmqa_Message* message); /** * @brief Sets the correlation ID of a z_bmqa_Message object. * - * This function sets the correlation ID of the z_bmqa_Message object 'message_obj' + * This function sets the correlation ID of the z_bmqa_Message object 'message' * to the provided correlation ID 'correlationId'. * - * @param message_obj A pointer to a z_bmqa_Message object. + * @param message A pointer to a z_bmqa_Message object. * @param correlationId A pointer to a z_bmqt_CorrelationId object representing * the correlation ID. * * @return Returns 0 upon successful operation. */ int z_bmqa_Message__setCorrelationId( - z_bmqa_Message* message_obj, + z_bmqa_Message* message, const z_bmqt_CorrelationId* correlationId); /** * @brief Sets the compression algorithm type of a z_bmqa_Message object. * * This function sets the compression algorithm type of the z_bmqa_Message object - * 'message_obj' to the provided value 'value'. + * 'message' to the provided value 'value'. * - * @param message_obj A pointer to a z_bmqa_Message object. + * @param message A pointer to a z_bmqa_Message object. * @param value The compression algorithm type value. * * @return Returns 0 upon successful operation. */ int z_bmqa_Message__setCompressionAlgorithmType( - z_bmqa_Message* message_obj, + z_bmqa_Message* message, z_bmqt_CompressionAlgorithmType::Enum value); #ifdef BMQ_ENABLE_MSG_GROUPID @@ -123,225 +123,225 @@ int z_bmqa_Message__setCompressionAlgorithmType( /** * @brief Sets the group ID of a z_bmqa_Message object. * - * This function sets the group ID of the z_bmqa_Message object 'message_obj' to + * This function sets the group ID of the z_bmqa_Message object 'message' to * the provided 'groupId'. * - * @param message_obj A pointer to a z_bmqa_Message object. + * @param message A pointer to a z_bmqa_Message object. * @param groupId A pointer to a string representing the group ID. * * @return Returns 0 upon successful operation. */ -int z_bmqa_Message__setGroupId(z_bmqa_Message* message_obj, +int z_bmqa_Message__setGroupId(z_bmqa_Message* message, const char* groupId); /** * @brief Clears the group ID of a z_bmqa_Message object. * - * This function clears the group ID of the z_bmqa_Message object 'message_obj'. + * This function clears the group ID of the z_bmqa_Message object 'message'. * - * @param message_obj A pointer to a z_bmqa_Message object. + * @param message A pointer to a z_bmqa_Message object. * * @return Returns 0 upon successful operation. */ -int z_bmqa_Message__clearGroupId(z_bmqa_Message* message_obj); +int z_bmqa_Message__clearGroupId(z_bmqa_Message* message); #endif /** * @brief Creates a copy of a z_bmqa_Message object. * - * This function creates a copy of the z_bmqa_Message object 'message_obj' and stores + * This function creates a copy of the z_bmqa_Message object 'message' and stores * it in the memory pointed to by 'other_obj'. * - * @param message_obj A pointer to a const z_bmqa_Message object to be copied. + * @param message A pointer to a const z_bmqa_Message object to be copied. * @param other_obj A pointer to a pointer to a z_bmqa_Message object where * the copy will be stored. * * @return Returns 0 upon successful creation of the copy. */ -int z_bmqa_Message__clone(const z_bmqa_Message* message_obj, +int z_bmqa_Message__clone(const z_bmqa_Message* message, z_bmqa_Message** other_obj); /** * @brief Retrieves the queue ID from a z_bmqa_Message object. * - * This function retrieves the queue ID from the z_bmqa_Message object 'message_obj' + * This function retrieves the queue ID from the z_bmqa_Message object 'message' * and stores it in the memory pointed to by 'queueId_obj'. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * @param queueId_obj A pointer to a pointer to a const z_bmqa_QueueId object * where the queue ID will be stored. * * @return Returns 0 upon successful retrieval. */ -int z_bmqa_Message__queueId(const z_bmqa_Message* message_obj, +int z_bmqa_Message__queueId(const z_bmqa_Message* message, const z_bmqa_QueueId** queueId_obj); /** * @brief Retrieves the correlation ID from a z_bmqa_Message object. * - * This function retrieves the correlation ID from the z_bmqa_Message object 'message_obj' + * This function retrieves the correlation ID from the z_bmqa_Message object 'message' * and stores it in the memory pointed to by 'correlationId_obj'. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * @param correlationId_obj A pointer to a pointer to a const z_bmqt_CorrelationId object * where the correlation ID will be stored. * * @return Returns 0 upon successful retrieval. */ int z_bmqa_Message__correlationId( - const z_bmqa_Message* message_obj, + const z_bmqa_Message* message, const z_bmqt_CorrelationId** correlationId_obj); /** * @brief Retrieves the subscription handle from a z_bmqa_Message object. * - * This function retrieves the subscription handle from the z_bmqa_Message object 'message_obj' + * This function retrieves the subscription handle from the z_bmqa_Message object 'message' * and stores it in the memory pointed to by 'subscription_obj'. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * @param subscription_obj A pointer to a pointer to a const z_bmqt_SubscriptionHandle object * where the subscription handle will be stored. * * @return Returns 0 upon successful retrieval. */ int z_bmqa_Message__subscriptionHandle( - const z_bmqa_Message* message_obj, + const z_bmqa_Message* message, const z_bmqt_SubscriptionHandle** subscription_obj); /** * @brief Retrieves the compression algorithm type from a z_bmqa_Message object. * - * This function retrieves the compression algorithm type from the z_bmqa_Message object 'message_obj'. + * This function retrieves the compression algorithm type from the z_bmqa_Message object 'message'. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * * @return The compression algorithm type of the message. */ z_bmqt_CompressionAlgorithmType::Enum -z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message_obj); +z_bmqa_Message__compressionAlgorithmType(const z_bmqa_Message* message); #ifdef BMQ_ENABLE_MSG_GROUPID /** * @brief Retrieves the group ID from a z_bmqa_Message object. * - * This function retrieves the group ID from the z_bmqa_Message object 'message_obj'. + * This function retrieves the group ID from the z_bmqa_Message object 'message'. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * * @return A pointer to a string representing the group ID. */ -const char* z_bmqa_Message__groupId(const z_bmqa_Message* message_obj); +const char* z_bmqa_Message__groupId(const z_bmqa_Message* message); #endif /** * @brief Retrieves the message GUID from a z_bmqa_Message object. * - * This function retrieves the message GUID from the z_bmqa_Message object 'message_obj' + * This function retrieves the message GUID from the z_bmqa_Message object 'message' * and stores it in the memory pointed to by 'messageGUID_obj'. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * @param messageGUID_obj A pointer to a pointer to a const z_bmqt_MessageGUID object * where the message GUID will be stored. * * @return Returns 0 upon successful retrieval. */ -int z_bmqa_Message__messageGUID(const z_bmqa_Message* message_obj, +int z_bmqa_Message__messageGUID(const z_bmqa_Message* message, const z_bmqt_MessageGUID** messageGUID_obj); /** * @brief Retrieves the confirmation cookie from a z_bmqa_Message object. * - * This function retrieves the confirmation cookie from the z_bmqa_Message object 'message_obj' + * This function retrieves the confirmation cookie from the z_bmqa_Message object 'message' * and stores it in the memory pointed to by 'cookie_obj'. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * @param cookie_obj A pointer to a pointer to a z_bmqa_MessageConfirmationCookie object * where the confirmation cookie will be stored. * * @return Returns 0 upon successful retrieval. */ int z_bmqa_Message__confirmationCookie( - const z_bmqa_Message* message_obj, + const z_bmqa_Message* message, z_bmqa_MessageConfirmationCookie** cookie_obj); /** * @brief Retrieves the acknowledgment status from a z_bmqa_Message object. * - * This function retrieves the acknowledgment status from the z_bmqa_Message object 'message_obj'. + * This function retrieves the acknowledgment status from the z_bmqa_Message object 'message'. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * * @return The acknowledgment status of the message. */ -int z_bmqa_Message__ackStatus(const z_bmqa_Message* message_obj); +int z_bmqa_Message__ackStatus(const z_bmqa_Message* message); /** * @brief Retrieves the data from a z_bmqa_Message object. * - * This function retrieves the data from the z_bmqa_Message object 'message_obj' + * This function retrieves the data from the z_bmqa_Message object 'message' * and stores it in the memory pointed to by 'buffer'. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * @param buffer A pointer to a pointer to a character buffer where the data * will be stored. * * @return Returns 0 upon successful retrieval. */ -int z_bmqa_Message__getData(const z_bmqa_Message* message_obj, char** buffer); +int z_bmqa_Message__getData(const z_bmqa_Message* message, char** buffer); /** * @brief Retrieves the size of the data from a z_bmqa_Message object. * - * This function retrieves the size of the data from the z_bmqa_Message object 'message_obj'. + * This function retrieves the size of the data from the z_bmqa_Message object 'message'. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * * @return The size of the data. */ -int z_bmqa_Message__dataSize(const z_bmqa_Message* message_obj); +int z_bmqa_Message__dataSize(const z_bmqa_Message* message); /** * @brief Checks if a z_bmqa_Message object has properties. * - * This function checks if the z_bmqa_Message object 'message_obj' has properties. + * This function checks if the z_bmqa_Message object 'message' has properties. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * * @return Returns true if the message has properties, false otherwise. */ -bool z_bmqa_Message__hasProperties(const z_bmqa_Message* message_obj); +bool z_bmqa_Message__hasProperties(const z_bmqa_Message* message); #ifdef BMQ_ENABLE_MSG_GROUPID /** * @brief Checks if a z_bmqa_Message object has a group ID. * - * This function checks if the z_bmqa_Message object 'message_obj' has a group ID. + * This function checks if the z_bmqa_Message object 'message' has a group ID. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * * @return Returns true if the message has a group ID, false otherwise. */ -bool z_bmqa_Message__hasGroupId(const z_bmqa_Message* message_obj); +bool z_bmqa_Message__hasGroupId(const z_bmqa_Message* message); #endif /** * @brief Loads the properties from a z_bmqa_Message object into a buffer. * - * This function loads the properties from the z_bmqa_Message object 'message_obj' + * This function loads the properties from the z_bmqa_Message object 'message' * into the buffer pointed to by 'buffer'. * - * @param message_obj A pointer to a const z_bmqa_Message object. + * @param message A pointer to a const z_bmqa_Message object. * @param buffer A pointer to a z_bmqa_MessageProperties object where * the properties will be loaded. * * @return Returns 0 upon successful loading of properties. */ -int z_bmqa_Message__loadProperties(const z_bmqa_Message* message_obj, +int z_bmqa_Message__loadProperties(const z_bmqa_Message* message, z_bmqa_MessageProperties* buffer); #if defined(__cplusplus) diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp index e4f25b7dc..7773fe1b8 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.cpp @@ -1,38 +1,39 @@ +#include #include #include #include -#include -int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj) + +int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** messageEvent) { using namespace BloombergLP; - BSLS_ASSERT(event_obj != NULL); + BSLS_ASSERT(messageEvent != NULL); bmqa::MessageEvent* event_p = reinterpret_cast( - *event_obj); + *messageEvent); delete event_p; - *event_obj = NULL; + *messageEvent = NULL; return 0; } -int z_bmqa_MessageEvent__create(z_bmqa_MessageEvent** event_obj) +int z_bmqa_MessageEvent__create(z_bmqa_MessageEvent** messageEvent) { using namespace BloombergLP; bmqa::MessageEvent* event_p = new bmqa::MessageEvent(); - *event_obj = reinterpret_cast(event_p); + *messageEvent = reinterpret_cast(event_p); return 0; } -int z_bmqa_MessageEvent__messageIterator(const z_bmqa_MessageEvent* event_obj, +int z_bmqa_MessageEvent__messageIterator(const z_bmqa_MessageEvent* messageEvent, z_bmqa_MessageIterator** iterator_obj) { using namespace BloombergLP; const bmqa::MessageEvent* event_p = - reinterpret_cast(event_obj); + reinterpret_cast(messageEvent); bmqa::MessageIterator* iterator_p = new bmqa::MessageIterator( event_p->messageIterator()); *iterator_obj = reinterpret_cast(iterator_p); @@ -41,28 +42,28 @@ int z_bmqa_MessageEvent__messageIterator(const z_bmqa_MessageEvent* event_obj, } z_bmqt_MessageEventType::Enum -z_bmqa_MessageEvent__type(const z_bmqa_MessageEvent* event_obj) +z_bmqa_MessageEvent__type(const z_bmqa_MessageEvent* messageEvent) { using namespace BloombergLP; const bmqa::MessageEvent* event_p = - reinterpret_cast(event_obj); + reinterpret_cast(messageEvent); return static_cast(event_p->type()); } -int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* event_obj, +int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* messageEvent, char** out) { using namespace BloombergLP; const bmqa::MessageEvent* event_p = - reinterpret_cast(event_obj); + reinterpret_cast(messageEvent); bsl::ostringstream ss; event_p->print(ss); bsl::string out_str = ss.str(); *out = new char[out_str.length() + 1]; - strcpy(*out, out_str.c_str()); + strncpy(*out, out_str.c_str()); return 0; } \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h index f4cb75d7a..2f444d29c 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageevent.h @@ -15,22 +15,22 @@ typedef struct z_bmqa_MessageEvent z_bmqa_MessageEvent; * * This function deallocates memory for the z_bmqa_MessageEvent object. * - * @param event_obj A pointer to a pointer to the z_bmqa_MessageEvent object to be deleted. + * @param messageEvent A pointer to a pointer to the z_bmqa_MessageEvent object to be deleted. * * @return Returns 0 upon successful deletion. */ -int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** event_obj); +int z_bmqa_MessageEvent__delete(z_bmqa_MessageEvent** messageEvent); /** * @brief Creates a new z_bmqa_MessageEvent object. * * This function creates a new z_bmqa_MessageEvent object. * - * @param event_obj A pointer to a pointer to the z_bmqa_MessageEvent object to be created. + * @param messageEvent A pointer to a pointer to the z_bmqa_MessageEvent object to be created. * * @return Returns 0 upon successful creation. */ -int z_bmqa_MessageEvent__create(z_bmqa_MessageEvent** event_obj); +int z_bmqa_MessageEvent__create(z_bmqa_MessageEvent** messageEvent); /** * @brief Retrieves the message iterator associated with a z_bmqa_MessageEvent object. @@ -38,14 +38,14 @@ int z_bmqa_MessageEvent__create(z_bmqa_MessageEvent** event_obj); * This function retrieves the message iterator associated with the z_bmqa_MessageEvent object * and stores it in the memory pointed to by 'iterator_obj'. * - * @param event_obj A pointer to a const z_bmqa_MessageEvent object. + * @param messageEvent A pointer to a const z_bmqa_MessageEvent object. * @param iterator_obj A pointer to a pointer to a z_bmqa_MessageIterator object * where the message iterator will be stored. * * @return Returns 0 upon successful retrieval. */ int z_bmqa_MessageEvent__messageIterator( - const z_bmqa_MessageEvent* event_obj, + const z_bmqa_MessageEvent* messageEvent, z_bmqa_MessageIterator** iterator_obj); /** @@ -53,26 +53,26 @@ int z_bmqa_MessageEvent__messageIterator( * * This function retrieves the message event type of the z_bmqa_MessageEvent object. * - * @param event_obj A pointer to a const z_bmqa_MessageEvent object. + * @param messageEvent A pointer to a const z_bmqa_MessageEvent object. * * @return The message event type of the message event. */ z_bmqt_MessageEventType::Enum -z_bmqa_MessageEvent__type(const z_bmqa_MessageEvent* event_obj); +z_bmqa_MessageEvent__type(const z_bmqa_MessageEvent* messageEvent); /** * @brief Converts a z_bmqa_MessageEvent object to a string. * - * This function converts the z_bmqa_MessageEvent object 'event_obj' to a string + * This function converts the z_bmqa_MessageEvent object 'messageEvent' to a string * and stores the string in the memory pointed to by 'out'. * - * @param event_obj A pointer to a const z_bmqa_MessageEvent object. + * @param messageEvent A pointer to a const z_bmqa_MessageEvent object. * @param out A pointer to a pointer to a character buffer where the string * representation of the message event will be stored. * * @return Returns 0 upon successful conversion. */ -int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* event_obj, +int z_bmqa_MessageEvent__toString(const z_bmqa_MessageEvent* messageEvent, char** out); #if defined(__cplusplus) diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp index f855257bb..5f74a6bb5 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.cpp @@ -3,39 +3,39 @@ #include int z_bmqa_MessageEventBuilder__delete( - z_bmqa_MessageEventBuilder** builder_obj) + z_bmqa_MessageEventBuilder** messageEventBuilder) { using namespace BloombergLP; - BSLS_ASSERT(builder_obj != NULL); + BSLS_ASSERT(messageEventBuilder != NULL); bmqa::MessageEventBuilder* builder_p = - reinterpret_cast(*builder_obj); + reinterpret_cast(*messageEventBuilder); delete builder_p; - *builder_obj = NULL; + *messageEventBuilder = NULL; return 0; } int z_bmqa_MessageEventBuilder__create( - z_bmqa_MessageEventBuilder** builder_obj) + z_bmqa_MessageEventBuilder** messageEventBuilder) { using namespace BloombergLP; bmqa::MessageEventBuilder* builder_p = new bmqa::MessageEventBuilder(); - *builder_obj = reinterpret_cast(builder_p); + *messageEventBuilder = reinterpret_cast(builder_p); return 0; } int z_bmqa_MessageEventBuilder__startMessage( - z_bmqa_MessageEventBuilder* builder_obj, - z_bmqa_Message** out_obj) + z_bmqa_MessageEventBuilder* messageEventBuilder, + z_bmqa_Message** messageOut) { using namespace BloombergLP; bmqa::MessageEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(messageEventBuilder); bmqa::Message* message_p = &builder_p->startMessage(); *out_obj = reinterpret_cast(message_p); @@ -43,37 +43,37 @@ int z_bmqa_MessageEventBuilder__startMessage( } int z_bmqa_MessageEventBuilder__packMessage( - z_bmqa_MessageEventBuilder* builder_obj, + z_bmqa_MessageEventBuilder* messageEventBuilder, const z_bmqa_QueueId* queueId) { using namespace BloombergLP; bmqa::MessageEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(messageEventBuilder); const bmqa::QueueId* queueId_p = reinterpret_cast( queueId); return builder_p->packMessage(*queueId_p); } -int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj) +int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* messageEventBuilder) { using namespace BloombergLP; bmqa::MessageEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(messageEventBuilder); builder_p->reset(); return 0; } int z_bmqa_MessageEventBuilder__messageEvent( - z_bmqa_MessageEventBuilder* builder_obj, - const z_bmqa_MessageEvent** event_obj) + z_bmqa_MessageEventBuilder* messageEventBuilder, + const z_bmqa_MessageEvent** messageEvent) { using namespace BloombergLP; bmqa::MessageEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(messageEventBuilder); const bmqa::MessageEvent* event_p = &(builder_p->messageEvent()); *event_obj = reinterpret_cast(event_p); @@ -81,13 +81,13 @@ int z_bmqa_MessageEventBuilder__messageEvent( } int z_bmqa_MessageEventBuilder__currentMessage( - z_bmqa_MessageEventBuilder* builder_obj, - z_bmqa_Message** message_obj) + z_bmqa_MessageEventBuilder* messageEventBuilder, + z_bmqa_Message** message) { using namespace BloombergLP; bmqa::MessageEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(messageEventBuilder); bmqa::Message* message_p = &(builder_p->currentMessage()); *message_obj = reinterpret_cast(message_p); @@ -95,21 +95,21 @@ int z_bmqa_MessageEventBuilder__currentMessage( } int z_bmqa_MessageEventBuilder__messageCount( - const z_bmqa_MessageEventBuilder* builder_obj) + const z_bmqa_MessageEventBuilder* messageEventBuilder) { using namespace BloombergLP; const bmqa::MessageEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(messageEventBuilder); return builder_p->messageCount(); } int z_bmqa_MessageEventBuilder__messageEventSize( - const z_bmqa_MessageEventBuilder* builder_obj) + const z_bmqa_MessageEventBuilder* messageEventBuilder) { using namespace BloombergLP; const bmqa::MessageEventBuilder* builder_p = - reinterpret_cast(builder_obj); + reinterpret_cast(messageEventBuilder); return builder_p->messageEventSize(); } \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h index 6ee7486ec..9b6274144 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageeventbuilder.h @@ -16,22 +16,22 @@ typedef struct z_bmqa_MessageEventBuilder z_bmqa_MessageEventBuilder; * * This function deallocates memory for the z_bmqa_MessageEventBuilder object. * - * @param builder_obj A pointer to a pointer to the z_bmqa_MessageEventBuilder object to be deleted. + * @param messageEventBuilder A pointer to a pointer to the z_bmqa_MessageEventBuilder object to be deleted. * * @return Returns 0 upon successful deletion. */ -int z_bmqa_MessageEventBuilder__delete(z_bmqa_MessageEventBuilder** builder_obj); +int z_bmqa_MessageEventBuilder__delete(z_bmqa_MessageEventBuilder** messageEventBuilder); /** * @brief Creates a new z_bmqa_MessageEventBuilder object. * * This function creates a new z_bmqa_MessageEventBuilder object. * - * @param builder_obj A pointer to a pointer to the z_bmqa_MessageEventBuilder object to be created. + * @param messageEventBuilder A pointer to a pointer to the z_bmqa_MessageEventBuilder object to be created. * * @return Returns 0 upon successful creation. */ -int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj); +int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** messageEventBuilder); /** * @brief Starts a new message in the message event builder. @@ -39,29 +39,29 @@ int z_bmqa_MessageEventBuilder__create(z_bmqa_MessageEventBuilder** builder_obj) * This function starts a new message in the message event builder and returns a pointer to the * created z_bmqa_Message object. * - * @param builder_obj A pointer to the z_bmqa_MessageEventBuilder object. - * @param out_obj A pointer to a pointer to a z_bmqa_Message object where the created message + * @param messageEventBuilder A pointer to the z_bmqa_MessageEventBuilder object. + * @param messageOut A pointer to a pointer to a z_bmqa_Message object where the created message * will be stored. * * @return Returns 0 upon successful creation of the message. */ int z_bmqa_MessageEventBuilder__startMessage( - z_bmqa_MessageEventBuilder* builder_obj, - z_bmqa_Message** out_obj); + z_bmqa_MessageEventBuilder* messageEventBuilder, + z_bmqa_Message** messageOut); /** * @brief Packs the current message in the message event builder. * * This function packs the current message in the message event builder with the specified queue ID. * - * @param builder_obj A pointer to the z_bmqa_MessageEventBuilder object. + * @param messageEventBuilder A pointer to the z_bmqa_MessageEventBuilder object. * @param queueId A pointer to the z_bmqa_QueueId object representing the queue ID to pack * the message with. * * @return Returns 0 upon successful packing of the message. */ int z_bmqa_MessageEventBuilder__packMessage( - z_bmqa_MessageEventBuilder* builder_obj, + z_bmqa_MessageEventBuilder* messageEventBuilder, const z_bmqa_QueueId* queueId); /** @@ -69,40 +69,40 @@ int z_bmqa_MessageEventBuilder__packMessage( * * This function resets the message event builder, clearing all previously added messages. * - * @param builder_obj A pointer to the z_bmqa_MessageEventBuilder object. + * @param messageEventBuilder A pointer to the z_bmqa_MessageEventBuilder object. * * @return Returns 0 upon successful reset. */ -int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* builder_obj); +int z_bmqa_MessageEventBuilder__reset(z_bmqa_MessageEventBuilder* messageEventBuilder); /** * @brief Retrieves the message event from the message event builder. * * This function retrieves the message event from the message event builder. * - * @param builder_obj A pointer to the z_bmqa_MessageEventBuilder object. - * @param event_obj A pointer to a pointer to a z_bmqa_MessageEvent object where the retrieved + * @param messageEventBuilder A pointer to the z_bmqa_MessageEventBuilder object. + * @param messageEvent A pointer to a pointer to a z_bmqa_MessageEvent object where the retrieved * message event will be stored. * * @return Returns 0 upon successful retrieval of the message event. */ int z_bmqa_MessageEventBuilder__messageEvent( - z_bmqa_MessageEventBuilder* builder_obj, - const z_bmqa_MessageEvent** event_obj); + z_bmqa_MessageEventBuilder* messageEventBuilder, + const z_bmqa_MessageEvent** messageEvent); /** * @brief Retrieves the current message being built in the message event builder. * * This function retrieves the current message being built in the message event builder. * - * @param builder_obj A pointer to the z_bmqa_MessageEventBuilder object. - * @param message_obj A pointer to a pointer to a z_bmqa_Message object where the retrieved + * @param messageEventBuilder A pointer to the z_bmqa_MessageEventBuilder object. + * @param messageEvent A pointer to a pointer to a z_bmqa_Message object where the retrieved * message will be stored. * * @return Returns 0 upon successful retrieval of the current message. */ int z_bmqa_MessageEventBuilder__currentMessage( - z_bmqa_MessageEventBuilder* builder_obj, + z_bmqa_MessageEventBuilder* messageEventBuilder, z_bmqa_Message** message_obj); /** @@ -110,24 +110,24 @@ int z_bmqa_MessageEventBuilder__currentMessage( * * This function retrieves the number of messages in the message event builder. * - * @param builder_obj A pointer to the const z_bmqa_MessageEventBuilder object. + * @param messageEventBuilder A pointer to the const z_bmqa_MessageEventBuilder object. * * @return The number of messages in the message event builder. */ int z_bmqa_MessageEventBuilder__messageCount( - const z_bmqa_MessageEventBuilder* builder_obj); + const z_bmqa_MessageEventBuilder* messageEventBuilder); /** * @brief Retrieves the size of the message event in bytes. * * This function retrieves the size of the message event in bytes. * - * @param builder_obj A pointer to the const z_bmqa_MessageEventBuilder object. + * @param messageEventBuilder A pointer to the const z_bmqa_MessageEventBuilder object. * * @return The size of the message event in bytes. */ int z_bmqa_MessageEventBuilder__messageEventSize( - const z_bmqa_MessageEventBuilder* builder_obj); + const z_bmqa_MessageEventBuilder* messageEventBuilder); #if defined(__cplusplus) } diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp index c36988a71..c4b669fee 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.cpp @@ -2,56 +2,56 @@ #include int z_bmqa_MessageIterator__delete( - z_bmqa_MessageIterator** messageIterator_obj) + z_bmqa_MessageIterator** messageIterator) { using namespace BloombergLP; - BSLS_ASSERT(messageIterator_obj != NULL); + BSLS_ASSERT(messageIterator != NULL); bmqa::MessageIterator* messageIterator_p = - reinterpret_cast(*messageIterator_obj); + reinterpret_cast(*messageIterator); delete messageIterator_p; - *messageIterator_obj = NULL; + *messageIterator = NULL; return 0; } int z_bmqa_MessageIterator__create( - z_bmqa_MessageIterator** messageIterator_obj) + z_bmqa_MessageIterator** messageIterator) { using namespace BloombergLP; bmqa::MessageIterator* messageIterator_p = new bmqa::MessageIterator(); - *messageIterator_obj = reinterpret_cast( + *messageIterator = reinterpret_cast( messageIterator_p); return 0; } bool z_bmqa_MessageIterator__nextMessage( - z_bmqa_MessageIterator* messageIterator_obj) + z_bmqa_MessageIterator* messageIterator) { using namespace BloombergLP; bmqa::MessageIterator* messageIterator_p = - reinterpret_cast(messageIterator_obj); + reinterpret_cast(messageIterator); return messageIterator_p->nextMessage(); } int z_bmqa_MessageIterator__message( - const z_bmqa_MessageIterator* messageIterator_obj, - const z_bmqa_Message** message_obj) + const z_bmqa_MessageIterator* messageIterator, + const z_bmqa_Message** messageOut) { using namespace BloombergLP; const bmqa::MessageIterator* messageIterator_p = - reinterpret_cast(messageIterator_obj); + reinterpret_cast(messageIterator); const z_bmqa_Message* message_p = reinterpret_cast( &messageIterator_p->message()); - *message_obj = reinterpret_cast(message_p); + *messageOut = reinterpret_cast(message_p); return 0; } \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h index f8dd4bef9..542abc633 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageiterator.h @@ -15,51 +15,51 @@ typedef struct z_bmqa_MessageIterator z_bmqa_MessageIterator; * * This function creates a new message iterator object. * - * @param messageIterator_obj A pointer to a pointer to the z_bmqa_MessageIterator object to be created. + * @param messageIterator A pointer to a pointer to the z_bmqa_MessageIterator object to be created. * * @return Returns 0 upon successful creation. */ int z_bmqa_MessageIterator__create( - z_bmqa_MessageIterator** messageIterator_obj); + z_bmqa_MessageIterator** messageIterator); /** * @brief Deletes a message iterator object. * * This function deallocates memory for the message iterator object. * - * @param messageIterator_obj A pointer to a pointer to the z_bmqa_MessageIterator object to be deleted. + * @param messageIterator A pointer to a pointer to the z_bmqa_MessageIterator object to be deleted. * * @return Returns 0 upon successful deletion. */ int z_bmqa_MessageIterator__delete( - z_bmqa_MessageIterator** messageIterator_obj); + z_bmqa_MessageIterator** messageIterator); /** * @brief Advances to the next message in the iterator. * * This function advances to the next message in the iterator. * - * @param messageIterator_obj A pointer to the z_bmqa_MessageIterator object. + * @param messageIterator A pointer to the z_bmqa_MessageIterator object. * * @return Returns true if there is another message in the iterator, otherwise returns false. */ bool z_bmqa_MessageIterator__nextMessage( - z_bmqa_MessageIterator* messageIterator_obj); + z_bmqa_MessageIterator* messageIterator); /** * @brief Retrieves the current message from the iterator. * * This function retrieves the current message from the iterator. * - * @param messageIterator_obj A pointer to the const z_bmqa_MessageIterator object. - * @param message_obj A pointer to a pointer to a const z_bmqa_Message object where the retrieved + * @param messageIterator A pointer to the const z_bmqa_MessageIterator object. + * @param messageOut A pointer to a pointer to a const z_bmqa_Message object where the retrieved * message will be stored. * * @return Returns 0 upon successful retrieval of the message. */ int z_bmqa_MessageIterator__message( - const z_bmqa_MessageIterator* messageIterator_obj, - const z_bmqa_Message** message_obj); + const z_bmqa_MessageIterator* messageIterator, + const z_bmqa_Message** messageOut); #if defined(__cplusplus) } diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp index 6878e1060..067ea8885 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.cpp @@ -15,25 +15,25 @@ const int z_bmqa_MessageProperties::k_MAX_PROPERTY_VALUE_LENGTH = BloombergLP::bmqa::MessageProperties::k_MAX_PROPERTY_VALUE_LENGTH; void z_bmqa_MessageProperties__clear( - z_bmqa_MessageProperties* properties_obj) + z_bmqa_MessageProperties* messageProperties) { using namespace BloombergLP; bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); properties_p->clear(); } bool z_bmqa_MessageProperties__remove( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, Enum *buffer) { using namespace BloombergLP; bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); //can I just use Enum like this? bsl::string name_str(name); @@ -41,33 +41,33 @@ bool z_bmqa_MessageProperties__remove( // return properties_p->remove(name_str, buffer); } -int z_bmqa_MessageProperties__delete(z_bmqa_MessageProperties** properties_obj) +int z_bmqa_MessageProperties__delete(z_bmqa_MessageProperties** messageProperties) { using namespace BloombergLP; - BSLS_ASSERT(properties_obj != NULL); + BSLS_ASSERT(messageProperties != NULL); bmqa::MessageProperties* properties_p = - reinterpret_cast(*properties_obj); + reinterpret_cast(*messageProperties); delete properties_p; - *properties_obj = NULL; + *messageProperties = NULL; return 0; } -int z_bmqa_MessageProperties__create(z_bmqa_MessageProperties** properties_obj) +int z_bmqa_MessageProperties__create(z_bmqa_MessageProperties** messageProperties) { using namespace BloombergLP; bmqa::MessageProperties* properties_p = new bmqa::MessageProperties(); - *properties_obj = reinterpret_cast( + *messageProperties = reinterpret_cast( properties_p); return 0; } int z_bmqa_MessageProperties__createCopy( - z_bmqa_MessageProperties** properties_obj, + z_bmqa_MessageProperties** messageProperties, const z_bmqa_MessageProperties* other) { using namespace BloombergLP; @@ -76,62 +76,62 @@ int z_bmqa_MessageProperties__createCopy( reinterpret_cast(other); bmqa::MessageProperties* properties_p = new bmqa::MessageProperties( *other_p); - *properties_obj = reinterpret_cast( + *messageProperties = reinterpret_cast( properties_p); return 0; } int z_bmqa_MessageProperties__setPropertyAsBool( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, bool value) { using namespace BloombergLP; bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->setPropertyAsBool(name_str, value); } int z_bmqa_MessageProperties__setPropertyAsChar( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, char value) { using namespace BloombergLP; bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->setPropertyAsChar(name_str,value); } int z_bmqa_MessageProperties__setPropertyAsShort( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, short value) { using namespace BloombergLP; bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->setPropertyAsShort(name_str,value); } int z_bmqa_MessageProperties__setPropertyAsInt32( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, int32_t value) { using namespace BloombergLP; bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->setPropertyAsInt32(name_str,value); @@ -139,14 +139,14 @@ int z_bmqa_MessageProperties__setPropertyAsInt32( int z_bmqa_MessageProperties__setPropertyAsInt64( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, long long value) { using namespace BloombergLP; bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->setPropertyAsInt64(name_str,value); @@ -154,14 +154,14 @@ int z_bmqa_MessageProperties__setPropertyAsInt64( //needs rigorous testing to see if value conversion to bsl::string is needed, or we use the char* value int z_bmqa_MessageProperties__setPropertyAsString( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, const char* value) { using namespace BloombergLP; bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); bsl::string val_str(value); @@ -169,7 +169,7 @@ int z_bmqa_MessageProperties__setPropertyAsString( } int z_bmqa_MessageProperties__setPropertyAsBinary( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, const char* value, int size) @@ -177,7 +177,7 @@ int z_bmqa_MessageProperties__setPropertyAsBinary( using namespace BloombergLP; bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); bsl::vector val_vec(value, value+size); @@ -186,86 +186,86 @@ int z_bmqa_MessageProperties__setPropertyAsBinary( int z_bmqa_MessageProperties__numProperties( - const z_bmqa_MessageProperties* properties_obj) + const z_bmqa_MessageProperties* messageProperties) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); return properties_p->numProperties(); } int z_bmqa_MessageProperties__totalSize( - const z_bmqa_MessageProperties* properties_obj) + const z_bmqa_MessageProperties* messageProperties) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); return properties_p->totalSize(); } bool z_bmqa_MessageProperties__getPropertyAsBool( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->getPropertyAsBool(name_str); } char z_bmqa_MessageProperties__getPropertyAsChar( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->getPropertyAsChar(name_str); } short z_bmqa_MessageProperties__getPropertyAsShort( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->getPropertyAsShort(name_str); } int32_t z_bmqa_MessageProperties__getPropertyAsInt32( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->getPropertyAsInt32(name_str); } long long z_bmqa_MessageProperties__getPropertyAsInt64( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->getPropertyAsInt64(name_str); @@ -273,13 +273,13 @@ long long z_bmqa_MessageProperties__getPropertyAsInt64( //docstring needs to include freeing cStr const char* z_bmqa_MessageProperties__getPropertyAsString( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); const bsl::string& propertyAsBSLString = properties_p->getPropertyAsString(name_str); @@ -289,13 +289,13 @@ const char* z_bmqa_MessageProperties__getPropertyAsString( //docstring needs to include freeing cBinVec const char* z_bmqa_MessageProperties__getPropertyAsBinary( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); bsl::vector propertyAsBSLVec = properties_p->getPropertyAsBinary(name_str); @@ -308,70 +308,70 @@ const char* z_bmqa_MessageProperties__getPropertyAsBinary( } bool z_bmqa_MessageProperties__getPropertyAsBoolOr( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name, bool value) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->getPropertyAsBoolOr(name_str, value); } char z_bmqa_MessageProperties__getPropertyAsCharOr( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const bsl::string& name, char value) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->getPropertyAsCharOr(name_str, value); } char z_bmqa_MessageProperties__getPropertyAsShortOr( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const bsl::string& name, short value) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->getPropertyAsShortOr(name_str, value); } int32_t z_bmqa_MessageProperties__getPropertyAsInt32Or( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const bsl::string& name, int32_t value) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->getPropertyAsInt32Or(name_str, value); } long long z_bmqa_MessageProperties__getPropertyAsInt64Or( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const bsl::string& name, long long value) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); return properties_p->getPropertyAsInt64Or(name_str, value); @@ -379,14 +379,14 @@ long long z_bmqa_MessageProperties__getPropertyAsInt64Or( const char* z_bmqa_MessageProperties__getPropertyAsStringOr( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name, const char* value) { using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); bsl::string value_str(value); @@ -395,7 +395,7 @@ const char* z_bmqa_MessageProperties__getPropertyAsStringOr( } const char* z_bmqa_MessageProperties__getPropertyAsBinaryOr( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name, const char* value, int size) @@ -403,7 +403,7 @@ const char* z_bmqa_MessageProperties__getPropertyAsBinaryOr( using namespace BloombergLP; const bmqa::MessageProperties* properties_p = - reinterpret_cast(properties_obj); + reinterpret_cast(messageProperties); bsl::string name_str(name); bsl::vector value_vec(value, value + size); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h index b98cb36ac..ba155f46c 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_messageproperties.h @@ -30,23 +30,23 @@ enum Enum { * * This function clears the message properties. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object to be cleared. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object to be cleared. */ void z_bmqa_MessageProperties__clear( - z_bmqa_MessageProperties* properties_obj); + z_bmqa_MessageProperties* messageProperties); /** * @brief Removes a property from the message properties. * * This function removes a property from the message properties. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property to be removed. * @param buffer A pointer to an Enum buffer. * @return Returns true if the property is successfully removed, false otherwise. */ bool z_bmqa_MessageProperties__remove( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, Enum *buffer); @@ -55,11 +55,11 @@ bool z_bmqa_MessageProperties__remove( * * This function deletes the message properties object. * - * @param properties_obj A pointer to a pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a pointer to a z_bmqa_MessageProperties object. * @return Returns 0 upon successful deletion. */ int z_bmqa_MessageProperties__delete( - z_bmqa_MessageProperties** properties_obj); + z_bmqa_MessageProperties** messageProperties); /** @@ -67,23 +67,23 @@ int z_bmqa_MessageProperties__delete( * * This function creates a new message properties object. * - * @param properties_obj A pointer to a pointer to a z_bmqa_MessageProperties object where the new object will be stored. + * @param messageProperties A pointer to a pointer to a z_bmqa_MessageProperties object where the new object will be stored. * @return Returns 0 upon successful creation. */ int z_bmqa_MessageProperties__create( - z_bmqa_MessageProperties** properties_obj); + z_bmqa_MessageProperties** messageProperties); /** * @brief Creates a copy of a message properties object. * * This function creates a copy of a message properties object. * - * @param properties_obj A pointer to a pointer to a z_bmqa_MessageProperties object where the copy will be stored. + * @param messageProperties A pointer to a pointer to a z_bmqa_MessageProperties object where the copy will be stored. * @param other A pointer to a z_bmqa_MessageProperties object to be copied. * @return Returns 0 upon successful creation of the copy. */ int z_bmqa_MessageProperties__createCopy( - z_bmqa_MessageProperties** properties_obj, + z_bmqa_MessageProperties** messageProperties, const z_bmqa_MessageProperties* other); /** @@ -91,26 +91,26 @@ int z_bmqa_MessageProperties__createCopy( * * This function sets a property as a boolean value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The boolean value of the property. * @return Returns 0 upon successful setting of the property. */ int z_bmqa_MessageProperties__setPropertyAsBool( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, bool value); /** * @brief Sets a property as a character value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The character value of the property. * @return Returns 0 upon successful setting of the property. */ int z_bmqa_MessageProperties__setPropertyAsChar( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, char value); @@ -119,13 +119,13 @@ int z_bmqa_MessageProperties__setPropertyAsChar( * * This function sets a property as a short value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The short value of the property. * @return Returns 0 upon successful setting of the property. */ int z_bmqa_MessageProperties__setPropertyAsShort( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, short value); @@ -134,13 +134,13 @@ int z_bmqa_MessageProperties__setPropertyAsShort( * * This function sets a property as a 32-bit integer value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The 32-bit integer value of the property. * @return Returns 0 upon successful setting of the property. */ int z_bmqa_MessageProperties__setPropertyAsInt32( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, int32_t value); @@ -149,13 +149,13 @@ int z_bmqa_MessageProperties__setPropertyAsInt32( * * This function sets a property as a 64-bit integer value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The 64-bit integer value of the property. * @return Returns 0 upon successful setting of the property. */ int z_bmqa_MessageProperties__setPropertyAsInt64( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, long long value); @@ -164,13 +164,13 @@ int z_bmqa_MessageProperties__setPropertyAsInt64( * * This function sets a property as a string value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The string value of the property. * @return Returns 0 upon successful setting of the property. */ int z_bmqa_MessageProperties__setPropertyAsString( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, const char* value); @@ -179,14 +179,14 @@ int z_bmqa_MessageProperties__setPropertyAsString( * * This function sets a property as a binary value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The binary value of the property. * @param size The size of the binary value. * @return Returns 0 upon successful setting of the property. */ int z_bmqa_MessageProperties__setPropertyAsBinary( - z_bmqa_MessageProperties* properties_obj, + z_bmqa_MessageProperties* messageProperties, const char* name, const char* value, int size); @@ -195,34 +195,34 @@ int z_bmqa_MessageProperties__setPropertyAsBinary( * * This function retrieves the number of properties in the message properties object. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @return Returns the number of properties. */ int z_bmqa_MessageProperties__numProperties( - const z_bmqa_MessageProperties* properties_obj); + const z_bmqa_MessageProperties* messageProperties); /** * @brief Retrieves the total size of the message properties object. * * This function retrieves the total size of the message properties object. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @return Returns the total size of the message properties object. */ int z_bmqa_MessageProperties__totalSize( - const z_bmqa_MessageProperties* properties_obj); + const z_bmqa_MessageProperties* messageProperties); /** * @brief Retrieves a property as a boolean value. * * This function retrieves a property as a boolean value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @return Returns the boolean value of the property. */ bool z_bmqa_MessageProperties__getPropertyAsBool( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name); /** @@ -230,12 +230,12 @@ bool z_bmqa_MessageProperties__getPropertyAsBool( * * This function retrieves a property as a character value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @return Returns the character value of the property. */ char z_bmqa_MessageProperties__getPropertyAsChar( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name); /** @@ -243,12 +243,12 @@ char z_bmqa_MessageProperties__getPropertyAsChar( * * This function retrieves a property as a short value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @return Returns the short value of the property. */ short z_bmqa_MessageProperties__getPropertyAsShort( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name); /** @@ -256,12 +256,12 @@ short z_bmqa_MessageProperties__getPropertyAsShort( * * This function retrieves a property as a 32-bit integer value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @return Returns the 32-bit integer value of the property. */ int32_t z_bmqa_MessageProperties__getPropertyAsInt32( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name); /** @@ -269,12 +269,12 @@ int32_t z_bmqa_MessageProperties__getPropertyAsInt32( * * This function retrieves a property as a 64-bit integer value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @return Returns the 64-bit integer value of the property. */ long long z_bmqa_MessageProperties__getPropertyAsInt64( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name); /** @@ -282,12 +282,12 @@ long long z_bmqa_MessageProperties__getPropertyAsInt64( * * This function retrieves a property as a string value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @return Returns the string value of the property. */ const char* z_bmqa_MessageProperties__getPropertyAsString( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name); /** @@ -295,12 +295,12 @@ const char* z_bmqa_MessageProperties__getPropertyAsString( * * This function retrieves a property as a binary value. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @return Returns the binary value of the property. */ const char* z_bmqa_MessageProperties__getPropertyAsBinary( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name); /** @@ -308,13 +308,13 @@ const char* z_bmqa_MessageProperties__getPropertyAsBinary( * * This function retrieves a property as a boolean value, or returns a default value if the property does not exist. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The default value to return if the property does not exist. * @return Returns the boolean value of the property if it exists, otherwise returns the default value. */ bool z_bmqa_MessageProperties__getPropertyAsBoolOr( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name, bool value); @@ -323,13 +323,13 @@ bool z_bmqa_MessageProperties__getPropertyAsBoolOr( * * This function retrieves a property as a character value, or returns a default value if the property does not exist. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The default value to return if the property does not exist. * @return Returns the character value of the property if it exists, otherwise returns the default value. */ char z_bmqa_MessageProperties__getPropertyAsCharOr( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name, char value); @@ -338,13 +338,13 @@ char z_bmqa_MessageProperties__getPropertyAsCharOr( * * This function retrieves a property as a short value, or returns a default value if the property does not exist. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The default value to return if the property does not exist. * @return Returns the short value of the property if it exists, otherwise returns the default value. */ short z_bmqa_MessageProperties__getPropertyAsShortOr( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name, short value); @@ -353,13 +353,13 @@ short z_bmqa_MessageProperties__getPropertyAsShortOr( * * This function retrieves a property as a 32-bit integer value, or returns a default value if the property does not exist. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The default value to return if the property does not exist. * @return Returns the 32-bit integer value of the property if it exists, otherwise returns the default value. */ int32_t z_bmqa_MessageProperties__getPropertyAsInt32Or( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name, int32_t value); @@ -368,13 +368,13 @@ int32_t z_bmqa_MessageProperties__getPropertyAsInt32Or( * * This function retrieves a property as a 64-bit integer value, or returns a default value if the property does not exist. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The default value to return if the property does not exist. * @return Returns the 64-bit integer value of the property if it exists, otherwise returns the default value. */ long long z_bmqa_MessageProperties__getPropertyAsInt64Or( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name, long long value); @@ -383,13 +383,13 @@ long long z_bmqa_MessageProperties__getPropertyAsInt64Or( * * This function retrieves a property as a string value, or returns a default value if the property does not exist. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The default value to return if the property does not exist. * @return Returns the string value of the property if it exists, otherwise returns the default value. */ const char* z_bmqa_MessageProperties__getPropertyAsStringOr( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name, const char* value); @@ -398,13 +398,13 @@ const char* z_bmqa_MessageProperties__getPropertyAsStringOr( * * This function retrieves a property as a binary value, or returns a default value if the property does not exist. * - * @param properties_obj A pointer to a z_bmqa_MessageProperties object. + * @param messageProperties A pointer to a z_bmqa_MessageProperties object. * @param name The name of the property. * @param value The default value to return if the property does not exist. * @return Returns the binary value of the property if it exists, otherwise returns the default value. */ const char* z_bmqa_MessageProperties__getPropertyAsBinaryOr( - const z_bmqa_MessageProperties* properties_obj, + const z_bmqa_MessageProperties* messageProperties, const char* name, const char* value); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp index bd12ee45e..3d345782d 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.cpp @@ -1,32 +1,32 @@ #include #include -int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj) +int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** openQueueStatus) { using namespace BloombergLP; - BSLS_ASSERT(status_obj != NULL); + BSLS_ASSERT(openQueueStatus != NULL); bmqa::OpenQueueStatus* status_p = reinterpret_cast( - *status_obj); + *openQueueStatus); delete status_p; - *status_obj = NULL; + *openQueueStatus = NULL; return 0; } -int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj) +int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** openQueueStatus) { using namespace BloombergLP; bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(); - *status_obj = reinterpret_cast(status_p); + *openQueueStatus = reinterpret_cast(status_p); return 0; } -int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, +int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** openQueueStatus, const z_bmqa_OpenQueueStatus* other) { using namespace BloombergLP; @@ -35,12 +35,12 @@ int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, reinterpret_cast(other); bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(*other_p); - *status_obj = reinterpret_cast(status_p); + *openQueueStatus = reinterpret_cast(status_p); return 0; } -int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, +int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** openQueueStatus, const z_bmqa_QueueId* queueId, int result, const char* errorDescription) @@ -56,44 +56,44 @@ int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, *queueId_p, result_enum, errorDescription_str); - *status_obj = reinterpret_cast(status_p); + *openQueueStatus = reinterpret_cast(status_p); return 0; } -bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj) +bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* openQueueStatus) { using namespace BloombergLP; const bmqa::OpenQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(openQueueStatus); return *status_p; } -int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, - const z_bmqa_QueueId** queueId_obj) +int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* openQueueStatus, + const z_bmqa_QueueId** queueId) { using namespace BloombergLP; const bmqa::OpenQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(openQueueStatus); const bmqa::QueueId* queueId_p = &(status_p->queueId()); - *queueId_obj = reinterpret_cast(queueId_p); + *queueId = reinterpret_cast(queueId_p); return 0; } -int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj) +int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* openQueueStatus) { using namespace BloombergLP; const bmqa::OpenQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(openQueueStatus); return status_p->result(); } const char* z_bmqa_OpenQueueStatus__errorDescription( - const z_bmqa_OpenQueueStatus* status_obj) + const z_bmqa_OpenQueueStatus* openQueueStatus) { using namespace BloombergLP; const bmqa::OpenQueueStatus* status_p = - reinterpret_cast(status_obj); + reinterpret_cast(openQueueStatus); return status_p->errorDescription().c_str(); } \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h index ff7ca2e61..815bc6403 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_openqueuestatus.h @@ -15,34 +15,34 @@ typedef struct z_bmqa_OpenQueueStatus z_bmqa_OpenQueueStatus; * * This function deallocates memory for the open queue status object. * - * @param status_obj A pointer to a pointer to the z_bmqa_OpenQueueStatus object to be deleted. + * @param openQueueStatus A pointer to a pointer to the z_bmqa_OpenQueueStatus object to be deleted. * * @return Returns 0 upon successful deletion. */ -int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** status_obj); +int z_bmqa_OpenQueueStatus__delete(z_bmqa_OpenQueueStatus** openQueueStatus); /** * @brief Creates a new open queue status object. * * This function creates a new open queue status object. * - * @param status_obj A pointer to a pointer to the z_bmqa_OpenQueueStatus object to be created. + * @param openQueueStatus A pointer to a pointer to the z_bmqa_OpenQueueStatus object to be created. * * @return Returns 0 upon successful creation. */ -int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** status_obj); +int z_bmqa_OpenQueueStatus__create(z_bmqa_OpenQueueStatus** openQueueStatus); /** * @brief Creates a copy of an open queue status object. * * This function creates a copy of an existing open queue status object. * - * @param status_obj A pointer to a pointer to the z_bmqa_OpenQueueStatus object where the copy will be stored. + * @param openQueueStatus A pointer to a pointer to the z_bmqa_OpenQueueStatus object where the copy will be stored. * @param other A pointer to the const z_bmqa_OpenQueueStatus object to be copied. * * @return Returns 0 upon successful creation of the copy. */ -int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, +int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** openQueueStatus, const z_bmqa_OpenQueueStatus* other); /** @@ -50,14 +50,14 @@ int z_bmqa_OpenQueueStatus__createCopy(z_bmqa_OpenQueueStatus** status_obj, * * This function creates an open queue status object with full information. * - * @param status_obj A pointer to a pointer to the z_bmqa_OpenQueueStatus object to be created. + * @param openQueueStatus A pointer to a pointer to the z_bmqa_OpenQueueStatus object to be created. * @param queueId A pointer to the const z_bmqa_QueueId object representing the queue ID. * @param result The result of the operation. * @param errorDescription The error description. * * @return Returns 0 upon successful creation of the object. */ -int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, +int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** openQueueStatus, const z_bmqa_QueueId* queueId, int result, const char* errorDescription); @@ -67,47 +67,47 @@ int z_bmqa_OpenQueueStatus__createFull(z_bmqa_OpenQueueStatus** status_obj, * * This function converts an open queue status object to a boolean value. * - * @param status_obj A pointer to the const z_bmqa_OpenQueueStatus object. + * @param openQueueStatus A pointer to the const z_bmqa_OpenQueueStatus object. * * @return Returns true if the status object is valid, false otherwise. */ -bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* status_obj); +bool z_bmqa_OpenQueueStatus__toBool(const z_bmqa_OpenQueueStatus* openQueueStatus); /** * @brief Retrieves the queue ID from an open queue status object. * * This function retrieves the queue ID from an open queue status object. * - * @param status_obj A pointer to the const z_bmqa_OpenQueueStatus object. - * @param queueId_obj A pointer to a pointer to the const z_bmqa_QueueId object to store the queue ID. + * @param openQueueStatus A pointer to the const z_bmqa_OpenQueueStatus object. + * @param queueId A pointer to a pointer to the const z_bmqa_QueueId object to store the queue ID. * * @return Returns 0 upon successful retrieval. */ -int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* status_obj, - const z_bmqa_QueueId** queueId_obj); +int z_bmqa_OpenQueueStatus__queueId(const z_bmqa_OpenQueueStatus* openQueueStatus, + const z_bmqa_QueueId** queueId); /** * @brief Retrieves the result from an open queue status object. * * This function retrieves the result from an open queue status object. * - * @param status_obj A pointer to the const z_bmqa_OpenQueueStatus object. + * @param openQueueStatus A pointer to the const z_bmqa_OpenQueueStatus object. * * @return Returns the result of the operation. */ -int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* status_obj); +int z_bmqa_OpenQueueStatus__result(const z_bmqa_OpenQueueStatus* openQueueStatus); /** * @brief Retrieves the error description from an open queue status object. * * This function retrieves the error description from an open queue status object. * - * @param status_obj A pointer to the const z_bmqa_OpenQueueStatus object. + * @param openQueueStatus A pointer to the const z_bmqa_OpenQueueStatus object. * * @return Returns a pointer to the error description string. */ const char* z_bmqa_OpenQueueStatus__errorDescription( - const z_bmqa_OpenQueueStatus* status_obj); + const z_bmqa_OpenQueueStatus* openQueueStatus); #if defined(__cplusplus) } diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp index c9ff9cc33..0235ffc1f 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.cpp @@ -2,31 +2,31 @@ #include #include -int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj) +int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId) { using namespace BloombergLP; - BSLS_ASSERT(queueId_obj != NULL); + BSLS_ASSERT(queueId != NULL); - bmqa::QueueId* queueId_p = reinterpret_cast(*queueId_obj); + bmqa::QueueId* queueId_p = reinterpret_cast(*queueId); delete queueId_p; - *queueId_obj = NULL; + *queueId = NULL; return 0; } -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj) +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId) { using namespace BloombergLP; bmqa::QueueId* queueId_p = new bmqa::QueueId(); - *queueId_obj = reinterpret_cast(queueId_p); + *queueId = reinterpret_cast(queueId_p); return 0; } -int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, +int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId, const z_bmqa_QueueId* other) { using namespace BloombergLP; @@ -35,13 +35,13 @@ int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, other); bmqa::QueueId* queueId_p = new bmqa::QueueId(*other_p); - *queueId_obj = reinterpret_cast(queueId_p); + *queueId = reinterpret_cast(queueId_p); return 0; } int z_bmqa_QueueId__createFromCorrelationId( - z_bmqa_QueueId** queueId_obj, + z_bmqa_QueueId** queueId, const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; @@ -49,81 +49,81 @@ int z_bmqa_QueueId__createFromCorrelationId( reinterpret_cast(correlationId); bmqa::QueueId* queueId_p = new bmqa::QueueId(*correlationId_p); - *queueId_obj = reinterpret_cast(queueId_p); + *queueId = reinterpret_cast(queueId_p); return 0; } -int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, +int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId, int64_t numeric) { using namespace BloombergLP; bmqa::QueueId* queueId_p = new bmqa::QueueId(numeric); - *queueId_obj = reinterpret_cast(queueId_p); + *queueId = reinterpret_cast(queueId_p); return 0; } -int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, +int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId, void* pointer) { using namespace BloombergLP; bmqa::QueueId* queueId_p = new bmqa::QueueId(pointer); - *queueId_obj = reinterpret_cast(queueId_p); + *queueId = reinterpret_cast(queueId_p); return 0; } const z_bmqt_CorrelationId* -z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj) +z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId) { using namespace BloombergLP; const bmqa::QueueId* queueId_p = reinterpret_cast( - queueId_obj); + queueId); const bmqt::CorrelationId* correlationId_p = &(queueId_p->correlationId()); return reinterpret_cast(correlationId_p); } -uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj) +uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId) { using namespace BloombergLP; const bmqa::QueueId* queueId_p = reinterpret_cast( - queueId_obj); + queueId); return queueId_p->flags(); } -const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId_obj) +const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId) { using namespace BloombergLP; const bmqa::QueueId* queueId_p = reinterpret_cast( - queueId_obj); + queueId); const bmqt::Uri* uri_p = &(queueId_p->uri()); return reinterpret_cast(uri_p); } -const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId_obj) +const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId) { using namespace BloombergLP; const bmqa::QueueId* queueId_p = reinterpret_cast( - queueId_obj); + queueId); const bmqt::QueueOptions* options_p = &(queueId_p->options()); return reinterpret_cast(options_p); } -int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId_obj) +int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId) { using namespace BloombergLP; const bmqa::QueueId* queueId_p = reinterpret_cast( - queueId_obj); + queueId); return queueId_p->isValid(); } diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h index cb36d3f40..a584faa9d 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_queueid.h @@ -17,34 +17,34 @@ typedef struct z_bmqa_QueueId z_bmqa_QueueId; * * This function deallocates memory for the queue ID object. * - * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object to be deleted. + * @param queueId A pointer to a pointer to the z_bmqa_QueueId object to be deleted. * * @return Returns 0 upon successful deletion. */ -int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId_obj); +int z_bmqa_QueueId__delete(z_bmqa_QueueId** queueId); /** * @brief Creates a new queue ID object. * * This function creates a new queue ID object. * - * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object to be created. + * @param queueId A pointer to a pointer to the z_bmqa_QueueId object to be created. * * @return Returns 0 upon successful creation. */ -int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId_obj); +int z_bmqa_QueueId__create(z_bmqa_QueueId** queueId); /** * @brief Creates a copy of a queue ID object. * * This function creates a copy of an existing queue ID object. * - * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object where the copy will be stored. + * @param queueId A pointer to a pointer to the z_bmqa_QueueId object where the copy will be stored. * @param other A pointer to the const z_bmqa_QueueId object to be copied. * * @return Returns 0 upon successful creation of the copy. */ -int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, +int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId, const z_bmqa_QueueId* other); /** @@ -52,13 +52,13 @@ int z_bmqa_QueueId__createCopy(z_bmqa_QueueId** queueId_obj, * * This function creates a queue ID object from a correlation ID. * - * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object to be created. + * @param queueId A pointer to a pointer to the z_bmqa_QueueId object to be created. * @param correlationId A pointer to the const z_bmqt_CorrelationId object representing the correlation ID. * * @return Returns 0 upon successful creation of the object. */ int z_bmqa_QueueId__createFromCorrelationId( - z_bmqa_QueueId** queueId_obj, + z_bmqa_QueueId** queueId, const z_bmqt_CorrelationId* correlationId); /** @@ -66,12 +66,12 @@ int z_bmqa_QueueId__createFromCorrelationId( * * This function creates a queue ID object from a numeric value. * - * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object to be created. + * @param queueId A pointer to a pointer to the z_bmqa_QueueId object to be created. * @param numeric The numeric value for the queue ID. * * @return Returns 0 upon successful creation of the object. */ -int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, +int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId, int64_t numeric); /** @@ -79,12 +79,12 @@ int z_bmqa_QueueId__createFromNumeric(z_bmqa_QueueId** queueId_obj, * * This function creates a queue ID object from a pointer. * - * @param queueId_obj A pointer to a pointer to the z_bmqa_QueueId object to be created. + * @param queueId A pointer to a pointer to the z_bmqa_QueueId object to be created. * @param pointer The pointer value for the queue ID. * * @return Returns 0 upon successful creation of the object. */ -int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, +int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId, void* pointer); /** @@ -92,57 +92,57 @@ int z_bmqa_QueueId__createFromPointer(z_bmqa_QueueId** queueId_obj, * * This function retrieves the correlation ID from a queue ID object. * - * @param queueId_obj A pointer to the const z_bmqa_QueueId object. - * @param queueId_obj A pointer to a pointer to the const z_bmqt_CorrelationId object to store the correlation ID. + * @param queueId A pointer to the const z_bmqa_QueueId object. + * @param queueId A pointer to a pointer to the const z_bmqt_CorrelationId object to store the correlation ID. * * @return Returns 0 upon successful retrieval. */ const z_bmqt_CorrelationId* -z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId_obj); +z_bmqa_QueueId__correlationId(const z_bmqa_QueueId* queueId); /** * @brief Retrieves the flags from a queue ID object. * * This function retrieves the flags from a queue ID object. * - * @param queueId_obj A pointer to the const z_bmqa_QueueId object. + * @param queueId A pointer to the const z_bmqa_QueueId object. * * @return Returns the flags associated with the queue ID. */ -uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId_obj); +uint64_t z_bmqa_QueueId__flags(const z_bmqa_QueueId* queueId); /** * @brief Retrieves the URI from a queue ID object. * * This function retrieves the URI from a queue ID object. * - * @param queueId_obj A pointer to the const z_bmqa_QueueId object. + * @param queueId A pointer to the const z_bmqa_QueueId object. * * @return Returns a pointer to the const z_bmqt_Uri object representing the URI. */ -const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId_obj); +const z_bmqt_Uri* z_bmqa_QueueId__uri(const z_bmqa_QueueId* queueId); /** * @brief Retrieves the options from a queue ID object. * * This function retrieves the options from a queue ID object. * - * @param queueId_obj A pointer to the const z_bmqa_QueueId object. + * @param queueId A pointer to the const z_bmqa_QueueId object. * * @return Returns a pointer to the const z_bmqt_QueueOptions object representing the options. */ -const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId_obj); +const z_bmqt_QueueOptions* options(const z_bmqa_QueueId* queueId); /** * @brief Checks if a queue ID object is valid. * * This function checks if a queue ID object is valid. * - * @param queueId_obj A pointer to the const z_bmqa_QueueId object. + * @param queueId A pointer to the const z_bmqa_QueueId object. * * @return Returns 1 if the queue ID is valid, 0 otherwise. */ -int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId_obj); +int z_bmqa_QueueId__isValid(const z_bmqa_QueueId* queueId); #if defined(__cplusplus) } diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp index 82b346ddf..11038b080 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.cpp @@ -12,22 +12,22 @@ z_bmqa_CustomSessionEventHandler::z_bmqa_CustomSessionEventHandler( z_bmqa_OnMessageEventCb onMessageEventCb, uint64_t mSize) { - this->mSize = mSize; - this->onSessionEventCb = onSessionEventCb; - this->onMessageEventCb = onMessageEventCb; + this->d_mSize = mSize; + this->d_onSessionEventCb = onSessionEventCb; + this->d_onMessageEventCb = onMessageEventCb; if (mSize != 0) { - data = static_cast(new char[mSize]); + d_data = static_cast(new char[mSize]); } else { - data = NULL; + d_data = NULL; } } z_bmqa_CustomSessionEventHandler::~z_bmqa_CustomSessionEventHandler() { - if (data != NULL) { - delete[] static_cast(data); + if (d_data != NULL) { + delete[] static_cast(d_data); } } @@ -36,7 +36,7 @@ void z_bmqa_CustomSessionEventHandler::onSessionEvent( { const z_bmqa_SessionEvent* sessionEvent_p = reinterpret_cast(&sessionEvent); - this->onSessionEventCb(sessionEvent_p, this->data); + this->d_onSessionEventCb(sessionEvent_p, this->d_data); } void z_bmqa_CustomSessionEventHandler::onMessageEvent( @@ -44,14 +44,14 @@ void z_bmqa_CustomSessionEventHandler::onMessageEvent( { const z_bmqa_MessageEvent* messageEvent_p = reinterpret_cast(&messageEvent); - this->onMessageEventCb(messageEvent_p, this->data); + this->d_onMessageEventCb(messageEvent_p, this->d_data); } void z_bmqa_CustomSessionEventHandler::callCustomFunction( z_bmqa_SessionEventHandlerMemberFunction function, void* args) { - function(args, this->data); + function(args, this->d_data); } void z_bmqa_CustomSessionEventHandler::lock() @@ -88,31 +88,31 @@ int z_bmqa_SessionEventHandler__create( } int z_bmqa_SessionEventHandler__callCustomFunction( - z_bmqa_SessionEventHandler* eventHandler_obj, + z_bmqa_SessionEventHandler* sessionEventHandler, z_bmqa_SessionEventHandlerMemberFunction cb, void* args) { z_bmqa_CustomSessionEventHandler* eventHandler_p = - reinterpret_cast(eventHandler_obj); + reinterpret_cast(sessionEventHandler); eventHandler_p->callCustomFunction(cb, args); return 0; } -int z_bmqa_Session__delete(z_bmqa_Session** session_obj) +int z_bmqa_Session__delete(z_bmqa_Session** session) { using namespace BloombergLP; - BSLS_ASSERT(session_obj != NULL); + BSLS_ASSERT(session != NULL); - bmqa::Session* session_p = reinterpret_cast(*session_obj); + bmqa::Session* session_p = reinterpret_cast(*session); delete session_p; - *session_obj = NULL; + *session = NULL; return 0; } -int z_bmqa_Session__create(z_bmqa_Session** session_obj, +int z_bmqa_Session__create(z_bmqa_Session** session, const z_bmqt_SessionOptions* options) { using namespace BloombergLP; @@ -126,11 +126,11 @@ int z_bmqa_Session__create(z_bmqa_Session** session_obj, else { session_p = new bmqa::Session(); } - *session_obj = reinterpret_cast(session_p); + *session = reinterpret_cast(session_p); return 0; } -int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, +int z_bmqa_Session__createAsync(z_bmqa_Session** session, z_bmqa_SessionEventHandler* eventHandler, const z_bmqt_SessionOptions* options) { @@ -150,15 +150,15 @@ int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, session_p = new bmqa::Session( bslma::ManagedPtr(eventHandler_p)); } - *session_obj = reinterpret_cast(session_p); + *session = reinterpret_cast(session_p); return 0; } -int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) +int z_bmqa_Session__start(z_bmqa_Session* session, int64_t timeoutMs) { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); if (timeoutMs != 0) { bsls::TimeInterval timeout; timeout.addMilliseconds(timeoutMs); @@ -169,11 +169,11 @@ int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs) } } -int z_bmqa_Session__startAsync(z_bmqa_Session* session_obj, int64_t timeoutMs) +int z_bmqa_Session__startAsync(z_bmqa_Session* session, int64_t timeoutMs) { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); if (timeoutMs != 0) { bsls::TimeInterval timeout; timeout.addMilliseconds(timeoutMs); @@ -184,42 +184,42 @@ int z_bmqa_Session__startAsync(z_bmqa_Session* session_obj, int64_t timeoutMs) } } -int z_bmqa_Session__stop(z_bmqa_Session* session_obj) +int z_bmqa_Session__stop(z_bmqa_Session* session) { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); session_p->stop(); return 0; } -int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj) +int z_bmqa_Session__stopAsync(z_bmqa_Session* session) { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); session_p->stopAsync(); return 0; } -int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj) +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session) { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); session_p->finalizeStop(); return 0; } int z_bmqa_Session__loadMessageEventBuilder( - z_bmqa_Session* session_obj, + z_bmqa_Session* session, z_bmqa_MessageEventBuilder* builder) { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); bmqa::MessageEventBuilder* builder_p = reinterpret_cast(builder); @@ -228,12 +228,12 @@ int z_bmqa_Session__loadMessageEventBuilder( } int z_bmqa_Session__loadConfirmEventBuilder( - z_bmqa_Session* session_obj, + z_bmqa_Session* session, z_bmqa_ConfirmEventBuilder* builder) { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder); @@ -241,12 +241,12 @@ int z_bmqa_Session__loadConfirmEventBuilder( return 0; } -int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, +int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session, z_bmqa_MessageProperties** buffer) { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); bmqa::MessageProperties* buffer_p = reinterpret_cast(buffer); @@ -254,19 +254,19 @@ int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, return 0; } -// int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session_obj, +// int z_bmqa_Session__getQueueIdWithUri(z_bmqa_Session* session, // z_bmqa_QueueId** queueId, const z_bmqt_Uri* uri){ // using namespace BloombergLP; // bmqa::Session* session_p = -// reinterpret_cast(session_obj); bmqa::Q* buffer_p = +// reinterpret_cast(session); bmqa::Q* buffer_p = // reinterpret_cast(uri); // session_p->getQueueId(buffer_p); // return 0; // } -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session, z_bmqa_QueueId* queueId, const char* uri, uint64_t flags, @@ -274,7 +274,7 @@ int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); bmqa::QueueId* queueId_p = reinterpret_cast(queueId); bmqa::OpenQueueStatus* status_p = new bmqa::OpenQueueStatus(); @@ -283,7 +283,7 @@ int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, return 0; } -int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, +int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session, z_bmqa_QueueId* queueId, const z_bmqt_QueueOptions* options, int64_t timeoutMs, @@ -291,7 +291,7 @@ int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); bmqa::QueueId* queueId_p = reinterpret_cast(queueId); bmqa::ConfigureQueueStatus* status_p = new bmqa::ConfigureQueueStatus(); const bmqt::QueueOptions* options_p = @@ -304,14 +304,14 @@ int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, return 0; } -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session, z_bmqa_QueueId* queueId, int64_t timeoutMs, z_bmqa_CloseQueueStatus** status) { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); bmqa::QueueId* queueId_p = reinterpret_cast(queueId); bmqa::CloseQueueStatus* status_p = new bmqa::CloseQueueStatus(); @@ -322,12 +322,12 @@ int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, return 0; } -int z_bmqa_Session__post(z_bmqa_Session* session_obj, +int z_bmqa_Session__post(z_bmqa_Session* session, const z_bmqa_MessageEvent* event) { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); const bmqa::MessageEvent* event_p = reinterpret_cast(event); @@ -335,28 +335,28 @@ int z_bmqa_Session__post(z_bmqa_Session* session_obj, return 0; } -// int z_bmqa_Session__confirmMessage(z_bmqa_Session* session_obj, +// int z_bmqa_Session__confirmMessage(z_bmqa_Session* session, // const z_bmqa_Message* message) // { // using namespace BloombergLP; // bmqa::Session* session_p = -// reinterpret_cast(session_obj); +// reinterpret_cast(session); // } // int z_bmqa_Session__confirmMessageWithCookie( -// z_bmqa_Session* session_obj, +// z_bmqa_Session* session, // const z_bmqa_MessageConfirmationCookie* cookie) // { // using namespace BloombergLP; // bmqa::Session* session_p = -// reinterpret_cast(session_obj); +// reinterpret_cast(session); // } -int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, +int z_bmqa_Session__confirmMessages(z_bmqa_Session* session, z_bmqa_ConfirmEventBuilder* builder) { using namespace BloombergLP; - bmqa::Session* session_p = reinterpret_cast(session_obj); + bmqa::Session* session_p = reinterpret_cast(session); bmqa::ConfirmEventBuilder* builder_p = reinterpret_cast(builder); return session_p->confirmMessages(builder_p); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h index 671f28b69..192271019 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_session.h @@ -24,6 +24,8 @@ extern "C" { #include #include +typedef struct z_bmqa_Session z_bmqa_Session; + typedef struct z_bmqa_SessionEventHandler z_bmqa_SessionEventHandler; typedef void (*z_bmqa_OnSessionEventCb)( @@ -67,127 +69,126 @@ int z_bmqa_SessionEventHandler__callCustomFunction( z_bmqa_SessionEventHandlerMemberFunction cb, void* args); -typedef struct z_bmqa_Session z_bmqa_Session; /** * @brief Deletes a Session object. * - * @param session_obj Pointer to the Session object to be deleted. + * @param session Pointer to the Session object to be deleted. * * @return Returns 0 upon successful deletion. */ -int z_bmqa_Session__delete(z_bmqa_Session** session_obj); +int z_bmqa_Session__delete(z_bmqa_Session** session); /** * @brief Creates a new Session object. * - * @param session_obj Pointer to store the created Session object. + * @param session Pointer to store the created Session object. * @param options Pointer to the SessionOptions object for configuring the session. * * @return Returns 0 upon successful creation. */ -int z_bmqa_Session__create(z_bmqa_Session** session_obj, +int z_bmqa_Session__create(z_bmqa_Session** session, const z_bmqt_SessionOptions* options); /** * @brief Creates a new Session object asynchronously. * - * @param session_obj Pointer to store the created Session object. + * @param session Pointer to store the created Session object. * @param eventHandler Event handler for handling session events. * @param options Pointer to the SessionOptions object for configuring the session. * * @return Returns 0 upon successful creation. */ -int z_bmqa_Session__createAsync(z_bmqa_Session** session_obj, +int z_bmqa_Session__createAsync(z_bmqa_Session** session, z_bmqa_SessionEventHandler* eventHandler, const z_bmqt_SessionOptions* options); /** * @brief Starts a session synchronously. * - * @param session_obj Pointer to the Session object to start. + * @param session Pointer to the Session object to start. * @param timeoutMs Timeout duration for starting the session. * * @return Returns 0 upon successful start. */ -int z_bmqa_Session__start(z_bmqa_Session* session_obj, int64_t timeoutMs); +int z_bmqa_Session__start(z_bmqa_Session* session, int64_t timeoutMs); /** * @brief Starts a session asynchronously. * - * @param session_obj Pointer to the Session object to start. + * @param session Pointer to the Session object to start. * @param timeoutMs Timeout duration for starting the session. * * @return Returns 0 upon successful start. */ -int z_bmqa_Session__startAsync(z_bmqa_Session* session_obj, int64_t timeoutMs); +int z_bmqa_Session__startAsync(z_bmqa_Session* session, int64_t timeoutMs); /** * @brief Stops a session synchronously. * - * @param session_obj Pointer to the Session object to stop. + * @param session Pointer to the Session object to stop. * * @return Returns 0 upon successful stop. */ -int z_bmqa_Session__stop(z_bmqa_Session* session_obj); +int z_bmqa_Session__stop(z_bmqa_Session* session); /** * @brief Stops a session asynchronously. * - * @param session_obj Pointer to the Session object to stop. + * @param session Pointer to the Session object to stop. * * @return Returns 0 upon successful stop. */ -int z_bmqa_Session__stopAsync(z_bmqa_Session* session_obj); +int z_bmqa_Session__stopAsync(z_bmqa_Session* session); /** * @brief Finalizes the stopping of a session. * - * @param session_obj Pointer to the Session object. + * @param session Pointer to the Session object. * * @return Returns 0 upon successful finalization. */ -int z_bmqa_Session__finalizeStop(z_bmqa_Session* session_obj); +int z_bmqa_Session__finalizeStop(z_bmqa_Session* session); /** * @brief Loads a MessageEventBuilder into the Session. * - * @param session_obj Pointer to the Session object. + * @param session Pointer to the Session object. * @param builder Pointer to the MessageEventBuilder object to load. * * @return Returns 0 upon successful loading. */ int z_bmqa_Session__loadMessageEventBuilder( - z_bmqa_Session* session_obj, + z_bmqa_Session* session, z_bmqa_MessageEventBuilder* builder); /** * @brief Loads a ConfirmEventBuilder into the Session. * - * @param session_obj Pointer to the Session object. + * @param session Pointer to the Session object. * @param builder Pointer to the ConfirmEventBuilder object to load. * * @return Returns 0 upon successful loading. */ int z_bmqa_Session__loadConfirmEventBuilder( - z_bmqa_Session* session_obj, + z_bmqa_Session* session, z_bmqa_ConfirmEventBuilder* builder); /** * @brief Loads MessageProperties into the Session. * - * @param session_obj Pointer to the Session object. + * @param session Pointer to the Session object. * @param buffer Pointer to store the loaded MessageProperties. * * @return Returns 0 upon successful loading. */ -int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, +int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session, z_bmqa_MessageProperties** buffer); /** * @brief Opens a queue synchronously. * - * @param session_obj Pointer to the Session object. + * @param session Pointer to the Session object. * @param queueId Pointer to the QueueId object. * @param uri URI for the queue. * @param flags Flags for opening the queue. @@ -195,7 +196,7 @@ int z_bmqa_Session__loadMessageProperties(z_bmqa_Session* session_obj, * * @return Returns 0 upon successful opening. */ -int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, +int z_bmqa_Session__openQueueSync(z_bmqa_Session* session, z_bmqa_QueueId* queueId, const char* uri, uint64_t flags, @@ -204,7 +205,7 @@ int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, /** * @brief Configures a queue synchronously. * - * @param session_obj Pointer to the Session object. + * @param session Pointer to the Session object. * @param queueId Pointer to the QueueId object. * @param options Pointer to the QueueOptions object. * @param timeoutMs Timeout duration for configuring the queue. @@ -212,7 +213,7 @@ int z_bmqa_Session__openQueueSync(z_bmqa_Session* session_obj, * * @return Returns 0 upon successful configuration. */ -int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, +int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session, z_bmqa_QueueId* queueId, const z_bmqt_QueueOptions* options, int64_t timeoutMs, @@ -221,14 +222,14 @@ int z_bmqa_Session__configureQueueSync(z_bmqa_Session* session_obj, /** * @brief Closes a queue synchronously. * - * @param session_obj Pointer to the Session object. + * @param session Pointer to the Session object. * @param queueId Pointer to the QueueId object. * @param timeoutMs Timeout duration for closing the queue. * @param status Pointer to store the CloseQueueStatus object. * * @return Returns 0 upon successful closing. */ -int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, +int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session, z_bmqa_QueueId* queueId, int64_t timeoutMs, z_bmqa_CloseQueueStatus** status); @@ -236,46 +237,46 @@ int z_bmqa_Session__closeQueueSync(z_bmqa_Session* session_obj, /** * @brief Posts a message event to the session. * - * @param session_obj Pointer to the Session object. + * @param session Pointer to the Session object. * @param event Pointer to the MessageEvent object to post. * * @return Returns 0 upon successful posting. */ -int z_bmqa_Session__post(z_bmqa_Session* session_obj, +int z_bmqa_Session__post(z_bmqa_Session* session, const z_bmqa_MessageEvent* event); /** * @brief Confirms a message. * - * @param session_obj Pointer to the Session object. + * @param session Pointer to the Session object. * @param message Pointer to the Message object to confirm. * * @return Returns 0 upon successful confirmation. */ -int z_bmqa_Session__confirmMessage(z_bmqa_Session* session_obj, +int z_bmqa_Session__confirmMessage(z_bmqa_Session* session, const z_bmqa_Message* message); /** * @brief Confirms a message with a cookie. * - * @param session_obj Pointer to the Session object. + * @param session Pointer to the Session object. * @param cookie Pointer to the MessageConfirmationCookie object. * * @return Returns 0 upon successful confirmation. */ int z_bmqa_Session__confirmMessageWithCookie( - z_bmqa_Session* session_obj, + z_bmqa_Session* session, const z_bmqa_MessageConfirmationCookie* cookie); /** * @brief Confirms multiple messages using a ConfirmEventBuilder. * - * @param session_obj Pointer to the Session object. + * @param session Pointer to the Session object. * @param builder Pointer to the ConfirmEventBuilder object containing the messages to confirm. * * @return Returns 0 upon successful confirmation. */ -int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, +int z_bmqa_Session__confirmMessages(z_bmqa_Session* session, z_bmqa_ConfirmEventBuilder* builder); #if defined(__cplusplus) @@ -289,10 +290,10 @@ int z_bmqa_Session__confirmMessages(z_bmqa_Session* session_obj, class z_bmqa_CustomSessionEventHandler : BloombergLP::bmqa::SessionEventHandler { private: - z_bmqa_OnSessionEventCb onSessionEventCb; /**< Callback function for session events. */ - z_bmqa_OnMessageEventCb onMessageEventCb; /**< Callback function for message events. */ - void* data; /**< Custom data pointer. */ - uint64_t mSize; /**< Size of the custom data. */ + z_bmqa_OnSessionEventCb d_onSessionEventCb; /**< Callback function for session events. */ + z_bmqa_OnMessageEventCb d_onMessageEventCb; /**< Callback function for message events. */ + void* d_data; /**< Custom data pointer. */ + uint64_t d_mSize; /**< Size of the custom data. */ BloombergLP::bslmt::Mutex mutex; /**< Mutex for thread safety. */ diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp index 54d6ac2d1..d3f0bc48a 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.cpp @@ -1,31 +1,31 @@ #include #include -int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** event_obj) +int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** sessionEvent) { using namespace BloombergLP; - BSLS_ASSERT(event_obj != NULL); + BSLS_ASSERT(sessionEvent != NULL); bmqa::SessionEvent* event_p = reinterpret_cast( - *event_obj); + *sessionEvent); delete event_p; - *event_obj = NULL; + *sessionEvent = NULL; return 0; } -int z_bmqa_SessionEvent__create(z_bmqa_SessionEvent** event_obj) +int z_bmqa_SessionEvent__create(z_bmqa_SessionEvent** sessionEvent) { using namespace BloombergLP; bmqa::SessionEvent* event_p = new bmqa::SessionEvent(); - *event_obj = reinterpret_cast(event_p); + *sessionEvent = reinterpret_cast(event_p); return 0; } -int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** event_obj, +int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** sessionEvent, const z_bmqa_SessionEvent* other) { using namespace BloombergLP; @@ -33,29 +33,29 @@ int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** event_obj, const bmqa::SessionEvent* other_p = reinterpret_cast(other); bmqa::SessionEvent* event_p = new bmqa::SessionEvent(*other_p); - *event_obj = reinterpret_cast(event_p); + *sessionEvent = reinterpret_cast(event_p); return 0; } z_bmqt_SessionEventType::Enum -z_bmqa_SessionEvent__type(const z_bmqa_SessionEvent* event_obj) +z_bmqa_SessionEvent__type(const z_bmqa_SessionEvent* sessionEvent) { using namespace BloombergLP; const bmqa::SessionEvent* event_p = - reinterpret_cast(event_obj); + reinterpret_cast(sessionEvent); return static_cast(event_p->type()); } int z_bmqa_SessionEvent__correlationId( - const z_bmqa_SessionEvent* event_obj, + const z_bmqa_SessionEvent* sessionEvent, z_bmqt_CorrelationId const** correlationId_obj) { using namespace BloombergLP; const bmqa::SessionEvent* event_p = - reinterpret_cast(event_obj); + reinterpret_cast(sessionEvent); const bmqt::CorrelationId* correlationId_p = reinterpret_cast( &(event_p->correlationId())); @@ -65,45 +65,45 @@ int z_bmqa_SessionEvent__correlationId( return 0; } -int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* event_obj, +int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* sessionEvent, z_bmqa_QueueId** queueId_obj) { using namespace BloombergLP; const bmqa::SessionEvent* event_p = - reinterpret_cast(event_obj); + reinterpret_cast(sessionEvent); bmqa::QueueId* queueId_p = new bmqa::QueueId(event_p->queueId()); *queueId_obj = reinterpret_cast(queueId_p); return 0; } -int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* event_obj) +int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* sessionEvent) { using namespace BloombergLP; const bmqa::SessionEvent* event_p = - reinterpret_cast(event_obj); + reinterpret_cast(sessionEvent); return event_p->statusCode(); } const char* -z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* event_obj) +z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* sessionEvent) { using namespace BloombergLP; const bmqa::SessionEvent* event_p = - reinterpret_cast(event_obj); + reinterpret_cast(sessionEvent); return event_p->errorDescription().c_str(); } -int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* event_obj, +int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* sessionEvent, char** out) { using namespace BloombergLP; const bmqa::SessionEvent* event_p = - reinterpret_cast(event_obj); + reinterpret_cast(sessionEvent); bsl::ostringstream ss; ss << *event_p; bsl::string out_str = ss.str(); diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h index c154d0674..567a15708 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.h @@ -17,93 +17,93 @@ typedef struct z_bmqa_SessionEvent z_bmqa_SessionEvent; /** * @brief Deletes a session event object. * - * @param event_obj A pointer to a pointer to the session event object to be deleted. + * @param sessionEvent A pointer to a pointer to the session event object to be deleted. * * @return Returns 0 upon successful deletion. */ -int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** event_obj); +int z_bmqa_SessionEvent__delete(z_bmqa_SessionEvent** sessionEvent); /** * @brief Creates a new session event object. * - * @param event_obj A pointer to a pointer to store the created session event object. + * @param sessionEvent A pointer to a pointer to store the created session event object. * * @return Returns 0 upon successful creation. */ -int z_bmqa_SessionEvent__create(z_bmqa_SessionEvent** event_obj); +int z_bmqa_SessionEvent__create(z_bmqa_SessionEvent** sessionEvent); /** * @brief Creates a copy of a session event object. * - * @param event_obj A pointer to a pointer to store the copied session event object. + * @param sessionEvent A pointer to a pointer to store the copied session event object. * @param other A pointer to the session event object to be copied. * * @return Returns 0 upon successful creation of the copy. */ -int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** event_obj, +int z_bmqa_SessionEvent__createCopy(z_bmqa_SessionEvent** sessionEvent, const z_bmqa_SessionEvent* other); /** * @brief Retrieves the type of the session event. * - * @param event_obj A pointer to the session event object. + * @param sessionEvent A pointer to the session event object. * * @return Returns the type of the session event. */ z_bmqt_SessionEventType::Enum -z_bmqa_SessionEvent__type(const z_bmqa_SessionEvent* event_obj); +z_bmqa_SessionEvent__type(const z_bmqa_SessionEvent* sessionEvent); /** * @brief Retrieves the correlation ID associated with the session event. * - * @param event_obj A pointer to the session event object. + * @param sessionEvent A pointer to the session event object. * @param correlationId_obj A pointer to a pointer to store the retrieved correlation ID. * * @return Returns 0 upon successful retrieval. */ int z_bmqa_SessionEvent__correlationId( - const z_bmqa_SessionEvent* event_obj, + const z_bmqa_SessionEvent* sessionEvent, z_bmqt_CorrelationId const** correlationId_obj); /** * @brief Retrieves the queue ID associated with the session event. * - * @param event_obj A pointer to the session event object. + * @param sessionEvent A pointer to the session event object. * @param queueId_obj A pointer to a pointer to store the retrieved queue ID. * * @return Returns 0 upon successful retrieval. */ -int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* event_obj, +int z_bmqa_SessionEvent__queueId(const z_bmqa_SessionEvent* sessionEvent, z_bmqa_QueueId** queueId_obj); /** * @brief Retrieves the status code associated with the session event. * - * @param event_obj A pointer to the session event object. + * @param sessionEvent A pointer to the session event object. * * @return Returns the status code of the session event. */ -int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* event_obj); +int z_bmqa_SessionEvent__statusCode(const z_bmqa_SessionEvent* sessionEvent); /** * @brief Retrieves the error description associated with the session event. * - * @param event_obj A pointer to the session event object. + * @param sessionEvent A pointer to the session event object. * * @return Returns a pointer to the error description string. */ const char* -z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* event_obj); +z_bmqa_SessionEvent__errorDescription(const z_bmqa_SessionEvent* sessionEvent); /** * @brief Converts the session event object to a string representation. * - * @param event_obj A pointer to the session event object. + * @param sessionEvent A pointer to the session event object. * @param out A pointer to a pointer to store the string representation. * * @return Returns 0 upon successful conversion. */ -int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* event_obj, +int z_bmqa_SessionEvent__toString(const z_bmqa_SessionEvent* sessionEvent, char** out); #if defined(__cplusplus) diff --git a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.t.cpp b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.t.cpp index 6a891ee14..0b0111882 100644 --- a/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.t.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqa/z_bmqa_sessionevent.t.cpp @@ -33,8 +33,6 @@ static void test1_breathingTest() z_bmqa_SessionEvent * obj; z_bmqa_SessionEvent__create(&obj); - - } // ============================================================================ diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp index fd2a649b0..eb56d72a5 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.cpp @@ -17,13 +17,12 @@ const char* z_bmqt_CompressionAlgorithmType::toAscii( bool fromAscii(z_bmqt_CompressionAlgorithmType::Enum* out, const char* str) { using namespace BloombergLP; - bmqt::CompressionAlgorithmType::Enum p; - bool result = bmqt::CompressionAlgorithmType::fromAscii(&p, str); - *out = static_cast(p); + bmqt::CompressionAlgorithmType::Enum type; + bool result = bmqt::CompressionAlgorithmType::fromAscii(&type, str); + *out = static_cast(type); return result; } -// Pass in unassigned pointer for error bool isValid(const char* str, char** error) { using namespace BloombergLP; @@ -36,7 +35,7 @@ bool isValid(const char* str, char** error) if (error_str.size() != 0) { *error = new char[error_str.size() + 1]; (*error)[error_str.size()] = '\0'; - strcpy(*error, error_str.c_str()); + strncpy(*error, error_str.c_str()); } else { *error = NULL; diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h index a8e7e35bc..3aee8e306 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_compressionalgorithmtype.h @@ -60,10 +60,12 @@ struct z_bmqt_CompressionAlgorithmType { static bool fromAscii(z_bmqt_CompressionAlgorithmType::Enum* out, const char* str); + + /// Pass in unassigned pointer for error /// Return true incase of valid specified `str` i.e. a enumerator name /// with the "ec_" prefix excluded. Otherwise in case of invalid `str` - /// return false and populate the specified `stream` with error message. - static bool isValid(const char* str); + /// return false and populate the specified `error` with error message. + static bool isValid(const char* str, char** error); }; #if defined(__cplusplus) diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp index 93c61ccb2..9e9192f3e 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.cpp @@ -3,31 +3,31 @@ #include #include -int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj) +int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId) { using namespace BloombergLP; - BSLS_ASSERT(correlationId_obj != NULL); + BSLS_ASSERT(correlationId != NULL); bmqt::CorrelationId* correlationId_p = - reinterpret_cast(*correlationId_obj); + reinterpret_cast(*correlationId); delete correlationId_p; - *correlationId_obj = NULL; + *correlationId = NULL; return 0; } -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj) +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId) { using namespace BloombergLP; bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(); - *correlationId_obj = reinterpret_cast( + *correlationId = reinterpret_cast( correlationId_p); return 0; } -int z_bmqt_CorrelationId__createCopy(z_bmqt_CorrelationId** correlationId_obj, +int z_bmqt_CorrelationId__createCopy(z_bmqt_CorrelationId** correlationId, const z_bmqt_CorrelationId* other_obj) { using namespace BloombergLP; @@ -35,145 +35,145 @@ int z_bmqt_CorrelationId__createCopy(z_bmqt_CorrelationId** correlationId_obj, const bmqt::CorrelationId* other_p = reinterpret_cast(other_obj); bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(*other_p); - *correlationId_obj = reinterpret_cast( + *correlationId = reinterpret_cast( correlationId_p); return 0; } int z_bmqt_CorrelationId__createFromNumeric( - z_bmqt_CorrelationId** correlationId_obj, + z_bmqt_CorrelationId** correlationId, int64_t numeric) { using namespace BloombergLP; bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(numeric); - *correlationId_obj = reinterpret_cast( + *correlationId = reinterpret_cast( correlationId_p); return 0; } int z_bmqt_CorrelationId__createFromPointer( - z_bmqt_CorrelationId** correlationId_obj, + z_bmqt_CorrelationId** correlationId, void* pointer) { using namespace BloombergLP; bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId(pointer); - *correlationId_obj = reinterpret_cast( + *correlationId = reinterpret_cast( correlationId_p); return 0; } -int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlationId_obj) +int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); + reinterpret_cast(correlationId); correlationId_p->makeUnset(); return 0; } -int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlationId_obj, +int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlationId, int64_t numeric) { using namespace BloombergLP; bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); + reinterpret_cast(correlationId); correlationId_p->setNumeric(numeric); return 0; } -int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlationId_obj, +int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlationId, void* pointer) { using namespace BloombergLP; bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); + reinterpret_cast(correlationId); correlationId_p->setPointer(pointer); return 0; } bool z_bmqt_CorrelationId__isUnset( - const z_bmqt_CorrelationId* correlationId_obj) + const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; const bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); + reinterpret_cast(correlationId); return correlationId_p->isUnset(); } bool z_bmqt_CorrelationId__isNumeric( - const z_bmqt_CorrelationId* correlationId_obj) + const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; const bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); + reinterpret_cast(correlationId); return correlationId_p->isNumeric(); } bool z_bmqt_CorrelationId__isPointer( - const z_bmqt_CorrelationId* correlationId_obj) + const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; const bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); + reinterpret_cast(correlationId); return correlationId_p->isPointer(); } bool z_bmqt_CorrelationId__isAutoValue( - const z_bmqt_CorrelationId* correlationId_obj) + const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; const bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); + reinterpret_cast(correlationId); return correlationId_p->isAutoValue(); } int64_t -z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlationId_obj) +z_bmqt_CorrelationId__theNumeric(const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; const bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); + reinterpret_cast(correlationId); return correlationId_p->theNumeric(); } void* z_bmqt_CorrelationId__thePointer( - const z_bmqt_CorrelationId* correlationId_obj) + const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; const bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); + reinterpret_cast(correlationId); return correlationId_p->thePointer(); } z_bmqt_CorrelationId::Type -z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj) +z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId) { using namespace BloombergLP; const bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); + reinterpret_cast(correlationId); return static_cast(correlationId_p->type()); } -int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj) +int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId) { using namespace BloombergLP; bmqt::CorrelationId* correlationId_p = new bmqt::CorrelationId( bmqt::CorrelationId::autoValue()); - *correlationId_obj = reinterpret_cast( + *correlationId = reinterpret_cast( correlationId_p); return 0; @@ -211,18 +211,18 @@ int z_bmqt_CorrelationId__assign(z_bmqt_CorrelationId** dst, } int z_bmqt_CorrelationId__toString( - const z_bmqt_CorrelationId* correlationId_obj, + const z_bmqt_CorrelationId* correlationId, char** out) { using namespace BloombergLP; bsl::ostringstream ss; const bmqt::CorrelationId* correlationId_p = - reinterpret_cast(correlationId_obj); + reinterpret_cast(correlationId); ss << *correlationId_p; bsl::string out_str = ss.str(); *out = new char[out_str.length() + 1]; - strcpy(*out, out_str.c_str()); + strncpy(*out, out_str.c_str()); return 0; } \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h index daf642ed4..4352f1953 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_correlationid.h @@ -25,53 +25,53 @@ typedef struct z_bmqt_CorrelationId { /** * @brief Deletes the memory allocated for a pointer to a bmqt::CorrelationId object. * - * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object. + * @param correlationId A pointer to a pointer to a bmqt::CorrelationId object. * Upon successful completion, this pointer will be set to NULL. * @return Returns 0 upon successful deletion. */ -int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId_obj); +int z_bmqt_CorrelationId__delete(z_bmqt_CorrelationId** correlationId); /** * @brief Creates a new bmqt::CorrelationId object and assigns its pointer to the provided pointer. * * This function dynamically allocates memory for a new bmqt::CorrelationId object and assigns its pointer to the provided pointer. * - * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object. + * @param correlationId A pointer to a pointer to a bmqt::CorrelationId object. * Upon successful completion, this pointer will be set to point to the newly allocated bmqt::CorrelationId object. * @return Returns 0 upon successful creation. */ -int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId_obj); +int z_bmqt_CorrelationId__create(z_bmqt_CorrelationId** correlationId); /** * @brief Creates a copy of a bmqt::CorrelationId object. * * This function creates a deep copy of the input bmqt::CorrelationId object 'other_obj' - * and stores it in the memory pointed to by 'correlationId_obj'. Upon successful completion, - * the pointer 'correlationId_obj' will point to the newly created copy. + * and stores it in the memory pointed to by 'correlationId'. Upon successful completion, + * the pointer 'correlationId' will point to the newly created copy. * - * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object where + * @param correlationId A pointer to a pointer to a bmqt::CorrelationId object where * the copy will be stored. Upon successful completion, this pointer * will point to the newly created copy. * @param other_obj A pointer to a bmqt::CorrelationId object which will be copied. * * @return Returns 0 upon successful creation of the copy. */ -int z_bmqt_CorrelationId__createCopy(z_bmqt_CorrelationId** correlationId_obj, +int z_bmqt_CorrelationId__createCopy(z_bmqt_CorrelationId** correlationId, const z_bmqt_CorrelationId* other_obj); /** * @brief Creates a new correlation ID from a numeric value. * * This function allocates memory for a new bmqt::CorrelationId object initialized with the provided numeric value. - * The pointer to the created object is stored in 'correlationId_obj'. + * The pointer to the created object is stored in 'correlationId'. * - * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object. + * @param correlationId A pointer to a pointer to a bmqt::CorrelationId object. * Upon successful completion, this pointer will hold the address of the newly created object. * @param numeric The numeric value used to initialize the new correlation ID object. * @return Returns 0 upon successful creation of the correlation ID object. */ int z_bmqt_CorrelationId__createFromNumeric( - z_bmqt_CorrelationId** correlationId_obj, + z_bmqt_CorrelationId** correlationId, int64_t numeric); /** @@ -79,13 +79,13 @@ int z_bmqt_CorrelationId__createFromNumeric( * * This function creates a bmqt::CorrelationId object using the provided pointer and assigns it to the input pointer to a bmqt::CorrelationId object. * - * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object. + * @param correlationId A pointer to a pointer to a bmqt::CorrelationId object. * Upon successful completion, this pointer will point to the newly created bmqt::CorrelationId object. * @param pointer The pointer used to create the bmqt::CorrelationId object. * @return Returns 0 upon successful creation. */ int z_bmqt_CorrelationId__createFromPointer( - z_bmqt_CorrelationId** correlationId_obj, + z_bmqt_CorrelationId** correlationId, void* pointer); /** @@ -93,7 +93,7 @@ int z_bmqt_CorrelationId__createFromPointer( * * This function invokes the 'makeUnset' method of the input bmqt::CorrelationId object. * - * @param correlationId_obj A pointer to a bmqt::CorrelationId object. + * @param correlationId A pointer to a bmqt::CorrelationId object. * This object will be made unset upon successful completion. * * @return Returns 0 upon successful invocation of 'makeUnset' on the bmqt::CorrelationId object. @@ -103,7 +103,7 @@ int z_bmqt_CorrelationId__makeUnset(z_bmqt_CorrelationId* correlation_Id_obj); /** * @brief Sets the numeric value for a bmqt::CorrelationId object. * - * @param correlationId_obj A pointer to a bmqt::CorrelationId object. + * @param correlationId A pointer to a bmqt::CorrelationId object. * @param numeric The numeric value to be set for the bmqt::CorrelationId object. * @return Returns 0 upon successful completion. */ @@ -115,7 +115,7 @@ int z_bmqt_CorrelationId__setNumeric(z_bmqt_CorrelationId* correlation_Id_obj, * * This function sets a pointer within the given bmqt::CorrelationId object to the specified value. * - * @param correlationId_obj A pointer to a bmqt::CorrelationId object. + * @param correlationId A pointer to a bmqt::CorrelationId object. * @param pointer The pointer value to be set within the bmqt::CorrelationId object. * * @return Returns 0 upon successful completion. @@ -128,7 +128,7 @@ int z_bmqt_CorrelationId__setPointer(z_bmqt_CorrelationId* correlation_Id_obj, * * This function checks if the correlation ID pointed to by the input pointer is unset. * - * @param correlationId_obj A pointer to a constant z_bmqt_CorrelationId object. + * @param correlationId A pointer to a constant z_bmqt_CorrelationId object. * @return Returns true if the correlation ID is unset, false otherwise. */ bool z_bmqt_CorrelationId__isUnset( @@ -137,9 +137,9 @@ bool z_bmqt_CorrelationId__isUnset( /** * @brief Checks if the given correlation ID is numeric. * - * This function checks whether the correlation ID pointed to by 'correlationId_obj' is numeric. + * This function checks whether the correlation ID pointed to by 'correlationId' is numeric. * - * @param correlationId_obj A pointer to a z_bmqt_CorrelationId object. + * @param correlationId A pointer to a z_bmqt_CorrelationId object. * @return Returns true if the correlation ID is numeric, false otherwise. */ bool z_bmqt_CorrelationId__isNumeric( @@ -148,7 +148,7 @@ bool z_bmqt_CorrelationId__isNumeric( /** * @brief Checks if the given object is a pointer. * - * @param correlationId_obj A pointer to a const z_bmqt_CorrelationId object. + * @param correlationId A pointer to a const z_bmqt_CorrelationId object. * @return Returns true if the object is a pointer; otherwise, returns false. */ bool z_bmqt_CorrelationId__isPointer( @@ -159,7 +159,7 @@ bool z_bmqt_CorrelationId__isPointer( * * This function checks whether the given correlation ID is an auto-generated value. * - * @param correlationId_obj A pointer to a constant z_bmqt_CorrelationId object. + * @param correlationId A pointer to a constant z_bmqt_CorrelationId object. * @return Returns true if the correlation ID is auto-generated, false otherwise. */ bool z_bmqt_CorrelationId__isAutoValue( @@ -170,7 +170,7 @@ bool z_bmqt_CorrelationId__isAutoValue( * * This function retrieves the numeric value of the specified CorrelationId object. * - * @param correlationId_obj A pointer to a const z_bmqt_CorrelationId object from which to retrieve the numeric value. + * @param correlationId A pointer to a const z_bmqt_CorrelationId object from which to retrieve the numeric value. * @return Returns the numeric value of the CorrelationId. */ int64_t z_bmqt_CorrelationId__theNumeric( @@ -181,7 +181,7 @@ int64_t z_bmqt_CorrelationId__theNumeric( * * This function returns the pointer stored within the input bmqt::CorrelationId object. * - * @param correlationId_obj A pointer to a bmqt::CorrelationId object. + * @param correlationId A pointer to a bmqt::CorrelationId object. * * @return Returns the pointer stored within the bmqt::CorrelationId object. */ @@ -191,24 +191,24 @@ void* z_bmqt_CorrelationId__thePointer( /** * @brief Retrieves the type of a z_bmqt_CorrelationId object. * - * This function returns the type of the z_bmqt_CorrelationId object specified by 'correlationId_obj'. + * This function returns the type of the z_bmqt_CorrelationId object specified by 'correlationId'. * - * @param correlationId_obj A pointer to a z_bmqt_CorrelationId object. + * @param correlationId A pointer to a z_bmqt_CorrelationId object. * @return Returns the type of the z_bmqt_CorrelationId object. */ z_bmqt_CorrelationId::Type -z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId_obj); +z_bmqt_CorrelationId__type(const z_bmqt_CorrelationId* correlationId); /** * @brief Generates an auto value for a bmqt::CorrelationId object and assigns it to a pointer. * * This function creates a new bmqt::CorrelationId object with an auto-generated value and assigns it to the pointer provided. * - * @param correlationId_obj A pointer to a pointer to a bmqt::CorrelationId object. + * @param correlationId A pointer to a pointer to a bmqt::CorrelationId object. * Upon successful completion, this pointer will hold the auto-generated correlation ID. * @return Returns 0 upon successful generation of the auto value. */ -int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId_obj); +int z_bmqt_CorrelationId__autoValue(z_bmqt_CorrelationId** correlationId); /** * @brief Compares two z_bmqt_CorrelationId objects. @@ -241,14 +241,14 @@ int z_bmqt_CorrelationId__assign(z_bmqt_CorrelationId** dst, * This function converts the given bmqt::CorrelationId object to a string representation and stores it in the output buffer. * The memory for the output buffer is allocated dynamically and should be deallocated by the caller. * - * @param correlationId_obj A pointer to a bmqt::CorrelationId object to be converted to a string. + * @param correlationId A pointer to a bmqt::CorrelationId object to be converted to a string. * @param out A pointer to a pointer to a character buffer where the string representation will be stored. * Upon successful completion, this pointer will point to the dynamically allocated buffer containing the string. * The caller is responsible for deallocating the memory allocated for this buffer. * @return Returns 0 upon successful conversion. */ int z_bmqt_CorrelationId__toString( - const z_bmqt_CorrelationId* correlationId_obj, + const z_bmqt_CorrelationId* correlationId, char** out); #if defined(__cplusplus) diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp index 51851671b..7c8cc5fd1 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageeventtype.cpp @@ -14,8 +14,8 @@ bool z_bmqt_MessageEventType::fromAscii(z_bmqt_MessageEventType::Enum* out, const char* str) { using namespace BloombergLP; - bmqt::MessageEventType::Enum p; - bool result = bmqt::MessageEventType::fromAscii(&p, str); - *out = static_cast(p); + bmqt::MessageEventType::Enum type; + bool result = bmqt::MessageEventType::fromAscii(&type, str); + *out = static_cast(type); return result; } \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp index 1a291da92..70a1ba5eb 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_messageguid.cpp @@ -34,7 +34,7 @@ int z_bmqt_MessageGUID__fromBinary(z_bmqt_MessageGUID* messageGUID_obj, bmqt::MessageGUID* messageGUID_p = reinterpret_cast( messageGUID_obj); - + messageGUID_p = messageGUID_p->fromBinary(buffer); return 0; } @@ -45,7 +45,7 @@ int z_bmqt_MessageGUID__fromHex(z_bmqt_MessageGUID* messageGUID_obj, bmqt::MessageGUID* messageGUID_p = reinterpret_cast( messageGUID_obj); - + messageGUID_p = messageGUID_p->fromHex(buffer); return 0; } @@ -66,7 +66,7 @@ int z_bmqt_MessageGUID__toBinary(const z_bmqt_MessageGUID* messageGUID_obj, const bmqt::MessageGUID* messageGUID_p = reinterpret_cast(messageGUID_obj); - + messageGUID_p->toBinary(destination); return 0; } @@ -77,7 +77,7 @@ int z_bmqt_MessageGUID__toHex(const z_bmqt_MessageGUID* messageGUID_obj, const bmqt::MessageGUID* messageGUID_p = reinterpret_cast(messageGUID_obj); - + messageGUID_p->toHex(destination); return 0; } @@ -92,7 +92,7 @@ int z_bmqt_MessageGUID__toString(const z_bmqt_MessageGUID* messageGUID_obj, ss << *messageGUID_p; bsl::string out_str = ss.str(); *out = new char[out_str.length() + 1]; - strcpy(*out, out_str.c_str()); + strncpy(*out, out_str.c_str()); return 0; } \ No newline at end of file diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.cpp index ad5212b64..7768aedd8 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_propertytype.cpp @@ -14,9 +14,9 @@ bool z_bmqt_PropertyType::fromAscii(z_bmqt_PropertyType::Enum* out, { using namespace BloombergLP; - bmqt::PropertyType::Enum p; - bool result = bmqt::PropertyType::fromAscii(&p, str); - *out = static_cast(p); + bmqt::PropertyType::Enum type; + bool result = bmqt::PropertyType::fromAscii(&type, str); + *out = static_cast(type); return result; } diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h index ff5b1e022..84ea1ad5a 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_sessioneventtype.h @@ -50,6 +50,15 @@ struct z_bmqt_SessionEventType { ec_QUEUE_RESUMED = 16 // Queue has resumed operation }; + + /// Return the non-modifiable string representation corresponding to the + /// specified enumeration `value`, if it exists, and a unique (error) + /// string otherwise. The string representation of `value` matches its + /// corresponding enumerator name with the `BMQT_` prefix elided. Note + /// that specifying a `value` that does not match any of the enumerators + /// will result in a string representation that is distinct from any of + /// those corresponding to the enumerators, but is otherwise + /// unspecified. static const char* toAscii(z_bmqt_SessionEventType::Enum value); /// Return true and fills the specified `out` with the enum value diff --git a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.cpp b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.cpp index a88f2bc40..82b6387d3 100644 --- a/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.cpp +++ b/src/groups/wrappers/z_bmq/z_bmqt/z_bmqt_subscription.cpp @@ -30,8 +30,6 @@ unsigned int z_bmqt_SubscriptionHandle__id( return subscriptionHandle_p->id(); } -/////// - int z_bmqt_SubscriptionExpression__create( z_bmqt_SubscriptionExpression** subscriptionExpression_obj) { @@ -113,8 +111,6 @@ bool z_bmqt_SubscriptionExpression__isValid( return subscriptionExpression_p->isValid(); } -/////// - int z_bmqt_Subscription__create(z_bmqt_Subscription** subscription_obj) { using namespace BloombergLP; diff --git a/test.txt b/test.txt deleted file mode 100644 index 90bfcb510..000000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -this is a test