etch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vei...@apache.org
Subject svn commit: r1578862 - in /etch/trunk: binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/ binding-cpp/runtime/ binding-cpp/runtime/include/common/ binding-cpp/runtime/include/serialization/ binding-cpp/runtime/include/util/ ...
Date Tue, 18 Mar 2014 13:19:21 GMT
Author: veithm
Date: Tue Mar 18 13:19:20 2014
New Revision: 1578862

URL: http://svn.apache.org/r1578862
Log:
Updating to CAPU v0.14.0

This patch updates the dependency CAPU to version 0.14.0.
Some changes in the Etch container wrapper classes like EtchList are
needed in order to deal with the new const iterators from CAPU containers.

Change-Id: I81c8055d0628ef645a02d27d2a7c4246d779cb24

Modified:
    etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm
    etch/trunk/binding-cpp/runtime/CMakeLists.txt
    etch/trunk/binding-cpp/runtime/FindCapu.cmake
    etch/trunk/binding-cpp/runtime/include/common/EtchHashSet.h
    etch/trunk/binding-cpp/runtime/include/common/EtchHashTable.h
    etch/trunk/binding-cpp/runtime/include/common/EtchList.h
    etch/trunk/binding-cpp/runtime/include/serialization/EtchStructValue.h
    etch/trunk/binding-cpp/runtime/include/util/EtchLogger.h
    etch/trunk/binding-cpp/runtime/src/main/common/EtchObject.cpp
    etch/trunk/binding-cpp/runtime/src/test/common/EtchHashTableTest.cpp
    etch/trunk/binding-cpp/runtime/src/test/common/EtchListTest.cpp
    etch/trunk/binding-cpp/runtime/toolchains/QNX_X86_32.toolchain
    etch/trunk/examples/helloworld/cpp/CMakeLists.txt

Modified: etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm
(original)
+++ etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm
Tue Mar 18 13:19:20 2014
@@ -137,7 +137,7 @@ public:
        return ETCH_EINVAL;
 
      // there should only be a single key, so take the first one
-     EtchHashTable<EtchField, capu::SmartPointer<EtchObject> >::Iterator it =
value->begin();
+     EtchHashTable<EtchField, capu::SmartPointer<EtchObject> >::ConstIterator
it = value->begin();
      EtchHashTable<EtchField, capu::SmartPointer<EtchObject> >::HashTableEntry
entry;
      it.next(&entry);
      EtchField key = entry.key;

