etch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vei...@apache.org
Subject svn commit: r1679584 - in /etch/trunk/binding-cpp/runtime: include/serialization/ src/main/serialization/
Date Fri, 15 May 2015 15:04:13 GMT
Author: veithm
Date: Fri May 15 15:04:12 2015
New Revision: 1679584

URL: http://svn.apache.org/r1679584
Log:
Replace validators code duplications with macro

The code implementing the functionality of caching validators
and getting them was duplicated all over the validator classes.
These duplications are now replaced by a respective macro defined
in the validators base class.

Change-Id: I3d44811b75159b48769a65f37e14c6ea99f434d0

Modified:
    etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h
    etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorByte.h
    etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h
    etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h
    etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorInt.h
    etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorLong.h
    etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorNone.h
    etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorObject.h
    etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h
    etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h
    etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorString.h
    etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp
    etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
    etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp
    etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp
    etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
    etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp
    etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorNone.cpp
    etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp
    etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp
    etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
    etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h Fri May 15
15:04:12 2015
@@ -58,17 +58,14 @@ public:
    */
   virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>&
result);
 
-  /**
-   * @see EtchValidator
-   */
-  static status_t Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val);
+  VALIDATOR_GET_DEF()
 
 protected:
   EtchValidatorBoolean(EtchRuntime* runtime, capu::uint32_t ndim);
 
 private:
   EtchRuntime* mRuntime;
-  static capu::SmartPointer<EtchValidator>* Validators(EtchRuntime* runtime);
+  VALIDATOR_CACHE_DEF()
 };
 
 

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorByte.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorByte.h?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorByte.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorByte.h Fri May 15 15:04:12
2015
@@ -62,17 +62,14 @@ public:
    */
   virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>&
result);
 
-  /**
-   * @see EtchValidator
-   */
-  static status_t Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val);
+  VALIDATOR_GET_DEF()
 
 protected:
   EtchValidatorByte(EtchRuntime* runtime, capu::uint32_t ndim);
 
 private:
   EtchRuntime* mRuntime;
-  static capu::SmartPointer<EtchValidator>* Validators(EtchRuntime* runtime);
+  VALIDATOR_CACHE_DEF()
   
 };
 

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h Fri May 15
15:04:12 2015
@@ -60,17 +60,14 @@ public:
    */
   virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>&
result);
 
-  /**
-   * @see EtchValidator
-   */
-  static status_t Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val);
+  VALIDATOR_GET_DEF()
 
 protected:
   EtchValidatorDouble(EtchRuntime* runtime, capu::uint32_t ndim);
 
 private:
   EtchRuntime* mRuntime;
-  static capu::SmartPointer<EtchValidator>* Validators(EtchRuntime* runtime);
+  VALIDATOR_CACHE_DEF()
 
 };
 

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h Fri May 15 15:04:12
2015
@@ -59,17 +59,14 @@ public:
    */
   virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>&
result);
 
-  /**
-   * @see EtchValidator
-   */
-  static status_t Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val);
+  VALIDATOR_GET_DEF()
 
 protected:
   EtchValidatorFloat(EtchRuntime* runtime, capu::uint32_t ndim);
 
 private:
   EtchRuntime* mRuntime;
-  static capu::SmartPointer<EtchValidator>* Validators(EtchRuntime* runtime);
+  VALIDATOR_CACHE_DEF()
 
 };
 

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorInt.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorInt.h?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorInt.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorInt.h Fri May 15 15:04:12
2015
@@ -63,19 +63,14 @@ public:
    */
   virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>&
result);
 
-  /**
-   * @see EtchValidator
-   */
-  static status_t Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val);
-
-
+  VALIDATOR_GET_DEF()
 
 protected:
   EtchValidatorInt(EtchRuntime* runtime, capu::uint32_t ndim);
 
 private:
   EtchRuntime* mRuntime;
-  static capu::SmartPointer<EtchValidator>* Validators(EtchRuntime* runtime);
+  VALIDATOR_CACHE_DEF()
 
 };
 

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorLong.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorLong.h?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorLong.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorLong.h Fri May 15 15:04:12
2015
@@ -61,17 +61,14 @@ public:
    */
   virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>&
result);
 
-  /**
-   * @see EtchValidator
-   */
-  static status_t Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val);
+  VALIDATOR_GET_DEF()
 
 protected:
   EtchValidatorLong(EtchRuntime* runtime, capu::uint32_t ndim);
 
 private:
   EtchRuntime* mRuntime;
