[PATCH 2.3.1 5/5] MAMA: Update examples and test tools for completed support of Vector Bool and Vectar Char.


Alireza Assadzadeh <Alireza.Assadzadeh@...>
 

Signed-off-by: Alireza Assadzadeh <Alireza.Assadzadeh@solacesystems.com>
---
mama/c_cpp/src/examples/c/mamalistencachedc.c | 26 ++++++++++++++
.../c_cpp/src/examples/cpp/mamalistencachedcpp.cpp | 40 ++++++++++++++++++++++
mama/c_cpp/src/examples/cpp/mamalistencpp.cpp | 16 +++++++++
.../src/testtools/capturereplay/c/captureconvert.c | 10 ++++++
4 files changed, 92 insertions(+)

diff --git a/mama/c_cpp/src/examples/c/mamalistencachedc.c b/mama/c_cpp/src/examples/c/mamalistencachedc.c
index db6d3ee..6d8ccf4 100644
--- a/mama/c_cpp/src/examples/c/mamalistencachedc.c
+++ b/mama/c_cpp/src/examples/c/mamalistencachedc.c
@@ -2630,6 +2630,32 @@ void printField(mamaFieldCacheField field)
printf ("%s\n", priceString);
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ const mama_bool_t* result = NULL;
+ mama_size_t size = 0;
+ mama_size_t i =0;
+ mamaFieldCacheField_getBoolVector(field,&result,&size);
+ printf("\n");
+ for (i=0;i<size;i++)
+ {
+ printf(" %d\n", (int)result[i]);
+ }
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ const char* result = NULL;
+ mama_size_t size = 0;
+ mama_size_t i =0;
+ mamaFieldCacheField_getCharVector(field,&result,&size);
+ printf("\n");
+ for (i=0;i<size;i++)
+ {
+ printf(" %c\n", (int)result[i]);
+ }
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
const mama_i8_t* result = NULL;
diff --git a/mama/c_cpp/src/examples/cpp/mamalistencachedcpp.cpp b/mama/c_cpp/src/examples/cpp/mamalistencachedcpp.cpp
index 23e94b8..e2c3f45 100644
--- a/mama/c_cpp/src/examples/cpp/mamalistencachedcpp.cpp
+++ b/mama/c_cpp/src/examples/cpp/mamalistencachedcpp.cpp
@@ -1287,6 +1287,22 @@ void DisplayCallback::displayMsgField (const MamaMsg& msg,
printData ("%s\n", price);
}
break;
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ const mama_bool_t* vectorBool;
+ size_t resultLen;
+ field.getVectorBool (vectorBool, resultLen);
+ displayVectorField (vectorBool, resultLen, "%d");
+ }
+ break;
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ const char* vectorChar;
+ size_t resultLen;
+ field.getVectorChar (vectorChar, resultLen);
+ displayVectorField (vectorChar, resultLen, "%c");
+ }
+ break;
case MAMA_FIELD_TYPE_VECTOR_I8:
{
const int8_t* vectorI8;
@@ -2149,6 +2165,30 @@ std::ostream& operator<<(std::ostream& os, const MamaFieldCacheField& field)
os << cachedPriceField.get(field).getAsString();
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ MamaFieldCacheFieldBoolVector cachedVectorField;
+ const mama_bool_t* values = NULL;
+ mama_size_t size = 0;
+ cachedVectorField.get(field,values,size);
+ for (mama_size_t i = 0; i < size; ++i)
+ {
+ os << "[" << (values[i] ? 1 : 0) << "]";
+ }
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ MamaFieldCacheFieldCharVector cachedVectorField;
+ const char* values = NULL;
+ mama_size_t size = 0;
+ cachedVectorField.get(field,values,size);
+ for (mama_size_t i = 0; i < size; ++i)
+ {
+ os << "[" << (char)values[i] << "]";
+ }
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
MamaFieldCacheFieldI8Vector cachedVectorField;
diff --git a/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp b/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp
index 082d00a..ed81b9d 100644
--- a/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp
+++ b/mama/c_cpp/src/examples/cpp/mamalistencpp.cpp
@@ -1226,6 +1226,22 @@ void DisplayCallback::displayMsgField (const MamaMsg& msg,
printData ("%s\n", price);
}
break;
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ const mama_bool_t* vectorBool;
+ size_t resultLen;
+ field.getVectorBool (vectorBool, resultLen);
+ displayVectorField (vectorBool, resultLen, "%d");
+ }
+ break;
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ const char* vectorChar;
+ size_t resultLen;
+ field.getVectorChar (vectorChar, resultLen);
+ displayVectorField (vectorChar, resultLen, "%c");
+ }
+ break;
case MAMA_FIELD_TYPE_VECTOR_I8:
{
const int8_t* vectorI8;
diff --git a/mama/c_cpp/src/testtools/capturereplay/c/captureconvert.c b/mama/c_cpp/src/testtools/capturereplay/c/captureconvert.c
index 4181219..b913a0c 100644
--- a/mama/c_cpp/src/testtools/capturereplay/c/captureconvert.c
+++ b/mama/c_cpp/src/testtools/capturereplay/c/captureconvert.c
@@ -538,6 +538,16 @@ static void copyMamaMsg (mamaMsg sourceMessage,
mamaMsg_destroy (internalTarget);
break;
}
+ case MAMA_FIELD_TYPE_VECTOR_BOOL:
+ {
+ MAMA_VECTOR_FIELD_COPY (Bool, mama_bool_t);
+ break;
+ }
+ case MAMA_FIELD_TYPE_VECTOR_CHAR:
+ {
+ MAMA_VECTOR_FIELD_COPY (Char, char);
+ break;
+ }
case MAMA_FIELD_TYPE_VECTOR_I8:
{
MAMA_VECTOR_FIELD_COPY (I8, mama_i8_t);
--
1.9.3

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.