Modified: etch/trunk/binding-cpp/runtime/CMakeLists.txt
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/CMakeLists.txt?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/CMakeLists.txt (original)
+++ etch/trunk/binding-cpp/runtime/CMakeLists.txt Tue Mar 18 13:19:20 2014
@@ -50,6 +50,8 @@ SET(GMOCK ${ETCH_EXTERNAL_DEPENDS}/gmock
 #Build external CAPU project (OS Abstraction)
 set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
 find_package(Capu)
+
+include (${CMAKE_TOOLCHAIN_FILE})
 
 # Set definitions
 IF (TARGET_OS STREQUAL "Linux")

Modified: etch/trunk/binding-cpp/runtime/FindCapu.cmake
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/FindCapu.cmake?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/FindCapu.cmake (original)
+++ etch/trunk/binding-cpp/runtime/FindCapu.cmake Tue Mar 18 13:19:20 2014
@@ -38,7 +38,7 @@ IF ("${CAPU_INCLUDE_DIR}" STREQUAL "" AN
         
         ExternalProject_Add(
             Capu
-            URL https://github.com/bmwcarit/capu/archive/v0.13.0.zip
+            URL https://github.com/bmwcarit/capu/zipball/master/bmwcarit-capu-v0.13.0-34-g0ca0967.zip
             SOURCE_DIR "${CAPU_PROJECT_DIR}"
             BINARY_DIR "${CAPU_CMAKE_BUILD_DIR}"
             INSTALL_DIR "${CAPU_PROJECT_DIR}/deliverable"

Modified: etch/trunk/binding-cpp/runtime/include/common/EtchHashSet.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/common/EtchHashSet.h?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/common/EtchHashSet.h (original)
+++ etch/trunk/binding-cpp/runtime/include/common/EtchHashSet.h Tue Mar 18 13:19:20 2014
@@ -56,13 +56,49 @@ public:
     /**
       * Constructor
       */
-    EtchHashSetIterator(typename capu::HashSet<T, C, H>::Iterator mBeginCapuIterator,
typename capu::HashSet<T, C, H>::Iterator mEndCapuIterator);
+    EtchHashSetIterator(typename capu::HashSet<T, C, H>::Iterator beginCapuIterator,
typename capu::HashSet<T, C, H>::Iterator endCapuIterator);
     typename capu::HashSet<T, C, H>::Iterator mBeginCapuIterator;
     typename capu::HashSet<T, C, H>::Iterator mEndCapuIterator;
       
 
   };
+
+  class EtchHashSetConstIterator {
+  public:
+      friend class EtchHashSet;
+
+      /**
+      * destructor
+      */
+      ~EtchHashSetConstIterator();
+
+      /**
+      * Check if iterator has next element.
+      * @return false if the next of current node that is pointed, is null otherwise true
+      */
+      capu::bool_t hasNext();
+
+      /**
+      * Shifts the iterator to the next position and returns the element if next != NULL
+      * @param element
+      * @return CAPU_OK if the next element has been gotten
+      *
+      */
+      status_t next(T *element = 0);
+
+
+  private:
+    /**
+      * Constructor
+      */
+    EtchHashSetConstIterator(typename capu::HashSet<T, C, H>::Iterator beginCapuIterator,
typename capu::HashSet<T, C, H>::Iterator endCapuIterator);
+    typename capu::HashSet<T, C, H>::ConstIterator mBeginCapuConstIterator;
+    typename capu::HashSet<T, C, H>::ConstIterator mEndCapuConstIterator;
+      
+
+  };
   typedef typename EtchHashSet<T, C, H>::EtchHashSetIterator Iterator;
+  typedef typename EtchHashSet<T, C, H>::EtchHashSetConstIterator ConstIterator;
 
   /**
    * EtchObjectType for EtchHashSet.
@@ -127,10 +163,16 @@ public:
   inline status_t clear();
 
   /**
+   * Return const iterator for iterating key value tuples.
+   * @return Iterator
+   */
+  inline ConstIterator begin() const;
+
+  /**
    * Return iterator for iterating key value tuples.
    * @return Iterator
    */
-  inline Iterator begin() const;
+  inline Iterator begin();
 
 private:
 
@@ -187,11 +229,17 @@ inline status_t EtchHashSet<T, C, H>::re
 }
 
 template <class T, class C, class H>
-inline typename EtchHashSet<T, C, H>::Iterator EtchHashSet<T, C, H>::begin()
const{
-  EtchHashSetIterator it(mHashSet.begin(),mHashSet.end());
+inline typename EtchHashSet<T, C, H>::ConstIterator EtchHashSet<T, C, H>::begin()
const{
+  EtchHashSetConstIterator it(mHashSet.begin(),mHashSet.end());
   return it;
 }
 
+template <class T, class C, class H>
+inline typename EtchHashSet<T, C, H>::Iterator EtchHashSet<T, C, H>::begin(){
+	EtchHashSetIterator it(mHashSet.begin(),mHashSet.end());
+	return it;
+}
+
 template<class T, class C, class H>
 EtchHashSet<T, C, H>::EtchHashSetIterator::EtchHashSetIterator(typename capu::HashSet<T,
C, H>::Iterator beginCapuIterator, typename capu::HashSet<T, C, H>::Iterator endCapuIterator)
:
   mBeginCapuIterator(beginCapuIterator), mEndCapuIterator(endCapuIterator) { 
@@ -199,16 +247,33 @@ EtchHashSet<T, C, H>::EtchHashSetIterato
 }
 
 template<class T, class C, class H>
+EtchHashSet<T, C, H>::EtchHashSetConstIterator::EtchHashSetConstIterator(typename capu::HashSet<T,
C, H>::Iterator beginCapuConstIterator, typename capu::HashSet<T, C, H>::Iterator
endCapuConstIterator) :
+	mBeginCapuConstIterator(beginCapuConstIterator), mEndCapuConstIterator(endCapuConstIterator)
{ 
+
+}
+
+template<class T, class C, class H>
 EtchHashSet<T, C, H>::EtchHashSetIterator::~EtchHashSetIterator() { 
 
 }
 
 template<class T, class C, class H>
+EtchHashSet<T, C, H>::EtchHashSetConstIterator::~EtchHashSetConstIterator() { 
+
+}
+
+template<class T, class C, class H>
 capu::bool_t EtchHashSet<T, C, H>::EtchHashSetIterator::hasNext() { 
   return mBeginCapuIterator != mEndCapuIterator;
 }
 
 template<class T, class C, class H>
+capu::bool_t EtchHashSet<T, C, H>::EtchHashSetConstIterator::hasNext() { 
+	return mBeginCapuConstIterator != mEndCapuConstIterator;
+}
+
+
+template<class T, class C, class H>
 status_t EtchHashSet<T, C, H>::EtchHashSetIterator::next(T *element) { 
   if (!hasNext()) {
     return ETCH_ERANGE;
@@ -222,6 +287,20 @@ status_t EtchHashSet<T, C, H>::EtchHashS
   return ETCH_OK;
 }
 
+template<class T, class C, class H>
+status_t EtchHashSet<T, C, H>::EtchHashSetConstIterator::next(T *element) { 
+	if (!hasNext()) {
+		return ETCH_ERANGE;
+	}
+
+	if (element != NULL) {
+		*element = *mBeginCapuConstIterator;
+	}
+	mBeginCapuConstIterator++;
+
+	return ETCH_OK;
+}
+
 typedef capu::SmartPointer<EtchHashSet<EtchObjectPtr> > EtchHashSetPtr;
 
 #endif /* ETCHSET_H */

Modified: etch/trunk/binding-cpp/runtime/include/common/EtchHashTable.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/common/EtchHashTable.h?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/common/EtchHashTable.h (original)
+++ etch/trunk/binding-cpp/runtime/include/common/EtchHashTable.h Tue Mar 18 13:19:20 2014
@@ -57,13 +57,49 @@ public:
     /**
       * Constructor
       */
-    EtchHashTableIterator(typename capu::HashTable<Key, T, C, H>::Iterator mBeginCapuIterator,
typename capu::HashTable<Key, T, C, H>::Iterator mEndCapuIterator);
+    EtchHashTableIterator(typename capu::HashTable<Key, T, C, H>::Iterator mBeginCapuIterator,
typename capu::HashTable<Key, T, C, H>::Iterator endCapuIterator);
     typename capu::HashTable<Key, T, C, H>::Iterator mBeginCapuIterator;
     typename capu::HashTable<Key, T, C, H>::Iterator mEndCapuIterator;
       
 
   };
+
+  class EtchHashTableConstIterator {
+  public:
+      friend class EtchHashTable;
+
+      /**
+      * destructor
+      */
+      ~EtchHashTableConstIterator();
+
+      /**
+      * Check if iterator has next element.
+      * @return false if the next of current node that is pointed, is null otherwise true
+      */
+      capu::bool_t hasNext();
+
+      /**
+      * Shifts the iterator to the next position and returns the element if next != NULL
+      * @param element
+      * @return CAPU_OK if the next element has been gotten
+      *
+      */
+      status_t next(HashTableEntry *element = 0);
+
+  private:
+    /**
+      * Constructor
+      */
+    EtchHashTableConstIterator(typename capu::HashTable<Key, T, C, H>::ConstIterator
mBeginCapuConstIterator, typename capu::HashTable<Key, T, C, H>::ConstIterator endCapuConstIterator);
+    typename capu::HashTable<Key, T, C, H>::ConstIterator mBeginCapuConstIterator;
+    typename capu::HashTable<Key, T, C, H>::ConstIterator mEndCapuConstIterator;
+      
+
+  };
+
   typedef typename EtchHashTable<Key, T, C, H>::EtchHashTableIterator Iterator;
+  typedef typename EtchHashTable<Key, T, C, H>::EtchHashTableConstIterator ConstIterator;
   
 
   /**
@@ -143,9 +179,16 @@ public:
 
   /**
    * Return iterator for iterating key value tuples.
+   * @return Const Iterator
+   */
+  inline ConstIterator begin() const;
+
+
+  /**
+   * Return iterator for iterating key value tuples.
    * @return Iterator
    */
-  inline Iterator begin() const;
+  inline Iterator begin();
 
 
 };
@@ -209,11 +252,17 @@ inline status_t EtchHashTable<Key, T, C,
 }
 
 template <class Key, class T, class C, class H>