-  static capu::SmartPointer<EtchValidator>* Validators(EtchRuntime* runtime);
+  VALIDATOR_CACHE_DEF()
 
 };
 

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorNone.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorNone.h?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorNone.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorNone.h Fri May 15 15:04:12
2015
@@ -63,7 +63,7 @@ protected:
 
 private:
   EtchRuntime* mRuntime;
-  static capu::SmartPointer<EtchValidator>* Validators(EtchRuntime* runtime);
+  VALIDATOR_CACHE_DEF()
 
 };
 

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorObject.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorObject.h?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorObject.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorObject.h Fri May 15
15:04:12 2015
@@ -57,17 +57,14 @@ public:
    */
   virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>&
result);
 
-  /**
-   * @see EtchValidator
-   */
-  static status_t Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val);
+  VALIDATOR_GET_DEF()
 
 protected:
   EtchValidatorObject(EtchRuntime* runtime, capu::uint32_t ndim);
 
 private:
   EtchRuntime* mRuntime;
-  static capu::SmartPointer<EtchValidator>* Validators(EtchRuntime* runtime);
+  VALIDATOR_CACHE_DEF()
 
 };
 

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h Fri
May 15 15:04:12 2015
@@ -66,7 +66,7 @@ protected:
 
 private:
   EtchRuntime* mRuntime;
-  static capu::SmartPointer<EtchValidator>* Validators(EtchRuntime* runtime);
+  VALIDATOR_CACHE_DEF()
 };
 
 #endif

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorShort.h Fri May 15 15:04:12
2015
@@ -62,10 +62,7 @@ public:
    */
   virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>&
result);
 
-  /**
-   * @see EtchValidator
-   */
-  static status_t Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val);
+  VALIDATOR_GET_DEF()
 
 protected:
 
@@ -73,7 +70,7 @@ protected:
 
 private:
   EtchRuntime* mRuntime;
-  static capu::SmartPointer<EtchValidator>* Validators(EtchRuntime* runtime);
+  VALIDATOR_CACHE_DEF()
 
 };
 

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorString.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorString.h?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorString.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchValidatorString.h Fri May 15
15:04:12 2015
@@ -58,17 +58,14 @@ public:
    */
   virtual status_t validateValue(capu::SmartPointer<EtchObject> value, capu::SmartPointer<EtchObject>&
result);
 
-  /**
-   * @see EtchValidator
-   */
-  static status_t Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val);
+  VALIDATOR_GET_DEF()
 
 protected:
   EtchValidatorString(EtchRuntime* runtime, capu::uint32_t ndim);
 
 private:
   EtchRuntime* mRuntime;
-  static capu::SmartPointer<EtchValidator>* Validators(EtchRuntime* runtime);
+  VALIDATOR_CACHE_DEF()
 
 };
 

Modified: etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp Fri May
15 15:04:12 2015
@@ -19,10 +19,7 @@
 #include "serialization/EtchValidatorBoolean.h"
 #include "support/EtchRuntime.h"
 
-capu::SmartPointer<EtchValidator>* EtchValidatorBoolean::Validators(EtchRuntime* runtime)
{
-  static EtchValidatorCaches validators;
-  return validators.get(runtime);
-}
+VALIDATOR_CACHE_IMPL(EtchValidatorBoolean)
 
 const EtchObjectType* EtchValidatorBoolean::TYPE() {
   const static EtchObjectType TYPE(EOTID_VALIDATOR_BOOLEAN, NULL);
@@ -76,23 +73,9 @@ status_t EtchValidatorBoolean::validateV
   }
 }
 
-status_t EtchValidatorBoolean::Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val) {
-  if (ndim > MAX_NDIMS) {
-    return ETCH_EINVAL;
-  }
-  if (ndim >= MAX_CACHED) {
-    val = new EtchValidatorBoolean(runtime, ndim);
-    return ETCH_OK;
-  }
-  if (Validators(runtime)[ndim].get() == NULL) {
-    Validators(runtime)[ndim] = new EtchValidatorBoolean(runtime, ndim);
-    ETCH_LOG_TRACE(runtime->getLogger(), runtime->getLogger().getValidatorContext(),
"EtchValidatorBoolean has been created");
-  }
-  val = Validators(runtime)[ndim];
-  return ETCH_OK;
-}
-
 status_t EtchValidatorBoolean::getElementValidator(capu::SmartPointer<EtchValidator>
&val) {
   return EtchValidatorBoolean::Get(mRuntime, mNDims - 1, val);
 }
 
