You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by ve...@apache.org on 2012/06/01 15:06:16 UTC
svn commit: r1345149 [1/2] - in /incubator/etch/trunk/binding-cpp/runtime:
include/serialization/ src/main/serialization/ src/test/serialization/
Author: veithm
Date: Fri Jun 1 13:06:15 2012
New Revision: 1345149
URL: http://svn.apache.org/viewvc?rev=1345149&view=rev
Log:
ETCH-185 Validators updated to smartpointers
methods validate and validateValue updated to smartpointers
Change-Id: I12184179d0c5a5d8ea59dc6fba0e34e644fc14f2
Modified:
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchComboValidator.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidator.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorByte.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorInt.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorLong.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorObject.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorString.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorStructValue.h
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchComboValidator.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorStructValue.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchComboValidatorTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorBooleanTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorByteTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorLongTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorObjectTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorRuntimeExceptionTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorStringTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorStructValueTest.cpp
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchComboValidator.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchComboValidator.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchComboValidator.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchComboValidator.h Fri Jun 1 13:06:15 2012
@@ -45,12 +45,12 @@ public:
/**
* @see EtchValidator
*/
- capu::bool_t validate(EtchObject* value);
+ capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- status_t validateValue(EtchObject* value, EtchObject*& result);
+ status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidator.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidator.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidator.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidator.h Fri Jun 1 13:06:15 2012
@@ -64,7 +64,7 @@ public:
* @return true if the value is valid by any validator in the
* chain, or false if all reject it.
*/
- virtual capu::bool_t validate(EtchObject* value) = 0;
+ virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value) = 0;
/**
* @param value
@@ -74,7 +74,7 @@ public:
* @return TRUE if the value is validated
* FALSE otherwise
*/
- virtual status_t validateValue(EtchObject* value, EtchObject*& result) = 0;
+ virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) = 0;
};
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h Fri Jun 1 13:06:15 2012
@@ -40,12 +40,12 @@ public:
/**
* @see EtchValidator
*/
- virtual capu::bool_t validate(EtchObject* value);
+ virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- virtual status_t validateValue(EtchObject* value, EtchObject*& result);
+ virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorByte.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorByte.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorByte.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorByte.h Fri Jun 1 13:06:15 2012
@@ -45,12 +45,12 @@ public:
/**
* @see EtchValidator
*/
- virtual capu::bool_t validate(EtchObject* value);
+ virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- virtual status_t validateValue(EtchObject* value, EtchObject*& result);
+ virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h Fri Jun 1 13:06:15 2012
@@ -43,12 +43,12 @@ public:
/**
* @see EtchValidator
*/
- virtual capu::bool_t validate(EtchObject* value);
+ virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- virtual status_t validateValue(EtchObject* value, EtchObject*& result);
+ virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h Fri Jun 1 13:06:15 2012
@@ -42,12 +42,12 @@ public:
/**
* @see EtchValidator
*/
- virtual capu::bool_t validate(EtchObject* value);
+ virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- virtual status_t validateValue(EtchObject* value, EtchObject*& result);
+ virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorInt.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorInt.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorInt.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorInt.h Fri Jun 1 13:06:15 2012
@@ -44,12 +44,12 @@ public:
/**
* @see EtchValidator
*/
- virtual capu::bool_t validate(EtchObject* value);
+ virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- virtual status_t validateValue(EtchObject* value, EtchObject*& result);
+ virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorLong.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorLong.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorLong.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorLong.h Fri Jun 1 13:06:15 2012
@@ -46,12 +46,12 @@ public:
/**
* @see EtchValidator
*/
- virtual capu::bool_t validate(EtchObject* value);
+ virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- virtual status_t validateValue(EtchObject* value, EtchObject*& result);
+ virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorObject.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorObject.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorObject.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorObject.h Fri Jun 1 13:06:15 2012
@@ -40,12 +40,12 @@ public:
/**
* @see EtchValidator
*/
- virtual capu::bool_t validate(EtchObject* value);
+ virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- virtual status_t validateValue(EtchObject* value, EtchObject*& result);
+ virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h Fri Jun 1 13:06:15 2012
@@ -34,12 +34,12 @@ public:
/**
* @see EtchValidator
*/
- capu::bool_t validate(EtchObject* value);
+ capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- status_t validateValue(EtchObject* value, EtchObject*& result);
+ status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h Fri Jun 1 13:06:15 2012
@@ -46,12 +46,12 @@ public:
/**
* @see EtchValidator
*/
- virtual capu::bool_t validate(EtchObject* value);
+ virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- virtual status_t validateValue(EtchObject* value, EtchObject*& result);
+ virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorString.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorString.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorString.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorString.h Fri Jun 1 13:06:15 2012
@@ -41,12 +41,12 @@ public:
/**
* @see EtchValidator
*/
- virtual capu::bool_t validate(EtchObject* value);
+ virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- virtual status_t validateValue(EtchObject* value, EtchObject*& result);
+ virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorStructValue.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorStructValue.h?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorStructValue.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorStructValue.h Fri Jun 1 13:06:15 2012
@@ -38,12 +38,12 @@ public:
/**
* @see EtchValidator
*/
- virtual capu::bool_t validate(EtchObject* value);
+ virtual capu::bool_t validate(capu::SmartPointer<EtchObject> value);
/**
* @see EtchValidator
*/
- virtual status_t validateValue(EtchObject* value, EtchObject*& result);
+ virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result);
/**
* @see EtchValidator
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchComboValidator.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchComboValidator.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchComboValidator.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchComboValidator.cpp Fri Jun 1 13:06:15 2012
@@ -40,11 +40,11 @@ capu::SmartPointer<EtchValidator> EtchCo
return mSecond;
}
-capu::bool_t EtchComboValidator::validate(EtchObject* value) {
+capu::bool_t EtchComboValidator::validate(capu::SmartPointer<EtchObject> value) {
return mFirst->validate(value) || mSecond->validate(value);
}
-status_t EtchComboValidator::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchComboValidator::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (mFirst->validateValue(value, result) == ETCH_OK) {
return ETCH_OK;
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp Fri Jun 1 13:06:15 2012
@@ -53,7 +53,7 @@ status_t EtchStructValue::put(EtchField
if ((mLevel == LEVEL_FULL) && (v.get() == NULL))
return ETCH_ENOT_EXIST;
- if ((v.get() != NULL) && (!v->validate(object.get())))
+ if ((v.get() != NULL) && (!v->validate(object)))
return ETCH_EINVAL;
}
return mTable.put(field, object, old_value);
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp Fri Jun 1 13:06:15 2012
@@ -34,8 +34,8 @@ EtchValidatorBoolean::~EtchValidatorBool
}
-capu::bool_t EtchValidatorBoolean::validate(EtchObject* value) {
- if (value == NULL) {
+capu::bool_t EtchValidatorBoolean::validate(capu::SmartPointer<EtchObject> value) {
+ if (value.get() == NULL) {
return false;
}
if (mExpectedType == NULL) {
@@ -46,7 +46,7 @@ capu::bool_t EtchValidatorBoolean::valid
}
//array handling
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
- EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
+ EtchNativeArray<capu::SmartPointer<EtchObject> > *array = (EtchNativeArray<capu::SmartPointer<EtchObject> > *) value.get();
if (array->getDim() != mNDims) {
return false;
}
@@ -57,7 +57,7 @@ capu::bool_t EtchValidatorBoolean::valid
return false;
}
-status_t EtchValidatorBoolean::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchValidatorBoolean::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (validate(value)) {
result = value;
return ETCH_OK;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp Fri Jun 1 13:06:15 2012
@@ -34,8 +34,8 @@ EtchValidatorByte::~EtchValidatorByte()
}
-capu::bool_t EtchValidatorByte::validate(EtchObject* value) {
- if (value == NULL)
+capu::bool_t EtchValidatorByte::validate(capu::SmartPointer<EtchObject> value) {
+ if (value.get() == NULL)
return false;
if (mExpectedType == NULL)
return false;
@@ -44,23 +44,23 @@ capu::bool_t EtchValidatorByte::validate
return true;
if (value->getObjectType()->equals(EtchShort::TYPE())) {
- EtchShort *v = (EtchShort *) value;
+ EtchShort *v = (EtchShort *) value.get();
return ((v->get() >= capu::NumericLimitMin<capu::int8_t> ()) && (v->get() <= capu::NumericLimitMax<capu::int8_t> ()));
}
if (value->getObjectType()->equals(EtchInt32::TYPE())) {
- EtchInt32 *v = (EtchInt32 *) value;
+ EtchInt32 *v = (EtchInt32 *) value.get();
return ((v->get() >= capu::NumericLimitMin<capu::int8_t> ()) && (v->get() <= capu::NumericLimitMax<capu::int8_t> ()));
}
if (value->getObjectType()->equals(EtchLong::TYPE())) {
- EtchLong *v = (EtchLong *) value;
+ EtchLong *v = (EtchLong *) value.get();
return ((v->get() >= capu::NumericLimitMin<capu::int8_t> ()) && (v->get() <= capu::NumericLimitMax<capu::int8_t> ()));
}
//array handling
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
- EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
+ EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value.get();
if (array->getDim() != mNDims) {
return false;
}
@@ -73,27 +73,27 @@ capu::bool_t EtchValidatorByte::validate
return false;
}
-status_t EtchValidatorByte::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchValidatorByte::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (validate(value)) {
if ((value->getObjectType()->equals(EtchByte::TYPE())) || (mNDims > 0)) {
result = value;
return ETCH_OK;
} else {
if (value->getObjectType()->equals(EtchShort::TYPE())) {
- EtchShort *v = (EtchShort *) value;
- result = (EtchObject*) (new EtchByte((capu::int8_t)v->get()));
+ EtchShort *v = (EtchShort *) value.get();
+ result = new EtchByte((capu::int8_t)v->get());
return ETCH_OK;
}
if (value->getObjectType()->equals(EtchLong::TYPE())) {
- EtchByte *v = (EtchByte *) value;
- result = (EtchObject*) (new EtchByte((capu::int8_t)v->get()));
+ EtchLong *v = (EtchLong *) value.get();
+ result = new EtchByte((capu::int8_t)v->get());
return ETCH_OK;
}
if (value->getObjectType()->equals(EtchInt32::TYPE())) {
- EtchInt32 *v = (EtchInt32 *) value;
- result = (EtchObject*) (new EtchByte((capu::int8_t)v->get()));
+ EtchInt32 *v = (EtchInt32 *) value.get();
+ result = new EtchByte((capu::int8_t)v->get());
return ETCH_OK;
}
return ETCH_ERROR;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp Fri Jun 1 13:06:15 2012
@@ -34,8 +34,8 @@ EtchValidatorDouble::~EtchValidatorDoubl
}
-capu::bool_t EtchValidatorDouble::validate(EtchObject* value) {
- if (value == NULL)
+capu::bool_t EtchValidatorDouble::validate(capu::SmartPointer<EtchObject> value) {
+ if (value.get() == NULL)
return false;
if (mExpectedType == NULL)
@@ -46,7 +46,7 @@ capu::bool_t EtchValidatorDouble::valida
//handle array
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
- EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
+ EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value.get();
if (array->getDim() != mNDims) {
return false;
}
@@ -57,7 +57,7 @@ capu::bool_t EtchValidatorDouble::valida
return false;
}
-status_t EtchValidatorDouble::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchValidatorDouble::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (validate(value)) {
result = value;
return ETCH_OK;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp Fri Jun 1 13:06:15 2012
@@ -34,9 +34,9 @@ EtchValidatorFloat::~EtchValidatorFloat(
}
-capu::bool_t EtchValidatorFloat::validate(EtchObject* value) {
+capu::bool_t EtchValidatorFloat::validate(capu::SmartPointer<EtchObject> value) {
- if (value == NULL)
+ if (value.get() == NULL)
return false;
if (mExpectedType == NULL)
return false;
@@ -45,7 +45,7 @@ capu::bool_t EtchValidatorFloat::validat
//array handling
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
- EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
+ EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value.get();
if (array->getDim() != mNDims) {
return false;
}
@@ -56,7 +56,7 @@ capu::bool_t EtchValidatorFloat::validat
return false;
}
-status_t EtchValidatorFloat::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchValidatorFloat::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (validate(value)) {
result = value;
return ETCH_OK;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp Fri Jun 1 13:06:15 2012
@@ -34,8 +34,8 @@ EtchValidatorInt::~EtchValidatorInt() {
}
-capu::bool_t EtchValidatorInt::validate(EtchObject* value) {
- if (value == NULL)
+capu::bool_t EtchValidatorInt::validate(capu::SmartPointer<EtchObject> value) {
+ if (value.get() == NULL)
return false;
if (mExpectedType == NULL)
@@ -49,13 +49,13 @@ capu::bool_t EtchValidatorInt::validate(
return true;
if (value->getObjectType()->equals(EtchLong::TYPE())) {
- EtchLong *v = (EtchLong *) value;
+ EtchLong *v = (EtchLong *) value.get();
return ((v->get() >= capu::NumericLimitMin<capu::int32_t > ()) && (v->get() <= capu::NumericLimitMax<capu::int32_t > ()));
}
//handle array
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
- EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
+ EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value.get();
if (array->getDim() != mNDims) {
return false;
}
@@ -67,27 +67,27 @@ capu::bool_t EtchValidatorInt::validate(
return false;
}
-status_t EtchValidatorInt::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchValidatorInt::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (validate(value)) {
if ((value->getObjectType()->equals(EtchInt32::TYPE())) || (mNDims > 0)) {
result = value;
return ETCH_OK;
} else {
if (value->getObjectType()->equals(EtchShort::TYPE())) {
- EtchShort *v = (EtchShort *) value;
- result = (EtchObject*) (new EtchInt32((capu::int32_t)v->get()));
+ EtchShort *v = (EtchShort *) value.get();
+ result = new EtchInt32((capu::int32_t)v->get());
return ETCH_OK;
}
if (value->getObjectType()->equals(EtchByte::TYPE())) {
- EtchByte *v = (EtchByte *) value;
- result = (EtchObject*) (new EtchInt32((capu::int32_t)v->get()));
+ EtchByte *v = (EtchByte *) value.get();
+ result = new EtchInt32((capu::int32_t)v->get());
return ETCH_OK;
}
if (value->getObjectType()->equals(EtchLong::TYPE())) {
- EtchLong *v = (EtchLong *) value;
- result = (EtchObject*) (new EtchInt32((capu::int32_t)v->get()));
+ EtchLong *v = (EtchLong *) value.get();
+ result = new EtchInt32((capu::int32_t)v->get());
return ETCH_OK;
}
return ETCH_ERROR;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp Fri Jun 1 13:06:15 2012
@@ -34,8 +34,8 @@ EtchValidatorLong::~EtchValidatorLong()
}
-capu::bool_t EtchValidatorLong::validate(EtchObject* value) {
- if (value == NULL)
+capu::bool_t EtchValidatorLong::validate(capu::SmartPointer<EtchObject> value) {
+ if (value.get() == NULL)
return false;
if (mExpectedType == NULL)
@@ -51,7 +51,7 @@ capu::bool_t EtchValidatorLong::validate
//handle array
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
- EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
+ EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value.get();
if (array->getDim() != mNDims) {
return false;
}
@@ -59,28 +59,29 @@ capu::bool_t EtchValidatorLong::validate
const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
return type->equals(type2);
}
+ return false;
}
-status_t EtchValidatorLong::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchValidatorLong::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (validate(value)) {
if ((value->getObjectType()->equals(EtchLong::TYPE())) || (mNDims > 0)) {
result = value;
return ETCH_OK;
} else {
if (value->getObjectType()->equals(EtchShort::TYPE())) {
- EtchShort *v = (EtchShort *) value;
+ EtchShort *v = (EtchShort *) value.get();
result = new EtchLong((capu::int64_t)v->get());
return ETCH_OK;
}
if (value->getObjectType()->equals(EtchByte::TYPE())) {
- EtchByte *v = (EtchByte *) value;
+ EtchByte *v = (EtchByte *) value.get();
result = new EtchLong((capu::int64_t)v->get());
return ETCH_OK;
}
if (value->getObjectType()->equals(EtchInt32::TYPE())) {
- EtchInt32 *v = (EtchInt32 *) value;
+ EtchInt32 *v = (EtchInt32 *) value.get();
result = new EtchLong((capu::int64_t)v->get());
return ETCH_OK;
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp Fri Jun 1 13:06:15 2012
@@ -35,17 +35,17 @@ EtchValidatorObject::~EtchValidatorObjec
}
-capu::bool_t EtchValidatorObject::validate(EtchObject* value) {
- if (value == NULL)
+capu::bool_t EtchValidatorObject::validate(capu::SmartPointer<EtchObject> value) {
+ if (value.get() == NULL)
return false;
if (mExpectedType == NULL)
return false;
if (value->getObjectType()->equals(mExpectedType))
return true;
- return ((dynamic_cast<EtchObject*> (value) != NULL) && (mSubclass));
+ return ((dynamic_cast<EtchObject*> (value.get()) != NULL) && (mSubclass));
}
-status_t EtchValidatorObject::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchValidatorObject::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (validate(value)) {
result = value;
return ETCH_OK;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp Fri Jun 1 13:06:15 2012
@@ -33,13 +33,13 @@ EtchValidatorRuntimeException::~EtchVali
}
-capu::bool_t EtchValidatorRuntimeException::validate(EtchObject* value) {
- if (value == NULL)
+capu::bool_t EtchValidatorRuntimeException::validate(capu::SmartPointer<EtchObject> value) {
+ if (value.get() == NULL)
return false;
return value->getObjectType()->equals(EtchRuntimeException::TYPE());
}
-status_t EtchValidatorRuntimeException::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchValidatorRuntimeException::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (validate(value)) {
result = value;
return ETCH_OK;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp Fri Jun 1 13:06:15 2012
@@ -34,8 +34,8 @@ EtchValidatorShort::~EtchValidatorShort(
}
-capu::bool_t EtchValidatorShort::validate(EtchObject* value) {
- if (value == NULL)
+capu::bool_t EtchValidatorShort::validate(capu::SmartPointer<EtchObject> value) {
+ if (value.get() == NULL)
return false;
if (mExpectedType == NULL)
@@ -49,17 +49,17 @@ capu::bool_t EtchValidatorShort::validat
return true;
if (value->getObjectType()->equals(EtchInt32::TYPE())) {
- EtchInt32 *v = (EtchInt32 *) value;
+ EtchInt32 *v = (EtchInt32 *) value.get();
return ((v->get() >= capu::NumericLimitMin<capu::int16_t > ()) && (v->get() <= capu::NumericLimitMax<capu::int16_t > ()));
}
if (value->getObjectType()->equals(EtchLong::TYPE())) {
- EtchLong *v = (EtchLong *) value;
+ EtchLong *v = (EtchLong *) value.get();
return ((v->get() >= capu::NumericLimitMin<capu::int16_t > ()) && (v->get() <= capu::NumericLimitMax<capu::int16_t > ()));
}
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
- EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
+ EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value.get();
if (array->getDim() != mNDims) {
return false;
}
@@ -70,27 +70,27 @@ capu::bool_t EtchValidatorShort::validat
return false;
}
-status_t EtchValidatorShort::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchValidatorShort::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (validate(value)) {
if ((value->getObjectType()->equals(EtchShort::TYPE())) || (mNDims > 0)) {
result = value;
return ETCH_OK;
} else {
if (value->getObjectType()->equals(EtchInt32::TYPE())) {
- EtchInt32 *v = (EtchInt32 *) value;
- result = (EtchObject*) (new EtchShort((capu::int16_t)v->get()));
+ EtchInt32 *v = (EtchInt32 *) value.get();
+ result = new EtchShort((capu::int16_t)v->get());
return ETCH_OK;
}
if (value->getObjectType()->equals(EtchByte::TYPE())) {
- EtchByte *v = (EtchByte *) value;
- result = (EtchObject*) (new EtchShort((capu::int16_t)v->get()));
+ EtchByte *v = (EtchByte *) value.get();
+ result = new EtchShort((capu::int16_t)v->get());
return ETCH_OK;
}
if (value->getObjectType()->equals(EtchLong::TYPE())) {
- EtchLong *v = (EtchLong *) value;
- result = (EtchObject*) (new EtchShort((capu::int16_t)v->get()));
+ EtchLong *v = (EtchLong *) value.get();
+ result = new EtchShort((capu::int16_t)v->get());
return ETCH_OK;
}
return ETCH_ERROR;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp Fri Jun 1 13:06:15 2012
@@ -34,8 +34,8 @@ EtchValidatorString::~EtchValidatorStrin
}
-capu::bool_t EtchValidatorString::validate(EtchObject* value) {
- if (value == NULL)
+capu::bool_t EtchValidatorString::validate(capu::SmartPointer<EtchObject> value) {
+ if (value.get() == NULL)
return false;
if (mExpectedType == NULL)
return false;
@@ -43,7 +43,7 @@ capu::bool_t EtchValidatorString::valida
return true;
// handle array
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
- EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
+ EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value.get();
if (array->getDim() != mNDims) {
return false;
}
@@ -54,7 +54,7 @@ capu::bool_t EtchValidatorString::valida
return false;
}
-status_t EtchValidatorString::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchValidatorString::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (validate(value)) {
result = value;
return ETCH_OK;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorStructValue.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorStructValue.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorStructValue.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorStructValue.cpp Fri Jun 1 13:06:15 2012
@@ -33,7 +33,7 @@ EtchValidatorStructValue::~EtchValidator
}
-status_t EtchValidatorStructValue::validateValue(EtchObject* value, EtchObject*& result) {
+status_t EtchValidatorStructValue::validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>& result) {
if (validate(value)) {
result = value;
return ETCH_OK;
@@ -42,16 +42,17 @@ status_t EtchValidatorStructValue::valid
}
}
-capu::bool_t EtchValidatorStructValue::validate(EtchObject* value) {
+capu::bool_t EtchValidatorStructValue::validate(capu::SmartPointer<EtchObject> value) {
if (mExpectedType == NULL)
return false;
- if (value == NULL)
+ if (value.get() == NULL)
return false;
if (value->getObjectType()->equals(mExpectedType))
return true;
//handle array
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
- EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
+ //TODO: move getDim to EtchObjectType and set it dynamically during creation of the object
+ EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value.get();
if (array->getDim() != mNDims) {
return false;
}
@@ -59,7 +60,7 @@ capu::bool_t EtchValidatorStructValue::v
const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
return type->equals(type2);
}
- return (dynamic_cast<EtchValidatorStructValue*> (value) != NULL);
+ return (dynamic_cast<EtchValidatorStructValue*> (value.get()) != NULL);
}
status_t EtchValidatorStructValue::getElementValidator(capu::SmartPointer<EtchValidator> &val) {
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchComboValidatorTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchComboValidatorTest.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchComboValidatorTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchComboValidatorTest.cpp Fri Jun 1 13:06:15 2012
@@ -33,33 +33,33 @@ TEST(EtchComboValidatorTest, createTest)
}
TEST(EtchComboValidatorTest, validateTest) {
- EtchObject* byte = NULL;
+ capu::SmartPointer<EtchObject> byte = NULL;
- EtchObject* integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
- EtchObject* integer2 = new EtchInt32(0);
- EtchObject* integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
- EtchObject* integer4 = new EtchInt32(897);
-
- EtchObject* longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
- EtchObject* longInteger2 = new EtchLong(0);
- EtchObject* longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
- EtchObject* longInteger4 = new EtchLong(897);
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
+
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- EtchObject* longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int32_t>() + (capu::int64_t)2);
+ capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int32_t>() + (capu::int64_t)2);
- EtchObject* shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
- EtchObject* shortInteger2 = new EtchShort(0);
- EtchObject* shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
- EtchObject* shortInteger4 = new EtchShort();
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
- EtchObject* str = NULL;
- EtchObject* str2 = new EtchString("hello");
+ capu::SmartPointer<EtchObject> str = NULL;
+ capu::SmartPointer<EtchObject> str2 = new EtchString("hello");
//
- EtchObject* byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
- EtchObject* byte2 = new EtchByte(0);
- EtchObject* byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
- EtchObject* byte4 = new EtchByte(32);
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
//create combo validator
EtchComboValidator *ptr = NULL;
@@ -90,38 +90,16 @@ TEST(EtchComboValidatorTest, validateTes
EXPECT_TRUE(ptr->validate(longInteger4));
EXPECT_TRUE(ptr->validate(shortInteger4));
delete ptr;
-
- delete integer;
- delete integer2;
- delete integer3;
- delete integer4;
-
- delete longInteger;
- delete longInteger2;
- delete longInteger3;
- delete longInteger4;
- delete longInteger5;
-
- delete shortInteger;
- delete shortInteger2;
- delete shortInteger3;
- delete shortInteger4;
-
- delete str2;
- delete byte1;
- delete byte2;
- delete byte3;
- delete byte4;
}
TEST(EtchComboValidatorTest, validateValueTest) {
- EtchObject* byte = NULL;
- EtchObject* result = NULL;
- EtchObject* integer = new EtchInt32(-128);
- EtchObject* integer2 = new EtchInt32(5);
- EtchObject* integer3 = new EtchInt32(127);
- EtchObject* byte2 = new EtchByte(3);
+ capu::SmartPointer<EtchObject> byte = NULL;
+ capu::SmartPointer<EtchObject> result = NULL;
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(-128);
+ capu::SmartPointer<EtchObject> integer2 = new EtchInt32(5);
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(127);
+ capu::SmartPointer<EtchObject> byte2 = new EtchByte(3);
//create combo validator
EtchComboValidator *ptr = NULL;
@@ -133,26 +111,20 @@ TEST(EtchComboValidatorTest, validateVal
//INT TESTS
EXPECT_TRUE(ptr->validateValue(byte, result) == ETCH_ERROR);
EXPECT_TRUE(ptr->validateValue(integer, result) == ETCH_OK);
- EXPECT_TRUE(((EtchInt32*) result)->get() == ((EtchInt32*) integer)->get());
+ EXPECT_TRUE(((EtchInt32*) result.get())->get() == ((EtchInt32*) integer.get())->get());
EXPECT_TRUE(ptr->validateValue(integer2, result) == ETCH_OK);
- EXPECT_TRUE(((EtchInt32*) result)->get() == ((EtchInt32*) integer2)->get());
+ EXPECT_TRUE(((EtchInt32*) result.get())->get() == ((EtchInt32*) integer2.get())->get());
EXPECT_TRUE(ptr->validateValue(integer3, result) == ETCH_OK);
- EXPECT_TRUE(((EtchInt32*) result)->get() == ((EtchInt32*) integer3)->get());
+ EXPECT_TRUE(((EtchInt32*) result.get())->get() == ((EtchInt32*) integer3.get())->get());
EXPECT_TRUE(ptr->validateValue(byte2, result) == ETCH_OK);
- EXPECT_TRUE(((EtchInt32*) result)->get() == ((EtchByte*) byte2)->get());
- delete result;
- EtchObject* str = NULL;
- EtchObject* str2 = new EtchString("hello");
+ EXPECT_TRUE(((EtchInt32*) result.get())->get() == ((EtchByte*) byte2.get())->get());
+
+ capu::SmartPointer<EtchObject> str = NULL;
+ capu::SmartPointer<EtchObject> str2 = new EtchString("hello");
//STRING TESTS
EXPECT_TRUE(ptr->validateValue(str, result) == ETCH_ERROR);
EXPECT_TRUE(ptr->validateValue(str2, result) == ETCH_OK);
- delete result;
delete ptr;
-
- delete byte2;
- delete integer;
- delete integer2;
- delete integer3;
}
TEST(EtchComboValidatorTest, elementValidatorTest) {
@@ -167,30 +139,30 @@ TEST(EtchComboValidatorTest, elementVali
ptr->getElementValidator(element_validator);
- EtchObject* str = NULL;
- EtchObject* str2 = new EtchString("hello");
+ capu::SmartPointer<EtchObject> str = NULL;
+ capu::SmartPointer<EtchObject> str2 = new EtchString("hello");
- EtchObject* integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
- EtchObject* integer2 = new EtchInt32(0);
- EtchObject* integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
- EtchObject* integer4 = new EtchInt32(897);
-
- EtchObject* longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
- EtchObject* longInteger2 = new EtchLong(0);
- EtchObject* longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
- EtchObject* longInteger4 = new EtchLong(897);
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
+
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- EtchObject* longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int32_t>() + (capu::int64_t)2);
+ capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int32_t>() + (capu::int64_t)2);
- EtchObject* shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
- EtchObject* shortInteger2 = new EtchShort(0);
- EtchObject* shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
- EtchObject* shortInteger4 = new EtchShort();
-
- EtchObject* byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
- EtchObject* byte2 = new EtchByte(0);
- EtchObject* byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
- EtchObject* byte4 = new EtchByte(32);
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
+
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
//INT TEST
EXPECT_FALSE(element_validator->validate(longInteger5));
EXPECT_TRUE(element_validator->validate(integer));
@@ -213,26 +185,4 @@ TEST(EtchComboValidatorTest, elementVali
EXPECT_FALSE(element_validator->validate(str));
EXPECT_TRUE(element_validator->validate(str2));
delete ptr;
-
- delete integer;
- delete integer2;
- delete integer3;
- delete integer4;
-
- delete longInteger;
- delete longInteger2;
- delete longInteger3;
- delete longInteger4;
- delete longInteger5;
-
- delete shortInteger;
- delete shortInteger2;
- delete shortInteger3;
- delete shortInteger4;
-
- delete str2;
- delete byte1;
- delete byte2;
- delete byte3;
- delete byte4;
}
\ No newline at end of file
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorBooleanTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorBooleanTest.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorBooleanTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorBooleanTest.cpp Fri Jun 1 13:06:15 2012
@@ -43,33 +43,29 @@ TEST(EtchValidatorBooleanTest, createTes
}
TEST(EtchValidatorBooleanTest, validateTest) {
- EtchObject* boolean = NULL;
- EtchObject* integer = new EtchInt32(4);
- EtchObject* boolean2 = new EtchBool(false);
+ capu::SmartPointer<EtchObject> boolean = NULL;
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(4);
+ capu::SmartPointer<EtchObject> boolean2 = new EtchBool(false);
capu::SmartPointer<EtchValidator> val2;
EXPECT_TRUE(EtchValidatorBoolean::Get(0, val2) == ETCH_OK);
capu::SmartPointer<EtchValidatorBoolean> val = capu::smartpointer_cast<EtchValidatorBoolean>(val2);
EXPECT_FALSE(val->validate(boolean));
EXPECT_FALSE(val->validate(integer));
EXPECT_TRUE(val->validate(boolean2));
- delete integer;
- delete boolean2;
}
TEST(EtchValidatorBooleanTest, validateValueTest) {
- EtchObject* boolean = NULL;
- EtchObject* result;
- EtchObject* integer = new EtchInt32(4);
- EtchObject* boolean2 = new EtchBool(false);
+ capu::SmartPointer<EtchObject> boolean = NULL;
+ capu::SmartPointer<EtchObject> result;
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(4);
+ capu::SmartPointer<EtchObject> boolean2 = new EtchBool(false);
capu::SmartPointer<EtchValidator> val2;
EXPECT_TRUE(EtchValidatorBoolean::Get(0, val2) == ETCH_OK);
capu::SmartPointer<EtchValidatorBoolean> val = capu::smartpointer_cast<EtchValidatorBoolean>(val2);
EXPECT_TRUE(val->validateValue(boolean, result) == ETCH_ERROR);
EXPECT_TRUE(val->validateValue(integer, result) == ETCH_ERROR);
EXPECT_TRUE(val->validateValue(boolean2, result) == ETCH_OK);
- delete integer;
- delete boolean2;
}
TEST(EtchValidatorBooleanTest, elementValidatorTest) {
@@ -80,13 +76,11 @@ TEST(EtchValidatorBooleanTest, elementVa
capu::SmartPointer<EtchValidator> element_validator;
val->getElementValidator(element_validator);
- EtchObject* boolean = NULL;
- EtchObject* integer = new EtchInt32(4);
- EtchObject* boolean2 = new EtchBool(false);
+ capu::SmartPointer<EtchObject> boolean = NULL;
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(4);
+ capu::SmartPointer<EtchObject> boolean2 = new EtchBool(false);
EXPECT_FALSE(element_validator->validate(boolean));
EXPECT_FALSE(element_validator->validate(integer));
EXPECT_TRUE(element_validator->validate(boolean2));
- delete integer;
- delete boolean2;
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorByteTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorByteTest.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorByteTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorByteTest.cpp Fri Jun 1 13:06:15 2012
@@ -39,25 +39,25 @@ TEST(EtchValidatorByteTest, createTest)
}
TEST(EtchValidatorByteTest, validateTest) {
- EtchObject* byte = NULL;
+ capu::SmartPointer<EtchObject> byte = NULL;
- EtchObject* integer = new EtchInt32(-128);
- EtchObject* integer2 = new EtchInt32(5);
- EtchObject* integer3 = new EtchInt32(127);
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(-128);
+ capu::SmartPointer<EtchObject> integer2 = new EtchInt32(5);
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(127);
//exceed limit of byte
- EtchObject* integer4 = new EtchInt32(897);
- EtchObject* longInteger = new EtchLong(-128);
- EtchObject* longInteger2 = new EtchLong(5);
- EtchObject* longInteger3 = new EtchLong(127);
+ capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(-128);
+ capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(5);
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(127);
//exceed limit of byte
- EtchObject* longInteger4 = new EtchLong(897);
- EtchObject* shortInteger = new EtchShort(-128);
- EtchObject* shortInteger2 = new EtchShort(5);
- EtchObject* shortInteger3 = new EtchShort(127);
+ capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(-128);
+ capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(5);
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(127);
//Exceed limit of byte
- EtchObject* shortInteger4 = new EtchShort(897);
- EtchObject* str = new EtchString();
- EtchObject* byte2 = new EtchByte(3);
+ capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort(897);
+ capu::SmartPointer<EtchObject> str = new EtchString();
+ capu::SmartPointer<EtchObject> byte2 = new EtchByte(3);
capu::SmartPointer<EtchValidator> ptr = NULL;
EXPECT_TRUE(EtchValidatorByte::Get(0, ptr) == ETCH_OK);
EXPECT_TRUE((capu::smartpointer_cast<EtchTypeValidator>(ptr))->getNDims() == 0);
@@ -77,50 +77,30 @@ TEST(EtchValidatorByteTest, validateTest
EXPECT_FALSE(ptr->validate(shortInteger4));
EXPECT_FALSE(ptr->validate(str));
- delete integer;
- delete integer2;
- delete integer3;
- delete integer4;
-
- delete longInteger;
- delete longInteger2;
- delete longInteger3;
- delete longInteger4;
-
- delete shortInteger;
- delete shortInteger2;
- delete shortInteger3;
- delete shortInteger4;
-
- delete str;
- delete byte2;
}
TEST(EtchValidatorByteTest, validateValueTest) {
- EtchObject* byte = NULL;
- EtchObject* result;
- EtchObject* integer = new EtchInt32(-128);
- EtchObject* integer2 = new EtchInt32(5);
- EtchObject* integer3 = new EtchInt32(127);
- EtchObject* byte2 = new EtchByte(3);
+ capu::SmartPointer<EtchObject> byte = NULL;
+ capu::SmartPointer<EtchObject> result;
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(-128);
+ capu::SmartPointer<EtchObject> integer2 = new EtchInt32(5);
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(127);
+ capu::SmartPointer<EtchObject> byte2 = new EtchByte(3);
capu::SmartPointer<EtchValidator> ptr = NULL;
EXPECT_TRUE(EtchValidatorByte::Get(0, ptr) == ETCH_OK);
EXPECT_TRUE(ptr->validateValue(byte, result) == ETCH_ERROR);
EXPECT_TRUE(ptr->validateValue(integer, result) == ETCH_OK);
- EXPECT_TRUE(((EtchByte*) result)->get() == ((EtchInt32*) integer)->get());
- delete result;
+ EXPECT_TRUE(((EtchByte*) result.get())->get() == ((EtchInt32*) integer.get())->get());
+
EXPECT_TRUE(ptr->validateValue(integer2, result) == ETCH_OK);
- EXPECT_TRUE(((EtchByte*) result)->get() == ((EtchInt32*) integer2)->get());
- delete result;
+ EXPECT_TRUE(((EtchByte*) result.get())->get() == ((EtchInt32*) integer2.get())->get());
+
EXPECT_TRUE(ptr->validateValue(integer3, result) == ETCH_OK);
- EXPECT_TRUE(((EtchByte*) result)->get() == ((EtchInt32*) integer3)->get());
- delete result;
+ EXPECT_TRUE(((EtchByte*) result.get())->get() == ((EtchInt32*) integer3.get())->get());
+
EXPECT_TRUE(ptr->validateValue(byte2, result) == ETCH_OK);
- EXPECT_TRUE(((EtchByte*) result)->get() == ((EtchByte*) byte2)->get());
- delete integer;
- delete integer2;
- delete integer3;
- delete byte2;
+ EXPECT_TRUE(((EtchByte*) result.get())->get() == ((EtchByte*) byte2.get())->get());
+
}
TEST(EtchValidatorByteTest, elementValidatorTest) {
@@ -129,23 +109,23 @@ TEST(EtchValidatorByteTest, elementValid
capu::SmartPointer<EtchValidator> elementValidator;
ptr->getElementValidator(elementValidator);
- EtchObject* integer = new EtchInt32(-128);
- EtchObject* integer2 = new EtchInt32(5);
- EtchObject* integer3 = new EtchInt32(127);
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(-128);
+ capu::SmartPointer<EtchObject> integer2 = new EtchInt32(5);
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(127);
//exceed limit of byte
- EtchObject* integer4 = new EtchInt32(897);
- EtchObject* longInteger = new EtchLong(-128);
- EtchObject* longInteger2 = new EtchLong(5);
- EtchObject* longInteger3 = new EtchLong(127);
+ capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(-128);
+ capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(5);
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(127);
//exceed limit of byte
- EtchObject* longInteger4 = new EtchLong(897);
- EtchObject* shortInteger = new EtchShort(-128);
- EtchObject* shortInteger2 = new EtchShort(5);
- EtchObject* shortInteger3 = new EtchShort(127);
+ capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(-128);
+ capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(5);
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(127);
//Exceed limit of byte
- EtchObject* shortInteger4 = new EtchShort(897);
- EtchObject* str = new EtchString();
- EtchObject* byte2 = new EtchByte(3);
+ capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort(897);
+ capu::SmartPointer<EtchObject> str = new EtchString();
+ capu::SmartPointer<EtchObject> byte2 = new EtchByte(3);
EXPECT_TRUE(elementValidator->validate(integer));
EXPECT_TRUE(elementValidator->validate(integer2));
@@ -161,21 +141,4 @@ TEST(EtchValidatorByteTest, elementValid
EXPECT_FALSE(elementValidator->validate(longInteger4));
EXPECT_FALSE(elementValidator->validate(shortInteger4));
EXPECT_FALSE(elementValidator->validate(str));
- delete integer;
- delete integer2;
- delete integer3;
- delete integer4;
-
- delete longInteger;
- delete longInteger2;
- delete longInteger3;
- delete longInteger4;
-
- delete shortInteger;
- delete shortInteger2;
- delete shortInteger3;
- delete shortInteger4;
-
- delete str;
- delete byte2;
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp Fri Jun 1 13:06:15 2012
@@ -41,16 +41,16 @@ TEST(EtchValidatorDoubleTest, createTest
}
TEST(EtchValidatorDoubleTest, validateTest) {
- EtchObject* byte = NULL;
+ capu::SmartPointer<EtchObject> byte = NULL;
- EtchObject* doubleTmp = new EtchDouble(capu::NumericLimitMax<capu::float_t>());
- EtchObject* doubleTmp1 = new EtchDouble(0);
- EtchObject* doubleTmp2 = new EtchDouble(capu::NumericLimitMin<capu::float_t>());
- EtchObject* doubleTmp3 = new EtchDouble(897.12);
+ capu::SmartPointer<EtchObject> doubleTmp = new EtchDouble(capu::NumericLimitMax<capu::float_t>());
+ capu::SmartPointer<EtchObject> doubleTmp1 = new EtchDouble(0);
+ capu::SmartPointer<EtchObject> doubleTmp2 = new EtchDouble(capu::NumericLimitMin<capu::float_t>());
+ capu::SmartPointer<EtchObject> doubleTmp3 = new EtchDouble(897.12);
//exceed limits of Float
- EtchObject* doubleTmp4_true = new EtchDouble((capu::double_t)capu::NumericLimitMax<capu::float_t>() + (capu::double_t)2.12);
+ capu::SmartPointer<EtchObject> doubleTmp4_true = new EtchDouble((capu::double_t)capu::NumericLimitMax<capu::float_t>() + (capu::double_t)2.12);
//incompatible type
- EtchObject* str = new EtchString();
+ capu::SmartPointer<EtchObject> str = new EtchString();
capu::SmartPointer<EtchValidator> ptr = NULL;
EXPECT_TRUE(EtchValidatorDouble::Get(0, ptr) == ETCH_OK);
@@ -64,35 +64,23 @@ TEST(EtchValidatorDoubleTest, validateTe
EXPECT_TRUE(ptr->validate(doubleTmp2));
EXPECT_TRUE(ptr->validate(doubleTmp3));
EXPECT_TRUE(ptr->validate(doubleTmp4_true));
-
- delete doubleTmp;
- delete doubleTmp1;
- delete doubleTmp2;
- delete doubleTmp3;
- delete doubleTmp4_true;
-
- delete str;
}
TEST(EtchValidatorDoubleTest, validateValueTest) {
- EtchObject* byte = NULL;
- EtchObject* result;
- EtchObject* doubleTmp = new EtchDouble(-128.12);
- EtchObject* doubleTmp2 = new EtchDouble(5.13);
- EtchObject* doubleTmp3 = new EtchDouble(127.54);
+ capu::SmartPointer<EtchObject> byte = NULL;
+ capu::SmartPointer<EtchObject> result;
+ capu::SmartPointer<EtchObject> doubleTmp = new EtchDouble(-128.12);
+ capu::SmartPointer<EtchObject> doubleTmp2 = new EtchDouble(5.13);
+ capu::SmartPointer<EtchObject> doubleTmp3 = new EtchDouble(127.54);
capu::SmartPointer<EtchValidator> ptr = NULL;
EXPECT_TRUE(EtchValidatorDouble::Get(0, ptr) == ETCH_OK);
EXPECT_TRUE(ptr->validateValue(byte, result) == ETCH_ERROR);
EXPECT_TRUE(ptr->validateValue(doubleTmp, result) == ETCH_OK);
- EXPECT_TRUE(((EtchDouble*) result)->get() == ((EtchDouble*) doubleTmp)->get());
+ EXPECT_TRUE(((EtchDouble*) result.get())->get() == ((EtchDouble*) doubleTmp.get())->get());
EXPECT_TRUE(ptr->validateValue(doubleTmp2, result) == ETCH_OK);
- EXPECT_TRUE(((EtchDouble*) result)->get() == ((EtchDouble*) doubleTmp2)->get());
+ EXPECT_TRUE(((EtchDouble*) result.get())->get() == ((EtchDouble*) doubleTmp2.get())->get());
EXPECT_TRUE(ptr->validateValue(doubleTmp3, result) == ETCH_OK);
- EXPECT_TRUE(((EtchDouble*) result)->get() == ((EtchDouble*) doubleTmp3)->get());
-
- delete doubleTmp;
- delete doubleTmp2;
- delete doubleTmp3;
+ EXPECT_TRUE(((EtchDouble*) result.get())->get() == ((EtchDouble*) doubleTmp3.get())->get());
}
TEST(EtchValidatorDoubleTest, elementValidatorTest) {
@@ -101,15 +89,15 @@ TEST(EtchValidatorDoubleTest, elementVal
capu::SmartPointer<EtchValidator> elementValidator;
ptr->getElementValidator(elementValidator);
- EtchObject* doubleTmp = new EtchDouble(capu::NumericLimitMax<capu::float_t>());
- EtchObject* doubleTmp1 = new EtchDouble(0);
- EtchObject* doubleTmp2 = new EtchDouble(capu::NumericLimitMin<capu::float_t>());
- EtchObject* doubleTmp3 = new EtchDouble(897.12);
+ capu::SmartPointer<EtchObject> doubleTmp = new EtchDouble(capu::NumericLimitMax<capu::float_t>());
+ capu::SmartPointer<EtchObject> doubleTmp1 = new EtchDouble(0);
+ capu::SmartPointer<EtchObject> doubleTmp2 = new EtchDouble(capu::NumericLimitMin<capu::float_t>());
+ capu::SmartPointer<EtchObject> doubleTmp3 = new EtchDouble(897.12);
//exceed limits of Float
- EtchObject* doubleTmp4_true = new EtchDouble((capu::double_t)capu::NumericLimitMax<capu::float_t>() + (capu::double_t)2.12);
+ capu::SmartPointer<EtchObject> doubleTmp4_true = new EtchDouble((capu::double_t)capu::NumericLimitMax<capu::float_t>() + (capu::double_t)2.12);
//incompatible type
- EtchObject* str = new EtchString();
+ capu::SmartPointer<EtchObject> str = new EtchString();
EXPECT_FALSE(elementValidator->validate(str));
EXPECT_TRUE(elementValidator->validate(doubleTmp4_true));
@@ -117,14 +105,6 @@ TEST(EtchValidatorDoubleTest, elementVal
EXPECT_TRUE(elementValidator->validate(doubleTmp1));
EXPECT_TRUE(elementValidator->validate(doubleTmp2));
EXPECT_TRUE(elementValidator->validate(doubleTmp3));
-
- delete doubleTmp;
- delete doubleTmp1;
- delete doubleTmp2;
- delete doubleTmp3;
- delete doubleTmp4_true;
-
- delete str;
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp Fri Jun 1 13:06:15 2012
@@ -42,15 +42,15 @@ TEST(EtchValidatorFloatTest, createTest)
}
TEST(EtchValidatorFloatTest, validateTest) {
- EtchObject* byte = NULL;
+ capu::SmartPointer<EtchObject> byte = NULL;
- EtchObject* floatTmp = new EtchFloat(capu::NumericLimitMin<capu::float_t>());
- EtchObject* floatTmp1 = new EtchFloat(0);
- EtchObject* floatTmp2 = new EtchFloat(capu::NumericLimitMax<capu::float_t>());
- EtchObject* floatTmp3 = new EtchFloat(897.12);
+ capu::SmartPointer<EtchObject> floatTmp = new EtchFloat(capu::NumericLimitMin<capu::float_t>());
+ capu::SmartPointer<EtchObject> floatTmp1 = new EtchFloat(0);
+ capu::SmartPointer<EtchObject> floatTmp2 = new EtchFloat(capu::NumericLimitMax<capu::float_t>());
+ capu::SmartPointer<EtchObject> floatTmp3 = new EtchFloat(897.12);
//incompatible type
- EtchObject* str = new EtchString();
+ capu::SmartPointer<EtchObject> str = new EtchString();
capu::SmartPointer<EtchValidator> ptr = NULL;
EXPECT_TRUE(EtchValidatorFloat::Get(0, ptr) == ETCH_OK);
@@ -63,32 +63,23 @@ TEST(EtchValidatorFloatTest, validateTes
EXPECT_TRUE(ptr->validate(floatTmp1));
EXPECT_TRUE(ptr->validate(floatTmp2));
EXPECT_TRUE(ptr->validate(floatTmp3));
-
- delete floatTmp;
- delete floatTmp1;
- delete floatTmp2;
- delete floatTmp3;
- delete str;
}
TEST(EtchValidatorFloatTest, validateValueTest) {
- EtchObject* byte = NULL;
- EtchObject* result;
- EtchObject* floatTmp = new EtchFloat(-128.12);
- EtchObject* floatTmp2 = new EtchFloat(5.13);
- EtchObject* floatTmp3 = new EtchFloat(127.54);
+ capu::SmartPointer<EtchObject> byte = NULL;
+ capu::SmartPointer<EtchObject> result;
+ capu::SmartPointer<EtchObject> floatTmp = new EtchFloat(-128.12);
+ capu::SmartPointer<EtchObject> floatTmp2 = new EtchFloat(5.13);
+ capu::SmartPointer<EtchObject> floatTmp3 = new EtchFloat(127.54);
capu::SmartPointer<EtchValidator> ptr = NULL;
EXPECT_TRUE(EtchValidatorFloat::Get(0, ptr) == ETCH_OK);
EXPECT_TRUE(ptr->validateValue(byte, result) == ETCH_ERROR);
EXPECT_TRUE(ptr->validateValue(floatTmp, result) == ETCH_OK);
- EXPECT_TRUE(((EtchFloat*) result)->get() == ((EtchFloat*) floatTmp)->get());
+ EXPECT_TRUE(((EtchFloat*) result.get())->get() == ((EtchFloat*) floatTmp.get())->get());
EXPECT_TRUE(ptr->validateValue(floatTmp2, result) == ETCH_OK);
- EXPECT_TRUE(((EtchFloat*) result)->get() == ((EtchFloat*) floatTmp2)->get());
+ EXPECT_TRUE(((EtchFloat*) result.get())->get() == ((EtchFloat*) floatTmp2.get())->get());
EXPECT_TRUE(ptr->validateValue(floatTmp3, result) == ETCH_OK);
- EXPECT_TRUE(((EtchFloat*) result)->get() == ((EtchFloat*) floatTmp3)->get());
- delete floatTmp;
- delete floatTmp2;
- delete floatTmp3;
+ EXPECT_TRUE(((EtchFloat*) result.get())->get() == ((EtchFloat*) floatTmp3.get())->get());
}
TEST(EtchValidatorFloatTest, elementValidatorTest) {
@@ -97,26 +88,19 @@ TEST(EtchValidatorFloatTest, elementVali
capu::SmartPointer<EtchValidator> elementValidator;
ptr->getElementValidator(elementValidator);
- EtchObject* floatTmp = new EtchFloat(capu::NumericLimitMin<capu::float_t>());
- EtchObject* floatTmp1 = new EtchFloat(0);
- EtchObject* floatTmp2 = new EtchFloat(capu::NumericLimitMax<capu::float_t>());
- EtchObject* floatTmp3 = new EtchFloat(897.12);
+ capu::SmartPointer<EtchObject> floatTmp = new EtchFloat(capu::NumericLimitMin<capu::float_t>());
+ capu::SmartPointer<EtchObject> floatTmp1 = new EtchFloat(0);
+ capu::SmartPointer<EtchObject> floatTmp2 = new EtchFloat(capu::NumericLimitMax<capu::float_t>());
+ capu::SmartPointer<EtchObject> floatTmp3 = new EtchFloat(897.12);
//incompatible type
- EtchObject* str = new EtchString();
+ capu::SmartPointer<EtchObject> str = new EtchString();
EXPECT_FALSE(elementValidator->validate(str));
EXPECT_TRUE(elementValidator->validate(floatTmp));
EXPECT_TRUE(elementValidator->validate(floatTmp1));
EXPECT_TRUE(elementValidator->validate(floatTmp2));
EXPECT_TRUE(elementValidator->validate(floatTmp3));
-
- delete floatTmp;
- delete floatTmp1;
- delete floatTmp2;
- delete floatTmp3;
-
- delete str;
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp?rev=1345149&r1=1345148&r2=1345149&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp Fri Jun 1 13:06:15 2012
@@ -39,32 +39,32 @@ TEST(EtchValidatorIntTest, createTest) {
}
TEST(EtchValidatorIntTest, validateTest) {
- EtchObject* byte = NULL;
+ capu::SmartPointer<EtchObject> byte = NULL;
- EtchObject* integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
- EtchObject* integer2 = new EtchInt32(0);
- EtchObject* integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
- EtchObject* integer4 = new EtchInt32(897);
-
- EtchObject* longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
- EtchObject* longInteger2 = new EtchLong(0);
- EtchObject* longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
- EtchObject* longInteger4 = new EtchLong(897);
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
+
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- EtchObject* longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int32_t>() + (capu::int64_t)2);
+ capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int32_t>() + (capu::int64_t)2);
- EtchObject* shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
- EtchObject* shortInteger2 = new EtchShort(0);
- EtchObject* shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
- EtchObject* shortInteger4 = new EtchShort();
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
- EtchObject* str = new EtchString();
+ capu::SmartPointer<EtchObject> str = new EtchString();
- EtchObject* byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
- EtchObject* byte2 = new EtchByte(0);
- EtchObject* byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
- EtchObject* byte4 = new EtchByte(32);
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
capu::SmartPointer<EtchValidator> ptr = NULL;
EXPECT_TRUE(EtchValidatorInt::Get(0, ptr) == ETCH_OK);
@@ -88,58 +88,29 @@ TEST(EtchValidatorIntTest, validateTest)
EXPECT_TRUE(ptr->validate(integer4));
EXPECT_TRUE(ptr->validate(longInteger4));
EXPECT_TRUE(ptr->validate(shortInteger4));
-
- delete integer;
- delete integer2;
- delete integer3;
- delete integer4;
-
- delete longInteger;
- delete longInteger2;
- delete longInteger3;
- delete longInteger4;
- delete longInteger5;
-
- delete shortInteger;
- delete shortInteger2;
- delete shortInteger3;
- delete shortInteger4;
-
- delete str;
- delete byte1;
- delete byte2;
- delete byte3;
- delete byte4;
-
}
TEST(EtchValidatorIntTest, validateValueTest) {
- EtchObject* byte = NULL;
- EtchObject* result;
- EtchObject* integer = new EtchInt32(-128);
- EtchObject* integer2 = new EtchInt32(5);
- EtchObject* integer3 = new EtchInt32(127);
- EtchObject* byte2 = new EtchByte(3);
+ capu::SmartPointer<EtchObject> byte = NULL;
+ capu::SmartPointer<EtchObject> result;
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(-128);
+ capu::SmartPointer<EtchObject> integer2 = new EtchInt32(5);
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(127);
+ capu::SmartPointer<EtchObject> byte2 = new EtchByte(3);
capu::SmartPointer<EtchValidator> ptr = NULL;
EXPECT_TRUE(EtchValidatorInt::Get(0, ptr) == ETCH_OK);
EXPECT_TRUE(ptr->validateValue(byte, result) == ETCH_ERROR);
EXPECT_TRUE(ptr->validateValue(integer, result) == ETCH_OK);
- EXPECT_TRUE(((EtchInt32*) result)->get() == ((EtchInt32*) integer)->get());
-// delete result;
+ EXPECT_TRUE(((EtchInt32*) result.get())->get() == ((EtchInt32*) integer.get())->get());
+
EXPECT_TRUE(ptr->validateValue(integer2, result) == ETCH_OK);
- EXPECT_TRUE(((EtchInt32*) result)->get() == ((EtchInt32*) integer2)->get());
-// delete result;
+ EXPECT_TRUE(((EtchInt32*) result.get())->get() == ((EtchInt32*) integer2.get())->get());
+
EXPECT_TRUE(ptr->validateValue(integer3, result) == ETCH_OK);
- EXPECT_TRUE(((EtchInt32*) result)->get() == ((EtchInt32*) integer3)->get());
-// delete result;
- EXPECT_TRUE(ptr->validateValue(byte2, result) == ETCH_OK);
- EXPECT_TRUE(((EtchInt32*) result)->get() == ((EtchByte*) byte2)->get());
- delete result;
- delete integer;
- delete integer2;
- delete integer3;
- delete byte2;
+ EXPECT_TRUE(((EtchInt32*) result.get())->get() == ((EtchInt32*) integer3.get())->get());
+ EXPECT_TRUE(ptr->validateValue(byte2, result) == ETCH_OK);
+ EXPECT_TRUE(((EtchInt32*) result.get())->get() == ((EtchByte*) byte2.get())->get());
}
TEST(EtchValidatorIntTest, elementValidatorTest) {
@@ -148,30 +119,30 @@ TEST(EtchValidatorIntTest, elementValida
capu::SmartPointer<EtchValidator> elementValidator;
ptr->getElementValidator(elementValidator);
- EtchObject* integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
- EtchObject* integer2 = new EtchInt32(0);
- EtchObject* integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
- EtchObject* integer4 = new EtchInt32(897);
-
- EtchObject* longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
- EtchObject* longInteger2 = new EtchLong(0);
- EtchObject* longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
- EtchObject* longInteger4 = new EtchLong(897);
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
+
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- EtchObject* longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int32_t>() + (capu::int64_t)2);
+ capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int32_t>() + (capu::int64_t)2);
- EtchObject* shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
- EtchObject* shortInteger2 = new EtchShort(0);
- EtchObject* shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
- EtchObject* shortInteger4 = new EtchShort();
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
- EtchObject* str = new EtchString();
+ capu::SmartPointer<EtchObject> str = new EtchString();
- EtchObject* byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
- EtchObject* byte2 = new EtchByte(0);
- EtchObject* byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
- EtchObject* byte4 = new EtchByte(32);
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
EXPECT_FALSE(elementValidator->validate(str));
EXPECT_FALSE(elementValidator->validate(longInteger5));
@@ -191,28 +162,6 @@ TEST(EtchValidatorIntTest, elementValida
EXPECT_TRUE(elementValidator->validate(integer4));
EXPECT_TRUE(elementValidator->validate(longInteger4));
EXPECT_TRUE(elementValidator->validate(shortInteger4));
-
- delete integer;
- delete integer2;
- delete integer3;
- delete integer4;
-
- delete longInteger;
- delete longInteger2;
- delete longInteger3;
- delete longInteger4;
- delete longInteger5;
-
- delete shortInteger;
- delete shortInteger2;
- delete shortInteger3;
- delete shortInteger4;
-
- delete str;
- delete byte1;
- delete byte2;
- delete byte3;
- delete byte4;
}