-inline typename EtchHashTable<Key, T, C, H>::Iterator EtchHashTable<Key, T, C, H>::begin()
const {
-  EtchHashTableIterator it(mHashTable.begin(),mHashTable.end());
+inline typename EtchHashTable<Key, T, C, H>::ConstIterator EtchHashTable<Key, T,
C, H>::begin() const {
+  EtchHashTableConstIterator it(mHashTable.begin(),mHashTable.end());
   return it;
 }
 
+template <class Key, class T, class C, class H>
+inline typename EtchHashTable<Key, T, C, H>::Iterator EtchHashTable<Key, T, C, H>::begin()
{
+	EtchHashTableIterator it(mHashTable.begin(),mHashTable.end());
+	return it;
+}
+
 template<class Key, class T, class C, class H>
 EtchHashTable<Key, T, C, H>::EtchHashTableIterator::EtchHashTableIterator(typename
capu::HashTable<Key, T, C, H>::Iterator beginCapuIterator, typename capu::HashTable<Key,
T, C, H>::Iterator endCapuIterator) :
   mBeginCapuIterator(beginCapuIterator), mEndCapuIterator(endCapuIterator) { 
@@ -221,16 +270,32 @@ EtchHashTable<Key, T, C, H>::EtchHashTab
 }
 
 template<class Key, class T, class C, class H>
+EtchHashTable<Key, T, C, H>::EtchHashTableConstIterator::EtchHashTableConstIterator(typename
capu::HashTable<Key, T, C, H>::ConstIterator beginCapuConstIterator, typename capu::HashTable<Key,
T, C, H>::ConstIterator endCapuConstIterator) :
+	mBeginCapuConstIterator(beginCapuConstIterator), mEndCapuConstIterator(endCapuConstIterator)
{ 
+
+}
+
+template<class Key, class T, class C, class H>
 EtchHashTable<Key, T, C, H>::EtchHashTableIterator::~EtchHashTableIterator() { 
 
 }
 
 template<class Key, class T, class C, class H>
+EtchHashTable<Key, T, C, H>::EtchHashTableConstIterator::~EtchHashTableConstIterator()
{ 
+
+}
+
+template<class Key, class T, class C, class H>
 capu::bool_t EtchHashTable<Key, T, C, H>::EtchHashTableIterator::hasNext() { 
   return mBeginCapuIterator != mEndCapuIterator;
 }
 
 template<class Key, class T, class C, class H>
+capu::bool_t EtchHashTable<Key, T, C, H>::EtchHashTableConstIterator::hasNext() { 
+	return mBeginCapuConstIterator != mEndCapuConstIterator;
+}
+
+template<class Key, class T, class C, class H>
 status_t EtchHashTable<Key, T, C, H>::EtchHashTableIterator::next(HashTableEntry *element)
{ 
   if (!hasNext()) {
     return ETCH_ERANGE;
@@ -244,6 +309,20 @@ status_t EtchHashTable<Key, T, C, H>::Et
   return ETCH_OK;
 }
 
+template<class Key, class T, class C, class H>
+status_t EtchHashTable<Key, T, C, H>::EtchHashTableConstIterator::next(HashTableEntry
*element) { 
+	if (!hasNext()) {
+		return ETCH_ERANGE;
+	}
+
+	if (element != NULL) {
+		*element = *mBeginCapuConstIterator;
+	}
+	mBeginCapuConstIterator++;
+
+	return ETCH_OK;
+}
+
 typedef capu::SmartPointer<EtchHashTable<EtchObjectPtr, EtchObjectPtr> > EtchHashTablePtr;
 
 #endif

Modified: etch/trunk/binding-cpp/runtime/include/common/EtchList.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/common/EtchList.h?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/common/EtchList.h (original)
+++ etch/trunk/binding-cpp/runtime/include/common/EtchList.h Tue Mar 18 13:19:20 2014
@@ -69,13 +69,61 @@ public:
     /**
       * Constructor
       */
-    EtchListIterator(typename capu::List<T, A, C>::Iterator mBeginCapuListIterator,
typename capu::List<T, A, C>::Iterator mEndCapuListIterator);
+    EtchListIterator(typename capu::List<T, A, C>::Iterator beginCapuListIterator,
typename capu::List<T, A, C>::Iterator endCapuListIterator);
     typename capu::List<T, A, C>::Iterator mBeginCapuListIterator;
-    typename capu::List<T, A, C>::Iterator mEndCapuListIterator;
-      
+    typename capu::List<T, A, C>::Iterator mEndCapuListIterator;      
 
   };
+
+  class EtchListConstIterator {
+  public:
+      friend class EtchList;
+
+      /**
+      * destructor
+      */
+      ~EtchListConstIterator();
+
+      /**
+      * Check if iterator has next element.
+      * @return false if the next of current node that is pointed, is null otherwise true
+      */
+      capu::bool_t hasNext();
+
+      /**
+      * Shifts the iterator to the next position and returns the element if next != NULL
+      * @param element
+      * @return CAPU_OK if the next element has been gotten
+      *
+      */
+      status_t next(T* element = 0);
+
+      /**
+        * Get current iterator element.
+        * @param element
+        * @return ETCH_OK if the current element has been gotten
+        */
+        status_t current(T& element);
+
+      /**
+      * Returns the index of the current element.
+      * @return The index of the current element. If there is no current element, the return
value is undefined.
+      */
+      capu::uint32_t currentIndex();
+
+  private:
+    /**
+      * Constructor
+      */
+    EtchListConstIterator(typename capu::List<T, A, C>::ConstIterator beginCapuListConstIterator,
typename capu::List<T, A, C>::ConstIterator endCapuListConstIterator);
+    typename capu::List<T, A, C>::ConstIterator mBeginCapuListConstIterator;
+    typename capu::List<T, A, C>::ConstIterator mEndCapuListConstIterator;      
+
+  };
+
+public:
   typedef typename EtchList<T, A, C>::EtchListIterator Iterator;
+  typedef typename EtchList<T, A, C>::EtchListConstIterator ConstIterator;
 
   /**
    * EtchObjectType for EtchList.
@@ -154,7 +202,13 @@ public:
    * returns an iterator pointing to the beginning of list
    * @return iterator
    */
-  Iterator begin() const;
+  Iterator begin();
+
+    /**
+   * returns a const iterator pointing to the beginning of list
+   * @return const iterator
+   */
+  ConstIterator begin() const;
 
   /**
    * finds the index of given element in the link list
@@ -164,7 +218,18 @@ public:
    * @return Iterator to the searched element if the element is found
    *         otherwise Iterator to the end of the list
    */
-  Iterator find(const T &element) const;
+  Iterator find(const T &element);
+
+
+  /**
+   * finds the index of given element in the link list
+   * if you are using an object you need to overload == operator
+   *
+   * @param element the value that will be searched
+   * @return Const Iterator to the searched element if the element is found
+   *         otherwise Iterator to the end of the list
+   */
+  ConstIterator find(const T &element) const;
 
   /**
    *
@@ -228,11 +293,16 @@ status_t EtchList<T, A, C>::add(capu::in
 }
 
 template<class T, class A, class C>
-typename EtchList<T, A, C>::Iterator EtchList<T, A, C>::begin() const {
+typename EtchList<T, A, C>::Iterator EtchList<T, A, C>::begin() {
   return EtchListIterator(mList.begin(), mList.end());
 }
 
 template<class T, class A, class C>
+typename EtchList<T, A, C>::ConstIterator EtchList<T, A, C>::begin() const {
+  return EtchListConstIterator(mList.begin(), mList.end());
+}
+
+template<class T, class A, class C>
 status_t EtchList<T, A, C>::clear() {
   mList.clear();
   return ETCH_OK;
@@ -244,11 +314,16 @@ capu::bool_t EtchList<T, A, C>::contains
 }
 
 template<class T, class A, class C>
-typename EtchList<T, A, C>::Iterator EtchList<T, A, C>::find(const T &element)
const {
+typename EtchList<T, A, C>::Iterator EtchList<T, A, C>::find(const T &element)
{
   return EtchListIterator(mList.find(element), mList.end());
 }
 
 template<class T, class A, class C>
+typename EtchList<T, A, C>::ConstIterator EtchList<T, A, C>::find(const T &element)
const {
+	return EtchListConstIterator(mList.find(element), mList.end());
+}
+
+template<class T, class A, class C>
 status_t EtchList<T, A, C>::get(capu::int32_t index, T* result) {
   status_t status = ETCH_EINVAL;
   if (result != NULL) {
@@ -280,8 +355,14 @@ capu::int32_t EtchList<T, A, C>::set(cap
 
 
 template<class T, class A, class C>
-EtchList<T, A, C>::EtchListIterator::EtchListIterator(typename capu::List<T, A,
C>::Iterator beginCapuListIterator, typename capu::List<T, A, C>::Iterator mEndCapuListIterator)
:
-  mBeginCapuListIterator(beginCapuListIterator), mEndCapuListIterator(mEndCapuListIterator)
{ 
+EtchList<T, A, C>::EtchListIterator::EtchListIterator(typename capu::List<T, A,
C>::Iterator beginCapuListIterator, typename capu::List<T, A, C>::Iterator endCapuListIterator)
:
+  mBeginCapuListIterator(beginCapuListIterator), mEndCapuListIterator(endCapuListIterator)
{ 
+
+}
+
+template<class T, class A, class C>
+EtchList<T, A, C>::EtchListConstIterator::EtchListConstIterator(typename capu::List<T,
A, C>::ConstIterator beginCapuListConstIterator, typename capu::List<T, A, C>::ConstIterator
endCapuListConstIterator) :
+	mBeginCapuListConstIterator(beginCapuListConstIterator), mEndCapuListConstIterator(endCapuListConstIterator)
{ 
 
 }
 
@@ -291,13 +372,23 @@ EtchList<T, A, C>::EtchListIterator::~Et
 }
 
 template<class T, class A, class C>
+EtchList<T, A, C>::EtchListConstIterator::~EtchListConstIterator() { 
+
+}
+
+template<class T, class A, class C>
 capu::bool_t EtchList<T, A, C>::EtchListIterator::hasNext() { 
   return mBeginCapuListIterator != mEndCapuListIterator;
 }
 
 template<class T, class A, class C>
+capu::bool_t EtchList<T, A, C>::EtchListConstIterator::hasNext() { 
+	return mBeginCapuListConstIterator != mEndCapuListConstIterator;
+}
+
+template<class T, class A, class C>
 status_t EtchList<T, A, C>::EtchListIterator::next(T *element) { 
-  if (mBeginCapuListIterator == mEndCapuListIterator) {
+  if (!hasNext()) {
     return ETCH_ERROR;
   }
   if (element != NULL) {
@@ -308,8 +399,20 @@ status_t EtchList<T, A, C>::EtchListIter
 }
 
 template<class T, class A, class C>
+status_t EtchList<T, A, C>::EtchListConstIterator::next(T *element) { 
+	if (!hasNext()) {
+		return ETCH_ERROR;
+	}
+	if (element != NULL) {
+		*element = *mBeginCapuListConstIterator;
+	}
+	mBeginCapuListConstIterator++;
+	return ETCH_OK;
+}
+
+template<class T, class A, class C>
 status_t EtchList<T, A, C>::EtchListIterator::current(T& element) { 
-  if (mBeginCapuListIterator != mEndCapuListIterator) {
+  if (hasNext()) {
     element = *mBeginCapuListIterator;
     return ETCH_OK;
   }
@@ -317,10 +420,24 @@ status_t EtchList<T, A, C>::EtchListIter
 }
 
 template<class T, class A, class C>
+status_t EtchList<T, A, C>::EtchListConstIterator::current(T& element) { 
+	if (hasNext()) {
+		element = *mBeginCapuListConstIterator;
+		return ETCH_OK;
+	}
+	return ETCH_ERROR;
+}
+
+template<class T, class A, class C>
 capu::uint32_t EtchList<T, A, C>::EtchListIterator::currentIndex() { 
   return mBeginCapuListIterator.currentIndex();
 }
 
+template<class T, class A, class C>
+capu::uint32_t EtchList<T, A, C>::EtchListConstIterator::currentIndex() { 
+	return mBeginCapuListConstIterator.currentIndex();
+}
+
 typedef capu::SmartPointer<EtchList<EtchObjectPtr> > EtchListPtr;
 
 #endif /* ETCHDOUBLELINKEDLIST_H */

Modified: etch/trunk/binding-cpp/runtime/include/serialization/EtchStructValue.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/serialization/EtchStructValue.h?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/serialization/EtchStructValue.h (original)
+++ etch/trunk/binding-cpp/runtime/include/serialization/EtchStructValue.h Tue Mar 18 13:19:20
2014
@@ -141,7 +141,7 @@ public:
    */
   EtchLevel getLevel();
 
-  typedef EtchHashTable<EtchField, capu::SmartPointer<EtchObject> >::Iterator
Iterator;
+  typedef EtchHashTable<EtchField, capu::SmartPointer<EtchObject> >::ConstIterator
Iterator;
   typedef EtchHashTable<EtchField, capu::SmartPointer<EtchObject> >::HashTableEntry
HashTableEntry;
 
   /**

Modified: etch/trunk/binding-cpp/runtime/include/util/EtchLogger.h
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/include/util/EtchLogger.h?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/include/util/EtchLogger.h (original)
+++ etch/trunk/binding-cpp/runtime/include/util/EtchLogger.h Tue Mar 18 13:19:20 2014
@@ -46,16 +46,16 @@ typedef capu::LogContext EtchLogContext;
 class EtchLogger: public capu::Logger {
 public:
   EtchLogger(IEtchLogAppender& logAppender) : capu::Logger(logAppender)
-    , mSerializerContext("etch.runtime.messagizer.serializer")
-    , mDeliveryServiceContext("etch.runtime.deliveryservice")
-    , mTransportContext("etch.runtime.transport")
-    , mPacketizerContext("etch.runtime.packetizer")
-    , mMessagizerContext("etch.runtime.messagizer")
-    , mValidatorContext("etch.runtime.messagizer.validator")
-    , mMailboxContext("etch.runtime.mailbox")
-    , mRuntimeContext("etch.runtime")
+    , mSerializerContext(createContext("etch.runtime.messagizer.serializer"))
+    , mDeliveryServiceContext(createContext("etch.runtime.deliveryservice"))
+    , mTransportContext(createContext("etch.runtime.transport"))
+    , mPacketizerContext(createContext("etch.runtime.packetizer"))
+    , mMessagizerContext(createContext("etch.runtime.messagizer"))
+    , mValidatorContext(createContext("etch.runtime.messagizer.validator"))
+    , mMailboxContext(createContext("etch.runtime.mailbox"))
+    , mRuntimeContext(createContext("etch.runtime"))
   {
-
+	  
   }
   EtchLogContext& getSerializerContext() {
     return mSerializerContext;

Modified: etch/trunk/binding-cpp/runtime/src/main/common/EtchObject.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/main/common/EtchObject.cpp?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/main/common/EtchObject.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/main/common/EtchObject.cpp Tue Mar 18 13:19:20 2014
@@ -41,7 +41,7 @@ EtchObject::~EtchObject() {
 }
 
 capu::bool_t EtchObject::isInstanceOf(const EtchObjectType* type) const {
-  capu::List<const EtchObjectType*>::Iterator iter = mTypes.begin();
+  capu::List<const EtchObjectType*>::ConstIterator iter = mTypes.begin();
   while(iter != mTypes.end()) {
     const EtchObjectType* t = *iter;
     iter++;

Modified: etch/trunk/binding-cpp/runtime/src/test/common/EtchHashTableTest.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/test/common/EtchHashTableTest.cpp?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/test/common/EtchHashTableTest.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/test/common/EtchHashTableTest.cpp Tue Mar 18 13:19:20
2014
@@ -260,7 +260,34 @@ TEST(EtchHashTableIterator, hasNext){
   delete h1;
 }
 
-TEST(EtchHashTableIterator, NEXT){
+TEST(EtchHashTableConstIterator, hasNext){
+	EtchString key("key");
+	EtchString key2("key2");
+	EtchInt32 value(5);
+	status_t status = ETCH_OK;
+
+	EtchHashTable<EtchString, EtchInt32>* h1 = new EtchHashTable<EtchString, EtchInt32
> ();
+
+	//create iterator
+	EtchHashTable<EtchString, EtchInt32>::Iterator it = h1->begin();
+	//check hasNext
+	EXPECT_TRUE(it.hasNext() == false);
+
+	// add new keys
+	status = h1->put(key, value);
+	EXPECT_TRUE(status == ETCH_OK);
+
+	//add new value
+	status = h1->put(key2, value);
+	EXPECT_TRUE(status == ETCH_OK);
+
+	it = h1->begin();
+	EXPECT_TRUE(it.hasNext() == true);
+
+	delete h1;
+}
+
+TEST(EtchHashTableIterator, next){
   EtchString key("key");
   EtchString key2("key2");
   EtchInt32 value(5);

Modified: etch/trunk/binding-cpp/runtime/src/test/common/EtchListTest.cpp
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/src/test/common/EtchListTest.cpp?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/src/test/common/EtchListTest.cpp (original)
+++ etch/trunk/binding-cpp/runtime/src/test/common/EtchListTest.cpp Tue Mar 18 13:19:20 2014
@@ -370,6 +370,57 @@ TEST(EtchListIterator, next) {
   delete list;
 }
 
+TEST(EtchListConstIterator, hasNext) {
+
+	EtchList<EtchInt32>* normalList = new EtchList<EtchInt32 > ();
+	
+	EtchInt32 data1;
+	EtchInt32 data2;
+	data1.set(32);
+	data2.set(43);
+
+	const EtchList<EtchInt32>* constList = normalList;
+	EtchList<EtchInt32>::ConstIterator it = constList->begin();
+	EXPECT_FALSE(it.hasNext());
+
+	normalList->add(data1);
+
+	it = constList->begin();
+
+	EXPECT_TRUE(it.hasNext());
+	
+	delete normalList;
+}
+
+TEST(EtchListConstIterator, next) {
+	EtchList<EtchInt32>* normalList = new EtchList<EtchInt32 > ();
+	
+	EtchInt32 data1;
+	EtchInt32 data2;
+	EtchInt32 data3;
+
+	data1.set(32);
+	data2.set(43);
+	normalList->add(data1);
+	normalList->add(data2);
+
+	const EtchList<EtchInt32>* constList = normalList;
+	
+	EtchList<EtchInt32>::ConstIterator it = constList->begin();
+	capu::int32_t cnt = 0;
+
+	while (it.hasNext()) {
+		it.next(&data3);
+		if (cnt == 0)
+			EXPECT_TRUE(data3.get() == data1.get());
+		else
+			EXPECT_TRUE(data3.get() == data2.get());
+		cnt++;
+	}
+
+	delete normalList;
+}
+
 
 TEST(EtchList, copyTest) {
   EtchList<EtchInt32> o1;

Modified: etch/trunk/binding-cpp/runtime/toolchains/QNX_X86_32.toolchain
URL: http://svn.apache.org/viewvc/etch/trunk/binding-cpp/runtime/toolchains/QNX_X86_32.toolchain?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/binding-cpp/runtime/toolchains/QNX_X86_32.toolchain (original)
+++ etch/trunk/binding-cpp/runtime/toolchains/QNX_X86_32.toolchain Tue Mar 18 13:19:20 2014
@@ -65,13 +65,15 @@ MESSAGE(STATUS "using QNX_TARGET ${QNX_T
 
 #set c compiler and flags
 SET(CMAKE_C_COMPILER ${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-gcc${HOST_EXECUTABLE_SUFFIX})
-SET(CMAKE_C_FLAGS_DEBUG "-g -march=i486 -D_DEBUG")
-SET(CMAKE_C_FLAGS_RELEASE "-O3 -march=i486 -DNDEBUG")
+SET(CMAKE_C_FLAGS "-march=i486")
+SET(CMAKE_C_FLAGS_DEBUG "{CMAKE_C_FLAGS} -g -D_DEBUG")
+SET(CMAKE_C_FLAGS_RELEASE "{CMAKE_C_FLAGS} -O3 -DNDEBUG")
 
 #set c++ compiler and flags
 SET(CMAKE_CXX_COMPILER "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-g++${HOST_EXECUTABLE_SUFFIX}")
-SET(CMAKE_CXX_FLAGS_DEBUG "-g -march=i486 -D_DEBUG")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=i486 -DNDEBUG")
+SET(CMAKE_CXX_FLAGS "-march=i486")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -D_DEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE "{CMAKE_CXX_FLAGS} -O3 -DNDEBUG")
 
 #set linker
 SET(CMAKE_LINKER       "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ld${HOST_EXECUTABLE_SUFFIX}"
    CACHE PATH "QNX Linker Program")

Modified: etch/trunk/examples/helloworld/cpp/CMakeLists.txt
URL: http://svn.apache.org/viewvc/etch/trunk/examples/helloworld/cpp/CMakeLists.txt?rev=1578862&r1=1578861&r2=1578862&view=diff
==============================================================================
--- etch/trunk/examples/helloworld/cpp/CMakeLists.txt (original)
+++ etch/trunk/examples/helloworld/cpp/CMakeLists.txt Tue Mar 18 13:19:20 2014
@@ -22,6 +22,8 @@ IF (EXISTS "${CMAKE_SOURCE_DIR}/CMakeLis
   INCLUDE ("${CMAKE_SOURCE_DIR}/CMakeLists_local.txt" OPTIONAL)
 ENDIF()
 
+include (${CMAKE_TOOLCHAIN_FILE})
+
 #====================================================================================#
 
 #Etch Home



Mime
View raw message