+VALIDATOR_GET_IMPL(EtchValidatorBoolean)
+

Modified: etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp Fri May 15
15:04:12 2015
@@ -19,10 +19,7 @@
 #include "serialization/EtchValidatorByte.h"
 #include "support/EtchRuntime.h"
 
-capu::SmartPointer<EtchValidator>* EtchValidatorByte::Validators(EtchRuntime* runtime)
{
-  static EtchValidatorCaches validators;
-  return validators.get(runtime);
-}
+VALIDATOR_CACHE_IMPL(EtchValidatorByte)
 
 const EtchObjectType* EtchValidatorByte::TYPE() {
   const static EtchObjectType TYPE(EOTID_VALIDATOR_BYTE, NULL);
@@ -120,23 +117,8 @@ status_t EtchValidatorByte::validateValu
   }
 }
 
-status_t EtchValidatorByte::Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val) {
-  if (ndim > MAX_NDIMS) {
-    return ETCH_EINVAL;
-  }
-  if (ndim >= MAX_CACHED) {
-    val = new EtchValidatorByte(runtime, ndim);
-    return ETCH_OK;
-  }
-  if (Validators(runtime)[ndim].get() == NULL) {
-    Validators(runtime)[ndim] = new EtchValidatorByte(runtime, ndim);
-    ETCH_LOG_TRACE(runtime->getLogger(), runtime->getLogger().getValidatorContext(),
"EtchValidatorByte has been created");
-
-  }
-  val = Validators(runtime)[ndim];
-  return ETCH_OK;
-}
-
 status_t EtchValidatorByte::getElementValidator(capu::SmartPointer<EtchValidator> &val)
{
   return EtchValidatorByte::Get(mRuntime, mNDims - 1, val);
 }
+
+VALIDATOR_GET_IMPL(EtchValidatorByte)

Modified: etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp Fri May
15 15:04:12 2015
@@ -19,10 +19,8 @@
 #include "serialization/EtchValidatorDouble.h"
 #include "support/EtchRuntime.h"
 
-capu::SmartPointer<EtchValidator>* EtchValidatorDouble::Validators(EtchRuntime* runtime)
{
-  static EtchValidatorCaches validators;
-  return validators.get(runtime);
-}
+VALIDATOR_CACHE_IMPL(EtchValidatorDouble)
+
 const EtchObjectType* EtchValidatorDouble::TYPE() {
   const static EtchObjectType TYPE(EOTID_VALIDATOR_DOUBLE, NULL);
   return &TYPE;
@@ -74,22 +72,8 @@ status_t EtchValidatorDouble::validateVa
   }
 }
 
-status_t EtchValidatorDouble::Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val) {
-  if (ndim > MAX_NDIMS) {
-    return ETCH_EINVAL;
-  }
-  if (ndim >= MAX_CACHED) {
-    val = new EtchValidatorDouble(runtime, ndim);
-    return ETCH_OK;
-  }
-  if (Validators(runtime)[ndim].get() == NULL) {
-    Validators(runtime)[ndim] = new EtchValidatorDouble(runtime, ndim);
-    ETCH_LOG_TRACE(runtime->getLogger(), runtime->getLogger().getValidatorContext(),
"EtchValidatorDouble has been created");
-  }
-  val = Validators(runtime)[ndim];
-  return ETCH_OK;
-}
-
 status_t EtchValidatorDouble::getElementValidator(capu::SmartPointer<EtchValidator>
&val) {
   return EtchValidatorDouble::Get(mRuntime, mNDims - 1, val);
 }
+
+VALIDATOR_GET_IMPL(EtchValidatorDouble)

Modified: etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp Fri May 15
15:04:12 2015
@@ -19,10 +19,7 @@
 #include "serialization/EtchValidatorFloat.h"
 #include "support/EtchRuntime.h"
 
-capu::SmartPointer<EtchValidator>* EtchValidatorFloat::Validators(EtchRuntime* runtime)
{
-  static EtchValidatorCaches validators;
-  return validators.get(runtime);
-}
+VALIDATOR_CACHE_IMPL(EtchValidatorFloat)
 
 const EtchObjectType* EtchValidatorFloat::TYPE() {
   const static EtchObjectType TYPE(EOTID_VALIDATOR_FLOAT, NULL);
@@ -74,22 +71,8 @@ status_t EtchValidatorFloat::validateVal
   }
 }
 
-status_t EtchValidatorFloat::Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val) {
-  if (ndim > MAX_NDIMS) {
-    return ETCH_EINVAL;
-  }
-  if (ndim >= MAX_CACHED) {
-    val = new EtchValidatorFloat(runtime, ndim);
-    return ETCH_OK;
-  }
-  if (Validators(runtime)[ndim].get() == NULL) {
-    Validators(runtime)[ndim] = new EtchValidatorFloat(runtime, ndim);
-    ETCH_LOG_TRACE(runtime->getLogger(), runtime->getLogger().getValidatorContext(),
"EtchValidatorFloat has been created");
-  }
-  val = Validators(runtime)[ndim];
-  return ETCH_OK;
-}
-
 status_t EtchValidatorFloat::getElementValidator(capu::SmartPointer<EtchValidator>
&val) {
   return EtchValidatorFloat::Get(mRuntime, mNDims - 1, val);
 }
+
+VALIDATOR_GET_IMPL(EtchValidatorFloat)

Modified: etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp Fri May 15
15:04:12 2015
@@ -19,10 +19,7 @@
 #include "serialization/EtchValidatorInt.h"
 #include "support/EtchRuntime.h"
 
-capu::SmartPointer<EtchValidator>* EtchValidatorInt::Validators(EtchRuntime* runtime)
{
-  static EtchValidatorCaches validators;
-  return validators.get(runtime);
-}
+VALIDATOR_CACHE_IMPL(EtchValidatorInt)
 
 const EtchObjectType* EtchValidatorInt::TYPE() {
   const static EtchObjectType TYPE(EOTID_VALIDATOR_INT, NULL);
@@ -112,22 +109,8 @@ status_t EtchValidatorInt::validateValue
   }
 }
 
-status_t EtchValidatorInt::Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val) {
-  if (ndim > MAX_NDIMS) {
-    return ETCH_EINVAL;
-  }
-  if (ndim >= MAX_CACHED) {
-    val = new EtchValidatorInt(runtime, ndim);
-    return ETCH_OK;
-  }
-  if (Validators(runtime)[ndim].get() == NULL) {
-    Validators(runtime)[ndim] = new EtchValidatorInt(runtime, ndim);
-    ETCH_LOG_TRACE(runtime->getLogger(), runtime->getLogger().getValidatorContext(),
"EtchValidatorInt has been created");
-  }
-  val = Validators(runtime)[ndim];
-  return ETCH_OK;
-}
-
 status_t EtchValidatorInt::getElementValidator(capu::SmartPointer<EtchValidator> &val)
{
   return EtchValidatorInt::Get(mRuntime, mNDims - 1, val);
 }
+
+VALIDATOR_GET_IMPL(EtchValidatorInt)

Modified: etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp Fri May 15
15:04:12 2015
@@ -19,10 +19,7 @@
 #include "serialization/EtchValidatorLong.h"
 #include "support/EtchRuntime.h"
 
-capu::SmartPointer<EtchValidator>* EtchValidatorLong::Validators(EtchRuntime* runtime)
{
-  static EtchValidatorCaches validators;
-  return validators.get(runtime);
-}
+VALIDATOR_CACHE_IMPL(EtchValidatorLong)
 
 const EtchObjectType* EtchValidatorLong::TYPE() {
   const static EtchObjectType TYPE(EOTID_VALIDATOR_LONG, NULL);
@@ -105,22 +102,8 @@ status_t EtchValidatorLong::validateValu
   }
 }
 
-status_t EtchValidatorLong::Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val) {
-  if (ndim > MAX_NDIMS) {
-    return ETCH_EINVAL;
-  }
-  if (ndim >= MAX_CACHED) {
-    val = new EtchValidatorLong(runtime, ndim);
-    return ETCH_OK;
-  }
-  if (Validators(runtime)[ndim].get() == NULL) {
-    Validators(runtime)[ndim] = new EtchValidatorLong(runtime, ndim);
-    ETCH_LOG_TRACE(runtime->getLogger(), runtime->getLogger().getValidatorContext(),
"EtchValidatorLong has been created");
-  }
-  val = Validators(runtime)[ndim];
-  return ETCH_OK;
-}
-
 status_t EtchValidatorLong::getElementValidator(capu::SmartPointer<EtchValidator> &val)
{
   return EtchValidatorLong::Get(mRuntime, mNDims - 1, val);
 }
+
+VALIDATOR_GET_IMPL(EtchValidatorLong)

Modified: etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorNone.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorNone.cpp?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorNone.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorNone.cpp Fri May 15
15:04:12 2015
@@ -19,10 +19,7 @@
 #include "serialization/EtchValidatorNone.h"
 #include "support/EtchRuntime.h"
 
-capu::SmartPointer<EtchValidator>* EtchValidatorNone::Validators(EtchRuntime* runtime)
{
-  static EtchValidatorCaches validators;
-  return validators.get(runtime);
-}
+VALIDATOR_CACHE_IMPL(EtchValidatorNone)
 
 const EtchObjectType* EtchValidatorNone::TYPE() {
   static const EtchObjectType TYPE(EOTID_VALIDATOR_NONE, NULL);
@@ -59,6 +56,7 @@ status_t EtchValidatorNone::validateValu
 status_t EtchValidatorNone::Get(EtchRuntime* runtime, capu::SmartPointer<EtchValidator>
&val) {
   if (Validators(runtime)[0].get() == NULL) {
     Validators(runtime)[0] = new EtchValidatorNone(runtime);
+    runtime->registerListener(&SRuntimeChangedListener);
     ETCH_LOG_TRACE(runtime->getLogger(), runtime->getLogger().getValidatorContext(),
"EtchValidatorNone has been created");
   }
   val = Validators(runtime)[0];

Modified: etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp Fri May
15 15:04:12 2015
@@ -19,10 +19,7 @@
 #include "serialization/EtchValidatorObject.h"
 #include "support/EtchRuntime.h"
 
-capu::SmartPointer<EtchValidator>* EtchValidatorObject::Validators(EtchRuntime* runtime)
{
-  static EtchValidatorCaches validators;
-  return validators.get(runtime);
-}
+VALIDATOR_CACHE_IMPL(EtchValidatorObject)
 
 const EtchObjectType* EtchValidatorObject::TYPE() {
   const static EtchObjectType TYPE(EOTID_VALIDATOR_OBJECT, NULL);
@@ -63,22 +60,6 @@ status_t EtchValidatorObject::validateVa
   }
 }
 
-status_t EtchValidatorObject::Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val) {
-  if (ndim > MAX_NDIMS)
-    return ETCH_EINVAL;
-  if (ndim >= MAX_CACHED) {
-    val = new EtchValidatorObject(runtime, ndim);
-    return ETCH_OK;
-  }
-  //TODO thread safety
-  if (Validators(runtime)[ndim].get() == NULL) {
-    ETCH_LOG_TRACE(runtime->getLogger(), runtime->getLogger().getValidatorContext(),
"EtchValidatorObject has been created");
-    Validators(runtime)[ndim] = new EtchValidatorObject(runtime, ndim);
-  }
-  val = Validators(runtime)[ndim];
-  return ETCH_OK;
-}
-
 status_t EtchValidatorObject::getElementValidator(capu::SmartPointer<EtchValidator>
&val) {
   if (mNDims > 0) {
     return EtchValidatorObject::Get(mRuntime, mNDims - 1, val);
@@ -86,3 +67,8 @@ status_t EtchValidatorObject::getElement
     return EtchValidatorObject::Get(mRuntime, 0, val);
   }
 }
+
+VALIDATOR_GET_IMPL(EtchValidatorObject)
+
+
+

Modified: etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp
(original)
+++ etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp
Fri May 15 15:04:12 2015
@@ -19,10 +19,7 @@
 #include "serialization/EtchValidatorRuntimeException.h"
 #include "support/EtchRuntime.h"
 
-capu::SmartPointer<EtchValidator>* EtchValidatorRuntimeException::Validators(EtchRuntime*
runtime) {
-  static EtchValidatorCaches validators;
-  return validators.get(runtime);
-}
+VALIDATOR_CACHE_IMPL(EtchValidatorRuntimeException)
 
 const EtchObjectType* EtchValidatorRuntimeException::TYPE() {
   const static EtchObjectType TYPE(EOTID_VALIDATOR_RUNTIME_EXCEPTION, NULL);
@@ -61,6 +58,7 @@ status_t EtchValidatorRuntimeException::
 status_t EtchValidatorRuntimeException::Get(EtchRuntime* runtime, capu::SmartPointer<EtchValidator>
&val) {
   if (Validators(runtime)[0].get() == NULL) {
     Validators(runtime)[0] = new EtchValidatorRuntimeException(runtime);
+    runtime->registerListener(&SRuntimeChangedListener);
     ETCH_LOG_TRACE(runtime->getLogger(), runtime->getLogger().getValidatorContext(),"EtchValidatorRuntimeException
has been created");
   }
   val = Validators(runtime)[0];

Modified: etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp Fri May 15
15:04:12 2015
@@ -19,10 +19,7 @@
 #include "serialization/EtchValidatorShort.h"
 #include "support/EtchRuntime.h"
 
-capu::SmartPointer<EtchValidator>* EtchValidatorShort::Validators(EtchRuntime* runtime)
{
-  static EtchValidatorCaches validators;
-  return validators.get(runtime);
-}
+VALIDATOR_CACHE_IMPL(EtchValidatorShort)
 
 const EtchObjectType* EtchValidatorShort::TYPE() {
   const static EtchObjectType TYPE(EOTID_VALIDATOR_SHORT, NULL);
@@ -114,22 +111,8 @@ status_t EtchValidatorShort::validateVal
   }
 }
 
-status_t EtchValidatorShort::Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val) {
-  if (ndim > MAX_NDIMS) {
-    return ETCH_EINVAL;
-  }
-  if (ndim >= MAX_CACHED) {
-    val = new EtchValidatorShort(runtime, ndim);
-    return ETCH_OK;
-  }
-  if (Validators(runtime)[ndim].get() == NULL) {
-    ETCH_LOG_TRACE(runtime->getLogger(), runtime->getLogger().getValidatorContext(),
"EtchValidatorShort has been created");
-    Validators(runtime)[ndim] = new EtchValidatorShort(runtime, ndim);
-  }
-  val = Validators(runtime)[ndim];
-  return ETCH_OK;
-}
-
 status_t EtchValidatorShort::getElementValidator(capu::SmartPointer<EtchValidator>
&val) {
   return EtchValidatorShort::Get(mRuntime, mNDims - 1, val);
 }
+
+VALIDATOR_GET_IMPL(EtchValidatorShort)

Modified: etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp?rev=1679584&r1=1679583&r2=1679584&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp Fri May
15 15:04:12 2015
@@ -19,10 +19,7 @@
 #include "serialization/EtchValidatorString.h"
 #include "support/EtchRuntime.h"
 
-capu::SmartPointer<EtchValidator>* EtchValidatorString::Validators(EtchRuntime* runtime)
{
-  static EtchValidatorCaches validators;
-  return validators.get(runtime);
-}
+VALIDATOR_CACHE_IMPL(EtchValidatorString)
 
 const EtchObjectType* EtchValidatorString::TYPE() {
   const static EtchObjectType TYPE(EOTID_VALIDATOR_STRING, NULL);
@@ -72,22 +69,8 @@ status_t EtchValidatorString::validateVa
   }
 }
 
-status_t EtchValidatorString::Get(EtchRuntime* runtime, capu::uint32_t ndim, capu::SmartPointer<EtchValidator>
&val) {
-  if (ndim > MAX_NDIMS) {
-    return ETCH_EINVAL;
-  }
-  if (ndim >= MAX_CACHED) {
-    val = new EtchValidatorString(runtime, ndim);
-    return ETCH_OK;
-  }
-  if (Validators(runtime)[ndim].get() == NULL) {
-    Validators(runtime)[ndim] = new EtchValidatorString(runtime, ndim);
-    ETCH_LOG_TRACE(runtime->getLogger(), runtime->getLogger().getValidatorContext(),
"EtchValidatorString has been created");
-  }
-  val = Validators(runtime)[ndim];
-  return ETCH_OK;
-}
-
 status_t EtchValidatorString::getElementValidator(capu::SmartPointer<EtchValidator>
&val) {
   return EtchValidatorString::Get(mRuntime, mNDims - 1, val);
 }
+
+VALIDATOR_GET_IMPL(EtchValidatorString)



Mime
View raw message