ETCH-263 Cleaning up external library dependency
Adapting Etch to use CAPU version 0.8.1
CAPU is now included as a external dependency
Change-Id: I1d81b508e129d15f78bfd0148e9367d31122d51f
git-svn-id: https://svn.apache.org/repos/asf/etch/trunk@1460566 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm b/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm
index 3aac3cb..6f16ed4 100644
--- a/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm
+++ b/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm
@@ -39,13 +39,12 @@
using namespace $namespace;
status_t $vf::Etch${intf.name()}RuntimeListener::onRuntimeChanged(EtchRuntime* runtime) {
- capu::int_t index = $vf::SRuntimes.find(runtime->getId());
- if (index == -1) {
+ if (runtime == NULL) {
return ETCH_ERROR;
}
if (runtime->isClosed()) {
//the runtime is closed and is removed
- $vf::SRuntimes.removeAt(index);
+ $vf::SRuntimes.remove(runtime->getId());
}
return ETCH_OK;
}
@@ -305,6 +304,7 @@
capu::SmartPointer<EtchValidator> tmpValue;
#end
#set( $ctr = $ctr + 1 )
+
// params for $n.name()
#if ($n.isStruct() || $n.isExcept())
@@ -353,7 +353,7 @@
return ETCH_OK;
}
- status = SRuntimes.add(runtime->getId());
+ status = SRuntimes.push_back(runtime->getId());
runtime->registerListener(&S${i}RuntimeListener);
if (status != ETCH_OK) {
return status;
diff --git a/binding-cpp/runtime/CMakeLists.txt b/binding-cpp/runtime/CMakeLists.txt
index 460f877..cb224da 100644
--- a/binding-cpp/runtime/CMakeLists.txt
+++ b/binding-cpp/runtime/CMakeLists.txt
@@ -48,26 +48,8 @@
SET(GMOCK ${ETCH_EXTERNAL_DEPENDS}/gmock/1.6.0)
#Build external CAPU project (OS Abstraction)
-SET(CAPU_PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/capu")
-SET(CAPU_CMAKE_BUILD_DIR "${CAPU_PROJECT_DIR}/build")
-SET(CAPU_CMAKE_TOOLCHAIN_DIR "${CAPU_PROJECT_DIR}/cmake/acme/toolchain")
-SET(CAPU_DELIVERABLE_DIR "${CAPU_PROJECT_DIR}/deliverable")
-
-
-include(ExternalProject)
-ExternalProject_Add(
- Capu
- SOURCE_DIR "${CAPU_PROJECT_DIR}"
- BINARY_DIR "${CAPU_CMAKE_BUILD_DIR}"
- DOWNLOAD_COMMAND ""
- UPDATE_COMMAND ""
- CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
- -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-)
-
-#CAPU path
-SET(CAPU "${CAPU_PROJECT_DIR}/deliverable/capu")
-
+set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
+find_package(Capu)
# Set definitions
IF (TARGET_OS STREQUAL "Linux")
diff --git a/binding-cpp/runtime/FindCapu.cmake b/binding-cpp/runtime/FindCapu.cmake
new file mode 100644
index 0000000..5210337
--- /dev/null
+++ b/binding-cpp/runtime/FindCapu.cmake
@@ -0,0 +1,77 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version
+# 2.0 (the "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Try to find or download capu
+#Once done this will define
+#LIBCAPU_FOUND - System has capu
+#LIBCAPU_INCLUDE_DIR - The capu include directory
+#LIBCAPU_LIBRARY_DIR - The library needed to use capu
+
+IF (NOT DEFINED CMAKE_BUILD_TYPE)
+ MESSAGE(FATAL_ERROR "CMAKE_BUILD_TYPE not set")
+ENDIF()
+
+IF (NOT DEFINED CAPU_INCLUDE_DIR OR NOT DEFINED CAPU_LIBRARY_DIR)
+ include(ExternalProject)
+
+ IF ("${LOCAL_CAPU_SOURCE_DIR}" STREQUAL "")
+ #download capu from foreign repository
+ SET(CAPU_PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rd/capu")
+ SET(CAPU_CMAKE_BUILD_DIR "${CMAKE_BINARY_DIR}/capu")
+
+ ExternalProject_Add(
+ Capu
+ GIT_REPOSITORY git://github.com/bmwcarit/capu.git
+ SOURCE_DIR "${CAPU_PROJECT_DIR}"
+ BINARY_DIR "${CAPU_CMAKE_BUILD_DIR}"
+ INSTALL_DIR "${CAPU_PROJECT_DIR}/deliverable"
+ CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
+ -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+ )
+ ELSE()
+ SET(CAPU_PROJECT_DIR "${LOCAL_CAPU_SOURCE_DIR}")
+ SET(CAPU_CMAKE_BUILD_DIR "${CAPU_PROJECT_DIR}/build_${TARGET_OS}_${TARGET_ARCH}")
+
+ ExternalProject_Add(
+ Capu
+ SOURCE_DIR "${CAPU_PROJECT_DIR}"
+ BINARY_DIR "${CAPU_CMAKE_BUILD_DIR}"
+ DOWNLOAD_COMMAND ""
+ UPDATE_COMMAND ""
+ INSTALL_COMMAND "install"
+ CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
+ -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+ )
+ ENDIF()
+
+ SET(CAPU_DELIVERABLE_DIR ${CAPU_PROJECT_DIR}/deliverable/Capu)
+
+ SET(LIBCAPU_INCLUDE_DIR ${CAPU_DELIVERABLE_DIR}/include/Capu)
+ SET(LIBCAPU_LIBRARY_DIR ${CAPU_DELIVERABLE_DIR}/lib/${TARGET_OS}_${TARGET_ARCH}/${CMAKE_BUILD_TYPE})
+ELSE()
+ SET(LIBCAPU_INCLUDE_DIR ${CAPU_INCLUDE_DIR})
+ SET(LIBCAPU_LIBRARY_DIR ${CAPU_LIBRARY_DIR})
+ENDIF()
+
+
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LibCapu DEFAULT_MSG
+ LIBCAPU_LIBRARY_DIR LIBCAPU_INCLUDE_DIR)
+
+mark_as_advanced(LIBCAPU_INCLUDE_DIR LIBCAPU_LIBRARY_DIR )
+
diff --git a/binding-cpp/runtime/build.xml b/binding-cpp/runtime/build.xml
index c2e959c..d21d46a 100644
--- a/binding-cpp/runtime/build.xml
+++ b/binding-cpp/runtime/build.xml
@@ -47,14 +47,6 @@
<!-- CLEAN TARGET -->
<target name="do-clean">
<delete dir="${target}" />
- <delete dir="${proj}/lib/capu/3psw/libs" />
- <delete dir="${proj}/lib/capu/build" />
- <delete dir="${proj}/lib/capu/deliverable" />
- </target>
-
- <target name="do-clean-capu">
- <delete dir="${proj}/lib/capu/build" />
- <delete dir="${proj}/lib/capu/deliverable" />
</target>
<!-- BUILD TARGET -->
@@ -97,8 +89,6 @@
<antcall target="do-build"/>
<echo>Testing platform: ${platform}</echo>
<antcall target="do-test"/>
- <!-- TODO remove this as soon as ACME in capu is able to build multiple targets -->
- <antcall target="do-clean-capu"/>
</sequential>
</for>
@@ -123,6 +113,16 @@
</target>
<target name="do-build-main" if="USE.cmake">
+ <property name="defaultCMakeToolchainDir" value="${basedir}/toolchains"/>
+ <if>
+ <isset property="target.platforms.${platform}.toolchainfile"/>
+ <then>
+ <propertycopy name="cmake.toolchainfile" from="target.platforms.${platform}.toolchainfile" />
+ </then>
+ <else>
+ <property name="cmake.toolchainfile" value="${defaultCMakeToolchainDir}/${platform}.toolchain"/>
+ </else>
+ </if>
<if>
<isset property="target.platforms.${platform}.generator"/>
<then>
@@ -130,21 +130,21 @@
<propertycopy name="cmake.generator" from="target.platforms.${platform}.generator" />
<echo>Configuring CMake build</echo>
<echo>Using generator: ${cmake.generator}</echo>
- <echo>Using toolchain file: ${basedir}/toolchains/${platform}.toolchain</echo>
+ <echo>Using toolchain file: ${cmake.toolchainfile}</echo>
<cmake srcdir="${basedir}" bindir="${target}/${platform}/${Etch.build.target}" cmakeonly="false" buildtype="${Etch.build.target}" >
<generator name="${cmake.generator}" />
<variable name="ETCH_EXTERNAL_DEPENDS" type="PATH" value="${env.ETCH_EXTERNAL_DEPENDS}" />
- <variable name="CMAKE_TOOLCHAIN_FILE" type="FILEPATH" value="${basedir}/toolchains/${platform}.toolchain" />
+ <variable name="CMAKE_TOOLCHAIN_FILE" type="FILEPATH" value="${cmake.toolchainfile}" />
</cmake>
</then>
<else>
<!-- try default generator -->
<echo>Configuring CMake build</echo>
<echo>Using default generator</echo>
- <echo>Using toolchain file: ${basedir}/toolchains/${platform}.toolchain</echo>
+ <echo>Using toolchain file: ${cmake.toolchainfile}</echo>
<cmake srcdir="${basedir}" bindir="${target}/${platform}/${Etch.build.target}" cmakeonly="false" buildtype="${Etch.build.target}" >
<variable name="ETCH_EXTERNAL_DEPENDS" type="PATH" value="${env.ETCH_EXTERNAL_DEPENDS}" />
- <variable name="CMAKE_TOOLCHAIN_FILE" type="FILEPATH" value="${basedir}/toolchains/${platform}.toolchain" />
+ <variable name="CMAKE_TOOLCHAIN_FILE" type="FILEPATH" value="${cmake.toolchainfile}" />
</cmake>
</else>
</if>
@@ -163,8 +163,8 @@
</fileset>
</copy>
- <property name="capu.library.output.path.prefix" value="${proj}/lib/capu/deliverable/capu/lib/${platform}"/>
- <property name="capu.binary.output.path.prefix" value="${proj}/lib/capu/deliverable/capu/bin/${platform}"/>
+ <property name="capu.library.output.path.prefix" value="${proj}/3rd/capu/deliverable/Capu/lib/${platform}"/>
+ <property name="capu.binary.output.path.prefix" value="${proj}/3rd/capu/deliverable/Capu/bin/${platform}"/>
<property name="etch.library.output.path.prefix" value="${target}/${platform}/${Etch.build.target}/src/main"/>
<property name="etch.binary.output.path.prefix" value="${target}/${platform}/${Etch.build.target}/src/test"/>
@@ -178,8 +178,8 @@
<property name="etch.binary.output.path" value="${etch.binary.output.path.prefix}/${Etch.build.target}" />
</then>
<else>
- <property name="capu.library.output.path" value="${capu.library.output.path.prefix}" />
- <property name="capu.binary.output.path" value="${capu.binary.output.path.prefix}" />
+ <property name="capu.library.output.path" value="${capu.library.output.path.prefix}/${Etch.build.target}" />
+ <property name="capu.binary.output.path" value="${capu.binary.output.path.prefix}/${Etch.build.target}" />
<property name="etch.library.output.path" value="${etch.library.output.path.prefix}" />
<property name="etch.binary.output.path" value="${etch.binary.output.path.prefix}" />
</else>
@@ -203,7 +203,7 @@
<!-- copy capu includes to dist folder -->
<copy todir="${Etch.dist}/binding-cpp/include">
- <fileset dir="${proj}/lib/capu/deliverable/capu/include/capu">
+ <fileset dir="${proj}/lib/capu/deliverable/Capu/include/Capu">
<exclude name="**/.svn" />
</fileset>
</copy>
@@ -244,12 +244,12 @@
<!-- Run CAPU Unit Tests -->
<!-- Run CAPU Unit Tests on Windows-->
<property name="executable-full-path"
- location="lib/capu/deliverable/capu/bin/Windows_X86_32/${Etch.build.target}/capuTest.exe"/>
+ location="3rd/capu/deliverable/Capu/bin/Windows_X86_32/${Etch.build.target}/capuTest.exe"/>
<exec executable="${executable-full-path}" osfamily="windows" failonerror="true">
<arg value="--gtest_output=xml:${testResultsDirectory}/"/>
</exec>
<!-- Run CAPU Unit Tests on Unix -->
- <exec executable="lib/capu/deliverable/capu/bin/Linux_X86_32/capuTest" osfamily="unix" failonerror="true">
+ <exec executable="3rd/capu/deliverable/Capu/bin/Linux_X86_32/${Etch.build.target}/capuTest" osfamily="unix" failonerror="true">
<arg value="--gtest_output=xml:${testResultsDirectory}/"/>
</exec>
diff --git a/binding-cpp/runtime/include/common/EtchComparatorNative.h b/binding-cpp/runtime/include/common/EtchComparatorNative.h
index c67d420..553b763 100644
--- a/binding-cpp/runtime/include/common/EtchComparatorNative.h
+++ b/binding-cpp/runtime/include/common/EtchComparatorNative.h
@@ -26,7 +26,7 @@
public:
template <class T>
- inline capu::bool_t operator() (const T &first, const T &second) {
+ inline capu::bool_t operator() (const T &first, const T &second) const {
capu::Comparator c;
return c(first, second);
}
diff --git a/binding-cpp/runtime/include/common/EtchConfig.h b/binding-cpp/runtime/include/common/EtchConfig.h
index cb789dc..2a8c3fe 100644
--- a/binding-cpp/runtime/include/common/EtchConfig.h
+++ b/binding-cpp/runtime/include/common/EtchConfig.h
@@ -26,19 +26,18 @@
#include "capu/Config.h"
/**
- * Hash table size
+ * Hash table sizes
*/
-#define ETCH_DEFAULT_HASH_TABLE_SIZE 1000
-
-#define ETCH_DEFAULT_TYPEMAP_HASH_SIZE 50
-#define ETCH_DEFAULT_C2TYPEMAP_HASH_SIZE 50
-#define ETCH_DEFAULT_FIELDMAP_HASH_SIZE 10
-#define ETCH_DEFAULT_STRUCTVALUE_HASH_SIZE 8
-#define ETCH_DEFAULT_TYPEVALIDATOR_HASH_SIZE 5
-#define ETCH_DEFAULT_CUSTOMVALIDATORCACHE_HASH_SIZE 100
-#define ETCH_DEFAULT_MAILBOXMANAGER_HASH_SIZE 300
-#define ETCH_DEFAULT_RESOURCES_HASH_SIZE 300
-#define ETCH_DEFAULT_URL_TERMS_HASH_SIZE 10
+#define ETCH_DEFAULT_HASH_TABLE_BIT_SIZE 4
+#define ETCH_DEFAULT_TYPEMAP_HASH_BIT_SIZE 4
+#define ETCH_DEFAULT_C2TYPEMAP_HASH_BIT_SIZE 4
+#define ETCH_DEFAULT_FIELDMAP_HASH_BIT_SIZE 4
+#define ETCH_DEFAULT_STRUCTVALUE_HASH_BIT_SIZE 4
+#define ETCH_DEFAULT_TYPEVALIDATOR_HASH_BIT_SIZE 4
+#define ETCH_DEFAULT_CUSTOMVALIDATORCACHE_HASH_BIT_SIZE 8
+#define ETCH_DEFAULT_MAILBOXMANAGER_HASH_BIT_SIZE 4
+#define ETCH_DEFAULT_URL_TERMS_HASH_BIT_SIZE 4
+#define ETCH_DEFAULT_RESOURCES_HASH_BIT_SIZE 4
/**
* Socket input buffer size (bytes)
diff --git a/binding-cpp/runtime/include/common/EtchHashNative.h b/binding-cpp/runtime/include/common/EtchHashNative.h
index acc2608..9ca07a1 100644
--- a/binding-cpp/runtime/include/common/EtchHashNative.h
+++ b/binding-cpp/runtime/include/common/EtchHashNative.h
@@ -19,23 +19,23 @@
#ifndef __ETCHHASHNATIVE_H__
#define __ETCHHASHNATIVE_H__
#include "common/EtchConfig.h"
-#include "capu/container/HashTable.h"
+#include "capu/container/Hash.h"
#include "capu/util/Traits.h"
class EtchHashNative {
public:
template<class T>
- static capu::uint32_t Digest(T &key) {
- return capu::Hash::Digest<T>(key);
+ static capu::uint32_t Digest(T &key, const capu::uint8_t bitSize) {
+ return capu::CapuDefaultHashFunction::Digest<T>(key, bitSize);
}
- static capu::uint32_t Digest(char* key) {
- return capu::Hash::Digest(key);
+ static capu::uint32_t Digest(char* key, const capu::uint8_t bitSize) {
+ return capu::CapuDefaultHashFunction::Digest(key, bitSize);
}
- static capu::uint32_t Digest(const char* key) {
- return capu::Hash::Digest(key);
+ static capu::uint32_t Digest(const char* key, const capu::uint8_t bitSize) {
+ return capu::CapuDefaultHashFunction::Digest(key, bitSize);
}
};
diff --git a/binding-cpp/runtime/include/common/EtchHashSet.h b/binding-cpp/runtime/include/common/EtchHashSet.h
index 65f8e12..0b31f5a 100644
--- a/binding-cpp/runtime/include/common/EtchHashSet.h
+++ b/binding-cpp/runtime/include/common/EtchHashSet.h
@@ -23,12 +23,46 @@
#include "common/EtchComparator.h"
#include "capu/container/HashSet.h"
-template <class T, class H = EtchObjectHash, class C = EtchComparator<T> >
+template <class T, class C = EtchComparator<T>, class H = EtchObjectHash>
class EtchHashSet : public EtchObject {
public:
- typedef typename capu::HashSet<T, C, H>::Iterator Iterator;
+ class EtchHashSetIterator {
+ public:
+ friend class EtchHashSet;
+
+ /**
+ * destructor
+ */
+ ~EtchHashSetIterator();
+
+ /**
+ * 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
+ */
+ EtchHashSetIterator(typename capu::HashSet<T, C, H>::Iterator mBeginCapuIterator, typename capu::HashSet<T, C, H>::Iterator mEndCapuIterator);
+ typename capu::HashSet<T, C, H>::Iterator mBeginCapuIterator;
+ typename capu::HashSet<T, C, H>::Iterator mEndCapuIterator;
+
+
+ };
+ typedef typename EtchHashSet<T, C, H>::EtchHashSetIterator Iterator;
/**
* EtchObjectType for EtchHashSet.
@@ -96,7 +130,7 @@
* Return iterator for iterating key value tuples.
* @return Iterator
*/
- inline Iterator begin();
+ inline Iterator begin() const;
private:
@@ -104,57 +138,88 @@
};
-template <class T, class H, class C>
-inline EtchHashSet<T, H, C>::EtchHashSet() {
- addObjectType(EtchHashSet<T, H, C>::TYPE());
+template <class T, class C, class H>
+inline EtchHashSet<T, C, H>::EtchHashSet() {
+ addObjectType(EtchHashSet<T, C, H>::TYPE());
}
-template <class T, class H, class C>
-inline EtchHashSet<T, H, C>::EtchHashSet(capu::uint32_t size)
+template <class T, class C, class H>
+inline EtchHashSet<T, C, H>::EtchHashSet(capu::uint32_t size)
: mHashSet(size) {
- addObjectType(EtchHashSet<T, H, C>::TYPE());
+ addObjectType(EtchHashSet<T, C, H>::TYPE());
}
-template <class T, class H, class C>
-const EtchObjectType* EtchHashSet<T, H, C>::TYPE() {
+template <class T, class C, class H>
+const EtchObjectType* EtchHashSet<T, C, H>::TYPE() {
const static EtchObjectType TYPE(EOTID_SET, NULL);
return &TYPE;
}
-template <class T, class H, class C>
-inline EtchHashSet<T, H, C>::EtchHashSet(const EtchHashSet& other)
+template <class T, class C, class H>
+inline EtchHashSet<T, C, H>::EtchHashSet(const EtchHashSet& other)
: EtchObject(other), mHashSet(other.mHashSet) {
}
-template <class T, class H, class C>
-inline EtchHashSet<T, H, C>::~EtchHashSet() {
+template <class T, class C, class H>
+inline EtchHashSet<T, C, H>::~EtchHashSet() {
}
-template <class T, class H, class C>
-inline status_t EtchHashSet<T, H, C>::clear() {
+template <class T, class C, class H>
+inline status_t EtchHashSet<T, C, H>::clear() {
return mHashSet.clear();
}
-template <class T, class H, class C>
-inline capu::uint32_t EtchHashSet<T, H, C>::count() {
+template <class T, class C, class H>
+inline capu::uint32_t EtchHashSet<T, C, H>::count() {
return mHashSet.count();
}
-template <class T, class H, class C>
-inline status_t EtchHashSet<T, H, C>::put(const T &value) {
+template <class T, class C, class H>
+inline status_t EtchHashSet<T, C, H>::put(const T &value) {
return mHashSet.put(value);
}
-template <class T, class H, class C>
-inline status_t EtchHashSet<T, H, C>::remove(const T &value) {
+template <class T, class C, class H>
+inline status_t EtchHashSet<T, C, H>::remove(const T &value) {
return mHashSet.remove(value);
}
-template <class T, class H, class C>
-inline typename EtchHashSet<T, H, C>::Iterator EtchHashSet<T, H, C>::begin() {
- return mHashSet.begin();
+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());
+ 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) {
+
+}
+
+template<class T, class C, class H>
+EtchHashSet<T, C, H>::EtchHashSetIterator::~EtchHashSetIterator() {
+
+}
+
+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>
+status_t EtchHashSet<T, C, H>::EtchHashSetIterator::next(T *element) {
+ if (!hasNext()) {
+ return ETCH_ERANGE;
+ }
+
+ if (element != NULL) {
+ *element = *mBeginCapuIterator;
+ }
+ mBeginCapuIterator++;
+
+ return ETCH_OK;
}
typedef capu::SmartPointer<EtchHashSet<EtchObjectPtr> > EtchHashSetPtr;
diff --git a/binding-cpp/runtime/include/common/EtchHashTable.h b/binding-cpp/runtime/include/common/EtchHashTable.h
index 95957af..05f7446 100644
--- a/binding-cpp/runtime/include/common/EtchHashTable.h
+++ b/binding-cpp/runtime/include/common/EtchHashTable.h
@@ -23,14 +23,48 @@
#include "common/EtchComparator.h"
#include "capu/container/HashTable.h"
-template <class Key, class T, class H = EtchObjectHash, class C = EtchComparator<Key> >
+template <class Key, class T, class C = EtchComparator<Key>, class H = EtchObjectHash >
class EtchHashTable : public EtchObject {
private:
capu::HashTable<Key, T, C, H> mHashTable;
public:
- typedef typename capu::Pair<Key, T> Pair;
- typedef typename capu::HashTable<Key, T, C, H >::Iterator Iterator;
+ typedef typename capu::HashTable<Key, T, C, H>::HashTableEntry HashTableEntry;
+ class EtchHashTableIterator {
+ public:
+ friend class EtchHashTable;
+
+ /**
+ * destructor
+ */
+ ~EtchHashTableIterator();
+
+ /**
+ * 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
+ */
+ EtchHashTableIterator(typename capu::HashTable<Key, T, C, H>::Iterator mBeginCapuIterator, typename capu::HashTable<Key, T, C, H>::Iterator mEndCapuIterator);
+ typename capu::HashTable<Key, T, C, H>::Iterator mBeginCapuIterator;
+ typename capu::HashTable<Key, T, C, H>::Iterator mEndCapuIterator;
+
+
+ };
+ typedef typename EtchHashTable<Key, T, C, H>::EtchHashTableIterator Iterator;
+
/**
* EtchObjectType for EtchHashTable.
@@ -113,64 +147,101 @@
*/
inline Iterator begin() const;
+
};
-template <class Key, class T, class H, class C>
-const EtchObjectType* EtchHashTable<Key, T, H, C>::TYPE() {
+template <class Key, class T, class C, class H>
+const EtchObjectType* EtchHashTable<Key, T, C, H>::TYPE() {
const static EtchObjectType TYPE(EOTID_HASHTABLE, NULL);
return &TYPE;
}
-template <class Key, class T, class H, class C>
-inline EtchHashTable<Key, T, H, C>::EtchHashTable()
-: mHashTable(ETCH_DEFAULT_HASH_TABLE_SIZE) {
- addObjectType(EtchHashTable<Key, T, H, C>::TYPE());
+template <class Key, class T, class C, class H>
+inline EtchHashTable<Key, T, C, H>::EtchHashTable()
+: mHashTable(ETCH_DEFAULT_HASH_TABLE_BIT_SIZE) {
+ addObjectType(EtchHashTable<Key, T, C, H>::TYPE());
}
-template <class Key, class T, class H, class C>
-inline EtchHashTable<Key, T, H, C>::EtchHashTable(capu::uint32_t size)
+template <class Key, class T, class C, class H>
+inline EtchHashTable<Key, T, C, H>::EtchHashTable(capu::uint32_t size)
: mHashTable(size) {
- addObjectType(EtchHashTable<Key, T, H, C>::TYPE());
+ addObjectType(EtchHashTable<Key, T, C, H>::TYPE());
}
-template <class Key, class T, class H, class C>
-inline EtchHashTable<Key, T, H, C>::EtchHashTable(const EtchHashTable& other)
+template <class Key, class T, class C, class H>
+inline EtchHashTable<Key, T, C, H>::EtchHashTable(const EtchHashTable& other)
: EtchObject(other), mHashTable(other.mHashTable) {
}
-template <class Key, class T, class H, class C>
-inline EtchHashTable<Key, T, H, C>::~EtchHashTable() {
+template <class Key, class T, class C, class H>
+inline EtchHashTable<Key, T, C, H>::~EtchHashTable() {
}
-template <class Key, class T, class H, class C>
-inline status_t EtchHashTable<Key, T, H, C>::put(const Key &key, T value, T* value_old) {
+template <class Key, class T, class C, class H>
+inline status_t EtchHashTable<Key, T, C, H>::put(const Key &key, T value, T* value_old) {
return mHashTable.put(key, value, value_old);
}
-template <class Key, class T, class H, class C>
-inline status_t EtchHashTable<Key, T, H, C>::get(const Key &key, T* value) {
- return mHashTable.get(key, value);
+template <class Key, class T, class C, class H>
+inline status_t EtchHashTable<Key, T, C, H>::get(const Key &key, T* value) {
+ status_t status = ETCH_EINVAL;
+ if (value != NULL) {
+ *value = mHashTable.at(key,&status);
+ }
+ return status;
}
-template <class Key, class T, class H, class C>
-inline status_t EtchHashTable<Key, T, H, C>::remove(const Key &key, T* value_old) {
+template <class Key, class T, class C, class H>
+inline status_t EtchHashTable<Key, T, C, H>::remove(const Key &key, T* value_old) {
return mHashTable.remove(key, value_old);
}
-template <class Key, class T, class H, class C>
-inline capu::uint32_t EtchHashTable<Key, T, H, C>::count() {
+template <class Key, class T, class C, class H>
+inline capu::uint32_t EtchHashTable<Key, T, C, H>::count() {
return mHashTable.count();
}
-template <class Key, class T, class H, class C>
-inline status_t EtchHashTable<Key, T, H, C>::clear() {
- return mHashTable.clear();
+template <class Key, class T, class C, class H>
+inline status_t EtchHashTable<Key, T, C, H>::clear() {
+ mHashTable.clear();
+ return ETCH_OK;
}
-template <class Key, class T, class H, class C>
-inline typename EtchHashTable<Key, T, H, C>::Iterator EtchHashTable<Key, T, H, C>::begin() const {
- return mHashTable.begin();
+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());
+ 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) {
+
+}
+
+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>
+capu::bool_t EtchHashTable<Key, T, C, H>::EtchHashTableIterator::hasNext() {
+ return mBeginCapuIterator != mEndCapuIterator;
+}
+
+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;
+ }
+
+ if (element != NULL) {
+ *element = *mBeginCapuIterator;
+ }
+ mBeginCapuIterator++;
+
+ return ETCH_OK;
}
typedef capu::SmartPointer<EtchHashTable<EtchObjectPtr, EtchObjectPtr> > EtchHashTablePtr;
diff --git a/binding-cpp/runtime/include/common/EtchList.h b/binding-cpp/runtime/include/common/EtchList.h
index 6b4989f..6f7c5a2 100644
--- a/binding-cpp/runtime/include/common/EtchList.h
+++ b/binding-cpp/runtime/include/common/EtchList.h
@@ -22,14 +22,60 @@
#include "capu/container/List.h"
#include "common/EtchComparator.h"
-template <class T, class C = EtchComparator<T> >
+template <class T, class A = capu::Allocator<capu::GenericListNode<T> >, class C = EtchComparator<T> >
class EtchList : public EtchObject {
private:
- capu::List<T, C> mList;
+ capu::List<T, A, C> mList;
public:
- typedef typename capu::List<T, C>::Iterator Iterator;
+ class EtchListIterator {
+ public:
+ friend class EtchList;
+
+ /**
+ * destructor
+ */
+ ~EtchListIterator();
+
+ /**
+ * 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
+ */
+ EtchListIterator(typename capu::List<T, A, C>::Iterator mBeginCapuListIterator, typename capu::List<T, A, C>::Iterator mEndCapuListIterator);
+ typename capu::List<T, A, C>::Iterator mBeginCapuListIterator;
+ typename capu::List<T, A, C>::Iterator mEndCapuListIterator;
+
+
+ };
+ typedef typename EtchList<T, A, C>::EtchListIterator Iterator;
/**
* EtchObjectType for EtchList.
@@ -80,7 +126,7 @@
* @return ETCH_EINVAL invalid index
* ETCH_OK if the element is successfully removed
*/
- status_t removeAt(capu::int32_t index, T* elementOld = NULL);
+ status_t removeAt(Iterator& it, T* elementOld = NULL);
/**
* get a single element on specified index
@@ -149,83 +195,132 @@
};
-template<class T, class C>
-const EtchObjectType* EtchList<T, C>::TYPE() {
+template<class T, class A, class C>
+const EtchObjectType* EtchList<T, A, C>::TYPE() {
const static EtchObjectType TYPE(EOTID_LIST, NULL);
return &TYPE;
}
-template<class T, class C>
-EtchList<T, C>::EtchList() {
- addObjectType(EtchList<T, C>::TYPE());
+template<class T, class A, class C>
+EtchList<T, A, C>::EtchList() {
+ addObjectType(EtchList<T, A, C>::TYPE());
}
-template<class T, class C>
-EtchList<T, C>::EtchList(const EtchList& other)
+template<class T, class A, class C>
+EtchList<T, A, C>::EtchList(const EtchList& other)
: EtchObject(other), mList(other.mList) {
}
-template<class T, class C>
-EtchList<T, C>::~EtchList() {
+template<class T, class A, class C>
+EtchList<T, A, C>::~EtchList() {
}
-template<class T, class C>
-status_t EtchList<T, C>::add(const T &element) {
- return mList.add(element);
+template<class T, class A, class C>
+status_t EtchList<T, A, C>::add(const T &element) {
+ return mList.insert(element);
}
-template<class T, class C>
-status_t EtchList<T, C>::add(capu::int32_t index, const T &element) {
- return mList.add(index, element);
+template<class T, class A, class C>
+status_t EtchList<T, A, C>::add(capu::int32_t index, const T &element) {
+ return mList.insert(index, element);
}
-template<class T, class C>
-typename EtchList<T, C>::Iterator EtchList<T, C>::begin() const {
- return mList.begin();
+template<class T, class A, class C>
+typename EtchList<T, A, C>::Iterator EtchList<T, A, C>::begin() const {
+ return EtchListIterator(mList.begin(), mList.end());
}
-template<class T, class C>
-status_t EtchList<T, C>::clear() {
- return mList.clear();
+template<class T, class A, class C>
+status_t EtchList<T, A, C>::clear() {
+ mList.clear();
+ return ETCH_OK;
}
-template<class T, class C>
-capu::bool_t EtchList<T, C>::contains(const T &element) {
+template<class T, class A, class C>
+capu::bool_t EtchList<T, A, C>::contains(const T &element) {
return mList.contains(element);
}
-template<class T, class C>
-capu::int32_t EtchList<T, C>::find(const T &element) const {
+template<class T, class A, class C>
+capu::int32_t EtchList<T, A, C>::find(const T &element) const {
return mList.find(element);
}
-template<class T, class C>
-status_t EtchList<T, C>::get(capu::int32_t index, T* result) {
- return mList.get(index, result);
+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) {
+ *result = mList.get(index, &status);
+ }
+ return status;
}
-template<class T, class C>
-capu::bool_t EtchList<T, C>::isEmpty() const {
+template<class T, class A, class C>
+capu::bool_t EtchList<T, A, C>::isEmpty() const {
return mList.isEmpty();
}
-template<class T, class C>
-status_t EtchList<T, C>::removeAt(capu::int32_t index, T* elementOld) {
- return mList.removeAt(index, elementOld);
+template<class T, class A, class C>
+status_t EtchList<T, A, C>::removeAt(typename EtchList<T, A, C>::Iterator& it, T* elementOld) {
+ status_t status = mList.erase(it.mBeginCapuListIterator, elementOld);
+ return status;
}
-template<class T, class C>
-capu::int32_t EtchList<T, C>::size() {
+template<class T, class A, class C>
+capu::int32_t EtchList<T, A, C>::size() {
return mList.size();
}
-template<class T, class C>
-capu::int32_t EtchList<T, C>::set(capu::int32_t index, const T &element, T* elementOld) {
+template<class T, class A, class C>
+capu::int32_t EtchList<T, A, C>::set(capu::int32_t index, const T &element, T* elementOld) {
return mList.set(index, element, elementOld);
}
+
+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) {
+
+}
+
+template<class T, class A, class C>
+EtchList<T, A, C>::EtchListIterator::~EtchListIterator() {
+
+}
+
+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>
+status_t EtchList<T, A, C>::EtchListIterator::next(T *element) {
+ if (mBeginCapuListIterator == mEndCapuListIterator) {
+ return ETCH_ERROR;
+ }
+ if (element != NULL) {
+ *element = *mBeginCapuListIterator;
+ }
+ mBeginCapuListIterator++;
+ return ETCH_OK;
+}
+
+template<class T, class A, class C>
+status_t EtchList<T, A, C>::EtchListIterator::current(T& element) {
+ if (mBeginCapuListIterator != mEndCapuListIterator) {
+ element = *mBeginCapuListIterator;
+ 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();
+}
+
typedef capu::SmartPointer<EtchList<EtchObjectPtr> > EtchListPtr;
#endif /* ETCHDOUBLELINKEDLIST_H */
diff --git a/binding-cpp/runtime/include/common/EtchObject.h b/binding-cpp/runtime/include/common/EtchObject.h
index 45093bb..63b127b 100644
--- a/binding-cpp/runtime/include/common/EtchObject.h
+++ b/binding-cpp/runtime/include/common/EtchObject.h
@@ -20,6 +20,7 @@
#define __ETCHOBJECT_H__
#include "capu/container/List.h"
+#include "capu/container/Hash.h"
#include "common/EtchError.h"
#include "common/EtchObjectType.h"
@@ -79,6 +80,7 @@
private:
capu::List<const EtchObjectType*> mTypes;
+
};
typedef capu::SmartPointer<EtchObject> EtchObjectPtr;
diff --git a/binding-cpp/runtime/include/common/EtchObjectHash.h b/binding-cpp/runtime/include/common/EtchObjectHash.h
index 2594c6a..2385bab 100644
--- a/binding-cpp/runtime/include/common/EtchObjectHash.h
+++ b/binding-cpp/runtime/include/common/EtchObjectHash.h
@@ -24,16 +24,17 @@
class EtchObjectHash {
public:
- static capu::uint32_t Digest(const EtchObject &key) {
- return key.getHashCode();
+ static capu::uint32_t Digest(const EtchObject &key, const capu::uint8_t bitCount) {
+
+ return capu::Resizer<capu::uint32_t>::Resize(key.getHashCode(),bitCount);
}
- static capu::uint32_t Digest(const EtchObject* key) {
- return key->getHashCode();
+ static capu::uint32_t Digest(const EtchObject* key, const capu::uint8_t bitCount) {
+ return capu::Resizer<capu::uint32_t>::Resize(key->getHashCode(),bitCount);
}
- static capu::uint32_t Digest(const capu::SmartPointer<EtchObject>& key) {
- return key->getHashCode();
+ static capu::uint32_t Digest(const capu::SmartPointer<EtchObject>& key, const capu::uint8_t bitCount) {
+ return capu::Resizer<capu::uint32_t>::Resize(key->getHashCode(),bitCount);
}
};
#endif
diff --git a/binding-cpp/runtime/include/common/EtchServerSocket.h b/binding-cpp/runtime/include/common/EtchServerSocket.h
index d8ea130..f94e5dd 100644
--- a/binding-cpp/runtime/include/common/EtchServerSocket.h
+++ b/binding-cpp/runtime/include/common/EtchServerSocket.h
@@ -19,8 +19,8 @@
#ifndef __ETCHSERVERSOCKET_H__
#define __ETCHSERVERSOCKET_H__
-#include "capu/os/ServerSocket.h"
-#include "capu/os/Socket.h"
+#include "capu/os/TcpServerSocket.h"
+#include "capu/os/TcpSocket.h"
#include "common/EtchSocket.h"
class EtchServerSocket : public EtchObject {
@@ -83,7 +83,7 @@
status_t listen(capu::uint8_t backlog);
private:
- capu::ServerSocket mServerSocket;
+ capu::TcpServerSocket mServerSocket;
};
diff --git a/binding-cpp/runtime/include/common/EtchSocket.h b/binding-cpp/runtime/include/common/EtchSocket.h
index 8543edd..3413732 100644
--- a/binding-cpp/runtime/include/common/EtchSocket.h
+++ b/binding-cpp/runtime/include/common/EtchSocket.h
@@ -19,7 +19,7 @@
#ifndef __ETCHSOCKET_H__
#define __ETCHSOCKET_H__
-#include "capu/os/Socket.h"
+#include "capu/os/TcpSocket.h"
#include "common/EtchObject.h"
class EtchSocket : public EtchObject {
@@ -55,7 +55,7 @@
* ETCH_SOCKET_ESOCKET if the socket is not created
* ETCH_ERROR otherwise
*/
- status_t send(unsigned char * buffer, capu::int32_t length);
+ status_t send(const char * buffer, capu::int32_t length);
/**
* Receive message
@@ -67,7 +67,7 @@
* ETCH_SOCKET_ESOCKET if the socket is not created
* ETCH_ERROR otherwise
*/
- status_t receive(unsigned char * buffer, capu::int32_t length, capu::int32_t& numBytes);
+ status_t receive(char * buffer, capu::int32_t length, capu::int32_t& numBytes);
/**
* close the socket
@@ -87,7 +87,7 @@
* ETCH_EINVAL if the dest_addr is NULL
* ETCH_SOCKET_ESOCKET if the socket is not created
*/
- status_t connect(unsigned char * dest_addr, capu::uint16_t port);
+ status_t connect(const char * dest_addr, capu::uint16_t port);
/**
* Sets the maximum socket buffer in bytes. The kernel doubles this value (to allow space for bookkeeping overhead)
@@ -181,12 +181,12 @@
friend class EtchServerSocket;
private:
- capu::Socket *mSocket;
+ capu::TcpSocket *mSocket;
/**
* Constructor
*/
- EtchSocket(capu::Socket* soc);
+ EtchSocket(capu::TcpSocket* soc);
};
diff --git a/binding-cpp/runtime/include/serialization/EtchClass2TypeMap.h b/binding-cpp/runtime/include/serialization/EtchClass2TypeMap.h
index 6e5fcd2..b46c2cb 100644
--- a/binding-cpp/runtime/include/serialization/EtchClass2TypeMap.h
+++ b/binding-cpp/runtime/include/serialization/EtchClass2TypeMap.h
@@ -21,6 +21,7 @@
#define __ETCHCLASS2TYPEMAP_H__
#include "common/EtchInt32.h"
+#include "common/EtchHashNative.h"
#include "serialization/EtchType.h"
/**
@@ -107,7 +108,7 @@
}
};
private:
- EtchHashTable<const EtchObjectType*, EtchType*, EtchClass2TypeMap::Hash, EtchClass2TypeMap::Comparator<const EtchObjectType*> > mC2T;
+ EtchHashTable<const EtchObjectType*, EtchType*, EtchClass2TypeMap::Comparator<const EtchObjectType*>,EtchHashNative > mC2T;
capu::bool_t mLocked;
diff --git a/binding-cpp/runtime/include/serialization/EtchFieldMap.h b/binding-cpp/runtime/include/serialization/EtchFieldMap.h
index d49d612..220bae9 100644
--- a/binding-cpp/runtime/include/serialization/EtchFieldMap.h
+++ b/binding-cpp/runtime/include/serialization/EtchFieldMap.h
@@ -21,6 +21,8 @@
#include "common/EtchString.h"
#include "common/EtchHashTable.h"
+#include "common/EtchComparatorNative.h"
+#include "common/EtchHashNative.h"
#include "serialization/EtchField.h"
/**
@@ -92,7 +94,7 @@
private:
- EtchHashTable<capu::int32_t, EtchField, capu::Hash, capu::Comparator> mById;
+ EtchHashTable<capu::int32_t, EtchField, EtchComparatorNative, EtchHashNative> mById;
EtchHashTable<EtchString, EtchField> mByName;
diff --git a/binding-cpp/runtime/include/serialization/EtchStructValue.h b/binding-cpp/runtime/include/serialization/EtchStructValue.h
index 3679a8b..5777750 100644
--- a/binding-cpp/runtime/include/serialization/EtchStructValue.h
+++ b/binding-cpp/runtime/include/serialization/EtchStructValue.h
@@ -84,13 +84,12 @@
* Puts an object to EtchStructValue by validating it
* @param field field of custom type
* @param object value of field that will be added. If object is set to NULL, the field is removed.
- * @param result the removed field is put to result (optional)
*
* @return ETCH_OK if successfully added
* ETCH_EINVAL if the level of type is not LEVEL_NONE and the object is NULL
* ETCH_ERROR if the level of type is not LEVEL_NONE and the object is not validated and is not NULL
*/
- status_t put(const EtchField &field, capu::SmartPointer<EtchObject> object, capu::SmartPointer<EtchObject> *value_old = NULL);
+ status_t put(const EtchField &field, capu::SmartPointer<EtchObject> object);
/**
* Get value associated with key in the EtchStructValue.
@@ -143,7 +142,7 @@
EtchLevel getLevel();
typedef EtchHashTable<EtchField, capu::SmartPointer<EtchObject> >::Iterator Iterator;
- typedef EtchHashTable<EtchField, capu::SmartPointer<EtchObject> >::Pair Pair;
+ typedef EtchHashTable<EtchField, capu::SmartPointer<EtchObject> >::HashTableEntry HashTableEntry;
/**
* @return an iterator which is pointing the beginning of collection
@@ -166,7 +165,7 @@
static const capu::int64_t serialVersionUID = 1L;
//Default size of mTable
- static const capu::int32_t DEFAULT_SIZE = ETCH_DEFAULT_STRUCTVALUE_HASH_SIZE;
+ static const capu::int32_t DEFAULT_SIZE = ETCH_DEFAULT_STRUCTVALUE_HASH_BIT_SIZE;
};
diff --git a/binding-cpp/runtime/include/serialization/EtchTypeMap.h b/binding-cpp/runtime/include/serialization/EtchTypeMap.h
index 7a96c72..89d621c 100644
--- a/binding-cpp/runtime/include/serialization/EtchTypeMap.h
+++ b/binding-cpp/runtime/include/serialization/EtchTypeMap.h
@@ -22,6 +22,8 @@
#include "common/EtchString.h"
#include "common/EtchHashTable.h"
#include "common/EtchHashSet.h"
+#include "common/EtchComparatorNative.h"
+#include "common/EtchHashNative.h"
#include "serialization/EtchType.h"
class EtchTypeMap {
@@ -96,7 +98,7 @@
private:
- EtchHashTable<capu::int32_t, EtchType*, capu::Hash, capu::Comparator > mById;
+ EtchHashTable<capu::int32_t, EtchType*, EtchComparatorNative, EtchHashNative > mById;
EtchHashTable<EtchString, EtchType* > mByName;
diff --git a/binding-cpp/runtime/include/serialization/EtchValidator.h b/binding-cpp/runtime/include/serialization/EtchValidator.h
index 4aad362..0552fa5 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidator.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidator.h
@@ -103,9 +103,9 @@
*/
virtual ~EtchValidatorCaches() {
capu::List<ValidatorCache*>::Iterator iter = mValidatorsCache.begin();
- while(iter.hasNext()) {
- ValidatorCache* entry = NULL;
- iter.next(&entry);
+ while(iter != mValidatorsCache.end()) {
+ ValidatorCache* entry = *iter;
+ iter++;
delete entry;
}
mValidatorsCache.clear();
@@ -117,16 +117,16 @@
capu::SmartPointer<EtchValidator>* get(EtchRuntime* runtime) {
capu::List<ValidatorCache*>::Iterator iter = mValidatorsCache.begin();
- while(iter.hasNext()) {
- ValidatorCache* entry = NULL;
- iter.next(&entry);
+ while(iter != mValidatorsCache.end()) {
+ ValidatorCache* entry = *iter;
+ iter++;
if(entry->id == runtime->getId()) {
return entry->validators;
}
}
ValidatorCache* entry = new ValidatorCache();
entry->id = runtime->getId();
- mValidatorsCache.add(entry);
+ mValidatorsCache.insert(entry);
return entry->validators;
}
diff --git a/binding-cpp/runtime/include/support/EtchFreePool.h b/binding-cpp/runtime/include/support/EtchFreePool.h
index 5a35358..6a1cc3b 100644
--- a/binding-cpp/runtime/include/support/EtchFreePool.h
+++ b/binding-cpp/runtime/include/support/EtchFreePool.h
@@ -29,6 +29,7 @@
class Thread;
}
+class EtchFreePoolRunnable;
/**
* A implementation of the free pool.
*/
@@ -88,11 +89,14 @@
capu::bool_t mIsOpen;
capu::Mutex mMutex;
capu::Thread** mThreads;
+ EtchFreePoolRunnable** mRunnables;
/**
* Checks thread list and clean up
+
*/
status_t check();
};
#endif /* __ETCHFREEPOOL_H__ */
+
diff --git a/binding-cpp/runtime/include/support/EtchQueuedPool.h b/binding-cpp/runtime/include/support/EtchQueuedPool.h
index 8d77a18..babe411 100644
--- a/binding-cpp/runtime/include/support/EtchQueuedPool.h
+++ b/binding-cpp/runtime/include/support/EtchQueuedPool.h
@@ -70,7 +70,7 @@
status_t add(capu::SmartPointer<EtchPoolRunnable> runnable);
private:
- capu::int32_t mSizeMax;
+ capu::uint32_t mSizeMax;
capu::bool_t mIsOpen;
capu::ThreadPool* mPool;
};
diff --git a/binding-cpp/runtime/include/transport/EtchTcpListener.h b/binding-cpp/runtime/include/transport/EtchTcpListener.h
index 6e6d568..ded5f3b 100644
--- a/binding-cpp/runtime/include/transport/EtchTcpListener.h
+++ b/binding-cpp/runtime/include/transport/EtchTcpListener.h
@@ -20,8 +20,8 @@
#ifndef __ETCHTCPLISTENER_H__
#define __ETCHTCPLISTENER_H__
-#include "capu/os/ServerSocket.h"
-#include "capu/os/Socket.h"
+#include "capu/os/TcpServerSocket.h"
+#include "capu/os/TcpSocket.h"
#include "capu/util/Runnable.h"
#include "common/EtchError.h"
diff --git a/binding-cpp/runtime/include/transport/EtchTcpTransportFactory.h b/binding-cpp/runtime/include/transport/EtchTcpTransportFactory.h
index 558bc11..5965796 100644
--- a/binding-cpp/runtime/include/transport/EtchTcpTransportFactory.h
+++ b/binding-cpp/runtime/include/transport/EtchTcpTransportFactory.h
@@ -143,7 +143,7 @@
EtchResources* mResources;
capu::bool_t mIsSecure;
EtchServerFactory* mSession;
- capu::List<EtchStack*>* mConnectionStacks;
+ EtchList<EtchStack*>* mConnectionStacks;
};
};
diff --git a/binding-cpp/runtime/include/util/EtchUtil.h b/binding-cpp/runtime/include/util/EtchUtil.h
index c9073a3..c9058fe 100644
--- a/binding-cpp/runtime/include/util/EtchUtil.h
+++ b/binding-cpp/runtime/include/util/EtchUtil.h
@@ -37,6 +37,6 @@
* ETCH_ERROR if length calculation has failed
* ETCH_EINVAL if src == NULL
*/
-status_t etch_strlen_utf8(const char *src, capu::int32_t &length);
+status_t etch_strlen_utf8(const char *src, capu::uint32_t &length);
#endif
diff --git a/binding-cpp/runtime/lib/capu/.gitignore b/binding-cpp/runtime/lib/capu/.gitignore
deleted file mode 100644
index 498965e..0000000
--- a/binding-cpp/runtime/lib/capu/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-3psw
-build
-deliverable
diff --git a/binding-cpp/runtime/lib/capu/CMakeLists.txt b/binding-cpp/runtime/lib/capu/CMakeLists.txt
deleted file mode 100644
index d070081..0000000
--- a/binding-cpp/runtime/lib/capu/CMakeLists.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8) # Must be first line
-
-PROJECT(capu) # Must be second line
-
-INCLUDE(cmake/acme/acme.cmake) # Must be third line
-
-ADD_SUBDIRECTORY(modules)
-
-FINALIZE()
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/acme.cmake b/binding-cpp/runtime/lib/capu/cmake/acme/acme.cmake
deleted file mode 100644
index 36e62a4..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/acme/acme.cmake
+++ /dev/null
@@ -1,152 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-#--------------------------------------------------------------------------
-# if a toolchain was provided and the toolchain file exists make sure,
-# all variables are set as early as possible
-#--------------------------------------------------------------------------
-IF (NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "" )
- IF (EXISTS "${CMAKE_TOOLCHAIN_FILE}")
- INCLUDE(${CMAKE_TOOLCHAIN_FILE})
- MESSAGE(STATUS "Using toolchain file: " ${CMAKE_TOOLCHAIN_FILE})
- ELSE()
- MESSAGE(STATUS "WARNING: toolchain file not found: " ${CMAKE_TOOLCHAIN_FILE})
- ENDIF()
-ENDIF()
-
-
-
-#--------------------------------------------------------------------------
-# store current path to acme build system
-# there the macro CMAKE_CURRENT_LIST_DIR, but it requires Cmake 2.8.3 or higher.
-# this solution works on CMake 2.6 as well.
-#--------------------------------------------------------------------------
-get_filename_component(ACME_PATH ${CMAKE_CURRENT_LIST_FILE} PATH)
-MESSAGE(STATUS "using ACME base directory: ${ACME_PATH}")
-
-#--------------------------------------------------------------------------
-# include internal implementation, configuration and plugins
-#--------------------------------------------------------------------------
-INCLUDE(${ACME_PATH}/internal/config.cmake)
-INCLUDE(${ACME_PATH}/internal/macros.cmake)
-
-MACRO(ADD_CMAKE_PROJECT aap_project_name)
- INTERNAL_ADD_CMAKE_PROJECT("${aap_project_name}" "${ARGN}")
-ENDMACRO(ADD_CMAKE_PROJECT)
-
-MACRO(ADD_EXTERNAL_LIBRARY ael_library_name)
- INTERNAL_ADD_EXTERNAL_LIBRARY("${ael_library_name}" "${ARGN}")
-ENDMACRO(ADD_EXTERNAL_LIBRARY)
-
-INCLUDE(${ACME_PATH}/internal/plugins.cmake)
-
-MACRO(ADD_MODULE ad_module_name ad_type)
- INTERNAL_ADD_MODULE("${ad_module_name}" "${ad_type}")
-ENDMACRO(ADD_MODULE)
-
-MACRO(ADD_OPTIONAL_MODULE aom_module_name aom_type)
- INTERNAL_ADD_OPTIONAL_MODULE("${aom_module_name}" "${aom_type}")
-ENDMACRO(ADD_OPTIONAL_MODULE)
-
-MACRO(REQUIRED_PACKAGE pkg_name)
- INTERNAL_REQUIRED_PACKAGE("${pkg_name}")
-ENDMACRO(REQUIRED_PACKAGE)
-
-MACRO(OPTIONAL_PACKAGE pkg_name)
- INTERNAL_OPTIONAL_PACKAGE("${pkg_name}")
-ENDMACRO(OPTIONAL_PACKAGE)
-
-MACRO(ADD_DEPENDENCY ad_name)
- INTERNAL_ADD_DEPENDENCY("${ad_name}")
-ENDMACRO(ADD_DEPENDENCY)
-
-MACRO(ADD_COMPILER_FLAG ad_compiler_flag)
- INTERNAL_ADD_COMPILER_FLAG("${ad_compiler_flag}")
-ENDMACRO(ADD_COMPILER_FLAG)
-
-MACRO(ADD_DEBUG_COMPILER_FLAG adcf_compiler_flag)
- INTERNAL_ADD_DEBUG_COMPILER_FLAG("${adcf_compiler_flag}")
-ENDMACRO(ADD_DEBUG_COMPILER_FLAG)
-
-MACRO(ADD_RELEASE_COMPILER_FLAG arcf_compiler_flag)
- INTERNAL_ADD_RELEASE_COMPILER_FLAG("${arcf_compiler_flag}")
-ENDMACRO(ADD_RELEASE_COMPILER_FLAG)
-
-MACRO(ADD_DEFINITION ad_definition)
- INTERNAL_ADD_DEFINITION("${ad_definition}")
-ENDMACRO(ADD_DEFINITION)
-
-MACRO(ADD_DEBUG_DEFINITION add_definition)
- INTERNAL_ADD_DEBUG_DEFINITION("${add_definition}")
-ENDMACRO(ADD_DEBUG_DEFINITION)
-
-MACRO(ADD_RELEASE_DEFINITION ard_definition)
- INTERNAL_ADD_RELEASE_DEFINITION("${ard_definition}")
-ENDMACRO(ADD_RELEASE_DEFINITION)
-
-MACRO(ADD_LINKER_FLAG alf_linker_flag)
- INTERNAL_ADD_LINKER_FLAG("${alf_linker_flag}")
-ENDMACRO(ADD_LINKER_FLAG)
-
-MACRO(ADD_DEBUG_LINKER_FLAG adlf_linker_flag)
- INTERNAL_ADD_DEBUG_LINKER_FLAG("${adlf_linker_flag}")
-ENDMACRO(ADD_DEBUG_LINKER_FLAG)
-
-MACRO(ADD_RELEASE_LINKER_FLAG arlf_linker_flag)
- INTERNAL_ADD_RELEASE_LINKER_FLAG("${arlf_linker_flag}")
-ENDMACRO(ADD_RELEASE_LINKER_FLAG)
-
-MACRO(ADD_FILE)
- INTERNAL_ADD_FILE(${ARGN})
-ENDMACRO(ADD_FILE)
-
-MACRO(ADD_OPTIONAL_FILE aoc_name)
- INTERNAL_ADD_OPTIONAL_FILE("${aoc_name}" "${ARGN}")
-ENDMACRO(ADD_OPTIONAL_FILE)
-
-MACRO(LINK_LIBRARY ll_name)
- INTERNAL_LINK_LIBRARY("${ll_name}" ${ARGN})
-ENDMACRO(LINK_LIBRARY ll_name)
-
-MACRO(LINK_LIBRARY_GROUP llg_name)
- INTERNAL_LINK_LIBRARY_GROUP("${llg_name}" ${ARGN})
-ENDMACRO(LINK_LIBRARY_GROUP)
-
-MACRO(ADD_INSTALL_FILE)
- INTERNAL_ADD_INSTALL_FILE("${ARGN}")
-ENDMACRO(ADD_INSTALL_FILE)
-
-MACRO(JUST_DOIT)
- INTERNAL_JUST_DOIT()
-ENDMACRO(JUST_DOIT)
-
-MACRO(INSTALL_MODULE)
- INTERNAL_INSTALL_MODULE("${ARGN}")
-ENDMACRO(INSTALL_MODULE)
-
-MACRO(INSTALL_RESOURCES)
- INTERNAL_INSTALL_RESOURCES("${ARGN}")
-ENDMACRO(INSTALL_RESOURCES)
-
-MACRO(FINALIZE)
- INTERNAL_FINALIZE()
-ENDMACRO()
-
-MACRO(REPORT)
- INTERNAL_REPORT()
-ENDMACRO(REPORT)
-
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/internal/config.cmake b/binding-cpp/runtime/lib/capu/cmake/acme/internal/config.cmake
deleted file mode 100644
index f77091b..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/acme/internal/config.cmake
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-SET(HEADER_FILE_EXTENSIONS "h;hpp;inc" CACHE STRING "file extension of header files.")
-SET(SOURCE_FILE_EXTENSIONS "cpp;c" CACHE STRING "file extension of source files.")
-
-SET(BUILD_UNITTESTS 1 CACHE BOOL "Building Unit-Tests")
-IF(NOT DEFINED THIRD_PARTY_DIR)
- SET(THIRD_PARTY_DIR ${PROJECT_SOURCE_DIR}/3psw)
-ENDIF()
-
-IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- SET(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/deliverable/${CMAKE_PROJECT_NAME}" CACHE PATH "Install prefix" FORCE )
-ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
-
-SET(CMAKE_CMAKE_OUTPUT_DIRECTORY "${CMAKE_INSTALL_PREFIX}/cmake" CACHE INTERNAL "Path to store information for external use of the project.")
-SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib/${TARGET_OS}_${TARGET_ARCH}" CACHE INTERNAL "Path to store library files.")
-SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib/${TARGET_OS}_${TARGET_ARCH}" CACHE INTERNAL "Path to store archive files.")
-SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_INSTALL_PREFIX}/bin/${TARGET_OS}_${TARGET_ARCH}" CACHE INTERNAL "Path to store executable files.")
-SET(CMAKE_HEADER_OUTPUT_DIRECTORY "${CMAKE_INSTALL_PREFIX}/include" CACHE INTERNAL "Path to store public header files.")
-SET(CMAKE_RESOURCE_OUTPUT_DIRECTORY "${CMAKE_INSTALL_PREFIX}/res" CACHE INTERNAL "Path to store resource files.")
-SET(CMAKE_DOC_OUTPUT_DIRECTORY "${CMAKE_INSTALL_PREFIX}/doc" CACHE INTERNAL "Path to store documentation files.")
-
-
-SET(GLOBAL_EXTERN_INCLUDE_DIRS "" CACHE INTERNAL "collect extern include dirs")
-SET(BUILD_GLOBAL_TEST_EXECUTABLE 0 CACHE BOOL "Enable building of one test executable")
-SET(GLOBAL_TEST_LIBS "" CACHE INTERNAL "collect test libs")
-SET(GLOBAL_TEST_SOURCE "" CACHE INTERNAL "collect test source")
-SET(GLOBAL_TEST_INCLUDE_DIRECTORIES "" CACHE INTERNAL "collect test include directories")
-
-SET(GLOBAL_TEST_DEBUG_COMPILER_FLAGS "" CACHE INTERNAL "collect test compiler flags")
-SET(GLOBAL_TEST_DEBUG_LINKER_FLAGS "" CACHE INTERNAL "collect test linker flags")
-SET(GLOBAL_TEST_DEBUG_DEFINITIONS "" CACHE INTERNAL "collect test defintions")
-SET(GLOBAL_TEST_RELEASE_COMPILER_FLAGS "" CACHE INTERNAL "collect test compiler flags")
-SET(GLOBAL_TEST_RELEASE_LINKER_FLAGS "" CACHE INTERNAL "collect test linker flags")
-SET(GLOBAL_TEST_RELEASE_DEFINITIONS "" CACHE INTERNAL "collect test defintions")
-
-SET(GLOBAL_TEST_LINKER_DIRECTORIES "" CACHE INTERNAL "collect test linker directories")
-#SET(GLOBAL_INCLUDE_DIRECTORIES "" CACHE INTERNAL "collect include directories")
-SET(GLOBAL_LIB_DIRECTORIES "" CACHE INTERNAL "collect lib directories")
-SET(GLOBAL_LIBRARIES "" CACHE INTERNAL "collect all linkable libraries")
-
-SET(UTILS_MODULES_STATIC "" CACHE INTERNAL "")
-SET(UTILS_MODULES_DYNAMIC "" CACHE INTERNAL "")
-SET(UTILS_MODULES_EXE "" CACHE INTERNAL "")
-SET(UTILS_MODULES_TESTS "" CACHE INTERNAL "")
-
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/internal/macros.cmake b/binding-cpp/runtime/lib/capu/cmake/acme/internal/macros.cmake
deleted file mode 100644
index 8ea7dfc..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/acme/internal/macros.cmake
+++ /dev/null
@@ -1,1060 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Split arguments passed to a function into several lists separated by
-# specified identifiers that do not have an associated list e.g.:
-#
-# SET(arguments
-# hello world
-# LIST3 foo bar
-# LIST1 fuz baz
-# )
-# ARGUMENT_SPLITTER("${arguments}" "LIST1 LIST2 LIST3" ARG)
-#
-# results in 8 distinct variables:
-# * ARG_DEFAULT_FOUND: 1
-# * ARG_DEFAULT: hello;world
-# * ARG_LIST1_FOUND: 1
-# * ARG_LIST1: fuz;baz
-# * ARG_LIST2_FOUND: 0
-# * ARG_LIST2:
-# * ARG_LIST3_FOUND: 1
-# * ARG_LIST3: foo;bar
-
-MACRO(INTERNAL_ARGUMENT_SPLITTER argInput argKeywordList argPrefix)
-
- SET(inputTokenList "DEFAULT" "${argInput}")
- SET(keywordList "DEFAULT ${argKeywordList}")
- SET(prefix ${argPrefix})
-
- # convert provided inputTokenList to list
- #SEPARATE_ARGUMENTS(inputTokenList)
- SEPARATE_ARGUMENTS(keywordList)
-
- # initialize all out variables to default values
- FOREACH(keyword ${keywordList})
- SET(${prefix}_${keyword}_FOUND 0)
- SET(${prefix}_${keyword} "")
- ENDFOREACH(keyword)
-
- # iterate all tokens of provided input
- FOREACH(token ${inputTokenList})
- # check if current token is a keyword
- SET(tokenIsKeyword 0)
- FOREACH(keyword ${keywordList})
- IF ("${keyword}" STREQUAL "${token}")
- SET(tokenIsKeyword 1)
- SET(lastKeyword ${keyword})
- ENDIF ("${keyword}" STREQUAL "${token}")
- ENDFOREACH(keyword)
-
- IF (${tokenIsKeyword})
- # if current token is keyword, set found variable to true
- SET(${prefix}_${token}_FOUND 1)
- ELSE (${tokenIsKeyword})
- # if current token is not keyword, append token to variable of last found keyword
- SET(${prefix}_${lastKeyword} ${${prefix}_${lastKeyword}} ${token})
- ENDIF (${tokenIsKeyword})
-
-
- ENDFOREACH(token)
-ENDMACRO(INTERNAL_ARGUMENT_SPLITTER)
-
-#MACRO(INTERNAL_ADD_OS_SUPPORT os)
-# SET(SUPPORTED_OS ${os} ${ARGN})
-# SET(TARGET_OS ${os} CACHE STRINGS "Select target OS")
-# SET_PROPERTY(CACHE TARGET_OS PROPERTY STRINGS ${SUPPORTED_OS})
-#ENDMACRO(INTERNAL_ADD_OS_SUPPORT)
-
-MACRO(INTERNAL_ADD_PREFIX var prefix)
- SET(${var})
- IF(NOT "${ARGN}" STREQUAL "")
- FOREACH(item ${ARGN})
- SET(${var} ${${var}} ${prefix}${item})
- ENDFOREACH(item)
- ENDIF(NOT "${ARGN}" STREQUAL "")
-ENDMACRO(INTERNAL_ADD_PREFIX)
-
-
-MACRO(INTERNAL_SPLIT_PATH_AND_FILE file_with_path path filename)
- GET_FILENAME_COMPONENT(${path} ${file_with_path} PATH)
- IF(NOT "${${path}}" STREQUAL "")
- SET(${path} "${${path}}/")
- ENDIF()
- GET_FILENAME_COMPONENT(${filename} ${file_with_path} NAME)
-ENDMACRO(INTERNAL_SPLIT_PATH_AND_FILE)
-
-
-MACRO(INTERNAL_GET_MODULE_NAME var)
- GET_FILENAME_COMPONENT(${var} ${CMAKE_CURRENT_SOURCE_DIR} NAME)
-ENDMACRO(INTERNAL_GET_MODULE_NAME)
-
-
-MACRO(INTERNAL_GET_PUBLIC_INCLUDE_PATH var)
- INTERNAL_GET_MODULE_NAME(gpip_module_name)
- INTERNAL_GET_INTERN_INCLUDE_PATH(gpip_include_path)
- SET(${var} "${gpip_include_path}/${gpip_module_name}")
-ENDMACRO(INTERNAL_GET_PUBLIC_INCLUDE_PATH)
-
-
-MACRO(INTERNAL_GET_INTERN_INCLUDE_PATH var)
- SET(${var} ${CMAKE_CURRENT_SOURCE_DIR}/include)
-ENDMACRO(INTERNAL_GET_INTERN_INCLUDE_PATH)
-
-
-MACRO(INTERNAL_GET_PLATFORM_INCLUDE_PATH var gpi_classname)
- INTERNAL_SPLIT_PATH_AND_FILE(${gpi_classname} gpi_path gpi_filename)
- INTERNAL_GET_INTERN_INCLUDE_PATH(gpi_include_path)
- #IF(NOT "${gpi_path}" STREQUAL "")
- SET(${var} "${gpi_include_path}/${CURRENT_MODULE_NAME}/${gpi_path}arch")
- #ELSE()
- # SET(${var} "${gpi_include_path}/${CURRENT_MODULE_NAME}/arch")
- #ENDIF()
-
-ENDMACRO(INTERNAL_GET_PLATFORM_INCLUDE_PATH)
-
-
-MACRO(INTERNAL_GET_SOURCE_PATH var)
- SET(${var} ${CMAKE_CURRENT_SOURCE_DIR}/src)
-ENDMACRO(INTERNAL_GET_SOURCE_PATH)
-
-
-MACRO(INTERNAL_GET_PLATFORM_SOURCE_PATH var gps_classname)
-# INTERNAL_GET_SOURCE_PATH(gps_source_path)
-# SET(${var} "${gps_source_path}/arch")
-
- INTERNAL_SPLIT_PATH_AND_FILE(${gps_classname} gps_path gps_filename)
- INTERNAL_GET_SOURCE_PATH(gps_source_path)
- SET(${var} "${gps_source_path}/${gps_path}arch")
-ENDMACRO(INTERNAL_GET_PLATFORM_SOURCE_PATH)
-
-
-MACRO(INTERNAL_GET_TEST_PATH var)
- SET(${var} ${CMAKE_CURRENT_SOURCE_DIR}/test)
-ENDMACRO(INTERNAL_GET_TEST_PATH)
-
-
-MACRO(INTERNAL_GET_PATH_TO_FILES gsp_class)
- INTERNAL_ARGUMENT_SPLITTER("${ARGN}" "PREFIX" GSP)
- INTERNAL_SPLIT_PATH_AND_FILE(${gsp_class} GSP_PATH_TO_FILE GSP_FILENAME)
-
- STRING(TOUPPER ${GSP_FILENAME} gsp_varname)
- IF(NOT "${GSP_PREFIX}" STREQUAL "")
- SET(gsp_varname ${GSP_PREFIX})
- #ELSEIF(NOT "${GSP_PLATFORM}" STREQUAL "")
- # STRING(TOUPPER ${GSP_PLATFORM} gsp_platform_varname)
- # SET(gsp_varname ${gsp_platform_varname}${gsp_varname})
-
- ENDIF()
-
- SET(gsp_all_classes ${gsp_class} ${GSP_DEFAULT_ARGS})
-
- SET(${gsp_varname}_PUBLIC_HEADER)
- SET(${gsp_varname}_INTERN_HEADER)
- SET(${gsp_varname}_SOURCE_FILES)
-
- FOREACH(gsp_current_class ${gsp_all_classes})
-
- INTERNAL_GET_PUBLIC_INCLUDE_PATH( gsp_public_include_path )
-
- FOREACH(gsp_current_header_type ${HEADER_FILE_EXTENSIONS})
- SET(gsp_public_include_file "${gsp_public_include_path}/${gsp_current_class}.${gsp_current_header_type}" )
-
- IF(EXISTS ${gsp_public_include_file})
- SET(${gsp_varname}_PUBLIC_HEADER ${${gsp_varname}_PUBLIC_HEADER} ${gsp_public_include_file})
- ENDIF()
-
- INTERNAL_GET_PLATFORM_INCLUDE_PATH( gsp_platform_include_path "${gsp_current_class}" )
- SET(gsp_generic_include_file "${gsp_platform_include_path}/${GSP_FILENAME}.${gsp_current_header_type}" )
-
- IF(EXISTS ${gsp_generic_include_file})
- SET(${gsp_varname}_PUBLIC_HEADER ${${gsp_varname}_PUBLIC_HEADER} ${gsp_generic_include_file})
- ENDIF()
-
- INTERNAL_GET_INTERN_INCLUDE_PATH( gsp_intern_include_path )
- SET(gsp_intern_include_file "${gsp_intern_include_path}/${gsp_current_class}.${gsp_current_header_type}" )
- IF(EXISTS ${gsp_intern_include_file})
- SET(${gsp_varname}_INTERN_HEADER ${${gsp_varname}_INTERN_HEADER} ${gsp_intern_include_file})
- ELSE()
- SET(gsp_intern_include_files "${gsp_platform_include_path}/${TARGET_OS}/${GSP_FILENAME}.${gsp_current_header_type}" "${gsp_platform_include_path}/${TARGET_OS}_${TARGET_ARCH}/${GSP_FILENAME}.${gsp_current_header_type}")
- FOREACH(gsp_intern_include_file ${gsp_intern_include_files})
- IF(EXISTS ${gsp_intern_include_file})
- SET(${gsp_varname}_INTERN_HEADER ${${gsp_varname}_INTERN_HEADER} ${gsp_intern_include_file})
- ENDIF()
- ENDFOREACH()
- ENDIF()
- ENDFOREACH()
-
- FOREACH(gsp_current_source_type ${SOURCE_FILE_EXTENSIONS})
- INTERNAL_GET_SOURCE_PATH(gsp_source_path)
- SET(gsp_source_file "${gsp_source_path}/${gsp_current_class}.${gsp_current_source_type}" )
- IF(EXISTS ${gsp_source_file})
- SET(${gsp_varname}_SOURCE_FILES ${${gsp_varname}_SOURCE_FILES} ${gsp_source_file})
- ELSE()
- INTERNAL_GET_PLATFORM_SOURCE_PATH(gsp_platform_source_path "${gsp_current_class}")
- SET(gsp_source_files "${gsp_platform_source_path}/${TARGET_OS}/${GSP_FILENAME}.${gsp_current_source_type}" "${gsp_platform_source_path}/${TARGET_OS}_${TARGET_ARCH}/${GSP_FILENAME}.${gsp_current_source_type}")
- FOREACH(gsp_source_file ${gsp_source_files})
- IF(EXISTS ${gsp_source_file})
- SET(${gsp_varname}_SOURCE_FILES ${${gsp_varname}_SOURCE_FILES} ${gsp_source_file})
- ENDIF()
- ENDFOREACH()
- ENDIF()
- ENDFOREACH()
-
- INTERNAL_GET_TEST_PATH( gsp_test_path )
- SET(gsp_test_header "${gsp_test_path}/${gsp_current_class}Test.h")
- SET(gsp_test_source "${gsp_test_path}/${gsp_current_class}Test.cpp")
-
- IF(EXISTS ${gsp_test_header})
- SET(${gsp_varname}_TEST_FILES ${${gsp_varname}_TEST_FILES} ${gsp_test_header})
- ENDIF()
-
- IF(EXISTS ${gsp_test_source})
- SET(${gsp_varname}_TEST_FILES ${${gsp_varname}_TEST_FILES} ${gsp_test_source})
- ENDIF()
-
- ENDFOREACH()
-
-ENDMACRO(INTERNAL_GET_PATH_TO_FILES)
-
-
-MACRO(INTERNAL_ADD_FILE ac_name)
- INTERNAL_ARGUMENT_SPLITTER("${ARGN}" "SOURCE_VAR TEST_VAR SOURCE_GROUP PREFIX CONDITIONS" AC)
-
- SET(ADD_FILE_CONDITIONS_MET 1)
- FOREACH(CONDITION ${AC_CONDITIONS})
- IF (NOT ${CONDITION})
- MESSAGE(STATUS "Excluded class ${ac_name}, condition ${CONDITION} failed")
- SET(ADD_FILE_CONDITIONS_MET 0)
- ENDIF()
- ENDFOREACH()
-
- IF(${ADD_FILE_CONDITIONS_MET})
-
- SET(ac_all_classes ${ac_name} ${AC_DEFAULT_ARGS})
-
- IF("${AC_PREFIX}" STREQUAL "")
- INTERNAL_SPLIT_PATH_AND_FILE(${ac_name} ac_path ac_filename)
-
- STRING(TOUPPER ${ac_filename} ac_varname)
- SET(AC_PREFIX ${ac_varname})
- ENDIF()
-
- INTERNAL_GET_PATH_TO_FILES(${ac_all_classes} PREFIX ${AC_PREFIX})
- IF(NOT "${${AC_PREFIX}_SOURCE_FILES}" STREQUAL "")
- SET(${CURRENT_MODULE_NAME}_HAS_SOURCE_FILES 1 CACHE INTERNAL "")
- ENDIF()
-
- IF(NOT "${AC_SOURCE_GROUP}" STREQUAL "")
- SET(${AC_SOURCE_GROUP} ${${AC_SOURCE_GROUP}} ${${AC_PREFIX}_INTERN_HEADER} ${${AC_PREFIX}_SOURCE_FILES})
- ENDIF()
-
- IF(NOT "${AC_SOURCE_VAR}" STREQUAL "")
- SET(${AC_SOURCE_VAR} ${${AC_SOURCE_VAR}} ${${AC_PREFIX}_PUBLIC_HEADER} ${${AC_PREFIX}_INTERN_HEADER} ${${AC_PREFIX}_SOURCE_FILES})
- ELSE()
- SET(${CURRENT_UPPER_MODULE_NAME}_MODULE_SOURCE_FILES ${${CURRENT_UPPER_MODULE_NAME}_MODULE_SOURCE_FILES} ${${AC_PREFIX}_PUBLIC_HEADER} ${${AC_PREFIX}_INTERN_HEADER} ${${AC_PREFIX}_SOURCE_FILES})
- ENDIF()
-
- IF(NOT "${AC_TEST_VAR}" STREQUAL "")
- SET(${AC_TEST_VAR} ${${AC_TEST_VAR}} ${${AC_PREFIX}_TEST_FILES})
- ELSE()
- SET(${CURRENT_MODULE_NAME}_TEST_FILES ${${CURRENT_MODULE_NAME}_TEST_FILES} ${${AC_PREFIX}_TEST_FILES})
- ENDIF()
-
- ENDIF()
-
-ENDMACRO(INTERNAL_ADD_FILE)
-
-
-MACRO(INTERNAL_ADD_OPTIONAL_FILE aoc_name)
- INTERNAL_ARGUMENT_SPLITTER("${ARGN}" "SOURCE_VAR SOURCE_GROUP PREFIX CONDITIONS" AOC)
- IF("${AOC_PREFIX}" STREQUAL "")
- INTERNAL_SPLIT_PATH_AND_FILE(${aoc_name} aoc_path aoc_filename)
- STRING(TOUPPER ${aoc_filename} aoc_varname)
- SET(AOC_PREFIX ${aoc_varname})
- ENDIF()
-
- SET(aoc_temp_files)
- set(aoc_temp_test)
-
- INTERNAL_ADD_FILE(${aoc_name} ${AOC_DEFAULT_ARGS} SOURCE_VAR aoc_temp_files TEST_VAR aoc_temp_test SOURCE_GROUP ${AOC_SOURCE_GROUP} PREFIX ${AOC_PREFIX} CONDITIONS ${AOC_CONDITIONS})
- INTERNAL_ADD_OPTIONAL_FILES(${CURRENT_UPPER_MODULE_NAME}_${AOC_PREFIX} SOURCE_FILES ${aoc_temp_files} TEST_FILES ${aoc_temp_test})
-
- SET(${CURRENT_UPPER_MODULE_NAME}_SOURCE_FILES ${${CURRENT_UPPER_MODULE_NAME}_MODULE_SOURCE_FILES} ${${CURRENT_UPPER_MODULE_NAME}_${AOC_PREFIX}_SOURCE_FILES})
- SET(${CURRENT_MODULE_NAME}_TEST_FILES ${${CURRENT_MODULE_NAME}_TEST_FILES} ${${CURRENT_UPPER_MODULE_NAME}_${AOC_PREFIX}_TEST_FILES})
-ENDMACRO(INTERNAL_ADD_OPTIONAL_FILE)
-
-
-MACRO(INTERNAL_ADD_SOURCE_FILES destination)
- INTERNAL_ARGUMENT_SPLITTER("${ARGN}" "PUBLIC_HEADER INTERN_HEADER SOURCE_FILES" ARG)
- SET(${destination} ${${destination}} ${ARG_PUBLIC_HEADER} ${ARG_INTERN_HEADER} ${ARG_SOURCE_FILES})
-ENDMACRO(INTERNAL_ADD_SOURCE_FILES)
-
-
-MACRO(INTERNAL_ADD_OPTIONAL_FILES prefix)
- INTERNAL_ARGUMENT_SPLITTER("${ARGN}" "SOURCE_FILES TEST_FILES" AOF)
-
- SET(${prefix}_ENABLE "on" CACHE BOOL "Enable ${prefix}" )
- SET(${prefix}_SOURCE_FILES)
- SET(${prefix}_TEST_FILES)
-
- IF(${WITH_${CURRENT_UPPER_MODULE_NAME}})
- IF(${${prefix}_ENABLE})
- SET(${prefix}_SOURCE_FILES ${AOF_SOURCE_FILES})
- SET(${prefix}_TEST_FILES ${AOF_TEST_FILES})
- ENDIF()
- ELSE()
- INTERNAL_REMOVE_OPTIONAL_FILES(${prefix})
- ENDIF()
-ENDMACRO(INTERNAL_ADD_OPTIONAL_FILES)
-
-
-MACRO(INTERNAL_ADD_DEPENDENCY ad_name)
-
- IF("${ad_name}_FOUND")
-
- SET(${CURRENT_MODULE_NAME}_DEPENDENCIES ${${CURRENT_MODULE_NAME}_DEPENDENCIES} ${ad_name} ${${ad_name}_DEPENDENCIES} CACHE INTERNAL "")
-
- FOREACH(iad_dependency ${${ad_name}_DEPENDENCIES})
- INTERNAL_ADD_DEFINITION("${${iad_dependency}_DEPENDENT_DEFINITIONS}")
- INTERNAL_ADD_DEBUG_DEFINITION("${${iad_dependency}_DEPENDENT_DEBUG_DEFINITIONS}")
- INTERNAL_ADD_RELEASE_DEFINITION("${${iad_dependency}_DEPENDENT_RELEASE_DEFINITIONS}")
- ENDFOREACH()
-
- INTERNAL_ADD_DEFINITION("${${ad_name}_DEPENDENT_DEFINITIONS}")
- INTERNAL_ADD_DEBUG_DEFINITION("${${ad_name}_DEPENDENT_DEBUG_DEFINITIONS}")
- INTERNAL_ADD_RELEASE_DEFINITION("${${ad_name}_DEPENDENT_RELEASE_DEFINITIONS}")
-
- ELSE()
- MESSAGE(STATUS "WARNING: Required package '${ad_name}' was not found.")
- MESSAGE(STATUS "WARNING: Build of '${CURRENT_MODULE_NAME}' was disabled.")
- MESSAGE(STATUS "WARNING: Install package '${ad_name}' to enable build of '${CURRENT_MODULE_NAME}'.")
- SET(${CURRENT_MODULE_NAME}_BUILD_ENABLED 0)
- ENDIF()
-
-
- #SET(${CURRENT_MODULE_NAME}_DEPENDENCIES ${${CURRENT_MODULE_NAME}_DEPENDENCIES} ${ad_name})
-ENDMACRO(INTERNAL_ADD_DEPENDENCY)
-
-MACRO(INTERNAL_LINK_LIBRARY ill_library)
-
- #LIST(FIND GLOBAL_LIBRARIES ${ill_library} FOUND_LIBRARY)
-
- #IF(${FOUND_LIBRARY} EQUAL -1)
- # MESSAGE(FATAL_ERROR "You tried to link against the unknown lib ${ill_library}")
- #ENDIF()
- SET(${CURRENT_MODULE_NAME}_LIBRARIES ${${CURRENT_MODULE_NAME}_LIBRARIES} ${ill_library} ${ARGN} "" CACHE INTERNAL "")
-ENDMACRO(INTERNAL_LINK_LIBRARY)
-
-MACRO(INTERNAL_LINK_LIBRARY_GROUP illg_library)
- SET(${CURRENT_MODULE_NAME}_LIBRARIES ${${CURRENT_MODULE_NAME}_LIBRARIES} ${illg_library} ${ARGN})
-
- INTERNAL_GROUP_LINK(${CURRENT_MODULE_NAME}_LIBRARIES ${${CURRENT_MODULE_NAME}_LIBRARIES})
-
-ENDMACRO(INTERNAL_LINK_LIBRARY_GROUP)
-
-MACRO(INTERNAL_GROUP_LINK igl_libs)
- IF("${TARGET_COMPILER}" STREQUAL "GCC")
- SET(${igl_libs} "-Wl,--start-group" ${ARGN} "-Wl,--end-group")
- ENDIF()
-ENDMACRO(INTERNAL_GROUP_LINK)
-
-
-MACRO(INTERNAL_JUST_DOIT)
- IF(${WITH_${CURRENT_UPPER_MODULE_NAME}} AND ${${CURRENT_MODULE_NAME}_BUILD_ENABLED})
-
- INTERNAL_GET_INTERN_INCLUDE_PATH(asl_intern_include_path)
-
- INCLUDE_DIRECTORIES(${asl_intern_include_path})
-
- SET(jd_collected_dependencies "${${CURRENT_MODULE_NAME}_PACKAGE_LIBS}" "${${CURRENT_MODULE_NAME}_LIBRARIES}")
-
- SET(jdi_include_dirs "")
- FOREACH(dependency ${${CURRENT_MODULE_NAME}_DEPENDENCIES})
- IF(EXISTS "${PROJECT_SOURCE_DIR}/modules/${dependency}/include")
- SET(jdi_include_dirs ${jdi_include_dirs} "${PROJECT_SOURCE_DIR}/modules/${dependency}/include")
- ELSEIF(DEFINED ${dependency}_INCLUDE_DIR)
- SET(jdi_include_dirs ${jdi_include_dirs} "${${dependency}_INCLUDE_DIR}")
- SET(GLOBAL_EXTERN_INCLUDE_DIRS ${GLOBAL_EXTERN_INCLUDE_DIRS} "${${dependency}_INCLUDE_DIR}" CACHE INTERNAL "collect extern include dirs")
- ELSE()
- MESSAGE(FATAL_ERROR "Added unknown dependency ${dependency}")
- ENDIF()
- ENDFOREACH()
-
-
-
- IF(${${CURRENT_MODULE_NAME}_HAS_SOURCE_FILES})
-
- #FOREACH(dependency ${${CURRENT_MODULE_NAME}_DEPENDENCIES})
- # SET(jd_dependency_linker_dirs ${jd_dependency_linker_dirs} "${${dependency}_LIBRARIES_DIR}")
- # ENDFOREACH()
-
-# IF(NOT "${jd_dependency_linker_dirs}" STREQUAL "")
-# LIST(REMOVE_DUPLICATES jd_dependency_linker_dirs)
-# ENDIF()
- LINK_DIRECTORIES(${GLOBAL_LIB_DIRECTORIES})
-
-
-
-
- IF(${CURRENT_MODULE_TYPE} STREQUAL "STATIC")
- SET(UTILS_MODULES_STATIC ${UTILS_MODULES_STATIC} ${CURRENT_MODULE_NAME} CACHE INTERNAL "")
- ADD_LIBRARY(${CURRENT_MODULE_NAME}
- STATIC
- ${${CURRENT_UPPER_MODULE_NAME}_MODULE_SOURCE_FILES}
- )
- SET(GLOBAL_LIBRARIES ${GLOBAL_LIBRARIES} ${CURRENT_MODULE_NAME} CACHE INTERNAL "collect all linkable libraries")
- ELSEIF(${CURRENT_MODULE_TYPE} STREQUAL "DYNAMIC")
- SET(UTILS_MODULES_DYNAMIC ${UTILS_MODULES_DYNAMIC} ${CURRENT_MODULE_NAME} CACHE INTERNAL "")
- ADD_LIBRARY(${CURRENT_MODULE_NAME}
- SHARED
- ${${CURRENT_UPPER_MODULE_NAME}_MODULE_SOURCE_FILES}
- )
- ELSEIF(${CURRENT_MODULE_TYPE} STREQUAL "EXE")
- SET(UTILS_MODULES_EXE ${UTILS_MODULES_EXE} ${CURRENT_MODULE_NAME} CACHE INTERNAL "")
- ADD_EXECUTABLE(${CURRENT_MODULE_NAME}
- ${${CURRENT_UPPER_MODULE_NAME}_MODULE_SOURCE_FILES}
- )
- ENDIF()
-
- INTERNAL_ADD_DEBUG_COMPILER_FLAGS_TO_TARGET(${CURRENT_MODULE_NAME} ${${CURRENT_MODULE_NAME}_DEBUG_COMPILER_FLAGS})
- INTERNAL_ADD_RELEASE_COMPILER_FLAGS_TO_TARGET(${CURRENT_MODULE_NAME} ${${CURRENT_MODULE_NAME}_RELEASE_COMPILER_FLAGS})
-
- INTERNAL_ADD_DEBUG_LINKER_FLAGS_TO_TARGET(${CURRENT_MODULE_NAME} ${${CURRENT_MODULE_NAME}_DEBUG_LINKER_FLAGS})
- INTERNAL_ADD_RELEASE_LINKER_FLAGS_TO_TARGET(${CURRENT_MODULE_NAME} ${${CURRENT_MODULE_NAME}_RELEASE_LINKER_FLAGS})
-
- INTERNAL_ADD_DEBUG_DEFINITIONS_TO_TARGET(${CURRENT_MODULE_NAME} ${${CURRENT_MODULE_NAME}_DEBUG_DEFINITIONS})
- INTERNAL_ADD_RELEASE_DEFINITIONS_TO_TARGET(${CURRENT_MODULE_NAME} ${${CURRENT_MODULE_NAME}_RELEASE_DEFINITIONS})
-
- INCLUDE_DIRECTORIES(${jdi_include_dirs})
-
-
- IF(NOT "${${CURRENT_MODULE_NAME}_DEPENDENCIES}" STREQUAL "")
- # FOREACH(current_dependency ${${CURRENT_MODULE_NAME}_DEPENDENCIES})
- # IF((${${current_dependency}_HAS_SOURCE_FILES}) AND NOT( "${${current_dependency}_MODULE_TYPE}" STREQUAL "EXE"))
- # SET(jd_collected_dependencies ${jd_collected_dependencies} "${current_dependency}")
- # ELSEIF(DEFINED ${current_dependency}_LIBRARIES)
- # SET(jd_collected_dependencies ${jd_collected_dependencies} ${current_dependency})
- # ENDIF()
- # ENDFOREACH()
- ADD_DEPENDENCIES(${CURRENT_MODULE_NAME} ${${CURRENT_MODULE_NAME}_DEPENDENCIES})
- ENDIF()
-
- IF(NOT "${${CURRENT_MODULE_NAME}_LIBRARIES}" STREQUAL "" AND NOT "${CURRENT_MODULE_TYPE}" STREQUAL "STATIC")
- TARGET_LINK_LIBRARIES(${CURRENT_MODULE_NAME} ${${CURRENT_MODULE_NAME}_LIBRARIES} ${jd_collected_dependencies})
- ENDIF()
-
- SET_TARGET_PROPERTIES(${CURRENT_MODULE_NAME} PROPERTIES LINKER_LANGUAGE CXX)
- ELSE()
- ADD_CUSTOM_TARGET(${CURRENT_MODULE_NAME} SOURCES
- ${${CURRENT_UPPER_MODULE_NAME}_MODULE_SOURCE_FILES}
- )
- ENDIF()
-
- IF(NOT "${${CURRENT_MODULE_NAME}_TEST_FILES}" STREQUAL "")
- SET(UTILS_MODULES_TESTS ${UTILS_MODULES_TESTS} ${CURRENT_MODULE_NAME}Test CACHE INTERNAL "")
-
- SET(EXTERNAL_PACKAGE_LINK_DIRECTORIES "")
- FOREACH(current_dependency ${${CURRENT_MODULE_NAME}_DEPENDENCIES})
- IF(${${current_dependency}_HAS_SOURCE_FILES})
- SET(jd_collected_dependencies ${jd_collected_dependencies} ${current_dependency})
- ENDIF()
- IF(DEFINED ${current_dependency}_LIBRARIES_DIR)
- SET(EXTERNAL_PACKAGE_LINK_DIRECTORIES ${EXTERNAL_PACKAGE_LINK_DIRECTORIES} "${${current_dependency}_LIBRARIES_DIR}")
- ENDIF()
- ENDFOREACH()
-
- IF(NOT "${jd_collected_dependencies}" STREQUAL "")
- list(REMOVE_DUPLICATES jd_collected_dependencies)
- ENDIF()
-
- IF(${BUILD_UNITTESTS})
-
- IF(${BUILD_GLOBAL_TEST_EXECUTABLE})
- #ADD_LIBRARY(${CURRENT_MODULE_NAME}Test STATIC ${${CURRENT_MODULE_NAME}_TEST_FILES})
- SET(GLOBAL_TEST_INCLUDE_DIRECTORIES ${GLOBAL_TEST_INCLUDE_DIRECTORIES} ${jdi_include_dirs} ${asl_intern_include_path} CACHE INTERNAL "collect test include directories")
- SET(GLOBAL_TEST_LIBS ${GLOBAL_TEST_LIBS} ${jd_collected_dependencies} CACHE INTERNAL "collect test libs")
- IF(${${CURRENT_MODULE_NAME}_HAS_SOURCE_FILES})
- SET(GLOBAL_TEST_LIBS ${GLOBAL_TEST_LIBS} ${CURRENT_MODULE_NAME} CACHE INTERNAL "collect test libs")
- ENDIF()
-
- SET(GLOBAL_TEST_SOURCE ${GLOBAL_TEST_SOURCE} ${${CURRENT_MODULE_NAME}_TEST_FILES} CACHE INTERNAL "collect test source")
- SET(GLOBAL_TEST_LINKER_DIRECTORIES ${GLOBAL_TEST_LINKER_DIRECTORIES} "${EXTERNAL_PACKAGE_LINK_DIRECTORIES}" CACHE INTERNAL "collect test linker directories")
-
- SET(GLOBAL_TEST_DEBUG_COMPILER_FLAGS ${GLOBAL_TEST_DEBUG_COMPILER_FLAGS} ${${CURRENT_MODULE_NAME}_DEBUG_COMPILER_FLAGS} CACHE INTERNAL "collect test compiler flags")
- SET(GLOBAL_TEST_RELEASE_COMPILER_FLAGS ${GLOBAL_TEST_RELEASE_COMPILER_FLAGS} ${${CURRENT_MODULE_NAME}_RELEASE_COMPILER_FLAGS} CACHE INTERNAL "collect test compiler flags")
-
- SET(GLOBAL_TEST_DEBUG_LINKER_FLAGS ${GLOBAL_TEST_DEBUG_LINKER_FLAGS} ${${CURRENT_MODULE_NAME}_DEBUG_LINKER_FLAGS} CACHE INTERNAL "collect test linker flags")
- SET(GLOBAL_TEST_RELEASE_LINKER_FLAGS ${GLOBAL_TEST_RELEASE_LINKER_FLAGS} ${${CURRENT_MODULE_NAME}_RELEASE_LINKER_FLAGS} CACHE INTERNAL "collect test linker flags")
-
- SET(GLOBAL_TEST_DEBUG_DEFINITIONS ${GLOBAL_TEST_DEBUG_DEFINITIONS} ${${CURRENT_MODULE_NAME}_DEBUG_DEFINITIONS} CACHE INTERNAL "collect test definitions")
- SET(GLOBAL_TEST_RELEASE_DEFINITIONS ${GLOBAL_TEST_RELEASE_DEFINITIONS} ${${CURRENT_MODULE_NAME}_RELEASE_DEFINITIONS} CACHE INTERNAL "collect test definitions")
-
- ELSE()
-
- IF(${${CURRENT_MODULE_NAME}_HAS_SOURCE_FILES})
- SET(jd_collected_dependencies ${jd_collected_dependencies} ${CURRENT_MODULE_NAME})
- ENDIF()
-
- INTERNAL_GET_TEST_PATH(jd_test_path)
- SET(${CURRENT_MODULE_NAME}_TEST_MAIN "")
- IF(EXISTS "${jd_test_path}/main.cpp")
- SET(${CURRENT_MODULE_NAME}_TEST_MAIN "${jd_test_path}/main.cpp")
- ELSE()
- SET(jd_collected_dependencies "${jd_collected_dependencies}" gtest_main gmock_main)
- ENDIF()
-
- LINK_DIRECTORIES(${GoogleTest_LIBRARIES_DIR} ${GoogleMock_LIBRARIES_DIR} ${EXTERNAL_PACKAGE_LINK_DIRECTORIES})
- ADD_EXECUTABLE(${CURRENT_MODULE_NAME}Test ${${CURRENT_MODULE_NAME}_TEST_FILES} ${${CURRENT_MODULE_NAME}_TEST_MAIN})
-
- INTERNAL_ADD_DEBUG_COMPILER_FLAGS_TO_TARGET(${CURRENT_MODULE_NAME}Test ${${CURRENT_MODULE_NAME}_DEBUG_COMPILER_FLAGS})
- INTERNAL_ADD_RELEASE_COMPILER_FLAGS_TO_TARGET(${CURRENT_MODULE_NAME}Test ${${CURRENT_MODULE_NAME}_RELEASE_COMPILER_FLAGS})
-
- INTERNAL_ADD_DEBUG_LINKER_FLAGS_TO_TARGET(${CURRENT_MODULE_NAME}Test ${${CURRENT_MODULE_NAME}_DEBUG_LINKER_FLAGS})
- INTERNAL_ADD_RELEASE_LINKER_FLAGS_TO_TARGET(${CURRENT_MODULE_NAME}Test ${${CURRENT_MODULE_NAME}_RELEASE_LINKER_FLAGS})
-
- INTERNAL_ADD_DEBUG_DEFINITIONS_TO_TARGET(${CURRENT_MODULE_NAME}Test ${${CURRENT_MODULE_NAME}_DEBUG_DEFINITIONS})
- INTERNAL_ADD_RELEASE_DEFINITIONS_TO_TARGET(${CURRENT_MODULE_NAME}Test ${${CURRENT_MODULE_NAME}_RELEASE_DEFINITIONS})
-
- INCLUDE_DIRECTORIES(${GoogleTest_INCLUDE_DIR} ${GoogleMock_INCLUDE_DIR} ${jdi_include_dirs})
- MESSAGE(STATUS "${CURRENT_MODULE_NAME} contains unit tests, building ${CURRENT_MODULE_NAME}Test")
-
- INTERNAL_GROUP_LINK(jd_collected_dependencies ${jd_collected_dependencies})
-
- TARGET_LINK_LIBRARIES(${CURRENT_MODULE_NAME}Test ${GoogleMock_LIBRARIES} ${GoogleTest_LIBRARIES} ${jd_collected_dependencies})
- ADD_DEPENDENCIES(${CURRENT_MODULE_NAME}Test GoogleMock ${CURRENT_MODULE_NAME})
-
- ENDIF()
-
- ENDIF()
-
- ENDIF()
-
- # copy header files
-
- IF(EXISTS "${${CURRENT_MODULE_NAME}_DIR}/include/${CURRENT_MODULE_NAME}")
- INSTALL(DIRECTORY ${${CURRENT_MODULE_NAME}_DIR}/include/${CURRENT_MODULE_NAME} DESTINATION "${CMAKE_HEADER_OUTPUT_DIRECTORY}/${CMAKE_PROJECT_NAME}" PATTERN ".svn" EXCLUDE)
- ENDIF()
-
- # copy resource files
-
- FILE(GLOB_RECURSE jdi_ressource_files "${${CURRENT_MODULE_NAME}_DIR}/res/*.*")
- FILE(GLOB_RECURSE jdi_exclude_files "${${CURRENT_MODULE_NAME}_DIR}/res/.svn/*")
- IF(NOT "${jdi_exclude_files}" STREQUAL "")
- LIST(REMOVE_ITEM jdi_ressource_files ${jdi_exclude_files})
- ENDIF()
- INSTALL(FILES ${jdi_ressource_files} DESTINATION "${CMAKE_RESOURCE_OUTPUT_DIRECTORY}/${CURRENT_MODULE_NAME}")
-
- # copy doc files
-
- FILE(GLOB_RECURSE jdi_doc_files "${${CURRENT_MODULE_NAME}_DIR}/doc/*.*")
- FILE(GLOB_RECURSE jdi_exclude_files "${${CURRENT_MODULE_NAME}_DIR}/doc/.svn/*")
- IF(NOT "${jdi_exclude_files}" STREQUAL "")
- LIST(REMOVE_ITEM jdi_doc_files ${jdi_exclude_files})
- ENDIF()
- INSTALL(FILES ${jdi_doc_files} DESTINATION "${CMAKE_DOC_OUTPUT_DIRECTORY}/${CURRENT_MODULE_NAME}")
-
- IF(NOT "${${CURRENT_MODULE_NAME}_INSTALL_FILES}" STREQUAL "")
- INSTALL(FILES ${${CURRENT_MODULE_NAME}_INSTALL_FILES} DESTINATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/\${BUILD_TYPE}")
- ENDIF()
-
- ENDIF()
-ENDMACRO(INTERNAL_JUST_DOIT)
-
-#MACRO(INTERNAL_ADD_COMPILER_FLAGS_TO_TARGET acf_target acf_flags)
-# SET_TARGET_PROPERTIES(${acf_target} PROPERTIES COMPILE_FLAGS "${acf_flags}" )
-#ENDMACRO(INTERNAL_ADD_COMPILER_FLAGS_TO_TARGET)
-
-#MACRO(INTERNAL_ADD_LINKER_FLAGS_TO_TARGET alf_target alf_flags)
-# SET_TARGET_PROPERTIES(${alf_target} PROPERTIES LINK_FLAGS "${alf_flags}" )
-#ENDMACRO(INTERNAL_ADD_LINKER_FLAGS_TO_TARGET)
-
-#MACRO(INTERNAL_ADD_DEFINITIONS_TO_TARGET adt_target adt_definitions)
-# SET_TARGET_PROPERTIES(${adt_target} PROPERTIES COMPILE_DEFINITIONS "${adt_definitions}" )
-#ENDMACRO(INTERNAL_ADD_DEFINITIONS_TO_TARGET)
-
-MACRO(INTERNAL_ADD_DEBUG_COMPILER_FLAGS_TO_TARGET acf_target)
- INTERNAL_LIST_TO_STRING("${ARGN}" acf_flags)
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${acf_flags}")
- SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${acf_flags}")
-ENDMACRO(INTERNAL_ADD_DEBUG_COMPILER_FLAGS_TO_TARGET)
-
-MACRO(INTERNAL_ADD_DEBUG_LINKER_FLAGS_TO_TARGET alf_target)
- SET_TARGET_PROPERTIES(${alf_target} PROPERTIES LINK_FLAGS_DEBUG "${ARGN}" )
-ENDMACRO(INTERNAL_ADD_DEBUG_LINKER_FLAGS_TO_TARGET)
-
-MACRO(INTERNAL_ADD_DEBUG_DEFINITIONS_TO_TARGET adt_target )
- SET_TARGET_PROPERTIES(${adt_target} PROPERTIES COMPILE_DEFINITIONS_DEBUG "${ARGN}" )
-ENDMACRO(INTERNAL_ADD_DEBUG_DEFINITIONS_TO_TARGET)
-
-MACRO(INTERNAL_ADD_RELEASE_COMPILER_FLAGS_TO_TARGET acf_target)
- INTERNAL_LIST_TO_STRING("${ARGN}" acf_flags)
- SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${acf_flags}")
- SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${acf_flags}")
-ENDMACRO(INTERNAL_ADD_RELEASE_COMPILER_FLAGS_TO_TARGET)
-
-MACRO(INTERNAL_ADD_RELEASE_LINKER_FLAGS_TO_TARGET alf_target )
- SET_TARGET_PROPERTIES(${alf_target} PROPERTIES LINK_FLAGS_RELEASE "${ARGN}" )
-ENDMACRO(INTERNAL_ADD_RELEASE_LINKER_FLAGS_TO_TARGET)
-
-MACRO(INTERNAL_ADD_RELEASE_DEFINITIONS_TO_TARGET adt_target )
- SET_TARGET_PROPERTIES(${adt_target} PROPERTIES COMPILE_DEFINITIONS_RELEASE "${ARGN}" )
-ENDMACRO(INTERNAL_ADD_RELEASE_DEFINITIONS_TO_TARGET)
-
-
-MACRO(INTERNAL_REPORT_MODULE)
- INTERNAL_ARGUMENT_SPLITTER("${ARGN}" "TYPE MODULES" RM)
- MESSAGE(STATUS)
- MESSAGE("Building ${RM_TYPE} modules:")
- MESSAGE(STATUS)
- FOREACH(r_module ${RM_MODULES})
- MESSAGE(STATUS "${r_module}")
- ENDFOREACH()
- MESSAGE(STATUS)
-ENDMACRO(INTERNAL_REPORT_MODULE)
-
-
-MACRO(INTERNAL_REPORT)
- MESSAGE(STATUS)
- MESSAGE(STATUS "-------------------------------------------------------------------")
- MESSAGE(STATUS "------------------- Configuration report begin --------------------")
- MESSAGE(STATUS "-------------------------------------------------------------------")
-
- IF(NOT "${UTILS_MODULES_STATIC}" STREQUAL "")
- INTERNAL_REPORT_MODULE(TYPE static MODULES ${UTILS_MODULES_STATIC})
- MESSAGE(STATUS "-------------------------------------------------------------------")
- ENDIF()
-
- IF(NOT "${UTILS_MODULES_DYNAMIC}" STREQUAL "")
- INTERNAL_REPORT_MODULE(TYPE dynamic MODULES ${UTILS_MODULES_DYNAMIC})
- MESSAGE(STATUS "-------------------------------------------------------------------")
- ENDIF()
-
- IF(NOT "${UTILS_MODULES_EXE}" STREQUAL "")
- INTERNAL_REPORT_MODULE(TYPE executables MODULES ${UTILS_MODULES_EXE})
- MESSAGE(STATUS "-------------------------------------------------------------------")
- ENDIF()
-
- IF(NOT "${UTILS_MODULES_TESTS}" STREQUAL "")
- INTERNAL_REPORT_MODULE(TYPE tests MODULES ${UTILS_MODULES_TESTS})
- MESSAGE(STATUS "-------------------------------------------------------------------")
- ENDIF()
- MESSAGE(STATUS "------------------- Configuration report end ----------------------")
- MESSAGE(STATUS "-------------------------------------------------------------------")
- MESSAGE(STATUS)
-ENDMACRO(INTERNAL_REPORT)
-
-
-MACRO(INTERNAL_REMOVE_OPTIONAL_FILES prefix)
- UNSET(${prefix}_ENABLE CACHE)
-ENDMACRO(INTERNAL_REMOVE_OPTIONAL_FILES)
-
-
-MACRO(INTERNAL_ADD_MODULE_INTERNAL ami_module_name ami_type)
- MESSAGE("---------------------------------------------------------------------------")
- MESSAGE(STATUS "Configuring build for ${ami_module_name} (${ami_type})")
- STRING(TOUPPER ${ami_type} CURRENT_MODULE_TYPE)
- SET(CURRENT_MODULE_NAME ${ami_module_name})
- STRING(TOUPPER ${CURRENT_MODULE_NAME} CURRENT_UPPER_MODULE_NAME)
- SET(${CURRENT_MODULE_NAME}_HAS_SOURCE_FILES 0 CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_MODULE_TYPE "${CURRENT_MODULE_TYPE}" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_BUILD_ENABLED 1)
- SET(${CURRENT_MODULE_NAME}_COMPILE_FLAGS "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_DEBUG_COMPILER_FLAGS "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_RELEASE_COMPILER_FLAGS "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_LINKER_FLAGS "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_DEBUG_LINKER_FLAGS "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_RELEASE_LINKER_FLAGS "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_DEBUG_DEFINITIONS "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_RELEASE_DEFINITIONS "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_DEPENDENCIES "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_LIBRARIES "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_INSTALL_FILES "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_PACKAGE_LIBS "" CACHE INTERNAL "")
- SET(${CURRENT_MODULE_NAME}_FOUND 1 CACHE INTERNAL "")
-ENDMACRO(INTERNAL_ADD_MODULE_INTERNAL)
-
-
-MACRO(INTERNAL_ADD_INSTALL_FILE iaif_filename)
- SET(${CURRENT_MODULE_NAME}_INSTALL_FILES ${${CURRENT_MODULE_NAME}_INSTALL_FILES} "${iaif_filename}" CACHE INTERNAL "")
-ENDMACRO(INTERNAL_ADD_INSTALL_FILE)
-
-MACRO(INTERNAL_ADD_MODULE ad_module_name ad_type)
- INTERNAL_ADD_MODULE_INTERNAL(${ad_module_name} ${ad_type})
- SET(WITH_${CURRENT_UPPER_MODULE_NAME} 1 CACHE INTERNAL "Use module ${CURRENT_UPPER_MODULE_NAME}")
-ENDMACRO(INTERNAL_ADD_MODULE)
-
-
-MACRO(INTERNAL_ADD_OPTIONAL_MODULE aom_module_name aom_type)
- INTERNAL_ADD_MODULE_INTERNAL(${aom_module_name} ${aom_type})
- SET(WITH_${CURRENT_UPPER_MODULE_NAME} 1 CACHE BOOL "Use module ${CURRENT_UPPER_MODULE_NAME}")
-ENDMACRO(INTERNAL_ADD_OPTIONAL_MODULE)
-
-
-MACRO(INTERNAL_ADD_COMPILER_FLAG aicf_compiler_flag)
- INTERNAL_ADD_DEBUG_COMPILER_FLAG(${aicf_compiler_flag})
- INTERNAL_ADD_RELEASE_COMPILER_FLAG(${aicf_compiler_flag})
-ENDMACRO(INTERNAL_ADD_COMPILER_FLAG)
-
-MACRO(INTERNAL_ADD_DEBUG_COMPILER_FLAG aidcf_compiler_flag)
- SET(${CURRENT_MODULE_NAME}_DEBUG_COMPILER_FLAGS ${${CURRENT_MODULE_NAME}_DEBUG_COMPILER_FLAGS} ${aidcf_compiler_flag} CACHE INTERNAL "")
-ENDMACRO(INTERNAL_ADD_DEBUG_COMPILER_FLAG)
-
-MACRO(INTERNAL_ADD_RELEASE_COMPILER_FLAG iarcf_compiler_flag)
- SET(${CURRENT_MODULE_NAME}_RELEASE_COMPILER_FLAGS ${${CURRENT_MODULE_NAME}_RELEASE_COMPILER_FLAGS} ${iarcf_compiler_flag} CACHE INTERNAL "")
-ENDMACRO(INTERNAL_ADD_RELEASE_COMPILER_FLAG)
-
-
-
-MACRO(INTERNAL_ADD_DEFINITION iad_definition)
- INTERNAL_ADD_RELEASE_DEFINITION("${iad_definition}")
- INTERNAL_ADD_DEBUG_DEFINITION("${iad_definition}")
-ENDMACRO(INTERNAL_ADD_DEFINITION)
-
-MACRO(INTERNAL_ADD_DEBUG_DEFINITION iadd_definition)
- SET(${CURRENT_MODULE_NAME}_DEBUG_DEFINITIONS "${${CURRENT_MODULE_NAME}_DEBUG_DEFINITIONS}" ${iadd_definition} CACHE INTERNAL "")
-ENDMACRO(INTERNAL_ADD_DEBUG_DEFINITION)
-
-MACRO(INTERNAL_ADD_RELEASE_DEFINITION iard_definition)
- SET(${CURRENT_MODULE_NAME}_RELEASE_DEFINITIONS "${${CURRENT_MODULE_NAME}_RELEASE_DEFINITIONS}" ${iard_definition} CACHE INTERNAL "")
-ENDMACRO(INTERNAL_ADD_RELEASE_DEFINITION)
-
-#MACRO(INTERNAL_ADD_DEBUG_COMPILER_FLAG adcf_compiler_flag)
-# SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${adcf_compiler_flag}")
-# SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${adcf_compiler_flag}")
-#ENDMACRO(INTERNAL_ADD_DEBUG_COMPILER_FLAG)
-
-
-#MACRO(INTERNAL_ADD_RELEASE_COMPILER_FLAG arcf_compiler_flag)
-#SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${arcf_compiler_flag}")
-# SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${arcf_compiler_flag}")
-#ENDMACRO(INTERNAL_ADD_RELEASE_COMPILER_FLAG)
-
-
-MACRO(INTERNAL_ADD_LINKER_FLAG ialf_linker_flag)
- INTERNAL_ADD_DEBUG_LINKER_FLAG(${ialf_linker_flag})
- INTERNAL_ADD_RELEASE_LINKER_FLAG(${ialf_linker_flag})
- #SET(${CURRENT_MODULE_NAME}_LINKER_FLAGS ${${CURRENT_MODULE_NAME}_LINKER_FLAGS} ${ad_linker_flag} CACHE INTERNAL "")
-ENDMACRO(INTERNAL_ADD_LINKER_FLAG)
-
-MACRO(INTERNAL_ADD_DEBUG_LINKER_FLAG aadl_linker_flag)
- SET(${CURRENT_MODULE_NAME}_DEBUG_LINKER_FLAGS "${${CURRENT_MODULE_NAME}_DEBUG_LINKER_FLAGS} ${aadl_linker_flag}" CACHE INTERNAL "")
-ENDMACRO(INTERNAL_ADD_DEBUG_LINKER_FLAG)
-
-MACRO(INTERNAL_ADD_RELEASE_LINKER_FLAG iarl_linker_flag)
- SET(${CURRENT_MODULE_NAME}_RELEASE_LINKER_FLAGS "${${CURRENT_MODULE_NAME}_RELEASE_LINKER_FLAGS} ${iarl_linker_flag}" CACHE INTERNAL "")
-ENDMACRO(INTERNAL_ADD_RELEASE_LINKER_FLAG)
-
-
-
-MACRO(INTERNAL_FINALIZE)
- INTERNAL_BUILD_UNIT_TESTS()
- list(REMOVE_DUPLICATES GLOBAL_EXTERN_INCLUDE_DIRS)
-
- #FILE(WRITE "${CMAKE_CMAKE_OUTPUT_DIRECTORY}/${CMAKE_PROJECT_NAME}.cmake" "SET(${CMAKE_PROJECT_NAME}_INCLUDE_DIR \"${GLOBAL_EXTERN_INCLUDE_DIRS} ${CMAKE_INSTALL_PREFIX}/${CMAKE_HEADER_OUTPUT_DIRECTORY}/${CMAKE_PROJECT_NAME}\")")
-
- REPORT()
-ENDMACRO(INTERNAL_FINALIZE)
-
-MACRO(INTERNAL_BUILD_UNIT_TESTS)
- IF(${BUILD_GLOBAL_TEST_EXECUTABLE} AND NOT "${GLOBAL_TEST_SOURCE}" STREQUAL "")
- #SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/deliverable/bin")
- #ADD_DEBUG_COMPILER_FLAG("/MTd")
- #ADD_RELEASE_COMPILER_FLAG("/MT")
-
- LINK_DIRECTORIES(${GoogleTest_LIBRARIES_DIR} ${GoogleMock_LIBRARIES_DIR} ${GLOBAL_TEST_LINKER_DIRECTORIES})
- message("global include ${GLOBAL_TEST_INCLUDE_DIRECTORIES}")
- INCLUDE_DIRECTORIES(${GoogleTest_INCLUDE_DIR} ${GoogleMock_INCLUDE_DIR} ${GLOBAL_TEST_INCLUDE_DIRECTORIES})
- MESSAGE(STATUS "Global unit test executable enabled, building Test")
- ADD_EXECUTABLE(Test ${GLOBAL_TEST_SOURCE})
-
- INTERNAL_ADD_DEBUG_COMPILER_FLAGS_TO_TARGET(Test ${GLOBAL_TEST_DEBUG_COMPILER_FLAGS})
- INTERNAL_ADD_RELEASE_COMPILER_FLAGS_TO_TARGET(Test ${GLOBAL_TEST_RELEASE_COMPILER_FLAGS})
-
- INTERNAL_ADD_DEBUG_LINKER_FLAGS_TO_TARGET(Test ${GLOBAL_TEST_DEBUG_LINKER_FLAGS})
- INTERNAL_ADD_RELEASE_LINKER_FLAGS_TO_TARGET(Test ${GLOBAL_TEST_RELEASE_LINKER_FLAGS})
-
- INTERNAL_ADD_DEBUG_DEFINITIONS_TO_TARGET(Test ${GLOBAL_TEST_DEBUG_DEFINITIONS})
- INTERNAL_ADD_RELEASE_DEFINITIONS_TO_TARGET(Test ${GLOBAL_TEST_RELEASE_DEFINITIONS})
-
- INTERNAL_GROUP_LINK(GLOBAL_TEST_LIBS ${GLOBAL_TEST_LIBS})
-
- TARGET_LINK_LIBRARIES(Test ${GLOBAL_TEST_LIBS} ${GoogleMock_LIBRARIES} ${GoogleTest_LIBRARIES} gtest_main gmock_main)
- SET_TARGET_PROPERTIES(Test PROPERTIES LINKER_LANGUAGE CXX)
- ENDIF()
-ENDMACRO(INTERNAL_BUILD_UNIT_TESTS)
-
-
-MACRO(INTERNAL_REQUIRED_PACKAGE pkg_name)
- MESSAGE(STATUS "${CURRENT_MODULE_NAME} requires package ${pkg_name}")
-
- SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
-
- IF(NOT "${pkg_name}_FOUND" AND EXISTS "${CMAKE_MODULE_PATH}/Find${pkg_name}.cmake")
-
- find_package("${pkg_name}" REQUIRED)
-
- SET( ${pkg_name}}_FOUND "NO" )
- IF(DEFINED ${pkg_name}_INCLUDE_DIRS)
- SET( ${pkg_name}_FOUND "YES" )
-
- MARK_AS_ADVANCED(
- ${pkg_name}_INCLUDE_DIRS
- ${pkg_name}_LIBRARIES
- )
-
- ENDIF()
- ENDIF()
-
- #INTERNAL_ADD_DEPENDENCY(${pkg_name})
-
- IF("${pkg_name}_FOUND")
-
- INCLUDE_DIRECTORIES(${${pkg_name}_INCLUDE_DIRS})
- SET(${CURRENT_MODULE_NAME}_PACKAGE_LIBS ${${CURRENT_MODULE_NAME}_PACKAGE_LIBS} ${${pkg_name}_LIBRARIES})
-
- # INTERNAL_ADD_DEFINITION("${${pkg_name}_DEPENDENT_DEFINITIONS}")
-
- ELSE()
- MESSAGE(STATUS "WARNING: Required package '${pkg_name}' was not found.")
- MESSAGE(STATUS "WARNING: Build of '${CURRENT_MODULE_NAME}' was disabled.")
- MESSAGE(STATUS "WARNING: Install package '${pkg_name}' to enable build of '${CURRENT_MODULE_NAME}'.")
- SET(${CURRENT_MODULE_NAME}_BUILD_ENABLED 0)
- ENDIF()
-
-ENDMACRO(INTERNAL_REQUIRED_PACKAGE)
-
-
-MACRO(INTERNAL_OPTIONAL_PACKAGE pkg_name)
- MESSAGE(STATUS "${CURRENT_MODULE_NAME} optionally requires package ${pkg_name}")
-
- SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
-
- find_package(${pkg_name} REQUIRED)
- IF(${pkg_name}_FOUND)
- INCLUDE_DIRECTORIES(${${pkg_name}_INCLUDE_DIR})
- SET(${CURRENT_MODULE_NAME}_PACKAGE_LIBS ${${CURRENT_MODULE_NAME}_PACKAGE_LIBS} ${${pkg_name}_LIBRARIES} CACHE INTERNAL "")
- ELSE(${pkg_name}_FOUND)
- MESSAGE(STATUS "INFO: Optional package '${pkg_name}' was not found.")
- ENDIF(${pkg_name}_FOUND)
-ENDMACRO(INTERNAL_OPTIONAL_PACKAGE)
-
-
-MACRO(INTERNAL_INSTALL_HEADER_FILES ihf_header_file_path)
- INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/modules/${CURRENT_MODULE_NAME}/include/${CURRENT_MODULE_NAME}/
- DESTINATION ${ihf_header_file_path}
- FILES_MATCHING
- PATTERN ".*" EXCLUDE)
-ENDMACRO(INTERNAL_INSTALL_HEADER_FILES)
-
-
-MACRO(INTERNAL_INSTALL_MODULE)
-
- IF(${WITH_${CURRENT_UPPER_MODULE_NAME}} AND ${${CURRENT_MODULE_NAME}_BUILD_ENABLED})
-
- INTERNAL_ARGUMENT_SPLITTER("${ARGN}" "HEADERS EXECUTABLE LIBRARY" INSTALL_PATH)
-
- IF(${INSTALL_PATH_HEADERS_FOUND})
- MESSAGE(STATUS "Install header files to ${INSTALL_PATH_HEADERS}")
- INTERNAL_INSTALL_HEADER_FILES(${INSTALL_PATH_HEADERS})
- ENDIF(${INSTALL_PATH_HEADERS_FOUND})
-
- IF(${INSTALL_PATH_EXECUTABLE_FOUND})
- MESSAGE(STATUS "Install executable files to ${INSTALL_PATH_EXECUTABLE}")
- SET(INSTALL_COMMAND RUNTIME DESTINATION ${INSTALL_PATH_EXECUTABLE})
- ENDIF(${INSTALL_PATH_EXECUTABLE_FOUND})
-
- IF(${INSTALL_PATH_LIBRARY_FOUND})
- MESSAGE(STATUS "Install library files to ${INSTALL_PATH_LIBRARY}")
- SET(INSTALL_COMMAND ${INSTALL_COMMAND} LIBRARY DESTINATION ${INSTALL_PATH_LIBRARY})
- SET(INSTALL_COMMAND ${INSTALL_COMMAND} ARCHIVE DESTINATION ${INSTALL_PATH_LIBRARY})
- ENDIF(${INSTALL_PATH_LIBRARY_FOUND})
-
- IF(NOT "${INSTALL_COMMAND}" STREQUAL "")
- INSTALL(TARGETS ${CURRENT_MODULE_NAME} LIBRARY DESTINATION ${INSTALL_COMMAND})
- ENDIF(NOT "${INSTALL_COMMAND}" STREQUAL "")
-
- ENDIF()
-
-ENDMACRO(INTERNAL_INSTALL_MODULE)
-
-
-MACRO(INTERNAL_INSTALL_RESOURCES)
- IF(${WITH_${CURRENT_UPPER_MODULE_NAME}} AND ${${CURRENT_MODULE_NAME}_BUILD_ENABLED})
- INTERNAL_ARGUMENT_SPLITTER("${ARGN}" "FILES DESTINATION" RES)
- MESSAGE(STATUS "install resource files to ${RES_DESTINATION}")
- INSTALL(FILES ${RES_FILES} DESTINATION ${RES_DESTINATION})
- ENDIF()
-ENDMACRO(INTERNAL_INSTALL_RESOURCES)
-
-MACRO(INTERNAL_LIST_TO_STRING ilts_input ilts_output)
- STRING(REGEX REPLACE ";" " " ${ilts_output} "${ilts_input}")
-ENDMACRO(INTERNAL_LIST_TO_STRING)
-
-MACRO(INTERNAL_ADD_EXTERNAL_LIBRARY ial_name)
- INTERNAL_ARGUMENT_SPLITTER("${ARGN}" "INCLUDE_DIRS LIBRARY_DIRS LIBNAMES DEPENDENT_DEFINITIONS DEPENDENT_DEBUG_DEFINITIONS DEPENDENT_RELEASE_DEFINITIONS" IAL)
-
- SET(${ial_name}_INCLUDE_DIR "")
-
- FOREACH(ial_include_dir ${IAL_INCLUDE_DIRS})
- SET(${ial_name}_INCLUDE_DIR ${${ial_name}_INCLUDE_DIR} "${ial_include_dir}")
- ENDFOREACH()
-
- SET(${ial_name}_LIBRARIES_DIR "")
- FOREACH(ial_library_dir ${IAL_LIBRARY_DIRS})
- SET(${ial_name}_LIBRARIES_DIR ${${ial_name}_LIBRARIES_DIR} "${ial_library_dir}")
- ENDFOREACH()
-
- SEPARATE_ARGUMENTS(IAL_LIBNAMES)
-
- SET(${ial_name}_LIBRARIES ${IAL_LIBNAMES})
- SET(${ial_name}_DEPENDENT_DEBUG_DEFINITIONS "${IAL_DEPENDENT_DEFINITIONS}" "${IAL_DEPENDENT_DEBUG_DEFINITIONS}")
- SET(${ial_name}_DEPENDENT_RELEASE_DEFINITIONS "${IAL_DEPENDENT_DEFINITIONS}" "${IAL_DEPENDENT_RELEASE_DEFINITIONS}")
- SET(${ial_name}_FOUND 1)
- SET(${ial_name}_INTERNAL 1)
-
- MARK_AS_ADVANCED(
- ${ial_name}_INCLUDE_DIR
- ${ial_name}_LIBRARIES_DIR
- ${ial_name}_LIBRARIES
- ${ial_name}_DEPENDENT_DEBUG_DEFINITIONS
- ${ial_name}_DEPENDENT_RELEASE_DEFINITIONS
- ${ial_name}_FOUND
- ${ial_name}_INTERNAL
- )
-
- #SET(GLOBAL_INCLUDE_DIRECTORIES ${GLOBAL_INCLUDE_DIRECTORIES} ${${ial_name}_INCLUDE_DIR} CACHE INTERNAL "collect include directories")
- SET(GLOBAL_LIB_DIRECTORIES ${GLOBAL_LIB_DIRECTORIES} ${${ial_name}_LIBRARIES_DIR} CACHE INTERNAL "collect lib directories")
- SET(GLOBAL_LIBRARIES ${GLOBAL_LIBRARIES} ${${ial_name}_LIBRARIES} CACHE INTERNAL "collect all linkable libraries")
-
-
- #message("include dirs ${${ial_name}_INCLUDE_DIR}")
- #message("library dirs ${${ial_name}_LIBRARIES_DIR}")
- #message("libraries ${${ial_name}_LIBRARIES}")
- #message("depandent defs ${${ial_name}_DEPENDENT_DEFINITIONS}")
-
-ENDMACRO(INTERNAL_ADD_EXTERNAL_LIBRARY)
-
-MACRO(INTERNAL_ADD_CMAKE_PROJECT iaap_name)
-
- INTERNAL_ARGUMENT_SPLITTER("${ARGN}" "LIBNAMES LIBDIRS INCLUDE_DIRS BINARY_INCLUDE_DIRS ABSOLUTE_INCLUDE_DIRS URL CHECKSUM SOURCE_DIR CMAKE_ARGUMENTS DEPENDENT_DEFINITIONS DEPENDENT_DEBUG_DEFINITIONS DEPENDENT_RELEASE_DEFINITIONS INSTALL CONFIG_FILE" IAAP)
-
- IF(NOT "${IAAP_URL}" STREQUAL "")
-
- SET(iaap_method DOWNLOAD_DIR "${THIRD_PARTY_DIR}/${iaap_name}"
- URL "${IAAP_URL}"
- URL_MD5 "${IAAP_CHECKSUM}")
-
- ELSEIF(NOT "${IAAP_SOURCE_DIR}" STREQUAL "")
-
- INTERNAL_LIST_TO_STRING("${IAAP_SOURCE_DIR}" IAAP_CONVERTED_SOURCE_DIR)
- SET(IAAP_SOURCE_DIR "${IAAP_CONVERTED_SOURCE_DIR}")
- SET(iaap_method SOURCE_DIR "${IAAP_SOURCE_DIR}"
- DOWNLOAD_COMMAND "")
-
- ELSEIF(EXISTS "${THIRD_PARTY_DIR}/${iaap_name}")
-
- SET(IAAP_SOURCE_DIR "${THIRD_PARTY_DIR}/${iaap_name}")
- SET(iaap_method SOURCE_DIR "${IAAP_SOURCE_DIR}"
- DOWNLOAD_COMMAND "")
-
- ENDIF()
-
- IF(NOT "${iaap_method}" STREQUAL "")
-
- SET(BUILD_${iaap_name} 1 CACHE BOOL "Use ${iaap_name}")
-
- IF(${BUILD_${iaap_name}})
-
- SET(ilts_cmake_arguments "")
- FOREACH(ilts_cmake_argument ${IAAP_CMAKE_ARGUMENTS})
- SET(ilts_cmake_arguments ${ilts_cmake_arguments} -D${ilts_cmake_argument})
- ENDFOREACH()
-
- SET(ilts_install_command INSTALL_COMMAND "")
- IF("${IAAP_INSTALL}" EQUAL 1)
- SET(ilts_install_command "")
- ENDIF()
-
- ExternalProject_Add(
- ${iaap_name}
- PREFIX ${CMAKE_BINARY_DIR}/${iaap_name}
- ${iaap_method}
- UPDATE_COMMAND ""
- CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
- -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
- -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
- -DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
- -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
- -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
- -DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
- -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
- -DBUILD_UNITTESTS:BOOLEAN=${BUILD_UNITTESTS}
- -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${PROJECT_SOURCE_DIR}/deliverable/${iaap_name}/lib/${TARGET_OS}_${TARGET_ARCH}
- -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${PROJECT_SOURCE_DIR}/deliverable/${iaap_name}/lib/${TARGET_OS}_${TARGET_ARCH}
- #-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${THIRD_PARTY_DIR}/deliverable/${iaap_name}/lib/${TARGET_OS}_${TARGET_ARCH}
- # -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${THIRD_PARTY_DIR}/deliverable/${iaap_name}/lib/${TARGET_OS}_${TARGET_ARCH}
- # -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY_DIR}/deliverable/${iaap_name}
- -DCMAKE_INSTALL_PREFIX:PATH=${PROJECT_SOURCE_DIR}/deliverable/${iaap_name}/
- -DBUILD_GLOBAL_TEST_EXECUTABLE:BOOLEAN=${BUILD_GLOBAL_TEST_EXECUTABLE}
- ${ilts_cmake_arguments}
- "${ilts_install_command}"
- )
-
-# SET(${iaap_name}_DIR "${CMAKE_BINARY_DIR}/${iaap_name}")
- SET(${iaap_name}_DIR "${IAAP_SOURCE_DIR}")
-
- SET(iacp_include_dirs "")
-
- IF(NOT ${IAAP_URL} STREQUAL "")
-
- foreach(iaap_include_dir ${IAAP_INCLUDE_DIRS})
- SET(iacp_include_dirs "${iacp_include_dirs}" "${CMAKE_BINARY_DIR}/${iaap_name}/${iaap_include_dir}")
- endforeach()
-
- ELSE()
-
- foreach(iaap_include_dir ${IAAP_INCLUDE_DIRS})
- SET(iacp_include_dirs "${iacp_include_dirs}" "${PROJECT_SOURCE_DIR}/deliverable/${iaap_name}/include/${iaap_include_dir}")
- #SET(${iaap_name}_INCLUDE_DIR "${${iaap_name}_INCLUDE_DIR}" "${CMAKE_INSTALL_PREFIX}/include/${iaap_include_dir}")
- endforeach()
-
- foreach(iaap_include_dir ${IAAP_BINARY_INCLUDE_DIRS})
- SET(iacp_include_dirs "${iacp_include_dirs}" "${CMAKE_BINARY_DIR}/${iaap_name}/src/${iaap_name}-build/${iaap_include_dir}")
- endforeach()
-
- foreach(iaap_include_dir ${IAAP_ABSOLUTE_INCLUDE_DIRS})
- SET(iacp_include_dirs "${iacp_include_dirs}" "${iaap_include_dir}")
- endforeach()
-
- ENDIF()
-
-
- INTERNAL_ADD_EXTERNAL_LIBRARY( ${iaap_name}
- INCLUDE_DIRS "${iacp_include_dirs}"
- LIBRARY_DIRS "${PROJECT_SOURCE_DIR}/deliverable/${iaap_name}/lib/${TARGET_OS}_${TARGET_ARCH}" ${IAAP_LIBDIRS}
- LIBNAMES "${IAAP_LIBNAMES}"
- DEPENDENT_DEFINITIONS "${IAAP_DEPENDENT_DEFINITIONS}"
- DEPENDENT_DEBUG_DEFINITIONS "${IAAP_DEPENDENT_DEBUG_DEFINITIONS}"
- DEPENDENT_RELEASE_DEFINITIONS "${IAAP_DEPENDENT_RELEASE_DEFINITIONS}")
- ENDIF()
- ENDIF()
-
-
-ENDMACRO(INTERNAL_ADD_CMAKE_PROJECT)
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/internal/plugins.cmake b/binding-cpp/runtime/lib/capu/cmake/acme/internal/plugins.cmake
deleted file mode 100644
index 4e5756f..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/acme/internal/plugins.cmake
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-include(ExternalProject)
-
-MESSAGE(---------------------------------------------------------------------------)
-MESSAGE("")
-MESSAGE("Searching for plugins: ")
-MESSAGE("")
-FILE(GLOB_RECURSE ACME_PLUGINS ${ACME_PATH}/plugins/*.cmake)
-FOREACH(plugin ${ACME_PLUGINS})
- INCLUDE(${plugin})
- MESSAGE(STATUS "Found acme plugin ${plugin}")
-ENDFOREACH()
-
-FILE(GLOB_RECURSE EXTERN_PLUGINS ${CMAKE_SOURCE_DIR}/cmake/plugins/*.cmake)
-FOREACH(plugin ${EXTERN_PLUGINS})
- MESSAGE(STATUS "Found internal plugin ${plugin}")
- GET_FILENAME_COMPONENT(PLUGIN_NAME ${plugin} NAME_WE)
- STRING(TOUPPER ${PLUGIN_NAME} PLUGIN_NAME)
- INCLUDE(${plugin})
-ENDFOREACH()
-
-
-#IF(${BUILD_UNITTESTS})
-# include(ExternalProject)
-# ExternalProject_Add(
-# GoogleTest
-# PREFIX ${CMAKE_BINARY_DIR}/GoogleTest
-# DOWNLOAD_DIR ${THIRD_PARTY_DIR}/GoogleTest
-# URL http://googletest.googlecode.com/files/gtest-1.6.0.zip
-# URL_MD5 4577b49f2973c90bf9ba69aa8166b786
-# CMAKE_ARGS -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${THIRD_PARTY_DIR}/libs/gtest
-# -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${THIRD_PARTY_DIR}/libs/gtest
-# -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
-# INSTALL_COMMAND ""
-# )
-# SET(GTEST_DIR "${CMAKE_BINARY_DIR}/GoogleTest/src/GoogleTest")
-# SET(GTEST_INCLUDE_DIR "${GTEST_DIR}/include")
-# SET(GTEST_LIB_DIR "${THIRD_PARTY_DIR}/libs/gtest")
-#
-# ExternalProject_Add(
-# GoogleMock
-# PREFIX ${CMAKE_BINARY_DIR}/GoogleMock
-# DOWNLOAD_DIR ${THIRD_PARTY_DIR}/GoogleMock
-# URL http://googlemock.googlecode.com/files/gmock-1.6.0.zip
-# URL_MD5 f547f47321ca88d3965ca2efdcc2a3c1
-# CMAKE_ARGS -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${THIRD_PARTY_DIR}/libs/gmock
-# -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${THIRD_PARTY_DIR}/libs/gmock
-# -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE}
-# INSTALL_COMMAND ""
-# )
-# SET(GMOCK_DIR "${CMAKE_BINARY_DIR}/GoogleMock/src/GoogleMock" )
-# SET(GMOCK_INCLUDE_DIR "${GMOCK_DIR}/include" )
-# SET(GMOCK_LIB_DIR "${THIRD_PARTY_DIR}/libs/gmock")
-#
-#ENDIF(${BUILD_UNITTESTS})
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/plugins/GoogleMock.cmake b/binding-cpp/runtime/lib/capu/cmake/acme/plugins/GoogleMock.cmake
deleted file mode 100644
index 240fcaf..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/acme/plugins/GoogleMock.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-
-IF(NOT ${BUILD_UNITTESTS})
- UNSET(BUILD_GoogleMock CACHE)
-ELSE()
- ADD_CMAKE_PROJECT( GoogleMock
- LIBNAMES gmock gtest
- INCLUDE_DIRS "src/GoogleMock/include" "src/GoogleMock/gtest/include"
- URL "http://googlemock.googlecode.com/files/gmock-1.6.0.zip"
- CHECKSUM "f547f47321ca88d3965ca2efdcc2a3c1"
- CMAKE_ARGUMENTS "gtest_force_shared_crt:Bool=1"
- )
-
-ENDIF()
-
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Integrity1002_armv7l_Emerald-P-ES1.toolchain b/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Integrity1002_armv7l_Emerald-P-ES1.toolchain
deleted file mode 100644
index 5b91ed6..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Integrity1002_armv7l_Emerald-P-ES1.toolchain
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-INCLUDE(CMakeForceCompiler)
-
-# this one is important
-SET(CMAKE_SYSTEM_NAME Integrity)
-
-SET(TARGET_OS Integrity)
-SET(TARGET_ARCH ARMV7L)
-SET(TARGET_COMPILER MULTI)
-
-#set(MAKE_OS "Integrity" CACHE STRING "Defines the target operating system." FORCE)
-SET(CGIDEVICE_NAME "Emerald")
-SET(CGIDEVICE_TARGET_BUILD "ON")
-SET(CGISTUDIO_COMPILER "MULTI")
-
-##### setup for Integrity Multi target compiler
-SET(integrity_cflags_shared "-bsp=emerald-p-evb -os_dir=C:/ghs/int1002 -cpu=cortexa9 -Ospeed -DMQ -DCHECKED_BUILD --link_once_templates -w")
-SET(integrity_cflag_optimizer "-O2")
-
-SET(CMAKE_C_FLAGS "${integrity_cflags_shared}" CACHE STRING "C Flags" FORCE)
-SET(CMAKE_CXX_FLAGS "${integrity_cflags_shared}" CACHE STRING "CXX Flags" FORCE)
-
-SET(CMAKE_C_FLAGS_DEBUG "${integrity_cflags_shared} -G -D_DEBUG" CACHE STRING "C Debug Flags" FORCE)
-SET(CMAKE_CXX_FLAGS_DEBUG "${integrity_cflags_shared} -G -D_DEBUG" CACHE STRING "CXX Debug Flags" FORCE)
-
-#### Change Compiler to MULTI
-SET(INTEGRITY_TOOLCHAIN_PATH "C:\\ghs\\multi524" CACHE PATH "Root path to MULTI tool chain.")
-SET(CMAKE_C_COMPILER "${INTEGRITY_TOOLCHAIN_PATH}/ccintarm.exe")
-SET(CMAKE_CXX_COMPILER "${INTEGRITY_TOOLCHAIN_PATH}/cxintarm.exe")
-
-#### Change other tools in toolchain
-SET(CMAKE_AR "${INTEGRITY_TOOLCHAIN_PATH}/ax.exe" CACHE FILEPATH "MULTI AR" FORCE)
-SET(CMAKE_LINKER "${INTEGRITY_TOOLCHAIN_PATH}/elxr.exe" CACHE FILEPATH "MULTI LINKER" FORCE)
-SET(CMAKE_NM "${INTEGRITY_TOOLCHAIN_PATH}/gnm.exe" CACHE FILEPATH "MULTI NM" FORCE)
-SET(CMAKE_STRIP "${INTEGRITY_TOOLCHAIN_PATH}/gstrip.exe" CACHE FILEPATH "MULTI STRIP" FORCE)
-
-# where is the target environment
-SET(CMAKE_FIND_ROOT_PATH "C:\\ghs\\int1002\\")
-
-# search for programs in the build host directories
-#SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-# for libraries and headers in the target directories
-SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
-ADD_DEFINITIONS("-DOS_INTEGRITY")
-ADD_DEFINITIONS("-DARCH_ARMV7L")
-
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Linux_X86_32.toolchain b/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Linux_X86_32.toolchain
deleted file mode 100644
index 5bd29a7..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Linux_X86_32.toolchain
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-SET(CMAKE_SYSTEM_NAME Linux)
-SET(CMAKE_SYSTEM_VERSION 1)
-
-SET(TARGET_OS Linux)
-SET(TARGET_ARCH X86_32)
-SET(TARGET_COMPILER GCC)
-
-SET(CMAKE_C_FLAGS_DEBUG "-m32 -ggdb -Wall -D_DEBUG")
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
-
-SET(CMAKE_C_FLAGS_RELEASE "-m32 -Wall -O3 -DNDEBUG")
-SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
-
-add_definitions("-DOS_LINUX")
-add_definitions("-DARCH_X86_32")
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Linux_armv7l.toolchain b/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Linux_armv7l.toolchain
deleted file mode 100644
index e064624..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Linux_armv7l.toolchain
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-SET(CMAKE_SYSTEM_NAME Linux)
-SET(CMAKE_SYSTEM_VERSION 1)
-
-SET(TARGET_OS Linux)
-SET(TARGET_ARCH ARMV7L)
-SET(TARGET_COMPILER GCC)
-
-SET(CMAKE_C_COMPILER /opt/pb-a8/cross/armv7a/bin/arm-angstrom-linux-gnueabi-gcc)
-SET(CMAKE_CXX_COMPILER /opt/pb-a8/cross/armv7a/bin/arm-angstrom-linux-gnueabi-g++)
-SET(CMAKE_LINKER /opt/pb-a8/cross/armv7a/bin/arm-angstrom-linux-gnueabi-ld)
-
-SET(CMAKE_C_FLAGS_DEBUG "-ggdb -march=armv7-a -mfpu=neon -mfloat-abi=softfp -D_DEBUG")
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
-
-SET(CMAKE_C_FLAGS_RELEASE "-O3 -march=armv7-a -mfpu=neon -mfloat-abi=softfp -DNDEBUG")
-SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
-
-SET(CMAKE_FIND_ROOT_PATH /opt/pb-a8/staging/armv7a-angstrom-linux-gnueabi)
-
-SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
-add_definitions("-DOS_LINUX")
-add_definitions("-DARCH_ARMV7L")
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/QNX_X86_32.toolchain b/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/QNX_X86_32.toolchain
deleted file mode 100644
index 37bd2b7..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/QNX_X86_32.toolchain
+++ /dev/null
@@ -1,100 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#------------------------------------------------------------------#
-#
-#HOW TO BUILD CAPU FOR QNX:
-#1. set QNX_HOST environment variable to your host's build tools
-#2. set QNX_TARGET environment variable to the qnx target location
-#3. add QNX_HOST/usr/bin to your path
-# Windows: set PATH=%QNX_HOST%\usr\bin;%PATH%
-# Linux: export PATH=$QNX_HOST/usr/bin:$PATH
-#4. execute cmake in build-folder:
-# cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=<path to capu>/cmake/acme/toolchain/QNX_X86.toolchain -DCMAKE_BUILD_TYPE=Debug|Release ..
-#5. make
-#
-#------------------------------------------------------------------#
-
-INCLUDE(CMakeForceCompiler)
-
-SET(CMAKE_SYSTEM_NAME QNX)
-
-SET(TARGET_OS QNX)
-SET(TARGET_ARCH X86_32)
-SET(TARGET_COMPILER GCC)
-
-SET(CMAKE_SYSTEM_PROCESSOR x86)
-
-#set successful exit value on target system
-SET(THREADS_PTHREAD_ARG 0)
-
-#check environment variables
-IF ("$ENV{QNX_HOST}" STREQUAL "")
- MESSAGE(FATAL_ERROR "QNX_HOST environment variable not found. Please set the variable to your host's build tools")
-ENDIF ()
-IF ("$ENV{QNX_TARGET}" STREQUAL "")
- MESSAGE(FATAL_ERROR "QNX_TARGET environment variable not found. Please set the variable to the qnx target location")
-ENDIF ()
-
-#set executable suffix
-IF(CMAKE_HOST_WIN32)
- SET(HOST_EXECUTABLE_SUFFIX ".exe")
- #convert windows paths to cmake paths
- FILE(TO_CMAKE_PATH "$ENV{QNX_HOST}" QNX_HOST)
- FILE(TO_CMAKE_PATH "$ENV{QNX_TARGET}" QNX_TARGET)
-ELSE()
- SET(QNX_HOST "$ENV{QNX_HOST}")
- SET(QNX_TARGET "$ENV{QNX_TARGET}")
-ENDIF()
-
-MESSAGE(STATUS "using QNX_HOST ${QNX_HOST}")
-MESSAGE(STATUS "using QNX_TARGET ${QNX_TARGET}")
-
-#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 -D_DEBUG")
-SET(CMAKE_C_FLAGS_RELEASE "-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 -D_DEBUG")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
-
-#set linker
-SET(CMAKE_LINKER "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ld${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Linker Program")
-
-#set make
-SET(CMAKE_MAKE_PROGRAM "${QNX_HOST}/usr/bin/make${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Make Program")
-
-#set other tools
-SET(CMAKE_AR "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ar${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ar Program")
-SET(CMAKE_NM "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-nm${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX nm Program")
-SET(CMAKE_OBJCOPY "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objcopy${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX objcopy Program")
-SET(CMAKE_OBJDUMP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objdump${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX objdump Program")
-SET(CMAKE_RANLIB "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ranlib${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ranlib Program")
-SET(CMAKE_SH "${QNX_HOST}/usr/bin/sh${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX shell Program")
-SET(CMAKE_STRIP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-strip${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Strip Program")
-
-#set target environment
-SET(CMAKE_FIND_ROOT_PATH "${QNX_TARGET}")
-
-# search for programs in the build host directories only
-SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
-ADD_DEFINITIONS("-DOS_QNX")
-ADD_DEFINITIONS("-DARCH_X86_32")
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Windows_X86_32.toolchain b/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Windows_X86_32.toolchain
deleted file mode 100644
index ee9f567..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Windows_X86_32.toolchain
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-SET(CMAKE_SYSTEM_NAME Windows)
-SET(CMAKE_SYSTEM_VERSION 1)
-
-SET(TARGET_OS Windows)
-SET(TARGET_ARCH X86_32)
-SET(TARGET_COMPILER MSVC)
-
-SET(CMAKE_C_FLAGS_RELEASE "/MD /O2 /Ob2 /DNDEBUG /MP8 /GR-")
-SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /W3")
-
-SET(CMAKE_C_FLAGS_DEBUG "/MDd /Zi /Od /RTC1 /D_DEBUG /MP8" )
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W3")
-
-
-add_definitions("-DOS_WINDOWS")
-add_definitions("-DARCH_X86_32")
-
-# enable the BUILD_CHECK_MEMORY flag if you would like to check for memory leaks with visual leak detector
-#add_definitions("-DBUILD_CHECK_MEMORY")
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Windows_X86_64.toolchain b/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Windows_X86_64.toolchain
deleted file mode 100644
index ad07010..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Windows_X86_64.toolchain
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-SET(CMAKE_SYSTEM_NAME Windows)
-SET(CMAKE_SYSTEM_VERSION 1)
-
-SET(TARGET_OS Windows)
-SET(TARGET_ARCH X86_64)
-SET(TARGET_COMPILER MSVC)
-
-SET(CMAKE_C_FLAGS_RELEASE "/MD /O2 /Ob2 /DNDEBUG /MP8 /GR-")
-SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /W3")
-
-SET(CMAKE_C_FLAGS_DEBUG "/MDd /Zi /Od /RTC1 /D_DEBUG /MP8" )
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W3")
-
-
-add_definitions("-DOS_WINDOWS")
-add_definitions("-DARCH_X86_64")
-
-# enable the BUILD_CHECK_MEMORY flag if you would like to check for memory leaks with visual leak detector
-#add_definitions("-DBUILD_CHECK_MEMORY")
diff --git a/binding-cpp/runtime/lib/capu/cmake/modules/FindIP4.cmake b/binding-cpp/runtime/lib/capu/cmake/modules/FindIP4.cmake
deleted file mode 100644
index fbd4d92..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/modules/FindIP4.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# To specify your package use the following variables
-# ${PACKAGE_NAME}_INCLUDE_DIRS
-# ${PACKAGE_NAME}_LIBRARY_DIRS
-# ${PACKAGE_NAME}_LIBNAMES
-# ${PACKAGE_NAME}_DEPENDENT_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_DEBUG_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_RELEASE_DEFINITIONS
-
-SET(PACKAGE_NAME IP4)
-
-IF("${TARGET_OS}" STREQUAL "Windows")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Linux")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Integrity")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- FIND_LIBRARY(${PACKAGE_NAME}_LIBRARIES NAMES ip4 PATHS /intarmv7a_vfp_common )
-
-ELSEIF("${TARGET_OS}" STREQUAL "QNX")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ENDIF()
-
diff --git a/binding-cpp/runtime/lib/capu/cmake/modules/FindLibRt.cmake b/binding-cpp/runtime/lib/capu/cmake/modules/FindLibRt.cmake
deleted file mode 100644
index 54cfab5..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/modules/FindLibRt.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# To specify your package use the following variables
-# ${PACKAGE_NAME}_INCLUDE_DIRS
-# ${PACKAGE_NAME}_LIBRARY_DIRS
-# ${PACKAGE_NAME}_LIBNAMES
-# ${PACKAGE_NAME}_DEPENDENT_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_DEBUG_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_RELEASE_DEFINITIONS
-
-SET(PACKAGE_NAME LibRt)
-
-IF("${TARGET_OS}" STREQUAL "Windows")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Linux")
-
- FIND_PATH(${PACKAGE_NAME}_INCLUDE_DIRS time.h /usr/include )
- FIND_LIBRARY(${PACKAGE_NAME}_LIBRARIES NAMES rt PATHS /usr/lib )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Integrity")
-
- FIND_PATH(${PACKAGE_NAME}_INCLUDE_DIRS time.h /INTEGRITY-include )
- FIND_LIBRARY(${PACKAGE_NAME}_LIBRARIES NAMES posix PATHS /intarmv7a_vfp_common )
-
-ELSEIF("${TARGET_OS}" STREQUAL "QNX")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ENDIF()
-
diff --git a/binding-cpp/runtime/lib/capu/cmake/modules/FindNet.cmake b/binding-cpp/runtime/lib/capu/cmake/modules/FindNet.cmake
deleted file mode 100644
index e3bec46..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/modules/FindNet.cmake
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# To specify your package use the following variables
-# ${PACKAGE_NAME}_INCLUDE_DIRS
-# ${PACKAGE_NAME}_LIBRARY_DIRS
-# ${PACKAGE_NAME}_LIBNAMES
-# ${PACKAGE_NAME}_DEPENDENT_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_DEBUG_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_RELEASE_DEFINITIONS
-
-SET(PACKAGE_NAME Net)
-
-IF("${TARGET_OS}" STREQUAL "Windows")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Linux")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "" )
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Integrity")
-
- FIND_PATH(${PACKAGE_NAME}_INCLUDE_DIRS netdb.h /INTEGRITY-include )
- FIND_LIBRARY(${PACKAGE_NAME}_LIBRARIES NAMES net PATHS /intarmv7a_vfp_common )
-
-ELSEIF("${TARGET_OS}" STREQUAL "QNX")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ENDIF()
-
diff --git a/binding-cpp/runtime/lib/capu/cmake/modules/FindRes.cmake b/binding-cpp/runtime/lib/capu/cmake/modules/FindRes.cmake
deleted file mode 100644
index e285be9..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/modules/FindRes.cmake
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# To specify your package use the following variables
-# ${PACKAGE_NAME}_INCLUDE_DIRS
-# ${PACKAGE_NAME}_LIBRARY_DIRS
-# ${PACKAGE_NAME}_LIBNAMES
-# ${PACKAGE_NAME}_DEPENDENT_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_DEBUG_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_RELEASE_DEFINITIONS
-
-SET(PACKAGE_NAME Res)
-
-IF("${TARGET_OS}" STREQUAL "Windows")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Linux")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Integrity")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- FIND_LIBRARY(${PACKAGE_NAME}_LIBRARIES NAMES res PATHS /intarmv7a_vfp_common )
-
-ELSEIF("${TARGET_OS}" STREQUAL "QNX")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ENDIF()
-
diff --git a/binding-cpp/runtime/lib/capu/cmake/modules/FindSocket.cmake b/binding-cpp/runtime/lib/capu/cmake/modules/FindSocket.cmake
deleted file mode 100644
index e1d1e67..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/modules/FindSocket.cmake
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# To specify your package use the following variables
-# ${PACKAGE_NAME}_INCLUDE_DIRS
-# ${PACKAGE_NAME}_LIBRARY_DIRS
-# ${PACKAGE_NAME}_LIBNAMES
-# ${PACKAGE_NAME}_DEPENDENT_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_DEBUG_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_RELEASE_DEFINITIONS
-
-SET(PACKAGE_NAME Socket)
-
-IF("${TARGET_OS}" STREQUAL "Windows")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Linux")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "" )
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Integrity")
-
- FIND_PATH(${PACKAGE_NAME}_INCLUDE_DIRS /sys/socket.h /INTEGRITY-include )
- FIND_LIBRARY(${PACKAGE_NAME}_LIBRARIES NAMES socket PATHS /intarmv7a_vfp_common )
-
-ELSEIF("${TARGET_OS}" STREQUAL "QNX")
-
- FIND_PATH(${PACKAGE_NAME}_INCLUDE_DIRS /sys/socket.h /include )
- FIND_LIBRARY(${PACKAGE_NAME}_LIBRARIES NAMES socket PATHS /x86/lib )
-
-ENDIF()
-
diff --git a/binding-cpp/runtime/lib/capu/cmake/modules/FindThread.cmake b/binding-cpp/runtime/lib/capu/cmake/modules/FindThread.cmake
deleted file mode 100644
index aa25f1c..0000000
--- a/binding-cpp/runtime/lib/capu/cmake/modules/FindThread.cmake
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# To specify your package use the following variables
-# ${PACKAGE_NAME}_INCLUDE_DIRS
-# ${PACKAGE_NAME}_LIBRARY_DIRS
-# ${PACKAGE_NAME}_LIBNAMES
-# ${PACKAGE_NAME}_DEPENDENT_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_DEBUG_DEFINITIONS
-# ${PACKAGE_NAME}_DEPENDENT_RELEASE_DEFINITIONS
-
-SET(PACKAGE_NAME Thread)
-
-IF("${TARGET_OS}" STREQUAL "Windows")
-
- SET(${PACKAGE_NAME}_INCLUDE_DIRS "")
- SET(${PACKAGE_NAME}_LIBRARIES "" )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Linux")
-
- FIND_PATH(${PACKAGE_NAME}_INCLUDE_DIRS pthread.h /usr/include )
- FIND_LIBRARY(${PACKAGE_NAME}_LIBRARIES NAMES pthread PATHS /usr/lib )
-
-ELSEIF("${TARGET_OS}" STREQUAL "Integrity")
-
- FIND_PATH(${PACKAGE_NAME}_INCLUDE_DIRS pthread.h /INTEGRITY-include )
- FIND_LIBRARY(${PACKAGE_NAME}_LIBRARIES NAMES posix PATHS /intarmv7a_vfp_common )
-
-ELSEIF("${TARGET_OS}" STREQUAL "QNX")
-
- FIND_PATH(${PACKAGE_NAME}_INCLUDE_DIRS pthread.h /include )
- FIND_LIBRARY(${PACKAGE_NAME}_LIBRARIES NAMES c PATHS /x86/lib )
-
-ENDIF()
-
diff --git a/binding-cpp/runtime/lib/capu/modules/CMakeLists.txt b/binding-cpp/runtime/lib/capu/modules/CMakeLists.txt
deleted file mode 100644
index 25f9dea..0000000
--- a/binding-cpp/runtime/lib/capu/modules/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ADD_SUBDIRECTORY(capu)
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/CMakeLists.txt b/binding-cpp/runtime/lib/capu/modules/capu/CMakeLists.txt
deleted file mode 100644
index d56ea2e..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/CMakeLists.txt
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version
-# 2.0 (the "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ADD_MODULE(capu static)
-
-ADD_FILE(Config)
-ADD_FILE(Error)
-ADD_FILE(os/Mutex SOURCE_GROUP arch_source_group)
-ADD_FILE(os/AtomicOperation SOURCE_GROUP arch_source_group)
-ADD_FILE(os/Thread SOURCE_GROUP arch_source_group)
-ADD_FILE(os/CondVar SOURCE_GROUP arch_source_group)
-ADD_FILE(os/StringUtils SOURCE_GROUP arch_source_group)
-ADD_FILE(os/NumericLimits SOURCE_GROUP arch_source_group)
-ADD_FILE(os/Time SOURCE_GROUP arch_source_group)
-ADD_FILE(os/File SOURCE_GROUP arch_source_group)
-ADD_FILE(container/List)
-ADD_FILE(container/Comparator)
-ADD_FILE(container/Hash)
-ADD_FILE(container/Pair)
-ADD_FILE(container/Array)
-ADD_FILE(container/Queue)
-ADD_FILE(container/RingBuffer)
-ADD_FILE(container/HashTable)
-ADD_FILE(container/HashSet)
-ADD_FILE(os/Socket SOURCE_GROUP arch_source_group)
-ADD_FILE(os/ServerSocket SOURCE_GROUP arch_source_group)
-ADD_FILE(os/UdpSocket SOURCE_GROUP arch_source_group)
-ADD_FILE(os/Memory SOURCE_GROUP arch_source_group)
-ADD_FILE(os/Math SOURCE_GROUP arch_source_group)
-ADD_FILE(util/SmartPointer)
-ADD_FILE(util/Runnable)
-ADD_FILE(util/Traits)
-ADD_FILE(util/ThreadPool)
-
-REQUIRED_PACKAGE(Thread)
-REQUIRED_PACKAGE(LibRt)
-REQUIRED_PACKAGE(Socket)
-REQUIRED_PACKAGE(Net)
-REQUIRED_PACKAGE(IP4)
-REQUIRED_PACKAGE(Res)
-
-SOURCE_GROUP(${TARGET_OS}_${TARGET_ARCH} FILES ${arch_source_group})
-
-SET(ENABLE_LOGGING 1 CACHE BOOL "Enable Capu Logging")
-IF(${ENABLE_LOGGING})
- ADD_DEFINITIONS(-DCAPU_LOGGING_ENABLED=1)
- ADD_FILE(util/Logger)
- ADD_FILE(util/Appender)
- ADD_FILE(util/ConsoleAppender)
-ELSE()
- ADD_DEFINITIONS(-DCAPU_LOGGING_ENABLED=0)
- MESSAGE (FATAL_ERROR "Disabling Logger is not supported yet")
-ENDIF()
-
-IF("${TARGET_OS}" STREQUAL "Integrity")
- ADD_FILE(os/Integrity/global_table)
- ADD_LINKER_FLAG("${CMAKE_SOURCE_DIR}/modules/capu/res/kernel_default.ld")
- ADD_LINKER_FLAG("-kernel")
-ENDIF()
-
-SET(USE_BOOST 0 CACHE BOOL "Enable boost performance test")
-SET(USE_STL_UNORDEREDMAP 0 CACHE BOOL "Enable strl tr1 unordered_map performance test")
-
-IF(${USE_BOOST})
- ADD_COMPILER_FLAG("USE_BOOST")
- SET(BOOST_ROOT_DIR "" CACHE PATH "Path to boost root")
- INCLUDE_DIRECTORIES("${BOOST_ROOT_DIR}")
-ENDIF()
-
-IF(${USE_STL_UNORDEREDMAP})
- ADD_COMPILER_FLAG("USE_STL_UNORDEREDMAP")
-ENDIF()
-
-JUST_DOIT()
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/Config.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/Config.h
deleted file mode 100644
index aabd2b0..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/Config.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __CONFIG_H__
-#define __CONFIG_H__
-
-#include "stdio.h"
-#include "stdlib.h"
-#include "string.h"
-
-/**
- * Defines the default hash table size
- */
-#define HASH_TABLE_DEFAULT_SIZE 1000
-
-/**
- * Defines the default hash set size
- */
-#define HASH_SET_DEFAULT_SIZE 1000
-
-/**
- * Defines the max number of possible appenders
- */
-#define LOGGER_APPENDER_MAX 10
-
-/**
- * os specific defines
- */
-#ifdef OS_WINDOWS
- #define _WINSOCKAPI_
-#endif
-
-namespace capu
-{
- #if defined (OS_WINDOWS)
- typedef signed char int8_t;
- typedef unsigned char uint8_t;
- typedef short int16_t;
- typedef unsigned short uint16_t;
- typedef int int32_t;
- typedef signed __int64 int64_t;
- typedef unsigned int uint32_t;
- typedef unsigned __int64 uint64_t;
- typedef float float_t;
- typedef double double_t;
- typedef bool bool_t;
- typedef char char_t;
- typedef uint8_t uchar_t;
- typedef int64_t time_t;
- #elif defined (OS_LINUX)
- typedef signed char int8_t;
- typedef unsigned char uint8_t;
- typedef short int int16_t;
- typedef unsigned short int uint16_t;
- typedef int int32_t;
- typedef long long int int64_t;
- typedef unsigned long int uint32_t;
- typedef unsigned long long int uint64_t;
- typedef float float_t;
- typedef double double_t;
- typedef bool bool_t;
- typedef double double_t;
- typedef char char_t;
- typedef uint8_t uchar_t;
- typedef int64_t time_t;
- #elif defined (OS_INTEGRITY)
- typedef signed char int8_t;
- typedef unsigned char uint8_t;
- typedef short int int16_t;
- typedef unsigned short int uint16_t;
- typedef int int32_t;
- typedef long long int int64_t;
- typedef unsigned long int uint32_t;
- typedef unsigned long long int uint64_t;
- typedef float float_t;
- typedef double double_t;
- typedef bool bool_t;
- typedef double double_t;
- typedef char char_t;
- typedef uint8_t uchar_t;
- typedef int64_t time_t;
- #elif defined (OS_QNX)
- typedef signed char int8_t;
- typedef unsigned char uint8_t;
- typedef short int int16_t;
- typedef unsigned short int uint16_t;
- typedef int int32_t;
- typedef long long int int64_t;
- typedef unsigned long int uint32_t;
- typedef unsigned long long int uint64_t;
- typedef float float_t;
- typedef double double_t;
- typedef bool bool_t;
- typedef double double_t;
- typedef char char_t;
- typedef int64_t time_t;
- typedef uint8_t uchar_t;
- #endif
-
- //platform depended types
- #if defined (ARCH_X86_32)
- typedef int32_t int_t;
- typedef uint32_t uint_t;
- #elif defined (ARCH_X86_64)
- typedef int64_t int_t;
- typedef uint64_t uint_t;
- #elif defined (ARCH_ARMV7L)
- typedef int32_t int_t;
- typedef uint32_t uint_t;
- #endif
-
-}
-
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/Error.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/Error.h
deleted file mode 100644
index 31fcc88..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/Error.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __ERROR_H__
-#define __ERROR_H__
-
-#include "Config.h"
-
-namespace capu {
- typedef int32_t status_t;
-
- enum Errors{
- CAPU_OK = 0,
- CAPU_EUNIMPL = 1,
- CAPU_ERANGE = 2,
- CAPU_EINVAL = 3,
- CAPU_ERROR = 4,
- CAPU_SOCKET_EBIND = 5,
- CAPU_SOCKET_ESOCKET = 6,
- CAPU_SOCKET_ECONNECT = 7,
- CAPU_SOCKET_ELISTEN = 8,
- CAPU_SOCKET_ECLOSE = 9,
- CAPU_SOCKET_EADDR = 10,
- CAPU_ENO_MEMORY = 11,
- CAPU_ETIMEOUT = 12,
- CAPU_ENOT_EXIST = 13,
- CAPU_ENOT_SUPPORTED = 14,
- CAPU_EIO = 15,
- CAPU_EOF = 16
- };
-}
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Array.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Array.h
deleted file mode 100644
index a32a3af..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Array.h
+++ /dev/null
@@ -1,305 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __ARRAY_H__
-#define __ARRAY_H__
-
-#include "capu/Config.h"
-#include "capu/Error.h"
-#include "capu/os/Memory.h"
-
-namespace capu
-{
-
- template<typename T>
- class Array
- {
- public:
-
- /**
- * default constructor
- * @param size fix size of the array
- */
- Array<T>();
-
- /**
- * constructor
- * @param size fix size of the array
- */
- Array<T>(uint_t size);
-
- /**
- * constructor
- * @param size fix size of the array
- * @param value for initialization of the array
- */
- Array<T>(uint_t size, const T& value);
-
- /**
- * constructor for conversion from raw data
- * @param size fix size of the array
- * @param value for initialization of the array
- */
- Array<T>(const T other[], uint_t size);
-
- /*
- * Copy constructor
- */
- Array<T>(const Array<T>& other);
-
- /*
- * Assignment operator
- */
- Array<T>& operator=(const Array<T>& other);
-
- /**
- * destructor
- */
- virtual ~Array(void);
-
- /**
- * return size of the array
- * @return returns the size of the array
- */
- uint_t size() const;
-
- /**
- * initializes the array with the given value
- * @param value initialization value
- */
- void set(const T& value);
-
- /**
- * sets every array index between start and start+count to value
- * @param value initialization value
- * @param start start index
- * @param count number of elements
- * @return ETCH_ERANGE if out of bounds
- * ETCH_OK otherwise
- */
- status_t set(const T& value, const uint_t start, const uint_t count);
-
- /**
- * swaps to elements
- * @param index1 index of the first element
- * @param index2 index of the second element
- * @return ETCH_ERANGE if out of bounds
- * ETCH_OK otherwise
- */
- status_t swap(uint_t index1, uint_t index2);
-
- /**
- * moves elements inside the array
- * @param start start index
- * @param count number of elements
- * @param dst destination index
- * @return ETCH_ERANGE if out of bounds
- * ETCH_OK otherwise
- */
- status_t move(uint_t start, uint_t count, uint_t dst);
-
- /**
- * copies the given values into the array
- * @param other values for the contents of the array
- * @param size fix size of the array
- * @return ETCH_ERANGE if size does not match array size
- * ETCH_OK otherwise
- */
- status_t copy(const T other[], uint_t size);
-
- /**
- * Allows access of an array element
- * @param the index of the element
- * @return reference to the element at the given position
- */
- T& operator [](const uint_t index) const;
-
- /**
- * Sets the raw data of the array to the given value
- * @param the byte value for all array elements
- */
- void setRawData(int32_t value);
-
- private:
- uint_t mSize;
- T* mData;
- status_t setData(const T& value, const uint_t start, const uint_t count);
-};
-
- template<typename T>
- Array<T>::Array()
- : mSize(0)
- , mData(0)
- {
-
- }
-
- template<typename T>
- Array<T>::Array(uint_t size)
- : mSize(size)
- , mData(new T[size])
- {
- }
-
- template<typename T>
- Array<T>::Array(uint_t size, const T& value)
- : mSize(size)
- , mData(new T[size])
- {
- set(value);
- }
-
- template<typename T>
- Array<T>::Array(const T other[], uint_t size)
- :mSize(size)
- {
- mData = new T[mSize];
- Memory::Copy(mData, other, size * sizeof(T));
- }
-
-
- template<typename T>
- Array<T>::Array(const Array<T>& other)
- : mSize(other.mSize)
- {
- mData = new T[mSize];
- Memory::Copy(mData, other.mData, other.size() * sizeof(T));
- }
-
- template<typename T>
- Array<T>& Array<T>::operator=(const Array<T>& other)
- {
- if(mSize != other.mSize)
- {
- if(mData != 0)
- {
- delete[] mData;
- }
- mSize = other.mSize;
- mData = new T[mSize];
- }
-
- Memory::Copy(mData, other.mData, other.size() * sizeof(T));
- return *this;
- }
-
- template<typename T>
- Array<T>::~Array(void)
- {
- delete[] mData;
- }
-
- template<typename T>
- void Array<T>::set(const T& value)
- {
- setData(value, 0, mSize);
- }
-
- template<typename T>
- status_t Array<T>::set(const T& value, uint_t index, uint_t count)
- {
- return setData(value, index, count);
- }
-
- template<typename T>
- status_t Array<T>::swap(uint_t index1, uint_t index2)
- {
- if (index1 >= mSize || index2 >= mSize){
- return CAPU_ERANGE;
- }
- T tmp = mData[index1];
- mData[index1] = mData[index2];
- mData[index2] = tmp;
-
- return CAPU_OK;
- }
-
- template<typename T>
- status_t Array<T>::move(uint_t start, uint_t count, uint_t dst)
- {
- if ((start >= mSize) || ((count+start) > mSize) || ((mSize-count) + start < 0) || ((dst+count) > mSize)) {
- return CAPU_ERANGE;
- }
- Memory::Move(mData + dst, mData + start, sizeof(T) * count);
-
- return CAPU_OK;
- }
-
- template<typename T>
- status_t Array<T>::copy(const T other[], uint_t size)
- {
- if (size != mSize) {
- return CAPU_ERANGE;
- }
-
- Memory::Copy(mData, other, size * sizeof(T));
-
- return CAPU_OK;
- }
-
- template<typename T>
- T& Array<T>::operator[](const uint_t index) const
- {
- return mData[index];
- }
-
- template<typename T>
- uint_t Array<T>::size() const
- {
- return mSize;
- }
-
- template<typename T>
- status_t Array<T>::setData(const T& value, const uint_t index, const uint_t count) {
-
- if ((index >= mSize) || ((count+index) > mSize) || ((mSize-count) + index < 0)) {
- return CAPU_ERANGE;
- }
- T* start = &mData[mSize-(mSize-count) + index];
-
- switch(count)
- {
- default:
- {
- T* end = start - (count - 10);
- while(start > end){ *(--start) = value; }
- }
- case 10 : *(--start) = value;
- case 9 : *(--start) = value;
- case 8 : *(--start) = value;
- case 7 : *(--start) = value;
- case 6 : *(--start) = value;
- case 5 : *(--start) = value;
- case 4 : *(--start) = value;
- case 3 : *(--start) = value;
- case 2 : *(--start) = value;
- case 1 : *(--start) = value;
- }
-
- return CAPU_OK;
- }
-
- template<typename T>
- void Array<T>::setRawData(int32_t value)
- {
- Memory::Set(mData, value, sizeof(T) * mSize);
- }
-}
-
-
-#endif // __ARRAY_H__
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Comparator.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Comparator.h
deleted file mode 100644
index 9725838..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Comparator.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __COMPARATOR_H__
-#define __COMPARATOR_H__
-
-#include "capu/Config.h"
-
-namespace capu {
-
- class Comparator {
-
- public:
- template <class T>
- bool_t operator () (const T &x, const T &y) const {
- return x == y;
- }
-
- bool_t operator () (const char* x, const char* y) const {
- return (strcmp(x,y) == 0);
- }
-
- bool_t operator () (char* x, char* y) const {
- return (strcmp(x,y) == 0);
- }
- };
-}
-
-#endif /* COMPARATOR_H */
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Hash.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Hash.h
deleted file mode 100644
index 48c7e9e..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Hash.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __HASH_H__
-#define __HASH_H__
-
-#include "capu/Config.h"
-
-namespace capu {
-
- template<typename T>
- class HashCalculator;
-
- template<>
- class HashCalculator<uint32_t>
- {
- private:
- static const uint32_t prime = 16777619UL;
- static const uint32_t offset_base = 2166136261UL;
- public:
- static uint32_t Hash(void* key, uint32_t len)
- {
- uint32_t result = offset_base;
- uint8_t* ptr = static_cast<uint8_t*>(key);
- do
- {
- result = (result^*ptr) * prime;
- ++ptr;
- }while(--len);
-
- return result;
- }
-
- static uint32_t Hash(char* key)
- {
- uint32_t result = offset_base;
- do
- {
- result = (result^*key) * prime;
- }while(*(++key));
-
- return result;
- }
-
- static uint32_t Hash(const char* key)
- {
- uint32_t result = offset_base;
- do
- {
- result = (result^*key) * prime;
- }while(*(++key));
-
- return result;
- }
-
- };
-
- template<>
- class HashCalculator<uint64_t>
- {
- private:
- static const uint64_t prime = 1099511628211ULL;
- static const uint64_t offset_base = 14695981039346656037ULL;
- public:
- static uint64_t Hash(void* key, uint32_t len)
- {
- uint64_t result = offset_base;
- uint8_t* ptr = static_cast<uint8_t*>(key);
- do
- {
- result = (result^*ptr) * prime;
- ++ptr;
- }while(--len);
-
- return result;
- }
-
- static uint64_t Hash(char* key)
- {
- uint64_t result = offset_base;
- do
- {
- result = (result^*key) * prime;
- }while(*(++key));
-
- return result;
- }
-
- static uint64_t Hash(const char* key)
- {
- uint64_t result = offset_base;
- do
- {
- result = (result^*key) * prime;
- }while(*(++key));
-
- return result;
- }
-
- };
-
- class Hash
- {
- public:
-
- static uint_t Digest(char* key)
- {
- return HashCalculator<uint_t>::Hash(key);
- }
-
- static uint_t Digest(const char* key)
- {
- return HashCalculator<uint_t>::Hash(key);
- }
-
- template<typename T>
- static uint_t Digest(T key)
- {
- return HashCalculator<uint_t>::Hash(&key, sizeof(T));
- }
- };
-
-}
-#endif /* HASH_H */
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/HashSet.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/HashSet.h
deleted file mode 100644
index 93a31d0..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/HashSet.h
+++ /dev/null
@@ -1,341 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __HASHSET_H__
-#define __HASHSET_H__
-
-#include "capu/container/Comparator.h"
-#include "capu/container/Hash.h"
-#include "capu/container/List.h"
-
-namespace capu {
-
- template <class T, class C = Comparator, class H = Hash >
- class HashSet {
-
- private:
- class HashSetIterator {
- public:
-
- /**
- * constructor
- *
- * @param list array of linked list which provide channing for hash set
- * @param listSize size of hash set (size of linked list array)
- */
- HashSetIterator(List<T, C> * list, uint_t listSize);
-
- /**
- * destructor
- */
- ~HashSetIterator();
-
- /**
- * Check if iterator has next element.
- * @return false if the next of current node that is pointed, is null otherwise true
- */
- bool_t hasNext();
-
- /**
- * Get next iterator element.
- * @param value
- * @return CAPU_ERANGE if the next of current node that is pointed, is null
- * CAPU_EINVAL if the value is NULL
- * CAPU_OK if the next element has been gotten
- *
- */
- status_t next(T* value);
-
- private:
- uint_t mCurrentListIndex;
- typename List<T, C>::Iterator mCurrentListIterator;
- List<T, C> * mList;
- uint_t mMaxListSize;
- };
-
- public:
-
- typedef HashSetIterator Iterator;
-
- /**
- * Default Constructor
- */
- HashSet();
-
- /**
- * Parameterized Constructor
- * @param size size of initial HashSet
- */
- HashSet(uint_t size);
-
- /**
- * Destructor
- */
- ~HashSet();
-
- /**
- * put a new value to the hash set.
- *
- * @param value new value that will be put to hash set
- *
- * @return CAPU_OK if remove is successful
- * CAPU_ERROR if value already exists in the set
- *
- */
- status_t put(const T &value);
-
- /**
- * Remove value associated with key in the hash set.
- *
- * @param value value that will be removed
- *
- * @return CAPU_OK if remove is successful
- * CAPU_ERANGE if specified value does not exist in hash set
- *
- */
- status_t remove(const T &value);
-
- /**
- * Checks if the provided value is already contained in the hash set.
- *
- * @param value value that will be checked
- *
- * @return true if element is already contained in the hash set
- * false otherwise
- *
- */
- bool_t hasElement(const T &value);
-
- /**
- * Returns count of the hash set.
- * @return number of element in hash set
- */
- uint_t count();
-
- /**
- * Clear all values of the hash set.
- *
- * @return CAPU_OK if all elements in list have been deleted
- */
- status_t clear();
-
- /**
- * Return iterator for iterating key value tuples.
- * @return Iterator
- */
- Iterator begin();
-
- private:
-
- /**
- * internally used function to check the same key exist in the specified linked list
- *
- * @param index specify which link list will be checked
- * @param k specify which key will be searched
- * @return -1 if the key is unique
- * otherwise the index in the linked list
- */
- int_t __check_duplicate_value(uint_t index, T k) {
- int_t count = 0;
- typename List<T, C>::Iterator it = mLists[index].begin();
- T tmp;
- C compare;
- while (it.hasNext()) {
- it.next(&tmp);
- //NOT UNIQUE VALUE
- if (compare(tmp, k))
- return count;
- count++;
- }
- //UNIQUE VALUE
- return -1;
- }
-
- List<T, C> *mLists;
- uint_t mSize;
- uint_t mCount;
- };
-
- template <class T, class C, class H>
- HashSet<T, C, H>::HashSet()
- : mSize(HASH_SET_DEFAULT_SIZE)
- , mCount(0) {
- mLists = new List<T, C>[mSize];
- }
-
- template <class T, class C, class H>
- HashSet<T, C, H>::~HashSet() {
- delete [] mLists;
- }
-
- template <class T, class C, class H>
- HashSet<T, C, H>::HashSet(uint_t size)
- : mSize(size)
- , mCount(0) {
- mLists = new List<T, C>[mSize];
- }
-
- template <class T, class C, class H>
- status_t HashSet< T, C, H>::put(const T &value) {
- status_t result;
- uint_t index = H::Digest(value) % mSize;
- if (mLists[index].isEmpty()) {
- result = mLists[index].add(value);
- if (result != CAPU_OK) {
- return result;
- }
- mCount++;
- //THERE IS NO OLD VALUE
- } else {
- int_t key_duplicate_index = this->__check_duplicate_value(index, value);
- if (key_duplicate_index < 0) {
- result = mLists[index].add(value);
- if (result != CAPU_OK) {
- return result;
- }
- mCount++;
- //THERE IS NO OLD VALUE
- } else {
- //THERE IS A NEW VALUE
- return CAPU_ERROR;
- }
- }
- return CAPU_OK;
- }
-
- template <class T, class C, class H>
- status_t HashSet< T, C, H>::remove(const T &value) {
- status_t result;
- uint_t index = H::Digest(value) % mSize;
-
- int_t key_index = this->__check_duplicate_value(index, value);
- if (key_index < 0) {
- return CAPU_ERANGE;
- } else {
- //delete the existing file
- result = mLists[index].removeAt(key_index);
- if (result != CAPU_OK) {
- return result;
- }
- mCount--;
- }
- return CAPU_OK;
- }
-
-
- template <class T, class C, class H>
- bool_t HashSet< T, C, H>::hasElement(const T &value) {
- uint_t index = H::Digest(value) % mSize;
-
- int_t key_index = this->__check_duplicate_value(index, value);
- if (key_index < 0) {
- return false;
- } else {
- return true;
- }
- }
-
-
- template <class T, class C, class H>
- uint_t HashSet< T, C, H>::count() {
- return mCount;
- }
-
- template <class T, class C, class H>
- status_t HashSet< T, C, H>::clear() {
- for (uint_t i = 0; i < mSize; ++i) {
- mLists[i].clear();
- }
- mCount = 0;
- return CAPU_OK;
- }
-
- template <class T, class C, class H>
- HashSet< T, C, H>::HashSetIterator::HashSetIterator(List<T, C> * list, uint_t list_size)
- : mCurrentListIndex(0), mCurrentListIterator(list[0].begin()), mList(list), mMaxListSize(list_size) {
- //to point the first non-empty one
- for (uint_t i = 0; i < list_size; ++i) {
- if (!mList[i].isEmpty()) {
- mCurrentListIndex = i;
- this->mCurrentListIterator = list[i].begin();
- break;
- }
- }
- }
-
- template <class T, class C, class H>
- HashSet< T, C, H>::HashSetIterator::~HashSetIterator() {
-
- }
-
- template <class T, class C, class H>
- bool_t HashSet< T, C, H>::HashSetIterator::hasNext() {
- if (mCurrentListIterator.hasNext()) {
- return true;
- } else {
- do {
- mCurrentListIndex++;
- if (mCurrentListIndex >= mMaxListSize) {
- return false;
- }
- } while (mList[mCurrentListIndex].isEmpty());
-
- if (mCurrentListIndex < mMaxListSize) {
- return true;
- } else {
- return false;
- }
- }
- }
-
- template <class T, class C, class H>
- status_t HashSet< T, C, H>::HashSetIterator::next(T* value) {
- if (value == NULL) {
- return CAPU_EINVAL;
- } else if (mCurrentListIndex >= mMaxListSize) {
- return CAPU_ERANGE;
- } else {
- status_t result = mCurrentListIterator.next(value);
- if (result != CAPU_OK)
- return result;
-
- if (!mCurrentListIterator.hasNext()) {
- do {
- mCurrentListIndex++;
- if (mCurrentListIndex >= mMaxListSize) {
- break;
- }
- } while (mList[mCurrentListIndex].isEmpty());
-
- if (mCurrentListIndex < mMaxListSize) {
- mCurrentListIterator = mList[mCurrentListIndex].begin();
- }
- }
- }
- return CAPU_OK;
- }
-
- template <class T, class C, class H>
- typename HashSet<T, C, H>::Iterator HashSet<T, C, H>::begin() {
- return typename HashSet<T, C, H>::Iterator(mLists, mSize);
- }
-
-}
-
-#endif /* HASHSET_H */
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/HashTable.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/HashTable.h
deleted file mode 100644
index e0a74ed..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/HashTable.h
+++ /dev/null
@@ -1,403 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __HASHTABLE_H__
-#define __HASHTABLE_H__
-#include "capu/Error.h"
-#include "capu/Config.h"
-#include "capu/container/Comparator.h"
-#include "capu/container/List.h"
-#include "capu/container/Pair.h"
-#include "capu/container/Hash.h"
-
-namespace capu {
-
- template <class Key, class T, class C = Comparator, class Hash = Hash >
- class HashTable {
- private:
-
- class HashTableIterator {
- public:
-
- /**
- * constructor
- *
- * @param list array of linked list which provide channing for hashtable
- * @param listSize size of hash table (size of linked list array)
- */
- HashTableIterator(List<Pair<Key, T> > * list, uint_t listSize);
-
- /**
- * destructor
- */
- ~HashTableIterator();
-
- /**
- * Check if iterator has next element.
- * @return false if the next of current node that is pointed, is null otherwise true
- */
- bool_t hasNext();
-
- /**
- * Get next iterator element.
- * @param value
- * @return CAPU_ERANGE if the next of current node that is pointed, is null
- * CAPU_EINVAL if the value is NULL
- * CAPU_OK if the next element has been gotten
- *
- */
- status_t next(Pair<Key, T>* value);
-
- private:
- uint_t mCurrentListIndex;
- typename List<Pair<Key, T> >::Iterator mCurrentListIterator;
- List<Pair<Key, T> > * mList;
- uint_t mMaxListSize;
- };
-
- public:
-
- typedef HashTableIterator Iterator;
-
- /**
- * Constructs HashTable.
- */
- HashTable();
-
- /**
- * Constructs HashTable.
- */
- HashTable(uint_t size);
-
-
- /**
- * Constructs a copy of HashTable.
- */
- HashTable(const HashTable& other);
-
- /**
- * Destructure.
- */
- virtual ~HashTable();
-
- /**
- * put a new value to the hashtable.
- * @param key Key value
- * @param value new value that will be put to hash table
- * @param value_old buffer which will be used to store value of old element
- *
- * @return CAPU_OK if remove is successful
- CAPU_ENO_MEMORY if allocation of element is failed
- * CAPU_EINVAL if value_old is null
- *
- */
- status_t put(const Key &key, const T &value, T* value_old = NULL);
-
- /**
- * Get value associated with key in the hashtable.
- * @param key Key
- * @param value buffer which will be used to return the found element
- *
- * @return CAPU_OK if get is successful performed
- * CAPU_EINVAL if value is null
- * CAPU_ENOT_EXIST if there is no pair with specified key
- */
- status_t get(const Key &key, T* value) const;
-
- /**
- * Remove value associated with key in the hashtable.
- *
- * @param key Key value
- * @param value_old buffer which will be used to store value of removed element
- *
- * @return CAPU_OK if remove is successful
- * CAPU_EINVAL if value_old is null
- * CAPU_ERANGE if the pair with specified key does not exist in hash table
- *
- */
- status_t remove(const Key &key, T* value_old);
-
- /**
- * Returns count of the hashtable.
- * @return number of element in hash table
- */
- uint_t count();
-
- /**
- * Clear all key and values of the hashtable.
- *
- * @return CAPU_OK if all elements in list have been deleted
- */
- status_t clear();
-
- /**
- * Return iterator for iterating key value tuples.
- * @return Iterator
- */
- Iterator begin() const;
-
- private:
-
- /**
- * internally used function to check the same key exist in the specified linked list
- *
- * @param index specify which link list will be checked
- * @param k specify which key will be searched
- * @return -1 if the key is unique
- * otherwise the index in the linked list
- */
- int_t getKeyIndexFromBucket(uint_t index, const Key &k) const {
- int_t count = 0;
- typename List<Pair<Key, T> >::Iterator it = mLists[index].begin();
- Pair<Key, T> pair;
- C compare;
- while (it.hasNext()) {
- it.next(&pair);
- //NOT UNIQUE KEY
- if (compare(pair.first, k))
- return count;
- count++;
- }
- //UNIQUE KEY
- return -1;
- }
-
- List<Pair<Key, T>, Comparator > *mLists;
- uint_t mSize;
- uint_t mCount;
-
- };
-
- template <class Key, class T, class C, class Hash>
- HashTable<Key, T, C, Hash>::HashTable()
- : mSize(HASH_TABLE_DEFAULT_SIZE), mCount(0) {
- mLists = new List<Pair<Key, T>, Comparator >[mSize];
- }
-
- template <class Key, class T, class C, class Hash>
- HashTable<Key, T, C, Hash>::HashTable(uint_t size)
- : mCount(0) {
- if (size <= 0) {
- mSize = HASH_TABLE_DEFAULT_SIZE;
- } else {
- mSize = size;
- }
- mLists = new List<Pair<Key, T>, Comparator >[mSize];
- }
-
- template <class Key, class T, class C, class Hash>
- HashTable<Key, T, C, Hash>::HashTable(const HashTable& other)
- : mSize(other.mSize), mCount(0) {
- mLists = new List<Pair<Key, T>, Comparator >[mSize];
- typename HashTable<Key, T, C, Hash>::Iterator iterator = other.begin();
- Pair<Key, T> pair;
- while(iterator.hasNext())
- {
- iterator.next(&pair);
- put(pair.first, pair.second, NULL);
- }
- }
-
- template <class Key, class T, class C, class Hash>
- HashTable<Key, T, C, Hash>::~HashTable() {
- delete [] mLists;
- }
-
- template <class Key, class T, class C, class Hash>
- status_t HashTable<Key, T, C, Hash>::put(const Key &key, const T &value, T* value_old) {
- status_t result;
- uint_t index = Hash::Digest(key) % mSize;
- if (mLists[index].isEmpty()) {
- Pair<Key, T> pair(key, value);
- result = mLists[index].add(pair);
- if (result != CAPU_OK) {
- return result;
- }
- mCount++;
- //THERE IS NO OLD VALUE
- } else {
- Pair<Key, T> new_pair(key, value);
- int_t key_duplicate_index = this->getKeyIndexFromBucket(index, key);
- if (key_duplicate_index < 0) {
- result = mLists[index].add(new_pair);
- if (result != CAPU_OK) {
- return result;
- }
- mCount++;
- //THERE IS NO OLD VALUE
- } else {
- Pair <Key, T> old_pair;
- result = mLists[index].get(key_duplicate_index, &old_pair);
- if (result != CAPU_OK) {
- return result;
- }
- //OLD VALUE
- if (value_old == NULL) {
- return CAPU_EINVAL;
- } else {
- *value_old = old_pair.second;
- }
-
- result = mLists[index].set(key_duplicate_index, new_pair);
- if (result != CAPU_OK) {
- return result;
- }
- }
- }
- return CAPU_OK;
- }
-
- template <class Key, class T, class C, class Hash>
- status_t HashTable<Key, T, C, Hash>::get(const Key &key, T* value) const {
- if (value == NULL)
- return CAPU_EINVAL;
-
- status_t result;
- uint_t index = Hash::Digest(key) % mSize;
-
- int_t key_index = this->getKeyIndexFromBucket(index, key);
- if (key_index < 0) {
- return CAPU_ENOT_EXIST;
- } else {
- Pair<Key, T> pair;
- result = mLists[index].get(key_index, &pair);
- if (result != CAPU_OK) {
- return result;
- }
- //GET THE VALUE
- *value = pair.second;
- }
- return CAPU_OK;
- }
-
- template <class Key, class T, class C, class Hash>
- status_t HashTable<Key, T, C, Hash>::remove(const Key &key, T* value_old) {
- if (value_old == NULL) {
- return CAPU_EINVAL;
- }
- status_t result;
- uint_t index = Hash::Digest(key) % mSize;
-
- int_t key_index = this->getKeyIndexFromBucket(index, key);
- if (key_index < 0) {
- return CAPU_ERANGE;
- } else {
- Pair<Key, T> pair;
- //retrieve the value
- result = mLists[index].get(key_index, &pair);
- if (result != CAPU_OK) {
- return result;
- }
- //delete
- result = mLists[index].removeAt(key_index);
- if (result != CAPU_OK) {
- return result;
- }
- mCount--;
- //GET THE VALUE
- *value_old = pair.second;
- }
- return CAPU_OK;
- }
-
- template <class Key, class T, class C, class Hash>
- uint_t HashTable<Key, T, C, Hash>::count() {
- return mCount;
- }
-
- template <class Key, class T, class C, class Hash>
- status_t HashTable<Key, T, C, Hash>::clear() {
- for (uint_t i = 0; i < mSize; ++i) {
- mLists[i].clear();
- }
- mCount = 0;
- return CAPU_OK;
- }
-
- template <class Key, class T, class C, class Hash>
- typename HashTable<Key, T, C, Hash>::Iterator HashTable<Key, T, C, Hash>::begin() const {
- return typename HashTable<Key, T, C, Hash>::Iterator(mLists, mSize);
- }
-
- template <class Key, class T, class C, class Hash>
- HashTable<Key, T, C, Hash>::HashTableIterator::HashTableIterator(List<Pair<Key, T> > * list, uint_t list_size)
- : mCurrentListIndex(0), mCurrentListIterator(list[0].begin()), mList(list), mMaxListSize(list_size) {
- //to point the first non-empty one
- for (uint_t i = 0; i < list_size; ++i) {
- if (!mList[i].isEmpty()) {
- mCurrentListIndex = i;
- this->mCurrentListIterator = list[i].begin();
- break;
- }
- }
- }
-
- template <class Key, class T, class C, class Hash>
- HashTable<Key, T, C, Hash>::HashTableIterator::~HashTableIterator() {
-
- }
-
- template <class Key, class T, class C, class Hash>
- bool_t HashTable<Key, T, C, Hash>::HashTableIterator::hasNext() {
- if (mCurrentListIterator.hasNext()) {
- return true;
- } else {
- do {
- mCurrentListIndex++;
- if (mCurrentListIndex >= mMaxListSize) {
- return false;
- }
- } while (mList[mCurrentListIndex].isEmpty());
-
- if (mCurrentListIndex < mMaxListSize) {
- return true;
- } else {
- return false;
- }
- }
- }
-
- template <class Key, class T, class C, class Hash>
- status_t HashTable<Key, T, C, Hash>::HashTableIterator::next(Pair<Key, T>* value) {
- if (value == NULL) {
- return CAPU_EINVAL;
- } else if (mCurrentListIndex >= mMaxListSize) {
- return CAPU_ERANGE;
- } else {
- status_t result = mCurrentListIterator.next(value);
- if (result != CAPU_OK)
- return result;
-
- if (!mCurrentListIterator.hasNext()) {
- do {
- mCurrentListIndex++;
- if (mCurrentListIndex >= mMaxListSize) {
- break;
- }
- } while (mList[mCurrentListIndex].isEmpty());
-
- if (mCurrentListIndex < mMaxListSize) {
- mCurrentListIterator = mList[mCurrentListIndex].begin();
- }
- }
- }
- return CAPU_OK;
- }
-}
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/List.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/List.h
deleted file mode 100644
index 04b6b53..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/List.h
+++ /dev/null
@@ -1,570 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef __List_H__
-#define __List_H__
-
-#include "capu/Error.h"
-#include "capu/Config.h"
-#include "capu/container/Comparator.h"
-
-namespace capu
-{
- template <class T, class C = Comparator>
- class List
- {
- private:
- class ListNode
- {
- public:
-
- ListNode()
- : mNext(0)
- , mPrev(0)
- {
- }
-
- ListNode(const T& data)
- : mData(data)
- , mNext(0)
- , mPrev(0)
- {
- }
-
- T mData;
- ListNode* mNext;
- ListNode* mPrev;
- };
-
- class ListIterator
- {
- public:
- friend class List<T, C>;
-
- /**
- * destructor
- */
- ~ListIterator();
-
- /**
- * Check if iterator has next element.
- * @return false if the next of current node that is pointed, is null otherwise true
- */
- 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 CAPU_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.
- */
- uint32_t currentIndex();
-
- private:
- ListIterator(ListNode* boundary); // creation only in list.begin()
- ListNode* mInitialNode;
- ListNode* mCurrentNode;
- uint32_t mIndex;
- };
-
- ListNode* mBoundary;
- uint_t mSize;
- C mComparator;
-
- void insertElement(ListNode* addPosition, const T& element);
- void deleteElement(ListNode* deletePosition);
- ListNode* findElement(uint_t index) const;
-
- public:
- typedef typename List<T, C>::ListIterator Iterator;
-
- /**
- * Default Constructor
- */
- List();
-
- /**
- * Copy constructor
- */
- List(const List<T, C>& other);
-
- /**
- * Destructor
- */
- virtual ~List();
-
-
- List<T,C>& operator=(List<T, C> const& other);
-
- /**
- * Add element to the end of list
- * @param element element that will be added
- * @return CAPU_ENO_MEMORY if allocation of element is failed
- * CAPU_OK if the element is successfully added
- */
- status_t add(const T& element);
-
- /**
- * Add element to specified position
- *
- * @param index index of element which will be inserted
- * @param element new value that will replace the old value
- *
- * @return CAPU_EINVAL if given index is invalid.
- * CAPU_ENO_MEMORY if allocation of element is failed
- * CAPU_OK if the element is successfully added
- * CAPU_ERROR otherwise
- */
- status_t add(uint_t index, const T& element);
-
- /**
- * Add element to specified position
- *
- * @param iterator with the position to insert
- * @param element new value that will replace the old value
- *
- * @return CAPU_ENO_MEMORY memory allocation failed.
- * CAPU_OK otherwise
- */
- status_t add(Iterator& iter, const T &element);
-
- /**
- * Sets the element at the specified index.
- * @param index the index of element that will be replaced
- * @param element element that will be overwritten to existing place
- * @param elementOld the buffer to keep the existing
- * @return CAPU_EINVAL if the index is not valid
- * CAPU_OK otherwise
- */
- status_t set(uint_t index, const T &element, T* elementOld = 0);
-
- /**
- * remove the element in the specified index and if the element_old
- * parameter is not NULL, the removed element will be put to element_old
- * @param index index of element that will be removed
- * @param elementOld the buffer which will keep the copy of the removed element
- * @return CAPU_EINVAL invalid index
- * CAPU_OK if the element is successfully removed
- */
- status_t removeAt(uint_t index, T* elementOld = 0);
-
- /**
- * remove the element in the specified iterator position and if the element_old
- * parameter is not NULL, the removed element will be put to element_old
- * @param iterator of element that will be removed
- * @param element_old the buffer which will keep the copy of the removed element
- * @return CAPU_EINVAL invalid iterator
- * CAPU_OK if the element is successfully removed
- *
- */
- status_t removeAt(Iterator& listIterator, T* elementOld = 0);
-
- /**
- * Removes an element.
- * @param element The element that will get removed.
- * @return CAPU_EINVAL if element was not found
- * CAPU_OK if element was removed.
- */
- status_t remove(const T& element);
-
- /**
- * removes all elements from linked list
- *
- * @return CAPU_OK if all of the elements are deleted
- */
- status_t clear();
-
- /**
- * get a single element on specified index
- * @param index index of element that will be get
- * @param result the buffer that the retrieved element will be stored
- * @return CAPU_EINVAL invalid index
- * CAPU_OK otherwise
- */
- status_t get(uint_t index, T* result) const;
-
- /**
- * return size of list
- * @return return the size of list
- */
- int_t size() const;
-
- /**
- * check the list is empty or not
- * @return true if empty
- * false otherwise
- */
- bool_t isEmpty() const;
-
- /**
- * returns an iterator pointing to the beginning of list
- * @return iterator
- */
- Iterator begin() const;
-
- /**
- * 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 -1 if the value either does not exist or given value is NULL
- * otherwise index of value on linked list
- */
- int_t find(const T &element) const;
-
- /**
- * check that if the list contains the given parameter or not
- * if you are using an object you need to overload == operator
- * @param element element that will be checked
- * @return true list contains it
- * false otherwise
- */
- bool_t contains(const T &element) const;
- };
-
- template <class T, class C>
- List<T, C>::List()
- : mBoundary(new ListNode())
- , mSize(0)
- {
- mBoundary->mNext = mBoundary;
- mBoundary->mPrev = mBoundary;
- }
-
- template <class T, class C>
- List<T, C>::List(const List<T, C>& other)
- : mBoundary(new ListNode())
- , mSize(0)
- {
- mBoundary->mNext = mBoundary;
- mBoundary->mPrev = mBoundary;
-
- // add all items from the other list
- Iterator it = other.begin();
- T current;
- while(it.hasNext())
- {
- it.next(¤t);
- add(current);
- }
- }
-
- template <class T, class C>
- List<T, C>::~List()
- {
- clear();
- delete mBoundary;
- }
-
- template <class T, class C>
- status_t List<T, C>::clear()
- {
- ListNode* current = mBoundary->mNext;
- ListNode* toDelete = 0;
- while (current != mBoundary)
- {
- toDelete = current;
- current = current->mNext;
- delete toDelete;
- }
- mSize = 0;
- mBoundary->mNext = mBoundary;
- mBoundary->mPrev = mBoundary;
- return CAPU_OK;
- }
-
- template <class T, class C>
- List<T,C>& List<T, C>::operator=(List<T, C> const& other)
- {
- clear();
- mBoundary->mNext = mBoundary;
- mBoundary->mPrev = mBoundary;
-
- // add all items from the other list
- Iterator it = other.begin();
- T current;
- while(it.hasNext())
- {
- it.next(¤t);
- add(current);
- }
- return *this;
- }
-
- template <class T, class C>
- int_t List<T, C>::find(const T &element) const
- {
- int_t counter = 0;
- ListNode* current = mBoundary->mNext;
- while (current != mBoundary)
- {
- if (mComparator(current->mData, element))
- {
- // element was found, return index
- return counter;
- }
- current = current->mNext;
- ++counter;
- }
-
- // not found
- return -1;
- }
-
- template <class T, class C>
- inline bool_t List<T, C>::contains(const T &element) const
- {
- return find(element) != -1;
- }
-
- template <class T, class C>
- inline status_t List<T, C>::add(Iterator& iter, const T &element)
- {
- insertElement(iter.mCurrentNode->mPrev, element); // insert before found position
- return CAPU_OK;
- }
-
- template <class T, class C>
- inline status_t List<T, C>::add(uint_t index, const T &element)
- {
- if (index > mSize) // if index == mSize, element is added at the end
- {
- // invalid index
- return CAPU_EINVAL;
- }
-
- insertElement(findElement(index)->mPrev, element); // insert before found position
- return CAPU_OK;
- }
-
- template <class T, class C>
- inline status_t List<T, C>::add(const T &element)
- {
- insertElement(mBoundary->mPrev, element); // insert at list end (boundary->mPrev)
- return CAPU_OK;
- }
-
- template <class T, class C>
- inline void List<T, C>::insertElement(typename List<T, C>::ListNode* addPosition, const T& element)
- {
- ListNode* newNode = new ListNode(element); // copy in
- newNode->mNext = addPosition->mNext;
- newNode->mPrev = addPosition;
- addPosition->mNext->mPrev = newNode;
- addPosition->mNext = newNode;
- ++mSize;
- }
-
- template <class T, class C>
- inline void List<T, C>::deleteElement(typename List<T, C>::ListNode* deletePosition)
- {
- deletePosition->mPrev->mNext = deletePosition->mNext;
- deletePosition->mNext->mPrev = deletePosition->mPrev;
- delete deletePosition;
- --mSize;
- }
-
- template <class T, class C>
- typename List<T, C>::ListNode* List<T, C>::findElement(uint_t index) const
- {
- // search element by running through list from the first element
- uint_t counter = 0;
- ListNode* current = mBoundary->mNext;
- while(counter < index)
- {
- ++counter;
- current = current->mNext;
- }
-
- // current is the element that was requested
- return current;
- }
-
-
- template <class T, class C>
- status_t List<T, C>::remove(const T& element)
- {
- ListNode* current = mBoundary->mNext;
- while (current != mBoundary)
- {
- if (mComparator(current->mData, element))
- {
- // deletion element found
- deleteElement(current);
- return CAPU_OK;
- }
- current = current->mNext;
- }
- return CAPU_EINVAL;
- }
-
- template <class T, class C>
- status_t List<T, C>::removeAt(uint_t index, T* elementOld)
- {
- if (index >= mSize)
- {
- // invalid index
- return CAPU_EINVAL;
- }
-
- ListNode* toDelete = findElement(index);
- if (elementOld)
- {
- *elementOld = toDelete->mData; // copy out
- }
- deleteElement(toDelete);
- return CAPU_OK;
- }
-
- template <class T, class C>
- status_t List<T, C>::removeAt(Iterator& listIterator, T* elementOld)
- {
- if (listIterator.hasNext())
- {
- if (elementOld)
- {
- *elementOld = listIterator.mCurrentNode->mData; // copy out
- }
- ListNode* node = listIterator.mCurrentNode;
- listIterator.mCurrentNode = listIterator.mCurrentNode->mNext;
- deleteElement(node);
- return CAPU_OK;
- }
- return CAPU_EINVAL;
- }
-
- template <class T, class C>
- inline status_t List<T, C>::set(uint_t index, const T &element, T* elementOld)
- {
- if (index >= mSize)
- {
- // invalid index
- return CAPU_EINVAL;
- }
-
- ListNode* node = findElement(index);
- if (elementOld)
- {
- *elementOld = node->mData; // copy out
- }
- node->mData = element; // copy in
- return CAPU_OK;
- }
-
- template <class T, class C>
- status_t List<T, C>::get(uint_t index, T* result) const
- {
- if (index >= mSize)
- {
- // invalid index
- return CAPU_EINVAL;
- }
-
- *result = findElement(index)->mData; // copy out
- return CAPU_OK;
- }
-
- template <class T, class C>
- inline int_t List<T, C>::size() const
- {
- return mSize;
- }
-
- template <class T, class C>
- inline bool_t List<T, C>::isEmpty() const
- {
- return mSize == 0;
- }
-
- template <class T, class C>
- typename List<T, C>::Iterator List<T, C>::begin() const
- {
- return ListIterator(mBoundary);
- }
-
- template <class T, class C>
- List<T, C>::ListIterator::ListIterator(ListNode* boundary)
- : mInitialNode(boundary)
- , mCurrentNode(boundary->mNext)
- , mIndex(0)
- {
- }
-
- template <class T, class C>
- List<T, C>::ListIterator::~ListIterator()
- {
- }
-
- template <class T, class C>
- bool_t List<T, C>::ListIterator::hasNext()
- {
- return mInitialNode != mCurrentNode;
- }
-
- template <class T, class C>
- status_t List<T, C>::ListIterator::next(T* element)
- {
- if (element)
- {
- status_t ret = current(element);
- if (ret != CAPU_OK)
- {
- return ret; // don't continue
- }
- }
- mCurrentNode = mCurrentNode->mNext;
- ++mIndex;
- return CAPU_OK;
- }
-
- template <class T, class C>
- uint32_t List<T, C>::ListIterator::currentIndex()
- {
- return mIndex;
- }
-
- template <class T, class C>
- status_t List<T, C>::ListIterator::current(T* element)
- {
- if (!hasNext())
- {
- return CAPU_ERANGE;
- }
- if (!element)
- {
- return CAPU_EINVAL;
- }
- *element = mCurrentNode->mData; // copy out
- return CAPU_OK;
- }
-}
-
-#endif /* __List_H__ */
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Pair.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Pair.h
deleted file mode 100644
index 59f425a..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Pair.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef __PAIR_H__
-#define __PAIR_H__
-
-namespace capu {
-
- template <class T1, class T2>
- class Pair {
-
- public:
-
- inline bool_t operator==(const Pair<T1, T2> &rhs) {
- return ((first == rhs.first) && (second == rhs.second));
- }
-
- ~Pair() {
-
- }
-
- Pair() {
-
- }
-
- Pair(const T1 _first, const T2 _second)
- : first(_first), second(_second) {
-
- }
- T1 first;
- T2 second;
- };
-}
-
-
-#endif /* PAIR_H */
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Queue.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Queue.h
deleted file mode 100644
index d4a28f2..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/Queue.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __QUEUE_H__
-#define __QUEUE_H__
-
-#include "capu/Error.h"
-#include "capu/Config.h"
-
-namespace capu {
-
- template <typename T>
- class Queue {
-
- class QueueNode
- {
- public:
- ~QueueNode()
- {
- }
-
- QueueNode() {
- mNext = NULL;
- }
-
- QueueNode(T data) {
- mNext = NULL;
- this->mData = data;
- }
-
- T mData;
- QueueNode* mNext;
- };
-
- QueueNode* mCurrent;
- QueueNode* mTail;
- int_t mSize;
-
- public:
-
- /**
- * Default Constructor
- */
- Queue();
-
- /**
- * Destructor
- */
- virtual ~Queue();
-
- /**
- * Add element to the end of list
- * @param element element that will be added
- * @return CAPU_ENO_MEMORY if allocation of element is failed
- * CAPU_OK if the element is successfully added
- */
- status_t add(const T &element);
-
-
- /**
- * Shifts the iterator to the next position and returns the element if next != NULL
- * @param element
- * @return ETCH_ERANGE if the next of current node that is pointed, is null
- * CAPU_OK if the next element has been gotten
- *
- */
- status_t next(T* element = NULL);
-
- /**
- * Check if iterator has next element.
- * @return false if the next of current node that is pointed, is null otherwise true
- */
- bool_t hasNext();
-
- /**
- * return size of the queue
- * @return return the size of list
- */
- int_t size();
-
- /**
- * check the queue is empty or not
- * @return true if empty
- * false otherwise
- */
- bool_t isEmpty();
-
- /**
- * removes all elements from queue
- *
- * @return CAPU_OK if all of the elements are deleted
- *
- */
- status_t clear();
- };
-
- template <typename T>
- Queue<T>::Queue()
- : mCurrent(NULL), mTail(NULL), mSize(0) {
- //init queue
- }
-
- template <typename T>
- Queue<T>::~Queue() {
- clear();
- }
-
- template <typename T>
- status_t Queue<T>::next(T* element) {
- if (mCurrent == NULL) {
- return CAPU_ERANGE;
- }
- T tmp = mCurrent->mData;
- QueueNode* del = mCurrent;
- mCurrent = mCurrent->mNext;
- delete del;
- --mSize;
-
- if (element != NULL) {
- *element = tmp;
- }
- return CAPU_OK;
- }
-
-
- template <typename T>
- bool_t Queue<T>::hasNext() {
- return mCurrent != NULL;
- }
-
- template <typename T>
- int_t Queue<T>::size() {
- return mSize;
- }
-
- template <typename T>
- status_t Queue<T>::clear() {
- //on the deallocation delete all elements in the queue
- while (mCurrent != NULL) {
- Queue::QueueNode* tmp = mCurrent;
- mCurrent = mCurrent->mNext;
- delete tmp;
- }
- mSize = 0;
- return CAPU_OK;
- }
-
-
- //add elements to the end of queue
- template <typename T>
- status_t Queue<T>::add(const T &element) {
- Queue::QueueNode *qElem = NULL;
- qElem = new Queue::QueueNode(element);
- //NOT ALLOCATED
- if (qElem == NULL) {
- return CAPU_ENO_MEMORY;
- }
-
- //Queue contains some elements so add it to the end of queue
- if (mCurrent != NULL) {
- mTail->mNext = qElem;
- mTail = qElem;
- ++mSize;
- return CAPU_OK;
- }
- //Queue is empty
- mCurrent = qElem;
- mTail = qElem;
- ++mSize;
- return CAPU_OK;
- }
-
- //checks if the queue is empty or not
- template <typename T>
- bool_t Queue<T>::isEmpty() {
- return (mSize == 0);
- }
-}
-
-
-#endif /* __QUEUE_H__ */
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/RingBuffer.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/RingBuffer.h
deleted file mode 100644
index f50ebe1..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/container/RingBuffer.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef __RINGBUFFER_H__
-#define __RINGBUFFER_H__
-
-#include "capu/Config.h"
-#include "capu/Error.h"
-
-namespace capu
-{
- /*
- * RingBuffer to store data.
- * The buffer is not thread-safe!
- */
- template<typename T>
- class RingBuffer
- {
- /*
- * Iterator class.
- */
- class RingBufferIterator
- {
- public:
- friend class RingBuffer<T>;
- RingBufferIterator(RingBuffer<T>* buffer);
- ~RingBufferIterator();
- bool_t hasNext();
- status_t next(T* element);
- private:
- uint32_t mCurrentIndex;
- bool_t mMoved;
- RingBuffer<T>* mBuffer;
- };
-
- public:
- /*
- * Used for iterations over the buffer.
- */
- typedef typename RingBuffer<T>::RingBufferIterator Iterator;
-
- /*
- * Destructor.
- */
- virtual ~RingBuffer();
-
- /*
- * Gets an iterator to iterate over the buffer.
- * @return Iterator for iteration over the buffer.
- */
- Iterator begin();
-
- /*
- * Inserts new data in the buffer.
- * @param element The element that should get added to the buffer.
- * @return The status to indicate if the add operation did succeed.
- */
- status_t add(const T& element);
-
- /*
- * Clears the buffer.
- * @return The status to indicate if the clear operation did succeed.
- */
- status_t clear();
-
- /*
- * Gets the size of the buffer. This is not the current fill status.
- * @return The size of the buffer.
- */
- uint32_t size();
-
- /*
- * Creates a new ring-base buffer with the specified size.
- *
- * @param bufferSize The size of the buffer.
- */
- RingBuffer(uint32_t bufferSize);
-
- private:
- uint32_t mStart;
- uint32_t mEnd;
- uint32_t mBufferSize;
- bool_t mEmpty;
- T* mData; // we use a backing array for the ring buffer
-
- /*
- * Helper function to increase an index so that the new index is always inside the array bounds.
- * @param index The index that should get increased.
- */
- void increase(uint32_t& index);
-
- /*
- * Helper function to determine if the buffer is full.
- * @return True if the buffer is full, false otherwise.
- */
- bool_t isFull();
- };
-
- template<typename T>
- inline RingBuffer<T>::RingBuffer(uint32_t bufferSize)
- : mStart(0)
- , mEnd(0)
- , mBufferSize(bufferSize)
- , mEmpty(true)
- , mData(new T[bufferSize])
- {
- }
-
- template<typename T>
- inline RingBuffer<T>::~RingBuffer()
- {
- delete[] mData;
- }
-
- template<typename T>
- inline bool_t RingBuffer<T>::isFull()
- {
- return mStart == mEnd && !mEmpty;
- }
-
- template<typename T>
- inline void RingBuffer<T>::increase(uint32_t& index)
- {
- index = (index + 1) % mBufferSize;
- }
-
- template<typename T>
- inline uint32_t RingBuffer<T>::size()
- {
- return mBufferSize;
- }
-
- template<typename T>
- inline status_t RingBuffer<T>::add(const T& element)
- {
- if (mBufferSize == 0)
- {
- // special case of a zero buffer size
- return CAPU_ERANGE;
- }
-
- mData[mEnd] = element; // write operation into the buffer
-
- if(isFull())
- {
- // only increase 'start pointer' if the buffer is full
- increase(mStart);
- }
- increase(mEnd);
- mEmpty = false;
-
- return CAPU_OK;
- }
-
- template<typename T>
- inline status_t RingBuffer<T>::clear()
- {
- mStart = 0;
- mEnd = 0;
- mEmpty = true;
- return CAPU_OK;
- }
-
- template<typename T>
- inline typename RingBuffer<T>::Iterator RingBuffer<T>::begin()
- {
- return RingBufferIterator(this);
- }
-
- template<typename T>
- inline RingBuffer<T>::RingBufferIterator::RingBufferIterator(RingBuffer<T>* buffer)
- : mCurrentIndex(buffer->mStart),
- mMoved(false),
- mBuffer(buffer)
-
- {
- // note: we could use a modification-counter on the RingBuffer to detect concurrent modifications
- }
-
- template<typename T>
- inline RingBuffer<T>::RingBufferIterator::~RingBufferIterator()
- {
- }
-
- template<typename T>
- inline bool_t RingBuffer<T>::RingBufferIterator::hasNext()
- {
- if(mBuffer->mEmpty)
- {
- // empty buffer has no next element
- return false;
- }
- if(mCurrentIndex == mBuffer->mEnd)
- {
- // pointing to end in an non-empty buffer: we are finished if we did move once!
- return !mMoved;
- }
-
- // buffer is not empty and we're not pointing to the end: iteration can continue
- return true;
- }
-
- template<typename T>
- inline status_t RingBuffer<T>::RingBufferIterator::next(T* element)
- {
- if (!element)
- {
- // user did not provide any memory space for the next element
- return CAPU_ENO_MEMORY;
- }
- if (!hasNext())
- {
- // note: 'hasNext' is probably called twice:
- // while(it.hasNext()) <- call in client code
- // it.next(&curr); <- call to 'hasNext' in 'next' method (this method)
- // can we ignore that?
- // but if we do not check here, we cannot know if there is a next element.
- return CAPU_ENOT_EXIST;
- }
-
- mMoved = true;
- *element = mBuffer->mData[mCurrentIndex]; // assignment operation from the buffer
- mBuffer->increase(mCurrentIndex); // increase iteration index
-
- return CAPU_OK;
- }
-
-}
-
-#endif //__RINGBUFFER_H__
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/AtomicOperation.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/AtomicOperation.h
deleted file mode 100644
index e590f67..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/AtomicOperation.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef __ATOMIC_OPERATION_H__
-#define __ATOMIC_OPERATION_H__
-
-#include "capu/Config.h"
-
-#define ATOMIC_OPERATION_INC_HEADER
-#include "arch/AtomicOperation.inc"
-#undef ATOMIC_OPERATION_INC_HEADER
-
-namespace capu
-{
- class AtomicOperation {
- public:
-
- /**
- * atomically add 'summand' to an uint32_t
- * @param mem reference to the object
- * @param summand amount to add
- */
- static uint32_t AtomicAdd32(volatile uint32_t &mem, uint32_t summand);
-
- /**
- * atomically subtract 'substrahend' from an uint32_t
- * @param mem reference to the object
- * @param subtrahend amount to subtract
- */
- static uint32_t AtomicSub32(volatile uint32_t &mem, uint32_t subtrahend);
-
- /**
- * atomically increment an uint32_t
- * @param mem reference to the object
- */
- static uint32_t AtomicInc32(volatile uint32_t &mem);
-
- /**
- * atomically decrement an uint32_t
- * @param mem reference to the object
- */
- static uint32_t AtomicDec32(volatile uint32_t &mem);
- };
-
-#define ATOMIC_OPERATION_INC_IMPL
-#include "arch/AtomicOperation.inc"
-#undef ATOMIC_OPERATION_INC_IMPL
-}
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/CondVar.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/CondVar.h
deleted file mode 100644
index 1061646..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/CondVar.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __CONDVAR_H__
-#define __CONDVAR_H__
-
-#include "capu/Config.h"
-#include "capu/Error.h"
-#include "capu/os/Mutex.h"
-
-#define CONDVAR_INC_HEADER
-#include "arch/CondVar.inc"
-#undef CONDVAR_INC_HEADER
-
-namespace capu
-{
- class CondVar
- {
- #define CONDVAR_INC_MEMBER
- #include "arch/CondVar.inc"
- #undef CONDVAR_INC_MEMBER
-
- public:
-
- inline CondVar();
-
- ~CondVar();
-
- /**
- * Wake up single thread that is waiting for this condition variable
- * @return CAPU_OK if the condition variable is correctly signaled
- * CAPU_ERROR otherwise
- */
- inline status_t signal();
-
- /**
- * Wait for a condition variable
- * @param mutex
- * @param timeout (default is infinite)
- * @return CAPU_OK if the condition variable is correctly waited
- * CAPU_EINVAL if the given mutex is NULL
- * CAPU_ERROR otherwise
- */
- inline status_t wait(Mutex *mutex, uint32_t millisec = 0);
-
- /**
- * Wake up all threads that is waiting for this condition variable
- * @return CAPU_OK if the condition variable is correctly broadcasted
- * CAPU_ERROR otherwise
- */
- inline status_t broadcast();
-
- };
-
-#define CONDVAR_INC_IMPL
- #include "arch/CondVar.inc"
-#undef CONDVAR_INC_IMPL
-
-}
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Debug.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Debug.h
deleted file mode 100644
index 2b266dc..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Debug.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __DEBUG_H__
-#define __DEBUG_H__
-
-#include "capu/Config.h"
-#include "capu/Error.h"
-
-#define DEBUG_INC_HEADER
-#include "arch/Debug.inc"
-#undef DEBUG_INC_HEADER
-
-namespace capu
-{
- class Debug
- {
- #define DEBUG_INC_MEMBER
- #include "arch/Debug.inc"
- #undef DEBUG_INC_MEMBER
-
- public:
-
- static void Assert(bool condition);
-
- };
-
-#define DEBUG_INC_IMPL
- #include "arch/Debug.inc"
-#undef DEBUG_INC_IMPL
-
-}
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/File.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/File.h
deleted file mode 100644
index b65e5cb..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/File.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FILE_H__
-#define __FILE_H__
-
-#include "capu/Config.h"
-#include "capu/Error.h"
-
-#define FILE_INC_HEADER
-#include "arch/File.inc"
-#undef FILE_INC_HEADER
-
-namespace capu {
-
- class File {
-
-#define FILE_INC_MEMBER
- #include "arch/File.inc"
-#undef FILE_INC_MEMBER
-
- public:
-
- /**
- * Create a new instance for a file.
- * @name of the file
- * @mode to specify the file mode
- "r" opens file for reading.
- "w" opens file as an empty file for writing.
- "r+" opens file for reading and writing. The file must exist.
- "w+" opens file for reading and writing. Create a new file also of old one exists.
- */
- inline File(const char* name, const char* mode);
-
- /**
- * return true if file is open else false
- */
- inline bool_t isOpen();
-
- /**
- * return true if file end was reachde
- */
- inline bool_t isEof();
-
- /**
- * Reads data from the stream and store it into the buffer.
- * @buffer elements to be read
- * @length of the buffer
- * @numBytes of bytes read from the stream
- * return CAPU_EINVAL if params are wrong
- CAPU_EOF if end of stream
- CAPU_ERROR if invalid state or file not open
- */
- inline status_t read(char * buffer, uint32_t length, int32_t* numBytes);
-
- /**
- * Writes the given byte buffer to the stream.
- * @buffer elements to be written
- * @length of the buffer
- * return CAPU_OK buffer could be written to the stream
- * CAPU_ERROR otherwise
- */
- inline status_t write(char * buffer, uint32_t length);
-
- /**
- * Writes any unwritten data to the file.
- */
- inline status_t flush();
-
- /**
- * Close the stream.
- *@return
- */
- inline status_t close();
-
- /**
- * Destruct current instance.
- */
- inline ~File();
-
- };
-
-#define FILE_INC_IMPL
-#include "arch/File.inc"
-#undef FILE_INC_IMPL
-
-}
-
-#endif /* __FILE_H__ */
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Math.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Math.h
deleted file mode 100644
index 36dc6ec..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Math.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef __MATH_H__
-#define __MATH_H__
-
-#include "capu/Config.h"
-
-#define MATH_INC_HEADER
-#include "arch/Math.inc"
-#undef MATH_INC_HEADER
-
-namespace capu {
-
- class Math {
- #define MATH_INC_MEMBER
- #include "arch/Math.inc"
- #undef MATH_INC_MEMBER
-
- public:
- static float_t Ceil(float_t val);
- static double_t Ceil(double_t val);
- static float_t Floor(float_t val);
- static double_t Floor(double_t val);
- static float_t Abs(float_t val);
- static double_t Abs(double_t val);
- static int_t Abs(int_t val);
- static float_t Sqrt(float_t val);
- static double_t Sqrt(double_t val);
- static float_t Pow2(float_t val);
- static double_t Pow2(double_t val);
- static float_t Pow(float_t val, float_t exponent);
- static double_t Por(double_t val, double_t exponent);
- static float_t Cos(float_t val);
- static double_t Cos(double_t val);
- static float_t Sin(float_t val);
- static double_t Sin(double_t val);
- static float_t Tan(float_t val);
- static double_t Tan(double_t val);
- static float_t ArcCos(float_t val);
- static double_t ArcCos(double_t val);
- static float_t ArcSin(float_t val);
- static double_t ArcSin(double_t val);
- static float_t ArcTan(float_t val);
- static double_t ArcTan(double_t val);
- static float_t Rad2Deg(float_t val);
- static double_t Rad2Deg(double_t val);
- static float_t Deg2Rad(float_t val);
- static double_t Deg2Rad(double_t val);
- };
-
-
-#define MATH_INC_IMPL
-#include "arch/Math.inc"
-#undef MATH_INC_IMPL
-
-}
-
-#endif
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Memory.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Memory.h
deleted file mode 100644
index 4fab56f..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Memory.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __MEMORY_H__
-#define __MEMORY_H__
-
-#include "capu/Config.h"
-#include "capu/Error.h"
-
-#define MEMORY_INC_HEADER
-#include "arch/Memory.inc"
-#undef MEMORY_INC_HEADER
-
-namespace capu
-{
- class Memory
- {
- #define MEMORY_INC_MEMBER
- #include "arch/Memory.inc"
- #undef MEMORY_INC_MEMBER
-
- public:
- inline static void Set (void* dst, int32_t val , uint_t size);
- inline static void Copy(void* dst, const void* src, uint_t size);
- inline static void Move(void* dst, const void* src, uint_t size);
- inline static int32_t Compare(const void* ptr1, const void* ptr2, uint_t num);
-
- };
-
-#define MEMORY_INC_IMPL
- #include "arch/Memory.inc"
-#undef MEMORY_INC_IMPL
-
-}
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Mutex.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Mutex.h
deleted file mode 100644
index 2bb245f..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Mutex.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __MUTEX_H__
-#define __MUTEX_H__
-
-#include "capu/Error.h"
-
-#define MUTEX_INC_HEADER
-#include "arch/Mutex.inc"
-#undef MUTEX_INC_HEADER
-
-
-
-namespace capu
-{
- class Mutex
- {
-
-#define MUTEX_INC_MEMBER
-#include "arch/Mutex.inc"
-#undef MUTEX_INC_MEMBER
-
- public:
-
- /**
- * Constructor
- */
- inline Mutex();
-
- /**
- * Destructor
- */
- inline ~Mutex();
-
- /**
- * used for locking if lock is not currently available, then wait until the lock is captured
- * @return CAPU_OK if the locking is successful
- * CAPU_ERROR otherwise
- */
- inline status_t lock();
-
- /**
- * it will attempt to lock a mutex. However if the mutex is already locked, the routine will return false immediately
- * @return true if the mutex is successfully locked
- * false if the mutex is already locked
- */
- inline bool trylock();
-
- /**
- *release the lock
- *@return CAPU_OK if the unlocking is successful
- * CAPU_ERROR otherwise
- */
- inline status_t unlock();
-
- };
-
-
-#define MUTEX_INC_IMPL
- #include "arch/Mutex.inc"
-#undef MUTEX_INC_IMPL
-}
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/NumericLimits.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/NumericLimits.h
deleted file mode 100644
index e90e589..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/NumericLimits.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __NUMERIC_LIMITS_H__
-#define __NUMERIC_LIMITS_H__
-
-#include "capu/Config.h"
-
-#define NUMERIC_LIMITS_INC_HEADER
-#include "arch/NumericLimits.inc"
-#undef NUMERIC_LIMITS_INC_HEADER
-
-namespace capu {
-
- template<typename T>
- inline T NumericLimitMax() {
- //not important
- return 0;
- }
-
- template<typename T>
- inline T NumericLimitMin() {
- //not important
- return 0;
- }
-
- template<>
- inline capu::int32_t NumericLimitMax<capu::int32_t>() {
- return 0x7fffffff;
- }
-
- template<>
- inline capu::int32_t NumericLimitMin<capu::int32_t>() {
- return 0x80000000;
- }
-
- template<>
- inline capu::uint32_t NumericLimitMax<capu::uint32_t>() {
- return 0xFFFFFFFF;
- }
-
- template<>
- inline capu::uint32_t NumericLimitMin<capu::uint32_t>() {
- return 0x0;
- }
-
- template<>
- inline capu::int16_t NumericLimitMin<capu::int16_t>() {
- return -32768;
- }
-
- template<>
- inline capu::int16_t NumericLimitMax<capu::int16_t>() {
- return 32767;
- }
-
- template<>
- inline capu::int8_t NumericLimitMin<capu::int8_t>() {
- return -128;
- }
-
- template<>
- inline capu::int8_t NumericLimitMax<capu::int8_t>() {
- return 127;
- }
-
- template<>
- inline capu::float_t NumericLimitMin<capu::float_t>() {
- return FLT_MIN;
- }
-
- template<>
- inline capu::float_t NumericLimitMax<capu::float_t>() {
- return FLT_MAX;
- }
-}
-
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/ServerSocket.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/ServerSocket.h
deleted file mode 100644
index e3eed60..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/ServerSocket.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __SERVERSOCKET_H__
-#define __SERVERSOCKET_H__
-
-#define SERVER_SOCKER_INC_HEADER
-#include "arch/ServerSocket.inc"
-#undef SERVER_SOCKER_INC_HEADER
-
-#include "capu/os/Socket.h"
-#include "capu/Error.h"
-
-namespace capu {
-
- class ServerSocket {
-#define SERVER_SOCKET_INC_MEMBER
-#include "arch/ServerSocket.inc"
-#undef SERVER_SOCKET_INC_MEMBER
-
- public:
-
- /**
- * Constructor of ServerSocket
- */
- inline ServerSocket();
-
- /**
- * Destructor of Server Socket
- */
- inline ~ServerSocket();
-
- /**
- * The program flow will be blocked until a connection arrives
- * Programmer is responsible for deallocating memory of returning socket.
- * @return Socket if a connection is accepted
- * NULL otherwise
- */
- inline Socket* accept();
-
- /**
- * Close the socket which is used for accepting connection
- * @return CAPU_OK if the socket is successfully closed
- * CAPU_SOCKET_ESOCKET if the socket is not created
- */
- inline status_t close();
-
- /**
- *
- * @param port indicates port number
- * @param address to bind if it is not given it accepts all connection from any address
- * @return CAPU_OK if the server socket is successfully bound
- * CAPU_SOCKET_EADDR if the addr is faulty
- * CAPU_ERROR if the socket is already bound
- * CAPU_EINVAL if the addr is NULL or port is equal to 0
- * CAPU_SOCKET_ESOCKET if the socket is not created
- */
- inline status_t bind(uint16_t port, const char * addr = NULL);
-
- /**
- *
- * @param backlog (maximum length of the queue of pending connections)
- * @return CAPU_OK if the listen is successful
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t listen(uint8_t backlog);
-
- };
-
-#define SERVER_SOCKET_INC_IMPL
-#include "arch/ServerSocket.inc"
-#undef SERVER_SOCKET_INC_IMPL
-}
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Socket.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Socket.h
deleted file mode 100644
index f31aa3a..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Socket.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __SOCKET_H__
-#define __SOCKET_H__
-
-#define SOCKET_INC_HEADER
-#include "arch/Socket.inc"
-#undef SOCKET_INC_HEADER
-
-#include "capu/Error.h"
-
-namespace capu {
-
- class Socket {
-#define SOCKET_INC_MEMBER
-#include "arch/Socket.inc"
-#undef SOCKET_INC_MEMBER
- public:
-
- /**
- * Default Constructor
- */
- inline Socket();
-
- /**
- * Destructor
- */
- inline ~Socket();
-
- /**
- * Send the messages
- * @param buffer the content of message that will be sent to destination
- * @param length the length of message that will be sent to destination
- * @return CAPU_OK if the sent is successful
- * CAPU_EINVAL if the buffer is NULL
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t send(unsigned char * buffer, int32_t length);
-
- /**
- * Receive message
- * @param buffer buffer that will be used to store incoming message
- * @param length buffer size
- * @param numBytes number of bytes on socket
- * @return CAPU_OK if the receive is successfully executed
- * CAPU_TIMEOUT if there has been a timeout
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t receive(unsigned char * buffer, int32_t length, int32_t& numBytes);
-
- /**
- * close the socket
- * @return CAPU_OK if the socket is correctly closed
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t close();
-
- /**
- * connect to the given address
- * @param dest_addr destination address of server
- * @param port port number of service
- * @return CAPU_OK if correctly connects to specified address
- * CAPU_SOCKET_ECONNECT if the connection is not successful
- * CAPU_SOCKET_EADDR if the given address is not resolved.
- * CAPU_EINVAL if the dest_addr is NULL
- * CAPU_SOCKET_ESOCKET if the socket is not created
- */
- inline status_t connect(unsigned char * dest_addr, uint16_t port);
-
- /**
- * Sets the maximum socket buffer in bytes. The kernel doubles this value (to allow space for bookkeeping overhead)
- * Set the receive buffer size
- * Sets buffer size information.
- * @return CAPU_OK if the buffer is successfully set for both receive and send operations
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t setBufferSize(int32_t bufferSize);
-
- /**
- * Set the linger option for socket
- * Specifies whether the socket lingers on close() if data is present.
- * @return CAPU_OK if the LingerOption is successfully set
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t setLingerOption(bool_t isLinger, int32_t linger);
-
-
- /**
- * Set no delay option
- * Specifies whether the Nagle algorithm used by TCP for send coalescing is to be disabled.
- * @return CAPU_OK if the NoDelay is successfully set
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t setNoDelay(bool_t noDelay);
-
- /**
- * Set Keep Alive option
- * Keeps connections active by enabling periodic transmission of messages, if this is supported by the protocol.
- * @return CAPU_OK if the KeepAlive is successfully set
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t setKeepAlive(bool_t keepAlive);
-
- /**
- * Set Timeout
- * Sets the timeout value that specifies the maximum amount of time an input function waits until it completes
- * @return CAPU_OK if the Timeout for receive operation is successfully set
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t setTimeout(int32_t timeout);
-
- /**
- * get the send and receive buffer size
- * gets buffer size information.
- * @return CAPU_OK if the buffer is successfully set for both receive and send operations
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t getBufferSize(int32_t& bufferSize);
-
- /**
- * get the linger option for socket
- * @return CAPU_OK if the LingerOption is successfully set
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t getLingerOption(bool_t& isLinger, int32_t& linger);
-
- /**
- * Get no delay option
- * @return CAPU_OK if the NoDelay is successfully set
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t getNoDelay(bool_t& noDelay);
-
- /**
- * Get Keep Alive option
- * @return CAPU_OK if the KeepAlive is successfully set
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t getKeepAlive(bool_t& keepAlive);
-
-
- /**
- * Get Timeout
- * @return CAPU_OK if the Timeout for receive operation is successfully set
- * CAPU_SOCKET_ESOCKET if the socket is not created
- * CAPU_ERROR otherwise
- */
- inline status_t getTimeout(int32_t& timeout);
- };
-
-#define SOCKET_INC_IMPL
-#include "arch/Socket.inc"
-#undef SOCKET_INC_IMPL
-}
-
-#endif /* Socket_H */
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/StringUtils.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/StringUtils.h
deleted file mode 100644
index 0446649..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/StringUtils.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef __STRINGUTILS_H__
-#define __STRINGUTILS_H__
-
-#include "capu/Config.h"
-#include "capu/Error.h"
-
-#define STRINGUTILS_INC_HEADER
-#include "arch/StringUtils.inc"
-#undef STRINGUTILS_INC_HEADER
-
-namespace capu
-{
- class StringUtils
- {
-#define STRINGUTILS_INC_MEMBER
-#include "arch/StringUtils.inc"
-#undef STRINGUTILS_INC_MEMBER
-
- public:
- /**
- * Static method to copy a String of length dstSize from src to dst
- * @param dst destination buffer
- * @param dstSize number of chars to be copied
- * @param src source buffer
- */
- inline static void Strncpy(char* dst, uint_t dstSize, const char* src);
-
- /**
- * Static method to write a C string according to the given format into the array pointed by buffer.
- * After the format parameter, the function expects at least as many additional arguments as specified in format.
- * @param buffer which contains the string
- * @param bufferSize size of the buffer
- * @param format the format of the string
- * @param arguments
- */
- inline static void Sprintf(char* buffer, uint_t bufferSize, const char* format, ...);
-
- /**
- * Static method to write a C string according to the given format into the array pointed by buffer.
- * The arguments specified in the format have to be passed by the values parameter.
- * @param buffer which contains the string
- * @param bufferSize size of the buffer
- * @param format the format of the string
- * @param values arguments for the format
- */
- inline static void Vsprintf(char* buffer, uint_t bufferSize, const char* format, va_list values);
-
- /**
- * Static method to count the bytes according to the given format
- * The arguments specified in the format have to be passed by the values parameter.
- * @param format the format of the string
- * @param values arguments for the format
- */
- inline static int32_t Vscprintf(const char* format, va_list values);
-
- /**
- * Static method to return the length of the given String
- * @param str the string
- * @return length of the string
- */
- inline static uint_t Strlen(const char* str);
-
- /**
- * Static method to compare two C strings.
- * @param str1 first string
- * @param str2 second string
- * @return 0 if both strings are equal
- * > 0 if the first character which does not match has a greater value in str1
- * < 0 otherwise
- */
- inline static int_t Strcmp(const char* str1, const char* str2);
-
- };
-
-#define STRINGUTILS_INC_IMPL
-#include "arch/StringUtils.inc"
-#undef STRINGUTILS_INC_IMPL
-
-}
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Thread.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Thread.h
deleted file mode 100644
index ba5f497..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Thread.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __THREAD_H__
-#define __THREAD_H__
-
-#define THREAD_INC_HEADER
-#include "arch/Thread.inc"
-#undef THREAD_INC_HEADER
-
-#include "capu/Error.h"
-#include "capu/util/Runnable.h"
-
-namespace capu
-{
-
- /**
- * Thread states
- */
- enum ThreadState {
- TS_NEW,
- TS_RUNNING,
- TS_TERMINATED
- };
-
-
- class Thread
- {
-
-#define THREAD_INC_MEMBER
-#include "arch/Thread.inc"
-#undef THREAD_INC_MEMBER
-
- public:
-
- /**
- * Default constructor
- */
- inline Thread() {}
-
- /**
- * Constructor
- * Creates a thread which will execute the given function
- * @param Runnable object that will be executed
- * @param arguments
- */
- inline Thread(Runnable* runnable);
-
- /**
- * Destructor
- */
- inline ~Thread();
-
- /**
- * Starts the thread
- * @param Runnable object that will be executed
- * @return CAPU_OK if thread has been started successfully
- * CAPU_ERROR otherwise
- */
- inline status_t start();
-
- /**
- * Waits the thread completeness
- * @return CAPU_OK if thread is currently waiting for completeness
- * CAPU_ERROR otherwise
- */
- inline status_t join();
-
- /**
- * Return the current thread state
- * @return state of the thread
- */
- inline ThreadState getState();
-
- /**
- * Suspend the current thread for specific amount of time
- * @return CAPU_OK if thread is currently suspended
- * CAPU_ERROR otherwise
- */
- static inline status_t Sleep(uint32_t millis);
-
- };
-
-#define THREAD_INC_IMPL
- #include "arch/Thread.inc"
-#undef THREAD_INC_IMPL
-
-}
-
-#endif /* Thread_H */
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Time.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Time.h
deleted file mode 100644
index c19a00f..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/Time.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __TIME_H__
-#define __TIME_H__
-
-#include "capu/Config.h"
-
-#define TIME_INC_HEADER
-#include "arch/Time.inc"
-#undef TIME_INC_HEADER
-
-namespace capu
-{
- class Time
- {
- #define TIME_INC_MEMBER
- #include "arch/Time.inc"
- #undef TIME_INC_MEMBER
- public:
-
- inline static uint32_t GetMilliseconds();
-
- };
-
-#define TIME_INC_IMPL
- #include "arch/Time.inc"
-#undef TIME_INC_IMPL
-
-}
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/UdpSocket.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/UdpSocket.h
deleted file mode 100644
index 8d68ed5..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/UdpSocket.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __UDPSOCKET_H__
-#define __UDPSOCKET_H__
-
-#define UDPSOCKET_INC_HEADER
-#include "arch/UdpSocket.inc"
-#undef UDPSOCKET_INC_HEADER
-
-#include "capu/Error.h"
-
-namespace capu {
-
- class UdpSocket{
-#define UDPSOCKET_INC_MEMBER
-#include "arch/UdpSocket.inc"
-#undef UDPSOCKET_INC_MEMBER
-
- public:
-
- struct SocketAddrInfo
- {
- uint16_t port;
- char addr[16];
- };
-
- /**
- * Default Constructor
- */
- inline UdpSocket();
-
- /**
- * Destructor
- */
- inline ~UdpSocket();
-
- /**
- *
- * @param port indicates port number
- * @param address to bind if it is not given it accepts all connection from any address
- * @return CAPU_OK if the server socket is successfully bound
- * CAPU_SOCKET_EADDR if the addr is faulty
- * CAPU_ERROR if the socket is already bound
- * CAPU_EINVAL if the port is equal to 0
- * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
- */
- inline status_t bind(uint16_t port, const char *addr = NULL);
-
- /**
- * Send the messages
- * @param buffer the content of message that will be sent to destination
- * @param length the length of message that will be sent to destination
- * @param receiverAddr the destination
- * @return CAPU_OK if the sent is successful
- * CAPU_EINVAL if the buffer is NULL
- * CAPU_SOCKET_EADDR if the given address is not resolved.
- * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
- * CAPU_ERROR otherwise
- */
- inline status_t send(unsigned char *buffer, int32_t length, SocketAddrInfo& receiverAddr);
-
- /**
- * Send the messages
- * @param buffer the content of message that will be sent to destination
- * @param length the length of message that will be sent to destination
- * @param receiverAddr the destination address
- * @param receiverPort the destination port
- * @return CAPU_OK if the sent is successful
- * CAPU_EINVAL if the buffer is NULL
- * CAPU_SOCKET_EADDR if the given address is not resolved.
- * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
- * CAPU_ERROR otherwise
- */
- inline status_t send(unsigned char *buffer, int32_t length, const char *receiverAddr, uint16_t receiverPort);
-
- /**
- * Receive message
- * @param buffer buffer that will be used to store incoming message
- * @param length buffer size
- * @param numBytes number of bytes on socket
- * @param sender out parameter for the socket address of the sender
- * @return CAPU_OK if the receive is successfully executed
- * CAPU_TIMEOUT if there has been a timeout
- * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
- * CAPU_ERROR otherwise
- */
- inline status_t receive(unsigned char *buffer, int32_t length, int32_t& numBytes, SocketAddrInfo* sender);
-
- /**
- * close the socket
- * @return CAPU_OK if the socket is correctly closed
- * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
- * CAPU_ERROR otherwise
- */
- inline status_t close();
-
-
- /**
- * Sets the maximum socket buffer in bytes. The kernel doubles this value (to allow space for bookkeeping overhead)
- * Set the receive buffer size
- * Sets buffer size information.
- * @return CAPU_OK if the buffer is successfully set for both receive and send operations
- * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
- * CAPU_ERROR otherwise
- */
- inline status_t setBufferSize(int32_t bufferSize);
-
- /**
- * Set Timeout
- * Sets the timeout value that specifies the maximum amount of time an input function waits until it completes
- * @return CAPU_OK if the Timeout for receive operation is successfully set
- * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
- * CAPU_ERROR otherwise
- */
- inline status_t setTimeout(int32_t timeout);
-
- /**
- * get the send and receive buffer size
- * gets buffer size information.
- * @return CAPU_OK if the buffer is successfully set for both receive and send operations
- * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
- * CAPU_ERROR otherwise
- */
- inline status_t getBufferSize(int32_t& bufferSize);
-
- /**
- * Get Timeout
- * @return CAPU_OK if the Timeout for receive operation is successfully set
- * CAPU_SOCKET_ESOCKET if the socket has not been created successfully
- * CAPU_ERROR otherwise
- */
- inline status_t getTimeout(int32_t& timeout);
- };
-
-
-#define UDPSOCKET_INC_IMPL
-#include "arch/UdpSocket.inc"
-#undef UDPSOCKET_INC_IMPL
-}
-
-#endif /* __UDPSOCKET_H__ */
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/AtomicOperation.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/AtomicOperation.inc
deleted file mode 100644
index 476f496..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/AtomicOperation.inc
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if defined(OS_LINUX)
- #if defined(ARCH_X86_32)
- #include "Linux_X86_32/AtomicOperation.inc"
- #elif defined(ARCH_X86_64)
- #include "Linux_X86_64/AtomicOperation.inc"
- #elif defined(ARCH_ARMV7L)
- #include "Linux_ARM_V7L/AtomicOperation.inc"
- #endif
-#elif defined(OS_WINDOWS)
- #if defined(ARCH_X86_32)
- #include "Windows_X86_32/AtomicOperation.inc"
- #elif defined(ARCH_X86_64)
- #include "Windows_X86_64/AtomicOperation.inc"
- #endif
-#elif defined(OS_INTEGRITY)
- #if defined(ARCH_ARMV7L)
- #include "Integrity_ARM_V7L/AtomicOperation.inc"
- #endif
-#elif defined(OS_QNX)
- #if defined(ARCH_X86_32)
- #include "Linux_X86_32/AtomicOperation.inc"
- #endif
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/CondVar.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/CondVar.inc
deleted file mode 100644
index f73a0db..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/CondVar.inc
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if defined(OS_LINUX)
- #include "Linux/CondVar.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/CondVar.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/CondVar.inc"
-#elif defined(OS_QNX)
- #include "Linux/CondVar.inc"
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Debug.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Debug.inc
deleted file mode 100644
index b21d55a..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Debug.inc
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if defined(OS_LINUX)
- #include "Linux/Debug.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/Debug.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/Debug.inc"
-#elif defined(OS_QNX)
- #include "Linux/Debug.inc"
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/File.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/File.inc
deleted file mode 100644
index 04f6898..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/File.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef OS_LINUX
- #include "Linux/File.inc"
-#elif OS_WINDOWS
- #include "Windows/File.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/File.inc"
-#elif defined(OS_QNX)
- #include "Linux/File.inc"
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Integrity_ARM_V7L/AtomicOperation.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Integrity_ARM_V7L/AtomicOperation.inc
deleted file mode 100644
index f529651..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Integrity_ARM_V7L/AtomicOperation.inc
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef ATOMIC_OPERATION_INC_HEADER
-#include "INTEGRITY.h"
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_MEMBER
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_IMPL
-inline void AtomicOperation::AtomicAdd32(volatile uint32_t &mem, uint32_t summand) {
- Address tmp;
- AtomicModify((Address*)mem, &tmp, 0, (Address)(&summand));
-}
-
-inline void AtomicOperation::AtomicSub32(volatile uint32_t &mem, uint32_t subtrahend) {
- Address tmp;
- int32_t subValue = -subtrahend;
- AtomicModify((Address*)mem, &tmp, 0, (Address)(&subtrahend));
-
-}
-
-inline void AtomicOperation::AtomicInc32(volatile uint32_t &mem) {
- AtomicAdd32(mem, 1);
-}
-
-inline void AtomicOperation::AtomicDec32(volatile uint32_t &mem) {
- AtomicSub32(mem, 1);
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/CondVar.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/CondVar.inc
deleted file mode 100644
index a78ce5f..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/CondVar.inc
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-
-#ifdef CONDVAR_INC_HEADER
-#include <pthread.h>
-#include <time.h>
-#include <errno.h>
-#endif
-
-#ifdef CONDVAR_INC_MEMBER
-private:
- pthread_cond_t mCond;
- pthread_condattr_t mCondAttr;
-#endif
-
-#ifdef CONDVAR_INC_IMPL
- inline CondVar::CondVar()
- {
- pthread_condattr_init(&mCondAttr);
- pthread_cond_init(&mCond,&mCondAttr);
- }
- inline CondVar::~CondVar()
- {
- pthread_cond_destroy(&mCond);
- pthread_condattr_destroy(&mCondAttr);
- }
- inline status_t CondVar::signal()
- {
- if(pthread_cond_signal(&mCond) == 0)
- {
- return CAPU_OK;
- }
- else
- {
- return CAPU_ERROR;
- }
- }
- inline status_t CondVar::broadcast()
- {
- if(pthread_cond_broadcast(&mCond) == 0)
- {
- return CAPU_OK;
- }
- else
- {
- return CAPU_ERROR;
- }
- }
- inline status_t CondVar::wait(Mutex *mutex, uint32_t millisec)
- {
- if(mutex == NULL)
- {
- return CAPU_EINVAL;
- }
-
- if(millisec != 0)
- {
- timespec _time;
- if(clock_gettime(CLOCK_REALTIME, &_time) < 0)
- {
- return CAPU_ERROR;
- }
- _time.tv_sec += (millisec/1000);
- _time.tv_nsec += ((millisec%1000)* 1000000);
- int32_t ret = pthread_cond_timedwait(&mCond, &mutex->mLock, &_time);
-
- switch(ret)
- {
- case 0:
- return CAPU_OK;
- case ETIMEDOUT:
- return CAPU_ETIMEOUT;
- default:
- return CAPU_ERROR;
- }
- }
- else
- {
- if(pthread_cond_wait(&mCond, &mutex->mLock) == 0)
- {
- return CAPU_OK;
- }
- else
- {
- return CAPU_ERROR;
- }
- }
- }
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Debug.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Debug.inc
deleted file mode 100644
index 529ecbd..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Debug.inc
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef DEBUG_INC_HEADER
-#include <assert.h>
-#endif
-
-#ifdef DEBUG_INC_MEMBER
-public:
-
-
-private:
-#endif
-
-#ifdef DEBUG_INC_IMPL
-
- inline void Debug::Assert(bool condition)
-{
- #ifndef NDEBUG
- assert(condition);
- #else
- #endif
-};
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/File.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/File.inc
deleted file mode 100644
index be5e0d6..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/File.inc
+++ /dev/null
@@ -1,118 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef FILE_INC_HEADER
-#endif
-
-#ifdef FILE_INC_MEMBER
- private:
- FILE* mHandle;
- bool_t mIsOpen;
-#endif
-
-#ifdef FILE_INC_IMPL
-
- inline File::File(const char* name, const char* mode) :
- mHandle(NULL) ,
- mIsOpen(false) {
-
- // try to open file
- mHandle = fopen(name, mode);
- if(mHandle != NULL) {
- mIsOpen = true;
- }
- }
-
- inline bool_t File::isOpen() {
- return mIsOpen;
- }
-
- inline bool_t File::isEof() {
- if(mHandle == NULL) {
- return false;
- }
- return (feof(mHandle) != 0);
- }
-
- inline status_t File::read(char * buffer, uint32_t length, int32_t* numBytes) {
- if(buffer == NULL) {
- return CAPU_EINVAL;
- }
- if(mHandle == NULL) {
- return CAPU_ERROR;
- }
-
- size_t result = fread(buffer, 1, length, mHandle);
- if(result == length) {
- if(numBytes != NULL) {
- *numBytes = result;
- }
- return CAPU_OK;
- }
- if(feof(mHandle)) {
- if(numBytes != NULL) {
- *numBytes = result;
- }
- return CAPU_EOF;
- }
-
- return CAPU_ERROR;
- }
-
- inline status_t File::write(char * buffer, uint32_t length) {
- if(buffer == NULL) {
- return CAPU_EINVAL;
- }
- if(mHandle == NULL) {
- return CAPU_ERROR;
- }
-
- size_t result = fwrite(buffer, 1, length, mHandle);
- if(result != length) {
- return CAPU_ERROR;
- }
- return CAPU_OK;
- }
-
- inline status_t File::flush() {
- if(mHandle != NULL) {
- int error = fflush(mHandle);
- if(error == 0) {
- return CAPU_OK;
- }
- }
- return CAPU_ERROR;
- }
-
- inline status_t File::close() {
- if(mHandle != NULL) {
- fclose(mHandle);
- mHandle = NULL;
- mIsOpen = false;
- return CAPU_OK;
- }
- return CAPU_ERROR;
- }
-
- inline File::~File() {
- if(mHandle != NULL) {
- fclose(mHandle);
- }
- }
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Math.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Math.inc
deleted file mode 100644
index cdb0568..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Math.inc
+++ /dev/null
@@ -1,153 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifdef MATH_INC_HEADER
-#include <cmath>
-#endif
-
-#ifdef MATH_INC_MEMBER
-public:
-static const float_t PI_f;
-static const double_t PI_d;
-#endif
-
-#ifdef MATH_INC_IMPL
-inline float_t Math::Ceil(float_t val) {
- return ceilf(val);
-}
-
-inline double_t Math::Ceil(double_t val) {
- return ceil(val);
-}
-
-inline float_t Floor(float_t val)
-{
- return floorf(val);
-}
-
-inline double_t Floor(double_t val)
-{
- return floor(val);
-}
-
-
-inline float_t Math::Abs(float_t val) {
- return fabs(val);
-}
-
-inline double_t Math::Abs(double_t val) {
- return abs(val);
-}
-
-inline int_t Abs(int_t val)
-{
- return abs(val);
-}
-
-inline float_t Math::Sqrt(float_t val) {
- return sqrtf(val);
-}
-
-inline double_t Math::Sqrt(double_t val) {
- return sqrt(val);
-}
-
-inline float_t Math::Pow2(float_t val) {
- return val * val;
-}
-
-inline double_t Math::Pow2(double_t val) {
- return val * val;
-}
-
-inline float_t Math::Cos(float_t val) {
- return cosf(val);
-}
-
-inline float_t Pow(float_t val, float_t exponent)
-{
- return powf(val, exponent);
-}
-
-inline double_t Por(double_t val, double_t exponent)
-{
- return pow(val, exponent);
-}
-
-inline double_t Math::Cos(double_t val) {
- return cos(val);
-}
-
-inline float_t Math::Sin(float_t val) {
- return sinf(val);
-}
-
-inline double_t Math::Sin(double_t val) {
- return sin(val);
-}
-
-inline float_t Math::Tan(float_t val) {
- return tanf(val);
-}
-
-inline double_t Math::Tan(double_t val) {
- return tan(val);
-}
-
-inline float_t Math::ArcCos(float_t val) {
- return acosf(val);
-}
-
-inline double_t Math::ArcCos(double_t val) {
- return acos(val);
-}
-
-inline float_t Math::ArcSin(float_t val) {
- return asinf(val);
-}
-
-inline double_t Math::ArcSin(double_t val) {
- return asin(val);
-}
-
-inline float_t Math::ArcTan(float_t val) {
- return atanf(val);
-}
-
-inline double_t Math::ArcTan(double_t val) {
- return atan(val);
-}
-
-inline float_t Math::Rad2Deg(float_t val) {
- return val * (180.f / PI_f);
-}
-
-inline double_t Math::Rad2Deg(double_t val) {
- return val * (180.0 / PI_d);
-}
-
-inline float_t Math::Deg2Rad(float_t val) {
- return val * (PI_f / 180.f);
-}
-
-inline double_t Math::Deg2Rad(double_t val) {
- return val * (PI_d / 180.0);
-}
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Memory.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Memory.inc
deleted file mode 100644
index 4605b5d..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Memory.inc
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $Id$
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef MEMORY_INC_HEADER
-#include "capu/Config.h"
-#endif
-
-#ifdef MEMORY_INC_MEMBER
-#endif
-
-#ifdef MEMORY_INC_IMPL
-
-inline
-void Memory::Set(void* dst, int32_t val, uint_t size)
-{
- memset(dst, val, size);
-}
-
-inline
-void Memory::Copy(void* dst, const void* src, uint_t size)
-{
- memcpy(dst, src, size);
-}
-
-inline
-void Memory::Move(void* dst, const void* src, uint_t size)
-{
- memmove(dst, src, size);
-}
-
-int32_t Memory::Compare(const void* ptr1, const void* ptr2, uint_t num)
-{
- return memcmp(ptr1, ptr2, num);
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Mutex.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Mutex.inc
deleted file mode 100644
index fb372c4..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Mutex.inc
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef MUTEX_INC_HEADER
-#include <pthread.h>
-#endif
-
-#ifdef MUTEX_INC_MEMBER
-public:
- friend class CondVar;
-
-private:
- pthread_mutex_t mLock;
- pthread_mutexattr_t mLockAttr;
-#endif
-
-#ifdef MUTEX_INC_IMPL
-inline Mutex::Mutex()
-{
- pthread_mutexattr_init(&mLockAttr);
- pthread_mutexattr_settype(&mLockAttr,PTHREAD_MUTEX_RECURSIVE);
- pthread_mutex_init(&mLock,&mLockAttr);
-}
-
-inline Mutex::~Mutex()
-{
- pthread_mutex_destroy(&mLock);
- pthread_mutexattr_destroy(&mLockAttr);
-}
-
-inline status_t Mutex::lock()
-{
- if(pthread_mutex_lock(&mLock)==0)
- return CAPU_OK;
- else
- return CAPU_ERROR;
-}
-
-inline status_t Mutex::unlock()
-{
- if(pthread_mutex_unlock(&mLock)==0)
- return CAPU_OK;
- else
- return CAPU_ERROR;
-}
-
-inline bool Mutex::trylock()
-{
- if(pthread_mutex_trylock(&mLock)==0)
- return true;
- else
- return false;
-}
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/NumericLimits.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/NumericLimits.inc
deleted file mode 100644
index b8312e9..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/NumericLimits.inc
+++ /dev/null
@@ -1,21 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef NUMERIC_LIMITS_INC_HEADER
-#include <float.h>
-#endif
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/ServerSocket.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/ServerSocket.inc
deleted file mode 100644
index 1185373..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/ServerSocket.inc
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef SERVER_SOCKET_INC_HEADER
-#include <sys/socket.h>
-#include <netdb.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#endif
-
-#ifdef SERVER_SOCKET_INC_MEMBER
-private:
-int32_t mServerSock;
-bool_t mIsBound;
-#endif
-
-#ifdef SERVER_SOCKET_INC_IMPL
-
-inline ServerSocket::ServerSocket() {
- mServerSock = -1;
- mIsBound = false;
- mServerSock = socket(AF_INET, SOCK_STREAM, 0);
-}
-
-inline ServerSocket::~ServerSocket() {
- close();
-}
-
-inline Socket* ServerSocket::accept() {
- int32_t clientAddrSize = sizeof (sockaddr_in);
- struct sockaddr_in serverAddr;
- capu::int32_t socketHandle = ::accept(mServerSock, (sockaddr *) & serverAddr, (socklen_t *) & clientAddrSize);
- if (socketHandle < 0) {
- return NULL;
- }
- Socket *s = new Socket(socketHandle);
- s->mServerAddress = serverAddr;
- return s;
-}
-
-inline status_t ServerSocket::close() {
- int32_t returnValue = CAPU_OK;
- if (mServerSock != -1) {
- shutdown(mServerSock, SHUT_RDWR);
- if (::close(mServerSock) < 0) {
- returnValue = CAPU_ERROR;
- }
- } else {
- returnValue = CAPU_SOCKET_ESOCKET;
- }
- mServerSock = -1;
- mIsBound = false;
- return returnValue;
-}
-
-inline status_t ServerSocket::bind(uint16_t port, const char * addr) {
-
- sockaddr_in mServerAddress;
- if (port == 0)
- return CAPU_EINVAL;
-
- if (mIsBound)
- return CAPU_ERROR;
-
- if (mServerSock == -1)
- return CAPU_SOCKET_ESOCKET;
-
- int32_t optval = 1;
- setsockopt(mServerSock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof (optval));
- memset((char *) &mServerAddress, 0x00, sizeof (mServerAddress));
- mServerAddress.sin_family = AF_INET;
- if (addr == NULL)
- mServerAddress.sin_addr.s_addr = INADDR_ANY;
- else if (inet_aton(addr, &mServerAddress.sin_addr) == 0)
- return CAPU_SOCKET_EADDR;
- mServerAddress.sin_port = htons(port);
-
- int32_t res = ::bind(mServerSock, (sockaddr *) & mServerAddress, sizeof (struct sockaddr_in));
- if (res < 0) {
- return CAPU_SOCKET_EBIND;
- }
-
- mIsBound = true;
- return CAPU_OK;
-}
-
-inline status_t ServerSocket::listen(uint8_t backlog) {
- if (!mIsBound)
- return CAPU_EINVAL;
-
- if (mServerSock == -1)
- return CAPU_SOCKET_ESOCKET;
-
- if (::listen(mServerSock, backlog) < 0)
- return CAPU_ERROR;
- return CAPU_OK;
-}
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Socket.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Socket.inc
deleted file mode 100644
index 152f862..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Socket.inc
+++ /dev/null
@@ -1,287 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef SOCKET_INC_HEADER
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <errno.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-#endif
-
-#ifdef SOCKET_INC_MEMBER
-private:
-int32_t mSocket;
-struct sockaddr_in mServerAddress;
-struct hostent *mServer;
-
-public:
-friend class ServerSocket;
-
-private:
-//private constructor needed in ServerSocket
-inline Socket(int32_t socket);
-#endif
-
-#ifdef SOCKET_INC_IMPL
-
-inline Socket::Socket() {
- mSocket = -1;
- mSocket = socket(AF_INET, SOCK_STREAM, 0);
-}
-
-inline Socket::Socket(int32_t socket) {
- mSocket = socket;
-}
-
-inline Socket::~Socket() {
- close();
-}
-
-inline status_t Socket::send(unsigned char * buffer, int32_t length) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- int32_t res = ::send(mSocket, buffer, length, 0);
-
- if (res < 0) {
- return CAPU_ERROR;
- }
- return CAPU_OK;
-}
-
-inline status_t Socket::receive(unsigned char * buffer, int32_t length, int32_t & numBytes) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- int32_t res = ::recv(mSocket, buffer, length, 0);
-
- if (res == -1) {
- numBytes = 0;
- if (errno == EAGAIN)
- return CAPU_ETIMEOUT;
- else
- return CAPU_ERROR;
- }
- numBytes = res;
-
- return CAPU_OK;
-}
-
-inline status_t Socket::close() {
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- } else {
- shutdown(mSocket, SHUT_RDWR);
- if (::close(mSocket) < 0)
- return CAPU_SOCKET_ECLOSE;
- mSocket = -1;
- return CAPU_OK;
- }
-}
-
-inline status_t Socket::connect(unsigned char * dest_addr, uint16_t port) {
- if ((dest_addr == NULL) || (port == 0))
- return CAPU_EINVAL;
-
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- mServer = gethostbyname((const char *) dest_addr);
- if (mServer == NULL)
- return CAPU_SOCKET_EADDR;
-
- // for padding
- memset((char *) &mServerAddress, 0x00, sizeof (mServerAddress));
- mServerAddress.sin_family = AF_INET;
-
- //destination ip is set
- memcpy((char *) &mServerAddress.sin_addr.s_addr, (char *) mServer->h_addr_list[0], mServer->h_length);
-
- //port is set
- mServerAddress.sin_port = htons(port);
-
- int32_t res = ::connect(mSocket, (const sockaddr *) &mServerAddress, sizeof (mServerAddress));
-
- if (res == -1)
- return CAPU_SOCKET_ECONNECT;
- return CAPU_OK;
-}
-
-inline status_t Socket::setBufferSize(int32_t bufferSize) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- if (bufferSize < 0)
- return CAPU_EINVAL;
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof (bufferSize)) < 0)
- return CAPU_ERROR;
-
- return CAPU_OK;
-}
-
-inline status_t Socket::setLingerOption(bool_t isLinger, int32_t linger) {
- if (linger < 0) {
- return CAPU_EINVAL;
- }
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- struct linger so_linger;
- if (isLinger) {
- so_linger.l_onoff = 1;
- so_linger.l_linger = linger;
- } else {
- so_linger.l_onoff = 0;
- so_linger.l_linger = 0;
- }
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_LINGER, &so_linger, sizeof (so_linger)) < 0)
- return CAPU_ERROR;
- return CAPU_OK;
-}
-
-inline status_t Socket::setNoDelay(bool_t noDelay) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- int32_t opt;
- if (noDelay)
- opt = 1;
- else
- opt = 0;
- if (setsockopt(mSocket, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof (opt)) < 0)
- return CAPU_ERROR;
- return CAPU_OK;
-}
-
-inline status_t Socket::setKeepAlive(bool_t keepAlive) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- int32_t opt;
- if (keepAlive)
- opt = 1;
- else
- opt = 0;
- if (setsockopt(mSocket, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof (opt)) < 0)
- return CAPU_ERROR;
- return CAPU_OK;
-}
-
-inline status_t Socket::setTimeout(int32_t timeout) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval _timeout;
- _timeout.tv_sec = timeout;
- _timeout.tv_usec = 0;
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, &_timeout, sizeof (_timeout)) < 0)
- return CAPU_ERROR;
- if (setsockopt(mSocket, SOL_SOCKET, SO_SNDTIMEO, &_timeout, sizeof (_timeout)) < 0)
- return CAPU_ERROR;
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getBufferSize(int32_t& bufferSize) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- int32_t size;
- socklen_t len = sizeof (size);
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, &size, &len) < 0)
- return CAPU_ERROR;
- bufferSize = size;
- return CAPU_OK;
-}
-
-inline status_t Socket::getLingerOption(bool_t& isLinger, int32_t& _linger) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- struct linger so_linger;
-
- socklen_t len = sizeof (so_linger);
- if (getsockopt(mSocket, SOL_SOCKET, SO_LINGER, &so_linger, &len) < 0)
- return CAPU_ERROR;
- _linger = so_linger.l_linger;
- if (so_linger.l_onoff == 1)
- isLinger = true;
- else
- isLinger = false;
- return CAPU_OK;
-}
-
-inline status_t Socket::getNoDelay(bool_t& noDelay) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- int32_t opt;
- socklen_t len = sizeof (opt);
- if (getsockopt(mSocket, IPPROTO_TCP, TCP_NODELAY, &opt, &len) < 0)
- return CAPU_ERROR;
-
- if (opt == 1)
- noDelay = true;
- else
- noDelay = false;
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getKeepAlive(bool_t& keepAlive) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- int32_t opt;
-
- socklen_t len = sizeof (opt);
- if (getsockopt(mSocket, SOL_SOCKET, SO_KEEPALIVE, &opt, &len) < 0)
- return CAPU_ERROR;
-
- if (opt == 1)
- keepAlive = true;
- else
- keepAlive = false;
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getTimeout(int32_t& timeout) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval _timeout;
-
- socklen_t len = sizeof (_timeout);
-
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, &_timeout, &len) < 0)
- return CAPU_ERROR;
-
- timeout = _timeout.tv_sec;
-
- return CAPU_OK;
-}
-#endif
-
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/StringUtils.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/StringUtils.inc
deleted file mode 100644
index baa8bc3..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/StringUtils.inc
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef STRINGUTILS_INC_HEADER
-#include "capu/Config.h"
-#include <stdarg.h>
-#endif
-
-#ifdef STRINGUTILS_INC_MEMBER
-private:
-#endif
-
-#ifdef STRINGUTILS_INC_IMPL
-
- inline void StringUtils::Strncpy(char* dst, uint_t dstSize, const char* src)
- {
- strncpy(dst, src, dstSize);
- }
-
- inline uint_t StringUtils::Strlen(const char* str)
- {
- return strlen(str);
- }
-
- inline int_t StringUtils::Strcmp(const char* str1, const char* str2)
- {
- return strcmp(str1, str2);
- }
-
- inline void StringUtils::Vsprintf(char* buffer, uint_t bufferSize,const char* format, va_list values)
- {
- vsnprintf(buffer, bufferSize, format, values);
- }
-
-
- inline int32_t StringUtils::Vscprintf(const char* format, va_list values) {
- char c;
- return vsnprintf(&c, 1, format, values);
- }
-
- inline void StringUtils::Sprintf(char* buffer, uint_t bufferSize, const char* format, ...)
- {
- va_list argptr;
- va_start(argptr,format);
- StringUtils::Vsprintf(buffer, bufferSize, format, argptr);
- va_end(argptr);
- }
-
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Thread.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Thread.inc
deleted file mode 100644
index 023246c..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Thread.inc
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef THREAD_INC_HEADER
-#include <pthread.h>
-#include <unistd.h>
-#endif
-
-#ifdef THREAD_INC_MEMBER
-private:
- class ThreadRunnable {
- public:
- Thread* thread;
- Runnable* runnable;
- };
-
- pthread_t mThread;
- pthread_attr_t mAttr;
- ThreadState mState;
- ThreadRunnable *mRunnable;
-
- /**
- * sets the current thread state
- */
- void setState(ThreadState state);
-
- static void * run(void* arg)
- {
- ThreadRunnable* tr = (ThreadRunnable*) arg;
- tr->thread->setState(TS_RUNNING);
- if (tr->runnable != NULL) {
- tr->runnable->run();
- }
- tr->thread->setState(TS_TERMINATED);
- pthread_exit(NULL);
- }
-
-
-#endif
-
-#ifdef THREAD_INC_IMPL
-
-inline Thread::Thread(Runnable *runnable) : mState(TS_NEW)
-{
- pthread_attr_init(&mAttr);
- pthread_attr_setdetachstate(&mAttr,PTHREAD_CREATE_JOINABLE);
- mRunnable = new ThreadRunnable();
- mRunnable->thread = this;
- mRunnable->runnable = runnable;
-
-}
-
-inline Thread::~Thread()
-{
- join();
- pthread_attr_destroy(&mAttr);
- delete mRunnable;
-}
-
-inline status_t Thread::start()
-{
- if (mRunnable == NULL) {
- return CAPU_EINVAL;
- }
-
- int32_t result = pthread_create(&mThread, &mAttr, Thread::run, mRunnable);
- if (result != 0) {
- return CAPU_ERROR;
- }
- return CAPU_OK;
-}
-
-
-inline status_t Thread::join ()
-{
- if (mThread == 0) {
- return CAPU_ERROR;
- }
- if(pthread_join(mThread, NULL) == 0) {
- mThread = 0;
- return CAPU_OK;
- }
- return CAPU_ERROR;
-}
-
-inline status_t Thread::Sleep(uint32_t millis)
-{
- if(usleep(millis*1000)==0)
- return CAPU_OK;
- return CAPU_ERROR;
-}
-
-inline ThreadState Thread::getState() {
- return mState;
-}
-
-inline void Thread::setState(ThreadState state) {
- mState = state;
-}
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Time.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Time.inc
deleted file mode 100644
index 82b4d49..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/Time.inc
+++ /dev/null
@@ -1,35 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifdef TIME_INC_HEADER
-#include <time.h>
-#endif
-
-#ifdef TIME_INC_MEMBER
-#endif
-
-#ifdef TIME_INC_IMPL
-inline
-uint32_t Time::GetMilliseconds()
-{
- timespec time;
- clock_gettime(CLOCK_REALTIME, &time);
- return static_cast<uint32_t>(((static_cast<uint64_t>(time.tv_sec) * 1000000000) + time.tv_nsec) / 1000000);
-}
-
-
-#endif
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/UdpSocket.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/UdpSocket.inc
deleted file mode 100644
index 5834738..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/UdpSocket.inc
+++ /dev/null
@@ -1,224 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef UDPSOCKET_INC_HEADER
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <errno.h>
-#include <arpa/inet.h>
-#include "capu/os/StringUtils.h"
-#endif
-
-#ifdef UDPSOCKET_INC_MEMBER
-public:
-private:
- int32_t mSocket;
- int32_t mAddressFamily;
- int32_t mSocketType;
- bool_t mIsBound;
-#endif
-
-#ifdef UDPSOCKET_INC_IMPL
-inline UdpSocket::UdpSocket() {
- //create the socket which is used to connect the server
- mAddressFamily = AF_INET;
- mSocketType = SOCK_DGRAM;
- mSocket = socket(mAddressFamily, mSocketType, 0);
- if (mSocket != -1) {
- int32_t optval = 1;
- setsockopt(mSocket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof (optval));
- }
- mIsBound = false;
-}
-
-inline UdpSocket::~UdpSocket() {
- close();
-}
-
-inline status_t UdpSocket::bind(uint16_t port, const char *addr) {
- if (port == 0) {
- return CAPU_EINVAL;
- }
-
- if (mIsBound) {
- return CAPU_ERROR;
- }
-
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- struct sockaddr_in mServerAddress;
- memset((char *) &mServerAddress, 0x00, sizeof (mServerAddress));
- mServerAddress.sin_family = AF_INET;
- if (addr == NULL)
- mServerAddress.sin_addr.s_addr = INADDR_ANY;
- else if (inet_aton(addr, &mServerAddress.sin_addr) == 0)
- return CAPU_SOCKET_EADDR;
- mServerAddress.sin_port = htons(port);
-
- int32_t res = ::bind(mSocket, (sockaddr *) &mServerAddress, sizeof (struct sockaddr_in));
- if (res < 0) {
- printf("%d\n", errno);
- return CAPU_SOCKET_EBIND;
- }
-
- mIsBound = true;
- return CAPU_OK;
-}
-
-
-inline status_t UdpSocket::send(unsigned char *buffer, int32_t length, const char *receiverAddr, uint16_t receiverPort) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
-
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- struct hostent *receiverAddrIp = gethostbyname(receiverAddr);
- if (receiverAddrIp == NULL) {
- return CAPU_SOCKET_EADDR;
- }
- struct sockaddr_in receiverSockAddr;
- receiverSockAddr.sin_family = AF_INET;
- memcpy((char *) &receiverSockAddr.sin_addr.s_addr, (char *) receiverAddrIp->h_addr_list[0], receiverAddrIp->h_length);
- receiverSockAddr.sin_port = htons(receiverPort);
-
-
- int32_t result = sendto(mSocket,(char*)buffer, length, 0, (sockaddr*)&receiverSockAddr, sizeof(receiverSockAddr));
- if(result == -1)
- {
- return CAPU_ERROR;
- }
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::send(unsigned char *buffer, int32_t length, SocketAddrInfo& receiverAddr) {
- return send(buffer, length, receiverAddr.addr, receiverAddr.port);
-}
-
-inline status_t UdpSocket::receive(unsigned char *buffer, int32_t length, int32_t &numBytes, SocketAddrInfo* sender) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
-
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- sockaddr remoteSocketAddr;
- socklen_t remoteSocketAddrSize = sizeof(remoteSocketAddr);
-
- int32_t result = recvfrom(mSocket, (char*)buffer, length, 0, &remoteSocketAddr, &remoteSocketAddrSize);
- if (result == -1) {
- numBytes = 0;
- if (errno == EAGAIN) {
- return CAPU_ETIMEOUT;
- } else {
- return CAPU_ERROR;
- }
- }else{
- if(sender != 0)
- {
- sender->port = ntohs(((sockaddr_in*)&remoteSocketAddr)->sin_port);
- char* addr = inet_ntoa(((sockaddr_in*)&remoteSocketAddr)->sin_addr);
- StringUtils::Strncpy(sender->addr, sizeof(sender->addr), addr);
- }
- }
- numBytes = result;
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::close() {
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- } else {
- if (::close(mSocket) < 0)
- return CAPU_SOCKET_ECLOSE;
- mSocket = -1;
- return CAPU_OK;
- }
-}
-
-inline status_t UdpSocket::setBufferSize(int32_t bufferSize) {
- if (bufferSize < 0) {
- return CAPU_EINVAL;
- }
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, sizeof(bufferSize)) == -1) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::setTimeout(int32_t timeout) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval soTimeout;
- soTimeout.tv_sec = timeout;
- soTimeout.tv_usec = 0;
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == -1) {
- return CAPU_ERROR;
- }
- if (setsockopt(mSocket, SOL_SOCKET, SO_SNDTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == -1) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::getBufferSize(int32_t& bufferSize) {
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- socklen_t len = sizeof (bufferSize);
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, &len) == -1) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::getTimeout(int32_t& timeout) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval soTimeout;
- socklen_t len = sizeof(soTimeout);
-
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, &len) == -1) {
- return CAPU_ERROR;
- }
-
- timeout = soTimeout.tv_sec;
-
- return CAPU_OK;
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_ARM_V7L/AtomicOperation.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_ARM_V7L/AtomicOperation.inc
deleted file mode 100644
index 54885fc..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_ARM_V7L/AtomicOperation.inc
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef ATOMIC_OPERATION_INC_HEADER
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_MEMBER
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_IMPL
-inline uint32_t AtomicOperation::AtomicAdd32(volatile uint32_t &mem, uint32_t summand) {
- //TODO: Make this thread-safe
- uint32_t oldValue = mem;
- __asm__ volatile (
- "1: ldrex r0, [%0] \n\t" //load mem into r0
- "add r0, r0, %1 \n\t" //add summand to r0 and store result in r0
- "strex r1, r0, [%0] \n\t" //store result from register back to mem
- "cmp r1, #0 \n\t" //check if we have had exclusive access
- "bne 1b" //if there was no exclusive access, try it again
- : /* no output register needed */
- : "r" (&mem), "r"(summand)
- : "r0" , "r1"
- );
-
- return oldValue;
-}
-
-inline uint32_t AtomicOperation::AtomicSub32(volatile uint32_t &mem, uint32_t subtrahend) {
- //TODO: Make this thread-safe
- uint32_t oldValue = mem;
-
- __asm__ volatile (
- "2: ldrex r0, [%0] \n\t" //load mem into r0
- "sub r0, r0, %1 \n\t" //subs subthrahend from r0 and store result in r0
- "strex r1, r0, [%0] \n\t" //store result from register back to mem
- "cmp r1, #0 \n\t" //check if we have had exclusive access
- "bne 2b" //if there was no exclusive access, try it again
- : /* no output register needed */
- : "r" (&mem), "r"(subtrahend)
- : "r0" , "r1"
- );
-
- return oldValue;
-}
-
-inline uint32_t AtomicOperation::AtomicInc32(volatile uint32_t &mem){
- return AtomicAdd32(mem, 1);
-}
-
-inline uint32_t AtomicOperation::AtomicDec32(volatile uint32_t &mem) {
- return AtomicSub32(mem, 1);
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_32/AtomicOperation.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_32/AtomicOperation.inc
deleted file mode 100644
index 8a5743e..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_32/AtomicOperation.inc
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef ATOMIC_OPERATION_INC_HEADER
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_MEMBER
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_IMPL
-inline uint32_t AtomicOperation::AtomicAdd32(volatile uint32_t &mem, uint32_t summand) {
-//This code comes from the Apache APR project (apache-apr/1.4.2/atomic/unix/ia32.c)
- asm volatile (
- "lock; xaddl %0,%1"
- : "=r" (summand), "=m" (mem)
- : "0" (summand), "m" (mem)
- : "memory", "cc");
-
- return summand;
-
-}
-
-inline uint32_t AtomicOperation::AtomicSub32(volatile uint32_t &mem, uint32_t subtrahend) {
-//This code comes from the Apache APR project (apache-apr/1.4.2/atomic/unix/ia32.c)
- int32_t summand = subtrahend * -1;
- asm volatile (
- "lock; xaddl %0,%1"
- : "=r" (summand), "=m" (mem)
- : "0" (summand), "m" (mem)
- : "memory", "cc");
-
- return summand;
-}
-
-inline uint32_t AtomicOperation::AtomicInc32(volatile uint32_t &mem) {
- return AtomicAdd32(mem, 1);
-}
-
-inline uint32_t AtomicOperation::AtomicDec32(volatile uint32_t &mem) {
- return AtomicSub32(mem, 1);
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_64/AtomicOperation.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_64/AtomicOperation.inc
deleted file mode 100644
index 768947b..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux_X86_64/AtomicOperation.inc
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef ATOMIC_OPERATION_INC_HEADER
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_MEMBER
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_IMPL
-inline uint32_t AtomicOperation::AtomicAdd32(volatile uint32_t &mem, uint32_t summand) {
-//This code comes from the Apache APR project (apache-apr/1.4.2/atomic/unix/ia32.c)
- asm volatile ("lock; xadd %0,%1"
- : "=r" (summand), "=m" (mem)
- : "0" (summand), "m" (mem)
- : "memory", "cc");
-
- return summand;
-}
-
-inline uint32_t AtomicOperation::AtomicSub32(volatile uint32_t &mem, uint32_t subtrahend) {
-//This code comes from the Apache APR project (apache-apr/1.4.2/atomic/unix/ia32.c)
-
- int32_t summand = subtrahend * -1;
- asm volatile ("lock; xadd %0,%1"
- : "=r" (summand), "=m" (mem)
- : "0" (summand), "m" (mem)
- : "memory", "cc");
-
- return summand;
-}
-
-inline uint32_t AtomicOperation::AtomicInc32(volatile uint32_t &mem) {
- return AtomicAdd32(mem, 1);
-}
-
-inline uint32_t AtomicOperation::AtomicDec32(volatile uint32_t &mem) {
- return AtomicSub32(mem, 1);
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Math.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Math.inc
deleted file mode 100644
index 5c824f3..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Math.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if defined(OS_LINUX)
- #include "Linux/Math.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/Math.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/Math.inc"
-#elif defined(OS_QNX)
- #include "Linux/Math.inc"
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Memory.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Memory.inc
deleted file mode 100644
index d90214c..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Memory.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if defined(OS_LINUX)
- #include "Linux/Memory.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/Memory.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/Memory.inc"
-#elif defined(OS_QNX)
- #include "Linux/Memory.inc"
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Mutex.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Mutex.inc
deleted file mode 100644
index 6373007..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Mutex.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if defined(OS_LINUX)
- #include "Linux/Mutex.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/Mutex.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/Mutex.inc"
-#elif defined(OS_QNX)
- #include "Linux/Mutex.inc"
-#endif
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc
deleted file mode 100644
index 3e26dcf..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if defined(OS_LINUX)
- #include "Linux/NumericLimits.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/NumericLimits.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/NumericLimits.inc"
-#elif defined(OS_QNX)
- #include "Linux/NumericLimits.inc"
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/Socket.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/Socket.inc
deleted file mode 100644
index 27f0f5d..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/Socket.inc
+++ /dev/null
@@ -1,288 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef SOCKET_INC_HEADER
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <errno.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-#endif
-
-#ifdef SOCKET_INC_MEMBER
-private:
-int32_t mSocket;
-struct sockaddr_in mServerAddress;
-struct hostent *mServer;
-
-public:
-friend class ServerSocket;
-
-private:
-//private constructor needed in ServerSocket
-inline Socket(int32_t socket);
-#endif
-
-#ifdef SOCKET_INC_IMPL
-
-inline Socket::Socket() {
- mSocket = -1;
- mSocket = socket(AF_INET, SOCK_STREAM, 0);
-}
-
-inline Socket::Socket(int32_t socket) {
- mSocket = socket;
-}
-
-inline Socket::~Socket() {
- close();
-}
-
-inline status_t Socket::send(unsigned char * buffer, int32_t length) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- int32_t res = ::send(mSocket, buffer, length, 0);
-
- if (res < 0) {
- return CAPU_ERROR;
- }
- return CAPU_OK;
-}
-
-inline status_t Socket::receive(unsigned char * buffer, int32_t length, int32_t & numBytes) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- int32_t res = ::recv(mSocket, buffer, length, 0);
-
- if (res == -1) {
- numBytes = 0;
- if (errno == EAGAIN)
- return CAPU_ETIMEOUT;
- else
- return CAPU_ERROR;
- }
- numBytes = res;
-
- return CAPU_OK;
-}
-
-inline status_t Socket::close() {
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- } else {
- if (::close(mSocket) < 0)
- return CAPU_SOCKET_ECLOSE;
- mSocket = -1;
- return CAPU_OK;
- }
-}
-
-inline status_t Socket::connect(unsigned char * dest_addr, uint16_t port) {
- if ((dest_addr == NULL) || (port == 0))
- return CAPU_EINVAL;
-
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- mServer = gethostbyname((const char *) dest_addr);
- if (mServer == NULL)
- return CAPU_SOCKET_EADDR;
-
- // for padding
- memset((char *) &mServerAddress, 0x00, sizeof (mServerAddress));
- mServerAddress.sin_family = AF_INET;
-
- //destination ip is set
- memcpy((char *) &mServerAddress.sin_addr.s_addr, (char *) mServer->h_addr_list[0], mServer->h_length);
-
- //port is set
- mServerAddress.sin_port = htons(port);
-
- int32_t res = ::connect(mSocket, (const sockaddr *) &mServerAddress, sizeof (mServerAddress));
-
- if (res == -1)
- return CAPU_SOCKET_ECONNECT;
- return CAPU_OK;
-}
-
-inline status_t Socket::setBufferSize(int32_t bufferSize) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- if (bufferSize < 0)
- return CAPU_EINVAL;
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof (bufferSize)) < 0)
- return CAPU_ERROR;
-
- return CAPU_OK;
-}
-
-inline status_t Socket::setLingerOption(bool_t isLinger, int32_t linger) {
- if (linger < 0) {
- return CAPU_EINVAL;
- }
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- struct linger so_linger;
- if (isLinger) {
- so_linger.l_onoff = 1;
- so_linger.l_linger = linger;
- } else {
- so_linger.l_onoff = 0;
- so_linger.l_linger = 0;
- }
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_LINGER, &so_linger, sizeof (so_linger)) < 0)
- return CAPU_ERROR;
- return CAPU_OK;
-}
-
-inline status_t Socket::setNoDelay(bool_t noDelay) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- int32_t opt;
- if (noDelay)
- opt = 1;
- else
- opt = 0;
- if (setsockopt(mSocket, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof (opt)) < 0)
- return CAPU_ERROR;
- return CAPU_OK;
-}
-
-inline status_t Socket::setKeepAlive(bool_t keepAlive) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- int32_t opt;
- if (keepAlive)
- opt = 1;
- else
- opt = 0;
- if (setsockopt(mSocket, SOL_SOCKET, SO_KEEPALIVE, &opt, sizeof (opt)) < 0)
- return CAPU_ERROR;
- return CAPU_OK;
-}
-
-inline status_t Socket::setTimeout(int32_t timeout) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval _timeout;
- _timeout.tv_sec = timeout + 1;
- _timeout.tv_usec = 0;
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, &_timeout, sizeof (_timeout)) < 0)
- return CAPU_ERROR;
- if (setsockopt(mSocket, SOL_SOCKET, SO_SNDTIMEO, &_timeout, sizeof (_timeout)) < 0)
- return CAPU_ERROR;
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getBufferSize(int32_t& bufferSize) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- int32_t size;
- socklen_t len = sizeof (size);
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, &size, &len) < 0)
- return CAPU_ERROR;
- bufferSize = size;
- return CAPU_OK;
-}
-
-inline status_t Socket::getLingerOption(bool_t& isLinger, int32_t& _linger) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- struct linger so_linger;
-
- socklen_t len = sizeof (so_linger);
- if (getsockopt(mSocket, SOL_SOCKET, SO_LINGER, &so_linger, &len) < 0)
- return CAPU_ERROR;
- _linger = so_linger.l_linger;
- if (so_linger.l_onoff > 0)
- isLinger = true;
- else
- isLinger = false;
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getNoDelay(bool_t& noDelay) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
- int32_t opt;
- socklen_t len = sizeof (opt);
- if (getsockopt(mSocket, IPPROTO_TCP, TCP_NODELAY, &opt, &len) < 0)
- return CAPU_ERROR;
-
- if (opt > 0)
- noDelay = true;
- else
- noDelay = false;
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getKeepAlive(bool_t& keepAlive) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- int32_t opt;
-
- socklen_t len = sizeof (opt);
- if (getsockopt(mSocket, SOL_SOCKET, SO_KEEPALIVE, &opt, &len) < 0)
- return CAPU_ERROR;
-
- if (opt > 0)
- keepAlive = true;
- else
- keepAlive = false;
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getTimeout(int32_t& timeout) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval _timeout;
-
- socklen_t len = sizeof (_timeout);
-
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, &_timeout, &len) < 0)
- return CAPU_ERROR;
- timeout = _timeout.tv_sec;
-
- return CAPU_OK;
-}
-#endif
-
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/StringUtils.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/StringUtils.inc
deleted file mode 100644
index 938547c..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/StringUtils.inc
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef STRINGUTILS_INC_HEADER
-#include "capu/Config.h"
-#include <string.h>
-#include <stdarg.h>
-#endif
-
-#ifdef STRINGUTILS_INC_MEMBER
-private:
-#endif
-
-#ifdef STRINGUTILS_INC_IMPL
-
- inline void StringUtils::Strncpy(char* dst, uint_t dstSize, const char* src)
- {
- strncpy(dst, src, dstSize);
- }
-
- inline uint_t StringUtils::Strlen(const char* str)
- {
- return strlen(str);
- }
-
- inline int_t StringUtils::Strcmp(const char* str1, const char* str2)
- {
- return strcmp(str1, str2);
- }
-
- inline void StringUtils::Vsprintf(char* buffer, uint_t bufferSize,const char* format, va_list values)
- {
- vsnprintf(buffer, bufferSize, format, values);
- }
-
- inline void StringUtils::Sprintf(char* buffer, uint_t bufferSize, const char* format, ...)
- {
- va_list argptr;
- va_start(argptr,format);
- StringUtils::Vsprintf(buffer, bufferSize, format, argptr);
- va_end(argptr);
- }
-
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/UdpSocket.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/UdpSocket.inc
deleted file mode 100644
index 41f6767..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/QNX/UdpSocket.inc
+++ /dev/null
@@ -1,225 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef UDPSOCKET_INC_HEADER
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <errno.h>
-#include <arpa/inet.h>
-#include "capu/os/StringUtils.h"
-#endif
-
-#ifdef UDPSOCKET_INC_MEMBER
-public:
-private:
- int32_t mSocket;
- int32_t mAddressFamily;
- int32_t mSocketType;
- bool_t mIsBound;
-#endif
-
-#ifdef UDPSOCKET_INC_IMPL
-inline UdpSocket::UdpSocket() {
- //create the socket which is used to connect the server
- mAddressFamily = AF_INET;
- mSocketType = SOCK_DGRAM;
- mSocket = socket(mAddressFamily, mSocketType, 0);
- if (mSocket != -1) {
- int32_t optval = 1;
- setsockopt(mSocket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof (optval));
- }
- mIsBound = false;
-}
-
-inline UdpSocket::~UdpSocket() {
- close();
-}
-
-inline status_t UdpSocket::bind(uint16_t port, const char *addr) {
- if (port == 0) {
- return CAPU_EINVAL;
- }
-
- if (mIsBound) {
- return CAPU_ERROR;
- }
-
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- struct sockaddr_in mServerAddress;
- memset((char *) &mServerAddress, 0x00, sizeof (mServerAddress));
- mServerAddress.sin_family = AF_INET;
- if (addr == NULL)
- mServerAddress.sin_addr.s_addr = INADDR_ANY;
- else if (inet_aton(addr, &mServerAddress.sin_addr) == 0)
- return CAPU_SOCKET_EADDR;
- mServerAddress.sin_port = htons(port);
-
- int32_t res = ::bind(mSocket, (sockaddr *) &mServerAddress, sizeof (struct sockaddr_in));
- if (res < 0) {
- printf("%d\n", errno);
- return CAPU_SOCKET_EBIND;
- }
-
- mIsBound = true;
- return CAPU_OK;
-}
-
-
-inline status_t UdpSocket::send(unsigned char *buffer, int32_t length, const char *receiverAddr, uint16_t receiverPort) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
-
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- struct hostent *receiverAddrIp = gethostbyname(receiverAddr);
- if (receiverAddrIp == NULL) {
- return CAPU_SOCKET_EADDR;
- }
- struct sockaddr_in receiverSockAddr;
- receiverSockAddr.sin_family = AF_INET;
- memcpy((char *) &receiverSockAddr.sin_addr.s_addr, (char *) receiverAddrIp->h_addr_list[0], receiverAddrIp->h_length);
- receiverSockAddr.sin_port = htons(receiverPort);
-
-
- int32_t result = sendto(mSocket,(char*)buffer, length, 0, (sockaddr*)&receiverSockAddr, sizeof(receiverSockAddr));
- if(result == -1)
- {
- return CAPU_ERROR;
- }
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::send(unsigned char *buffer, int32_t length, SocketAddrInfo& receiverAddr) {
- return send(buffer, length, receiverAddr.addr, receiverAddr.port);
-}
-
-inline status_t UdpSocket::receive(unsigned char *buffer, int32_t length, int32_t &numBytes, SocketAddrInfo* sender) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
-
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- sockaddr remoteSocketAddr;
- socklen_t remoteSocketAddrSize = sizeof(remoteSocketAddr);
-
- int32_t result = recvfrom(mSocket, (char*)buffer, length, 0, &remoteSocketAddr, &remoteSocketAddrSize);
- if (result == -1) {
- numBytes = 0;
- if (errno == EAGAIN) {
- return CAPU_ETIMEOUT;
- } else {
- return CAPU_ERROR;
- }
- }else{
- if(sender != 0)
- {
- sender->port = ntohs(((sockaddr_in*)&remoteSocketAddr)->sin_port);
- char* addr = inet_ntoa(((sockaddr_in*)&remoteSocketAddr)->sin_addr);
- StringUtils::Strncpy(sender->addr, sizeof(sender->addr), addr);
- }
- }
- numBytes = result;
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::close() {
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- } else {
- if (::close(mSocket) < 0)
- return CAPU_SOCKET_ECLOSE;
- mSocket = -1;
- return CAPU_OK;
- }
-}
-
-inline status_t UdpSocket::setBufferSize(int32_t bufferSize) {
- if (bufferSize < 0) {
- return CAPU_EINVAL;
- }
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, sizeof(bufferSize)) == -1) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::setTimeout(int32_t timeout) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval soTimeout;
- soTimeout.tv_sec = timeout + 1;
- soTimeout.tv_usec = 0;
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == -1) {
- return CAPU_ERROR;
- }
- if (setsockopt(mSocket, SOL_SOCKET, SO_SNDTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == -1) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::getBufferSize(int32_t& bufferSize) {
- if (mSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- socklen_t len = sizeof (bufferSize);
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, &len) == -1) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::getTimeout(int32_t& timeout) {
- if (mSocket == -1)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval soTimeout;
- socklen_t len = sizeof(soTimeout);
-
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, &len) == -1) {
- return CAPU_ERROR;
- }
-
- timeout = soTimeout.tv_sec;
-
- return CAPU_OK;
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/ServerSocket.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/ServerSocket.inc
deleted file mode 100644
index 0ee004f..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/ServerSocket.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- #if defined(OS_LINUX)
- #include "Linux/ServerSocket.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/ServerSocket.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/ServerSocket.inc"
-#elif defined(OS_QNX)
- #include "Linux/ServerSocket.inc"
-#endif
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Socket.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Socket.inc
deleted file mode 100644
index 71f019c..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Socket.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if defined(OS_LINUX)
- #include "Linux/Socket.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/Socket.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/Socket.inc"
-#elif defined(OS_QNX)
- #include "Qnx/Socket.inc"
-#endif
-
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/StringUtils.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/StringUtils.inc
deleted file mode 100644
index c1847b5..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/StringUtils.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if defined(OS_LINUX)
- #include "Linux/StringUtils.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/StringUtils.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/StringUtils.inc"
-#elif defined(OS_QNX)
- #include "Linux/StringUtils.inc"
-#endif
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Thread.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Thread.inc
deleted file mode 100644
index 9c62c99..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Thread.inc
+++ /dev/null
@@ -1,27 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if defined(OS_LINUX)
- #include "Linux/Thread.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/Thread.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/Thread.inc"
-#elif defined(OS_QNX)
- #include "Linux/Thread.inc"
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Time.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Time.inc
deleted file mode 100644
index 2605b36..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Time.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#if defined(OS_LINUX)
- #include "Linux/Time.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/Time.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/Time.inc"
-#elif defined(OS_QNX)
- #include "Linux/Time.inc"
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/UdpSocket.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/UdpSocket.inc
deleted file mode 100644
index 3f0fc38..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/UdpSocket.inc
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#if defined(OS_LINUX)
- #include "Linux/UdpSocket.inc"
-#elif defined(OS_WINDOWS)
- #include "Windows/UdpSocket.inc"
-#elif defined(OS_INTEGRITY)
- #include "Linux/UdpSocket.inc"
-#elif defined(OS_QNX)
- #include "Qnx/UdpSocket.inc"
-#endif
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/CondVar.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/CondVar.inc
deleted file mode 100644
index f9874c9..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/CondVar.inc
+++ /dev/null
@@ -1,122 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef CONDVAR_INC_HEADER
-#include <windows.h>
-#endif
-
-#ifdef CONDVAR_INC_MEMBER
-private:
- HANDLE mSemaphore;
- Mutex mLockWaitCounter;
- uint32_t mWaitCounter;
- uint32_t mGeneration;
-#endif
-
-#ifdef CONDVAR_INC_IMPL
-
- inline CondVar::CondVar()
- {
- mSemaphore = CreateSemaphore(NULL,0,INT_MAX,NULL);
- mWaitCounter = 0;
- mGeneration = 0;
- }
-
- inline CondVar::~CondVar() {
- CloseHandle(mSemaphore);
- }
-
- inline status_t CondVar::signal()
- {
- bool releaseSemaphore = false;
- mLockWaitCounter.lock();
- if (mWaitCounter > 0) {
- releaseSemaphore = true;
- ++mGeneration;
- }
- mLockWaitCounter.unlock();
- if (releaseSemaphore){
- ReleaseSemaphore(mSemaphore, 1, NULL);
- }
- return CAPU_OK;
- }
-
- inline status_t CondVar::broadcast()
- {
- bool releaseSemaphore = false;
- if (mWaitCounter > 0) {
- releaseSemaphore = true;
- ++mGeneration;
- }
- mLockWaitCounter.unlock();
- if (releaseSemaphore){
- ReleaseSemaphore(mSemaphore, mWaitCounter, NULL);
- }
- return CAPU_OK;
- }
-
- inline status_t CondVar::wait(Mutex *mutex, uint32_t millisec)
- {
- uint32_t myGeneration = mGeneration;
- if (mutex == NULL) {
- return CAPU_EINVAL;
- } else {
- if (mLockWaitCounter.lock() == CAPU_OK) {
- ++mWaitCounter;
- mLockWaitCounter.unlock();
- mutex->unlock();
- DWORD waitResult;
- while (true) {
- if(millisec == 0) {
- // regular wait
- waitResult = WaitForSingleObject(mSemaphore, INFINITE);
- } else {
- // timed wait
- waitResult = WaitForSingleObject(mSemaphore, millisec);
- }
-
- if (waitResult == WAIT_OBJECT_0) {
- if (myGeneration != mGeneration) {
- mLockWaitCounter.lock();
- --mWaitCounter;
- mLockWaitCounter.unlock();
-
- mutex->lock();
- return CAPU_OK;
- } else {
- ReleaseSemaphore(mSemaphore, 1, NULL);
- }
- } else
- if (waitResult == WAIT_TIMEOUT) {
- mLockWaitCounter.lock();
- --mWaitCounter;
- mLockWaitCounter.unlock();
-
- mutex->lock();
- return CAPU_ETIMEOUT;
- } else {
- mutex->lock();
- return CAPU_ERROR;
- }
- }
- } else {
- return CAPU_ERROR;
- }
- }
- }
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Debug.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Debug.inc
deleted file mode 100644
index d9c1653..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Debug.inc
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef DEBUG_INC_HEADER
-#include <assert.h>
-#endif
-
-#ifdef DEBUG_INC_MEMBER
-public:
-
-
-private:
-#endif
-
-#ifdef DEBUG_INC_IMPL
-
- inline void Debug::Assert(bool condition)
-{
- #ifdef _DEBUG
- assert(condition);
- #endif
-};
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/File.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/File.inc
deleted file mode 100644
index 7488d43..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/File.inc
+++ /dev/null
@@ -1,119 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef FILE_INC_HEADER
-#endif
-
-#ifdef FILE_INC_MEMBER
- private:
- FILE* mHandle;
- bool_t mIsOpen;
-#endif
-
-#ifdef FILE_INC_IMPL
-
- inline File::File(const char* name, const char* flags) :
- mHandle(NULL) ,
- mIsOpen(false) {
-
- errno_t error;
- // try to open file
- error = fopen_s(&mHandle, name, flags);
- if(error == 0) {
- mIsOpen = true;
- }
- }
-
- inline bool_t File::isOpen() {
- return mIsOpen;
- }
-
- inline bool_t File::isEof() {
- if(mHandle == NULL) {
- return false;
- }
- return (feof(mHandle) != 0);
- }
-
- inline status_t File::read(char * buffer, uint32_t length, int32_t* numBytes) {
- if(buffer == NULL) {
- return CAPU_EINVAL;
- }
- if(mHandle == NULL) {
- return CAPU_ERROR;
- }
-
- size_t result = fread(buffer, 1, length, mHandle);
- if(result == length) {
- if(numBytes != NULL) {
- *numBytes = result;
- }
- return CAPU_OK;
- }
- if(feof(mHandle)) {
- if(numBytes != NULL) {
- *numBytes = result;
- }
- return CAPU_EOF;
- }
-
- return CAPU_ERROR;
- }
-
- inline status_t File::write(char * buffer, uint32_t length) {
- if(buffer == NULL) {
- return CAPU_EINVAL;
- }
- if(mHandle == NULL) {
- return CAPU_ERROR;
- }
-
- size_t result = fwrite(buffer, 1, length, mHandle);
- if(result != length) {
- return CAPU_ERROR;
- }
- return CAPU_OK;
- }
-
- inline status_t File::flush() {
- if(mHandle != NULL) {
- int error = fflush(mHandle);
- if(error == 0) {
- return CAPU_OK;
- }
- }
- return CAPU_ERROR;
- }
-
- inline status_t File::close() {
- if(mHandle != NULL) {
- fclose(mHandle);
- mHandle = NULL;
- mIsOpen = false;
- return CAPU_OK;
- }
- return CAPU_ERROR;
- }
-
- inline File::~File() {
- if(mHandle != NULL) {
- fclose(mHandle);
- }
- }
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Math.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Math.inc
deleted file mode 100644
index cdb0568..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Math.inc
+++ /dev/null
@@ -1,153 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifdef MATH_INC_HEADER
-#include <cmath>
-#endif
-
-#ifdef MATH_INC_MEMBER
-public:
-static const float_t PI_f;
-static const double_t PI_d;
-#endif
-
-#ifdef MATH_INC_IMPL
-inline float_t Math::Ceil(float_t val) {
- return ceilf(val);
-}
-
-inline double_t Math::Ceil(double_t val) {
- return ceil(val);
-}
-
-inline float_t Floor(float_t val)
-{
- return floorf(val);
-}
-
-inline double_t Floor(double_t val)
-{
- return floor(val);
-}
-
-
-inline float_t Math::Abs(float_t val) {
- return fabs(val);
-}
-
-inline double_t Math::Abs(double_t val) {
- return abs(val);
-}
-
-inline int_t Abs(int_t val)
-{
- return abs(val);
-}
-
-inline float_t Math::Sqrt(float_t val) {
- return sqrtf(val);
-}
-
-inline double_t Math::Sqrt(double_t val) {
- return sqrt(val);
-}
-
-inline float_t Math::Pow2(float_t val) {
- return val * val;
-}
-
-inline double_t Math::Pow2(double_t val) {
- return val * val;
-}
-
-inline float_t Math::Cos(float_t val) {
- return cosf(val);
-}
-
-inline float_t Pow(float_t val, float_t exponent)
-{
- return powf(val, exponent);
-}
-
-inline double_t Por(double_t val, double_t exponent)
-{
- return pow(val, exponent);
-}
-
-inline double_t Math::Cos(double_t val) {
- return cos(val);
-}
-
-inline float_t Math::Sin(float_t val) {
- return sinf(val);
-}
-
-inline double_t Math::Sin(double_t val) {
- return sin(val);
-}
-
-inline float_t Math::Tan(float_t val) {
- return tanf(val);
-}
-
-inline double_t Math::Tan(double_t val) {
- return tan(val);
-}
-
-inline float_t Math::ArcCos(float_t val) {
- return acosf(val);
-}
-
-inline double_t Math::ArcCos(double_t val) {
- return acos(val);
-}
-
-inline float_t Math::ArcSin(float_t val) {
- return asinf(val);
-}
-
-inline double_t Math::ArcSin(double_t val) {
- return asin(val);
-}
-
-inline float_t Math::ArcTan(float_t val) {
- return atanf(val);
-}
-
-inline double_t Math::ArcTan(double_t val) {
- return atan(val);
-}
-
-inline float_t Math::Rad2Deg(float_t val) {
- return val * (180.f / PI_f);
-}
-
-inline double_t Math::Rad2Deg(double_t val) {
- return val * (180.0 / PI_d);
-}
-
-inline float_t Math::Deg2Rad(float_t val) {
- return val * (PI_f / 180.f);
-}
-
-inline double_t Math::Deg2Rad(double_t val) {
- return val * (PI_d / 180.0);
-}
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Memory.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Memory.inc
deleted file mode 100644
index 08371c3..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Memory.inc
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $Id$
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef MEMORY_INC_HEADER
-#include <memory.h>
-#include "capu/Config.h"
-#endif
-
-#ifdef MEMORY_INC_MEMBER
-#endif
-
-#ifdef MEMORY_INC_IMPL
-
-inline
-void Memory::Set(void* dst, int32_t val, uint_t size)
-{
- memset(dst, val, size);
-}
-
-inline
-void Memory::Copy(void* dst, const void* src, uint_t size)
-{
- memcpy(dst, src, size);
-}
-
-inline
-void Memory::Move(void* dst, const void* src, uint_t size)
-{
- memmove(dst, src, size);
-}
-
-int32_t Memory::Compare(const void* ptr1, const void* ptr2, uint_t num)
-{
- return memcmp(ptr1, ptr2, num);
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Mutex.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Mutex.inc
deleted file mode 100644
index 1048385..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Mutex.inc
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef MUTEX_INC_HEADER
-#include <windows.h>
-#endif
-
-#ifdef MUTEX_INC_MEMBER
-public:
- friend class CondVar;
-
-private:
- HANDLE mLock;
-#endif
-
-#ifdef MUTEX_INC_IMPL
- inline Mutex::Mutex()
- {
- mLock = CreateMutex(
- NULL, // default security attributes
- FALSE, // initially not owned
- NULL); // unnamed mutex
- }
-
- inline Mutex::~Mutex()
- {
- CloseHandle(mLock);
- }
-
- inline status_t Mutex::lock()
- {
- DWORD waitResult = WaitForSingleObject(mLock, INFINITE);
- if (waitResult == WAIT_OBJECT_0) {
- return CAPU_OK;
- } else {
- return CAPU_ERROR;
- }
- }
-
- inline status_t Mutex::unlock()
- {
- if (ReleaseMutex(mLock)) {
- return CAPU_OK;
- } else {
- return CAPU_ERROR;
- }
- }
-
- inline bool Mutex::trylock()
- {
- DWORD waitResult = WaitForSingleObject(mLock, 0);
- if (waitResult == WAIT_OBJECT_0) {
- return true;
- } else {
- return false;
- }
- }
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/NumericLimits.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/NumericLimits.inc
deleted file mode 100644
index b8312e9..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/NumericLimits.inc
+++ /dev/null
@@ -1,21 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef NUMERIC_LIMITS_INC_HEADER
-#include <float.h>
-#endif
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/ServerSocket.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/ServerSocket.inc
deleted file mode 100644
index f949c57..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/ServerSocket.inc
+++ /dev/null
@@ -1,143 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef SERVER_SOCKET_INC_HEADER
-#define _WINSOCKAPI_
-// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
-#pragma comment (lib, "Ws2_32.lib")
-#pragma comment (lib, "Mswsock.lib")
-#pragma comment (lib, "AdvApi32.lib")
-#include <windows.h>
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#endif
-
-#ifdef SERVER_SOCKET_INC_MEMBER
- SOCKET mServerSocket;
- WSADATA mWsaData;
- bool_t mIsBound;
-#endif
-
-#ifdef SERVER_SOCKET_INC_IMPL
-inline ServerSocket::ServerSocket()
-{
- mServerSocket = INVALID_SOCKET;
- mIsBound = false;
- //Initialize Winsock
- int32_t result = WSAStartup(MAKEWORD(2,2), &mWsaData);
- if (result == 0) {
- //create the socket which is used to connect the server
- mServerSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (mServerSocket != INVALID_SOCKET) {
- int32_t optVal = 1;
- setsockopt(mServerSocket, SOL_SOCKET, SO_REUSEADDR, (char*)&optVal, sizeof(optVal));
- }
- } else {
- WSACleanup();
- mServerSocket = INVALID_SOCKET;
- }
-}
-
-inline ServerSocket::~ServerSocket()
-{
- close();
-}
-
-inline Socket* ServerSocket::accept()
-{
- SOCKET handle = ::accept(mServerSocket, NULL, NULL);
- if (handle == INVALID_SOCKET) {
- return NULL;
- }
- Socket *clientSocket = new Socket(handle);
- return clientSocket;
-}
-
-inline status_t ServerSocket::close()
-{
- int32_t returnValue = CAPU_OK;
- if (mServerSocket == INVALID_SOCKET) {
- returnValue = CAPU_SOCKET_ESOCKET;
- } else {
- if (closesocket(mServerSocket) != 0) {
- int32_t result = WSAGetLastError();
- if (result != WSANOTINITIALISED){ //socket has already been closed
- returnValue = CAPU_SOCKET_ECLOSE;
- }
- }
- }
- mServerSocket = INVALID_SOCKET;
- mIsBound = false;
- WSACleanup();
- return returnValue;
-}
-
-
-inline status_t ServerSocket::bind(uint16_t port, const char *addr) {
- if (port == 0) {
- return CAPU_EINVAL;
- }
-
- //check if the address is valid
-
- if (mIsBound) {
- return CAPU_ERROR;
- }
-
- if (mServerSocket == INVALID_SOCKET)
- return CAPU_SOCKET_ESOCKET;
-
- sockaddr_in socketAddr;
- memset((char*) &socketAddr, 0x00, sizeof(socketAddr));
- socketAddr.sin_family = AF_INET;
- if (addr == NULL) {
- socketAddr.sin_addr.s_addr = INADDR_ANY;
- } else if (inet_addr(addr) == INADDR_NONE) {
- return CAPU_SOCKET_EADDR;
- } else {
- socketAddr.sin_addr.s_addr = inet_addr(addr);
- }
- socketAddr.sin_port = htons(port);
-
- int32_t result = ::bind(mServerSocket, (sockaddr*) &socketAddr, sizeof(socketAddr));
- if (result == SOCKET_ERROR) {
- return CAPU_SOCKET_EBIND;
- }
-
- mIsBound = true;
- return CAPU_OK;
-}
-
-inline status_t ServerSocket::listen(uint8_t backlog) {
- if (!mIsBound) {
- return CAPU_EINVAL;
- }
-
- if (mServerSocket == -1) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- int32_t result = ::listen(mServerSocket, backlog);
-
- if (result == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Socket.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Socket.inc
deleted file mode 100644
index ccc2271..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Socket.inc
+++ /dev/null
@@ -1,347 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef SOCKET_INC_HEADER
-#define _WINSOCKAPI_
-// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
-#pragma comment (lib, "Ws2_32.lib")
-#pragma comment (lib, "Mswsock.lib")
-#pragma comment (lib, "AdvApi32.lib")
-#include <windows.h>
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#endif
-
-#ifdef SOCKET_INC_MEMBER
-public:
- friend class ServerSocket;
-private:
- SOCKET mSocket;
- WSADATA mWsaData;
-
- //private constructor needed in ServerSocket
- inline Socket(SOCKET socket);
-#endif
-
-#ifdef SOCKET_INC_IMPL
-
-inline Socket::Socket() {
- //Initialize Winsock
- int32_t result = WSAStartup(MAKEWORD(2,2), &mWsaData);
- if (result == 0) {
- //create the socket which is used to connect the server
- mSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (mSocket == INVALID_SOCKET) {
- WSACleanup();
- }
- } else {
- mSocket = INVALID_SOCKET;
- }
-}
-
-inline Socket::Socket(SOCKET socket) {
- //Initialize Winsock
- int32_t result = WSAStartup(MAKEWORD(2,2), &mWsaData);
- if (result == 0) {
- //create the socket which is used to connect the server
- mSocket = socket;
- if (mSocket == INVALID_SOCKET) {
- WSACleanup();
- }
- } else {
- mSocket = INVALID_SOCKET;
- }
-}
-
-inline Socket::~Socket() {
- close();
-}
-
-inline status_t Socket::send(unsigned char *buffer, int32_t length) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
-
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- int32_t result;
- result = ::send(mSocket, (const char*)buffer, length, 0);
- if (result == SOCKET_ERROR) {
- close();
- return CAPU_ERROR;
- }
- return CAPU_OK;
-}
-
-inline status_t Socket::receive(unsigned char *buffer, int32_t length, int32_t &numBytes) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
-
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- int32_t result = recv(mSocket, (char*)buffer, length, 0);
- if (result == SOCKET_ERROR) {
- numBytes = 0;
- result = WSAGetLastError();
- if (result == WSAETIMEDOUT) {
- return CAPU_ETIMEOUT;
- }
- else{
- return CAPU_ERROR;
- }
- }
- numBytes = result;
- return CAPU_OK;
-}
-
-inline status_t Socket::close() {
- int32_t returnValue = CAPU_OK;
- if (mSocket == INVALID_SOCKET) {
- returnValue = CAPU_SOCKET_ESOCKET;
- } else {
- shutdown(mSocket, SD_BOTH);
- int32_t result = closesocket(mSocket);
- if (result != 0) {
- result = WSAGetLastError();
- if (result != WSANOTINITIALISED){ //socket has already been closed
- returnValue = CAPU_SOCKET_ECLOSE;
- }
- }
- }
- mSocket = INVALID_SOCKET;
- WSACleanup();
- return returnValue;
-}
-
-inline status_t Socket::connect(unsigned char *dest_addr, uint16_t port) {
-
- //check parameters
- if ((dest_addr == NULL) || (port == 0)) {
- return CAPU_EINVAL;
- }
-
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- struct hostent* serverHost = gethostbyname((const char *) dest_addr);
- if (serverHost == NULL) {
- return CAPU_SOCKET_EADDR;
- }
-
- struct sockaddr_in serverAddress;
- memset((char *) &serverAddress, 0x00, sizeof (serverAddress));
-
- serverAddress.sin_family = AF_INET;
- memcpy((char *) &serverAddress.sin_addr.s_addr, (char *) serverHost->h_addr_list[0], serverHost->h_length);
- serverAddress.sin_port = htons(port);
-
- int32_t result = ::connect(mSocket, (sockaddr *) &serverAddress, sizeof (serverAddress));
- if (result == SOCKET_ERROR) {
- int32_t errorCode = WSAGetLastError();
- close();
- return CAPU_SOCKET_ECONNECT;
- }
- return CAPU_OK;
-}
-
-inline status_t Socket::setBufferSize(int32_t bufferSize) {
- if (bufferSize < 0) {
- return CAPU_EINVAL;
- }
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, sizeof(bufferSize)) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t Socket::setLingerOption(bool_t isLinger, int32_t linger) {
- if (linger < 0) {
- return CAPU_EINVAL;
- }
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- struct linger soLinger;
- if (isLinger) {
- soLinger.l_onoff = 1;
- soLinger.l_linger = linger;
- } else {
- soLinger.l_onoff = 0;
- soLinger.l_linger = 0;
- }
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_LINGER, (char*)&soLinger, sizeof(soLinger)) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
- return CAPU_OK;
-}
-
-inline status_t Socket::setNoDelay(bool_t noDelay) {
- if (mSocket == INVALID_SOCKET)
- return CAPU_SOCKET_ESOCKET;
- int32_t opt;
- if (noDelay) {
- opt = 1;
- } else {
- opt = 0;
- }
- if (setsockopt(mSocket, IPPROTO_TCP, TCP_NODELAY, (char*)&opt, sizeof(opt)) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
- return CAPU_OK;
-}
-
-inline status_t Socket::setKeepAlive(bool_t keepAlive) {
- if (mSocket == INVALID_SOCKET)
- return CAPU_SOCKET_ESOCKET;
- int32_t opt;
- if (keepAlive) {
- opt = 1;
- } else {
- opt = 0;
- }
- if (setsockopt(mSocket, SOL_SOCKET, SO_KEEPALIVE, (char*)&opt, sizeof(opt)) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
- return CAPU_OK;
-}
-
-inline status_t Socket::setTimeout(int32_t timeout) {
- if (mSocket == INVALID_SOCKET)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval soTimeout;
- soTimeout.tv_sec = timeout;
- soTimeout.tv_usec = 0;
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
- if (setsockopt(mSocket, SOL_SOCKET, SO_SNDTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getBufferSize(int32_t& bufferSize) {
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- socklen_t len = sizeof (bufferSize);
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, &len) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getLingerOption(bool_t& isLinger, int32_t& _linger) {
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- struct linger soLinger;
- int32_t len = sizeof (soLinger);
-
- if (getsockopt(mSocket, SOL_SOCKET, SO_LINGER, (char*)&soLinger, &len) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- _linger = soLinger.l_linger;
-
- if (soLinger.l_onoff == 1) {
- isLinger = true;
- } else {
- isLinger = false;
- }
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getNoDelay(bool_t& noDelay) {
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- int32_t opt = 0;
- socklen_t len = sizeof(opt);
-
- if (getsockopt(mSocket, IPPROTO_TCP, TCP_NODELAY, (char*)&opt, &len) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- if (opt == 1) {
- noDelay = true;
- } else {
- noDelay = false;
- }
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getKeepAlive(bool_t& keepAlive) {
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- int32_t opt = 0;
- int32_t len = sizeof (opt);
-
- if (getsockopt(mSocket, SOL_SOCKET, SO_KEEPALIVE, (char*)&opt, &len) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- if (opt == 1) {
- keepAlive = true;
- } else {
- keepAlive = false;
- }
-
- return CAPU_OK;
-}
-
-inline status_t Socket::getTimeout(int32_t& timeout) {
- if (mSocket == INVALID_SOCKET)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval soTimeout;
- socklen_t len = sizeof(soTimeout);
-
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, &len) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- timeout = soTimeout.tv_sec;
-
- return CAPU_OK;
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/StringUtils.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/StringUtils.inc
deleted file mode 100644
index 86e1c14..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/StringUtils.inc
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef STRINGUTILS_INC_HEADER
-#define _WINSOCKAPI_
-#include <windows.h>
-#include <stdarg.h>
-#include "capu/Config.h"
-#endif
-
-#ifdef STRINGUTILS_INC_MEMBER
-private:
-#endif
-
-#ifdef STRINGUTILS_INC_IMPL
-
- inline void StringUtils::Strncpy(char* dst, uint_t dstSize, const char* src)
- {
-
- memcpy(dst, src, dstSize);
- }
-
- inline uint_t StringUtils::Strlen(const char* str)
- {
- return strlen(str);
- }
-
- inline int_t StringUtils::Strcmp(const char* str1, const char* str2)
- {
- return strcmp(str1, str2);
- }
-
- inline void StringUtils::Vsprintf(char* buffer, uint_t bufferSize, const char* format, va_list values)
- {
- vsprintf_s(buffer, bufferSize, format, values);
- }
-
- inline int32_t StringUtils::Vscprintf(const char* format, va_list values) {
- return _vscprintf(format, values);
- }
-
- inline void StringUtils::Sprintf(char* buffer, uint_t bufferSize, const char* format, ...)
- {
- va_list argptr;
- va_start(argptr,format);
- StringUtils::Vsprintf(buffer, bufferSize, format, argptr);
- va_end(argptr);
- }
-
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Thread.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Thread.inc
deleted file mode 100644
index 9591b3f..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Thread.inc
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifdef THREAD_INC_HEADER
-#include <windows.h>
-#endif
-
-#ifdef THREAD_INC_MEMBER
-private:
- class ThreadRunnable {
- public:
- Thread* thread;
- Runnable* runnable;
- };
-
- DWORD mThreadId;
- HANDLE mThreadHandle;
- ThreadState mState;
- ThreadRunnable *mRunnable;
-
- /**
- * sets the current thread state
- */
- void setState(ThreadState state);
-
- static DWORD WINAPI run(LPVOID arg)
- {
- ThreadRunnable* tr = (ThreadRunnable*) arg;
- tr->thread->setState(TS_RUNNING);
- if (tr->runnable != NULL) {
- tr->runnable->run();
- }
- tr->thread->setState(TS_TERMINATED);
- return NULL;
- }
-
-
-#endif
-
-#ifdef THREAD_INC_IMPL
-
-
-
-inline Thread::Thread(Runnable *runnable) : mState(TS_NEW) {
- mRunnable = new ThreadRunnable();
- mRunnable->thread = this;
- mRunnable->runnable = runnable;
-}
-
-inline Thread::~Thread()
-{
- join();
- delete mRunnable;
-}
-
-inline status_t Thread::start()
-{
- if (mRunnable == NULL) {
- return CAPU_EINVAL;
- }
-
- mThreadHandle = CreateThread(NULL, 0, Thread::run, mRunnable, 0, &mThreadId);
- //TODO: check thread handle and return appropriate error code
- if (mThreadHandle == NULL) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t Thread::join()
-{
- if (mThreadHandle && WaitForSingleObject(mThreadHandle,INFINITE) == 0) {
- return CAPU_OK;
- } else {
- return CAPU_ERROR;
- }
-}
-
-inline ThreadState Thread::getState() {
- return mState;
-}
-
-inline void Thread::setState(ThreadState state) {
- mState = state;
-}
-
-inline status_t Thread::Sleep(uint32_t millis)
-{
- ::Sleep(millis);
- return CAPU_OK;
-}
-
-
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Time.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Time.inc
deleted file mode 100644
index b9c40fe..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/Time.inc
+++ /dev/null
@@ -1,37 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifdef TIME_INC_HEADER
-#define _WINSOCKAPI_
-#include <windows.h>
-#endif
-
-#ifdef TIME_INC_MEMBER
-#endif
-
-#ifdef TIME_INC_IMPL
-inline
-uint32_t Time::GetMilliseconds()
-{
- LONGLONG res, freq;
- QueryPerformanceCounter((LARGE_INTEGER*)&res);
- QueryPerformanceFrequency((LARGE_INTEGER*)&freq);
- return static_cast<uint32_t>( (LONGLONG)res*1000/(LONGLONG)freq );
-}
-
-
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/UdpSocket.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/UdpSocket.inc
deleted file mode 100644
index 3105d44..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows/UdpSocket.inc
+++ /dev/null
@@ -1,251 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef UDPSOCKET_INC_HEADER
-#define WIN32_LEAN_AND_MEAN
-// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
-#pragma comment (lib, "Ws2_32.lib")
-#pragma comment (lib, "Mswsock.lib")
-#pragma comment (lib, "AdvApi32.lib")
-#include <windows.h>
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#include "capu/os/StringUtils.h"
-#endif
-
-#ifdef UDPSOCKET_INC_MEMBER
-public:
-private:
- SOCKET mSocket;
- WSADATA mWsaData;
- int32_t mAddressFamily;
- int32_t mSocketType;
- int32_t mProtocol;
- bool_t mIsBound;
-#endif
-
-#ifdef UDPSOCKET_INC_IMPL
-inline UdpSocket::UdpSocket() {
- //Initialize Winsock
- int32_t result = WSAStartup(MAKEWORD(2,2), &mWsaData);
- if (result == 0) {
- //create the socket which is used to connect the server
- mAddressFamily = AF_INET;
- mSocketType = SOCK_DGRAM;
- mProtocol = IPPROTO_UDP;
- mSocket = socket(mAddressFamily, mSocketType, mProtocol);
- mIsBound = false;
- if (mSocket == INVALID_SOCKET) {
- WSACleanup();
- } else {
- int32_t optVal = 1;
- setsockopt(mSocket, SOL_SOCKET, SO_REUSEADDR, (char*)&optVal, sizeof(optVal));
- }
- } else {
- mSocket = INVALID_SOCKET;
- }
-}
-
-inline UdpSocket::~UdpSocket() {
- close();
-}
-
-inline status_t UdpSocket::bind(uint16_t port, const char *addr) {
- if (port == 0) {
- return CAPU_EINVAL;
- }
-
- //check if the address is valid
-
- if (mIsBound) {
- return CAPU_ERROR;
- }
-
- if (mSocket == INVALID_SOCKET)
- return CAPU_SOCKET_ESOCKET;
-
- sockaddr_in socketAddr;
- memset((char*) &socketAddr, 0x00, sizeof(socketAddr));
- socketAddr.sin_family = AF_INET;
- if (addr == NULL) {
- socketAddr.sin_addr.s_addr = INADDR_ANY;
- } else if (inet_addr(addr) == INADDR_NONE) {
- return CAPU_SOCKET_EADDR;
- } else {
- socketAddr.sin_addr.s_addr = inet_addr(addr);
- }
- socketAddr.sin_port = htons(port);
-
- int32_t result = ::bind(mSocket, (sockaddr*) &socketAddr, sizeof(socketAddr));
- if (result == SOCKET_ERROR) {
- return CAPU_SOCKET_EBIND;
- }
-
- mIsBound = true;
- return CAPU_OK;
-}
-
-
-inline status_t UdpSocket::send(unsigned char *buffer, int32_t length, const char* receiverAddr, uint16_t receiverPort) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
-
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- struct hostent* serverHost = gethostbyname((const char *) receiverAddr);
- if (serverHost == NULL) {
- return CAPU_SOCKET_EADDR;
- }
-
- struct sockaddr_in receiverSockAddr;
- memset((char *) &receiverSockAddr, 0x00, sizeof (receiverSockAddr));
-
- receiverSockAddr.sin_family = AF_INET;
- memcpy((char *) &receiverSockAddr.sin_addr.s_addr, (char *) serverHost->h_addr_list[0], serverHost->h_length);
- receiverSockAddr.sin_port = htons(receiverPort);
-
- int32_t result = sendto(mSocket,(char*)buffer, length, 0, (sockaddr*) &receiverSockAddr, sizeof(receiverSockAddr));
- if (result == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
- return CAPU_OK;
-
-}
-
-inline status_t UdpSocket::send(unsigned char *buffer, int32_t length, SocketAddrInfo& receiverAddr) {
- return send(buffer, length, receiverAddr.addr, receiverAddr.port);
-}
-
-inline status_t UdpSocket::receive(unsigned char *buffer, int32_t length, int32_t &numBytes, SocketAddrInfo* sender) {
- if ((buffer == NULL) || (length < 0)) {
- return CAPU_EINVAL;
- }
-
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- sockaddr remoteSocketAddr;
- int32_t remoteSocketAddrSize = sizeof(remoteSocketAddr);
-
- int32_t result = recvfrom(mSocket, (char*)buffer, length, 0, &remoteSocketAddr, &remoteSocketAddrSize);
- if (result == SOCKET_ERROR) {
- numBytes = 0;
- result = WSAGetLastError();
- if (result == WSAETIMEDOUT) {
- return CAPU_ETIMEOUT;
- }
- else{
- return CAPU_ERROR;
- }
- }else{
- if(sender != 0)
- {
- sender->port = ntohs(((sockaddr_in*)&remoteSocketAddr)->sin_port);
- char* addr = inet_ntoa(((sockaddr_in*)&remoteSocketAddr)->sin_addr);
- StringUtils::Strncpy(sender->addr, sizeof(sender->addr), addr);
- }
- }
-
- numBytes = result;
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::close() {
- int32_t returnValue = CAPU_OK;
- if (mSocket == INVALID_SOCKET) {
- returnValue = CAPU_SOCKET_ESOCKET;
- } else {
- int32_t result = closesocket(mSocket);
- if (result != 0) {
- result = WSAGetLastError();
- if (result != WSANOTINITIALISED){ //socket has already been closed
- returnValue = CAPU_SOCKET_ECLOSE;
- }
- }
- }
- mSocket = INVALID_SOCKET;
- WSACleanup();
- return returnValue;
-}
-
-inline status_t UdpSocket::setBufferSize(int32_t bufferSize) {
- if (bufferSize < 0) {
- return CAPU_EINVAL;
- }
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, sizeof(bufferSize)) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::setTimeout(int32_t timeout) {
- if (mSocket == INVALID_SOCKET)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval soTimeout;
- soTimeout.tv_sec = timeout;
- soTimeout.tv_usec = 0;
-
- if (setsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
- if (setsockopt(mSocket, SOL_SOCKET, SO_SNDTIMEO, (char*)&soTimeout, sizeof(soTimeout)) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::getBufferSize(int32_t& bufferSize) {
- if (mSocket == INVALID_SOCKET) {
- return CAPU_SOCKET_ESOCKET;
- }
-
- socklen_t len = sizeof (bufferSize);
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVBUF, (char*)&bufferSize, &len) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- return CAPU_OK;
-}
-
-inline status_t UdpSocket::getTimeout(int32_t& timeout) {
- if (mSocket == INVALID_SOCKET)
- return CAPU_SOCKET_ESOCKET;
-
- struct timeval soTimeout;
- socklen_t len = sizeof(soTimeout);
-
- if (getsockopt(mSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&soTimeout, &len) == SOCKET_ERROR) {
- return CAPU_ERROR;
- }
-
- timeout = soTimeout.tv_sec;
-
- return CAPU_OK;
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows_X86_32/AtomicOperation.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows_X86_32/AtomicOperation.inc
deleted file mode 100644
index ff7ef96..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows_X86_32/AtomicOperation.inc
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef ATOMIC_OPERATION_INC_HEADER
-#include <Windows.h>
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_MEMBER
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_IMPL
-
-inline uint32_t AtomicOperation::AtomicAdd32(volatile uint32_t &mem, uint32_t summand){
- return InterlockedExchangeAdd((long*)&mem, summand);
-}
-
-inline uint32_t AtomicOperation::AtomicSub32(volatile uint32_t &mem, uint32_t subtrahend) {
- return InterlockedExchangeAdd((long*)&mem, 0-subtrahend);
-}
-
-inline uint32_t AtomicOperation::AtomicInc32(volatile uint32_t &mem) {
- return AtomicAdd32(mem, 1);
-}
-
-inline uint32_t AtomicOperation::AtomicDec32(volatile uint32_t &mem) {
- return AtomicSub32(mem, 1);;
-
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows_X86_64/AtomicOperation.inc b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows_X86_64/AtomicOperation.inc
deleted file mode 100644
index 3f6da49..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Windows_X86_64/AtomicOperation.inc
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef ATOMIC_OPERATION_INC_HEADER
-#include <Windows.h>
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_MEMBER
-#endif
-
-#ifdef ATOMIC_OPERATION_INC_IMPL
-
-inline uint32_t AtomicOperation::AtomicAdd32(volatile uint32_t &mem, uint32_t summand){
- return InterlockedExchangeAdd((long*)&mem, summand);
-}
-
-inline uint32_t AtomicOperation::AtomicSub32(volatile uint32_t &mem, uint32_t subtrahend) {
- return InterlockedExchangeAdd((long*)&mem, 0-subtrahend);
-}
-
-inline uint32_t AtomicOperation::AtomicInc32(volatile uint32_t &mem) {
- return AtomicAdd32(mem, 1);
-}
-
-inline uint32_t AtomicOperation::AtomicDec32(volatile uint32_t &mem) {
- return AtomicSub32(mem, 1);
-}
-#endif
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Appender.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Appender.h
deleted file mode 100644
index d848154..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Appender.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __APPENDER_H__
-#define __APPENDER_H__
-
-#include "capu/util/Logger.h"
-
-namespace capu {
-
- class Appender {
- protected:
- capu::LoggerLevel mLvl;
- public:
-
- virtual ~Appender() {}
-
- /**
- * open logger appender
- */
- virtual status_t open() = 0;
-
- /**
- * print trace message to the logger appender.
- * @param message that will be logged
- */
- virtual status_t log(class LoggerMessage* message) = 0;
-
- /**
- * close logger appender
- */
- virtual status_t close() = 0;
-
- /**
- * set Logging Level /\
- * Error Logging = CLL_ERROR, /||\
- * Waring Logging = CLL_WARN, || CLL_WARN includes CLL_ERROR etc.
- * Info Logging = CLL_INFO, ||
- * Debug Logging = CLL_DEBUG, ||
- * Trace Logging = CLL_TRACE, ||
- */
- void setLoggingLevel(LoggerLevel level) {
- mLvl = level;
- }
-
- };
-
-}
-
-
-#endif /* __APPENDER_H__ */
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/ConsoleAppender.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/ConsoleAppender.h
deleted file mode 100644
index 30d217c..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/ConsoleAppender.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* ConsoleAppender.h
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __CONSOLEAPPENDER_H__
-#define __CONSOLEAPPENDER_H__
-
-#include "capu/util/Appender.h"
-#include "capu/util/Logger.h"
-
-namespace capu {
-class ConsoleAppender : public capu::Appender {
- public:
-
- virtual ~ConsoleAppender() {}
-
- capu::status_t open() {
- return capu::CAPU_OK;
- }
-
- capu::status_t log(capu::LoggerMessage* message) {
- if(message->getLevel() >= mLvl)
- printf("%s:%d %s, %s\n", message->getFile(), message->getLine(), message->getTag(), message->getMessage());
- return capu::CAPU_OK;
- }
-
- capu::status_t close() {
- return capu::CAPU_OK;
- }
- };
-}
-
-
-
-#endif /* __CONSOLEAPPENDER_H__ */
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Logger.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Logger.h
deleted file mode 100644
index 1ec551e..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Logger.h
+++ /dev/null
@@ -1,374 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __LOGGER_H__
-#define __LOGGER_H__
-
-#include "capu/Error.h"
-#include "capu/Config.h"
-#include "capu/os/StringUtils.h"
-#include <stdarg.h>
-
-#if CAPU_LOGGING_ENABLED
-#define CAPU_LOG(logger, level, tag, format, ...) if(logger != NULL) logger->log(level, tag, __FILE__, __LINE__, format, ##__VA_ARGS__)
-#define CAPU_LOG_TRACE(logger, tag, format, ...) if(logger != NULL) logger->log(capu::CLL_TRACE, tag, __FILE__, __LINE__, format, ##__VA_ARGS__)
-#define CAPU_LOG_DEBUG(logger, tag, format, ...) if(logger != NULL) logger->log(capu::CLL_DEBUG, tag, __FILE__, __LINE__, format, ##__VA_ARGS__)
-#define CAPU_LOG_INFO(logger, tag, format, ...) if(logger != NULL) logger->log(capu::CLL_INFO, tag, __FILE__, __LINE__, format, ##__VA_ARGS__)
-#define CAPU_LOG_WARN(logger, tag, format, ...) if(logger != NULL) logger->log(capu::CLL_WARN, tag, __FILE__, __LINE__, format, ##__VA_ARGS__)
-#define CAPU_LOG_ERROR(logger, tag, format, ...) if(logger != NULL) logger->log(capu::CLL_ERROR, tag, __FILE__, __LINE__, format, ##__VA_ARGS__)
-#else
-#define CAPU_LOG(logger, level, tag, format, ...)
-#define CAPU_LOG_TRACE(logger, tag, format, ...)
-#define CAPU_LOG_DEBUG(logger, tag, format, ...)
-#define CAPU_LOG_INFO(logger, tag, format, ...)
-#define CAPU_LOG_WARN(logger, tag, format, ...)
-#define CAPU_LOG_ERROR(logger, tag, format, ...)
-#endif
-
-namespace capu {
-
- class Appender;
-
- /**
- * Logger levels
- */
- enum LoggerLevel {
- CLL_INVALID,
- CLL_TRACE,
- CLL_DEBUG,
- CLL_INFO,
- CLL_WARN,
- CLL_ERROR
- };
-
-
- class LoggerMessage {
- public:
- /**
- * creats a new LoggerMessage instance
- */
- LoggerMessage();
-
- // id
- void setId(int32_t id);
- int32_t getId();
-
- // timestamp
- void setTimestamp(int32_t timestamp);
- int32_t getTimestamp();
-
- // threadId
- void setThreadId(const char *threadId);
- const char* getThreadId();
-
- // level
- void setLevel(LoggerLevel level);
- LoggerLevel getLevel();
-
- // tag
- void setTag(const char *tag);
- const char* getTag();
-
- // filename
- void setFile(const char *file);
- const char* getFile();
-
- // line
- void setLine(int32_t line);
- int32_t getLine();
-
- // message
- void setMessage(const char* message);
- const char* getMessage();
-
- /**
- * cleanup current message
- */
- ~LoggerMessage();
-
- private:
- int32_t mId;
- int32_t mTimestamp;
- char *mThreadId;
- LoggerLevel mLevel;
- char *mTag;
- char *mFile;
- int32_t mLine;
- char *mMessage;
- };
-
- // id
- inline void LoggerMessage::setId(int32_t id) {
- mId = id;
- }
- inline int32_t LoggerMessage::getId() {
- return mId;
- }
-
- // timestamp
- inline void LoggerMessage::setTimestamp(int32_t timestamp) {
- mTimestamp = timestamp;
- }
- inline int32_t LoggerMessage::getTimestamp() {
- return mTimestamp;
- }
-
- // threadId
- inline void LoggerMessage::setThreadId(const char *threadId) {
- if(threadId != NULL) {
- if(mThreadId != NULL) {
- delete mThreadId;
- mThreadId = NULL;
- }
- uint_t length = StringUtils::Strlen(threadId);
- mThreadId = new char[length + 1];
- StringUtils::Strncpy(mThreadId, length + 1, threadId);
- }
- }
- inline const char* LoggerMessage::getThreadId() {
- return mThreadId;
- }
-
- // level
- inline void LoggerMessage::setLevel(LoggerLevel level) {
- mLevel = level;
- }
- inline LoggerLevel LoggerMessage::getLevel() {
- return mLevel;
- }
-
- // tag
- inline void LoggerMessage::setTag(const char *tag) {
- if(tag != NULL) {
- if(mTag != NULL) {
- delete mTag;
- mTag = NULL;
- }
- uint_t length = StringUtils::Strlen(tag);
- mTag = new char[length + 1];
- StringUtils::Strncpy(mTag, length + 1, tag);
- }
- }
- inline const char* LoggerMessage::getTag() {
- return mTag;
- }
-
- // filename
- inline void LoggerMessage::setFile(const char *file) {
- if(file != NULL) {
- if(mFile != NULL) {
- delete mFile;
- mFile = NULL;
- }
- uint_t length = StringUtils::Strlen(file);
- mFile = new char[length + 1];
- StringUtils::Strncpy(mFile, length + 1, file);
- }
- }
- inline const char* LoggerMessage::getFile() {
- return mFile;
- }
-
- // line
- inline void LoggerMessage::setLine(int32_t line) {
- mLine = line;
- }
- inline int32_t LoggerMessage::getLine() {
- return mLine;
- }
-
- // message
- inline void LoggerMessage::setMessage(const char* message) {
- if(message != NULL) {
- if(mMessage != NULL) {
- delete mMessage;
- mMessage = NULL;
- }
- uint_t length = StringUtils::Strlen(message);
- mMessage = new char[length + 1];
- StringUtils::Strncpy(mMessage, length + 1, message);
- }
- }
- inline const char* LoggerMessage::getMessage() {
- return mMessage;
- }
-
- class Logger {
- public:
-
- /**
- * creats a new Logger
- * @param id of the logger
- */
- Logger(int32_t id = 0);
-
- /**
- * destroy logger instance
- */
- ~Logger();
-
- /**
- * sets an appender for the logger
- */
- status_t setAppender(Appender *appender);
-
- /**
- * removes the appender identified by name
- */
- status_t removeAppender(Appender *appender);
-
- /**
- * opens the logger
- */
- status_t open();
-
- /**
- * print trace message to the logger.
- * @param tag that will be logged
- * @param message that will be logged
- * @param file name of the log call
- * @param line number of the log call
- * @param msgFormat of the log message
- */
- status_t trace(const char *tag, const char *file, int32_t line,const char *msgFormat, ...);
-
- /**
- * print debug message to the logger.
- * @param tag that will be logged
- * @param message that will be logged
- * @param file name of the log call
- * @param line number of the log call
- * @param msgFormat of the log message
- */
- status_t debug(const char *tag, const char *file, int32_t line,const char *msgFormat, ...);
-
- /**
- * print info message to the logger.
- * @param tag that will be logged
- * @param message that will be logged
- * @param file name of the log call
- * @param line number of the log call
- * @param msgFormat of the log message
- */
- status_t info(const char *tag, const char *file, int32_t line,const char *msgFormat, ...);
-
- /**
- * print warn message to the logger.
- * @param tag that will be logged
- * @param message that will be logged
- * @param file name of the log call
- * @param line number of the log call
- * @param msgFormat of the log message
- */
- status_t warn(const char *tag, const char *file, int32_t line,const char *msgFormat, ...);
-
- /**
- * print error message to the logger.
- * @param tag that will be logged
- * @param message that will be logged
- * @param file name of the log call
- * @param line number of the log call
- * @param msgFormat of the log message
- */
- status_t error(const char *tag, const char *file, int32_t line,const char *msgFormat, ...);
-
- /**
- * print log message with given level to the logger.
- * @param level of the lov message
- * @param tag that will be logged
- * @param message that will be logged
- * @param file name of the log call
- * @param line number of the log call
- * @param msgFormat of the log message
- */
- status_t log(LoggerLevel level, const char *tag, const char *file, int32_t line,const char *msgFormat, ...);
-
- /**
- * close the logger
- */
- status_t close();
-
- private:
- /**
- * print log message with given level to the logger.
- * @param level of the lov message
- * @param tag that will be logged
- * @param message that will be logged
- * @param file name of the log call
- * @param line number of the log call
- * @param msgFormat of the log message
- * @param args variable argument list
- */
- status_t vlog(LoggerLevel level, const char *tag, const char *file, int32_t line,const char *msgFormat, va_list args);
-
- private:
- int32_t mId;
- Appender* mAppenders[LOGGER_APPENDER_MAX];
- bool_t mOpen;
- };
-
- inline status_t Logger::trace(const char *tag, const char *file, int32_t line, const char *msgFormat, ...) {
- va_list args;
- va_start(args, msgFormat);
- status_t status = vlog(CLL_TRACE, tag, file, line, msgFormat, args);
- va_end(args);
- return status;
- }
-
- inline status_t Logger::debug(const char *tag, const char *file, int32_t line,const char *msgFormat, ...) {
- va_list args;
- va_start(args, msgFormat);
- status_t status = vlog(CLL_DEBUG, tag, file, line, msgFormat, args);
- va_end(args);
- return status;
- }
-
- inline status_t Logger::info(const char *tag, const char *file, int32_t line,const char *msgFormat, ...) {
- va_list args;
- va_start(args, msgFormat);
- status_t status = vlog(CLL_INFO, tag, file, line, msgFormat, args);
- va_end(args);
- return status;
- }
-
- inline status_t Logger::warn(const char *tag, const char *file, int32_t line,const char *msgFormat, ...) {
- va_list args;
- va_start(args, msgFormat);
- status_t status = vlog(CLL_WARN, tag, file, line, msgFormat, args);
- return status;
- }
-
- inline status_t Logger::error(const char *tag, const char *file, int32_t line,const char *msgFormat, ...) {
- va_list args;
- va_start(args, msgFormat);
- status_t status = vlog(CLL_ERROR, tag, file, line, msgFormat, args);
- va_end(args);
- return status;
- }
-
- inline status_t Logger::log(LoggerLevel level, const char *tag, const char *file, int32_t line,const char *msgFormat, ...) {
- va_list args;
- va_start(args, msgFormat);
- status_t status = vlog(level, tag, file, line, msgFormat, args);
- va_end(args);
- return status;
- }
-
-}
-
-#endif /* __LOGGER_H__ */
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Runnable.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Runnable.h
deleted file mode 100644
index 06df943..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Runnable.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __RUNNABLE_H__
-#define __RUNNABLE_H__
-
-namespace capu
-{
- class Runnable
- {
- public:
-
- virtual ~Runnable() {}
-
- /**
- * Thread Execution Function
- */
- virtual void run() = 0;
-
- };
-}
-
-#endif /* __RUNNABLE_H__ */
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/SmartPointer.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/SmartPointer.h
deleted file mode 100644
index 0d5ace6..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/SmartPointer.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __SMARTPOINTER_H__
-#define __SMARTPOINTER_H__
-
-#include "capu/Config.h"
-#include "capu/os/AtomicOperation.h"
-
-namespace capu {
-
- template<class T>
- class SmartPointer {
- public:
- /**
- * Default constructor
- */
- SmartPointer();
-
- /**
- * Constructor
- * @param pointer to object
- */
- SmartPointer(T* ptr);
-
- /**
- * Copy constructor for different, but castable type
- * @param reference to smartPointer
- */
- template<class X> friend class SmartPointer;
- template<class X>
- SmartPointer(const SmartPointer<X>& smartPointer);
-
- /**
- * Copy constructor
- * @param reference to smartPointer
- */
- SmartPointer(const SmartPointer& smartPointer);
-
- /**
- * Deconstructor
- */
- ~SmartPointer();
-
- /**
- * Overload assignment operator to be able to decrement the
- * reference count if another object gets assigned to this smart pointer
- * @param reference to smartPointer
- */
- SmartPointer& operator= (const SmartPointer& smartPointer);
-
- /**
- * Overload assignment operator for castable, but different type
- * @param reference to smartPointer
- */
- template <class X>
- SmartPointer<T>& operator= (const SmartPointer<X>& smartPointer);
-
- /**
- * Overload assignment operator to be able to decrement the
- * reference count if another object gets assigned to this smart pointer
- */
- SmartPointer& operator= (T* ptr);
-
- /**
- * Overload file operator to be able to access the object
- * referenced by the pointer
- */
- T* operator->() const;
-
- /**
- * Overload dereference operator to be able to get the object
- * referenced by the pointer. Use with care!
- */
- T& operator*() const;
-
- /**
- * Returns true if two smart pointer are equal to each other
- * false otherwise
- */
- capu::bool_t operator==(const SmartPointer<T>& x) const;
-
- /**
- * Returns true if two smart pointer aren't equal to each other
- * false otherwise
- */
- capu::bool_t operator!=(const SmartPointer<T>& x) const;
-
- /**
- * Returns the object stored by the smartPointer
- */
- T* get() const;
-
- /**
- * Check if object exists
- * @return true if object exists
- */
- operator bool();
-
- /**
- * Returns the reference counter value.
- * If the object does not exist, 0 ist returned
- * @return reference count
- */
- capu::uint32_t getRefCount();
-
- /**
- * cast a SmartPointer of type X to type T
- * this is a simple C-cast, so there are no type checks
- * @param reference to smartPointer
- */
- template<class X>
- SmartPointer<X> unchecked_cast();
-
- private:
- T* mData;
- capu::uint32_t* mReferenceCount;
-
- void incRefCount();
- void decRefCount();
-
- void freeData();
- };
-
- template<class T>
- inline
- SmartPointer<T>::SmartPointer()
- : mData(0)
- , mReferenceCount(0) {
- }
-
- template<class T>
- inline
- SmartPointer<T>::SmartPointer(T* ptr)
- : mData(0)
- , mReferenceCount(0) {
- if (mData != ptr) {
- mData = ptr;
- mReferenceCount = new capu::uint32_t(0);
- incRefCount();
- }
- }
-
- template<class T>
- template<class X>
- inline
- SmartPointer<T>::SmartPointer(const SmartPointer<X>& smartPointer)
- : mData(static_cast<T*> (smartPointer.mData))
- , mReferenceCount(smartPointer.mReferenceCount)
- {
- incRefCount();
- }
-
- template<class T>
- inline
- SmartPointer<T>::SmartPointer(const SmartPointer<T>& smartPointer)
- : mData(smartPointer.mData)
- , mReferenceCount(smartPointer.mReferenceCount) {
- incRefCount();
- }
-
- template<class T>
- inline
- SmartPointer<T>::~SmartPointer() {
- decRefCount();
- }
-
- template<class T>
- inline
- SmartPointer<T>& SmartPointer<T>::operator=(const SmartPointer<T>& smartPointer) {
- if (this != &smartPointer) {
- decRefCount();
-
- mData = smartPointer.mData;
- mReferenceCount = smartPointer.mReferenceCount;
-
- incRefCount();
- }
-
- return *this;
- }
-
- template<class T>
- inline
- SmartPointer<T>& SmartPointer<T>::operator=(T* ptr) {
- if (mData != ptr) {
- decRefCount();
-
- mData = ptr;
- mReferenceCount = new capu::uint32_t(0);
-
- incRefCount();
- }
- return *this;
- }
-
- template <class T>
- template <class X>
- inline
- SmartPointer<T>& SmartPointer<T>::operator= (const SmartPointer<X>& smartPointer) {
- if (*this != smartPointer) {
- decRefCount();
- mData = static_cast<T*> (smartPointer.mData);
- mReferenceCount = smartPointer.mReferenceCount;
- incRefCount();
- }
- return *this;
- }
-
- template<class T>
- inline
- T* SmartPointer<T>::operator->() const {
- return mData;
- }
-
- template<class T>
- inline
- T& SmartPointer<T>::operator*() const {
- return *mData;
- }
-
- template<class T>
- capu::bool_t SmartPointer<T>::operator==(const SmartPointer<T>& x) const {
- return ((x.mData == this->mData) && (x.mReferenceCount == this->mReferenceCount));
- }
-
- template<class T>
- capu::bool_t SmartPointer<T>::operator!=(const SmartPointer<T>& x) const {
- return ((x.mData != this->mData) || (x.mReferenceCount != this->mReferenceCount));
- }
-
- template<class T>
- inline
- void SmartPointer<T>::incRefCount() {
- if (mReferenceCount) {
- capu::AtomicOperation::AtomicInc32(*mReferenceCount);
- }
- }
-
- template<class T>
- inline
- void SmartPointer<T>::decRefCount() {
- if (mReferenceCount) {
- uint32_t oldValue = capu::AtomicOperation::AtomicDec32(*mReferenceCount);
- if (--oldValue == 0) {
- freeData();
- }
- }
- }
-
- template<class T>
- inline
- void SmartPointer<T>::freeData() {
- delete mData;
- delete mReferenceCount;
- mData = 0;
- mReferenceCount = 0;
- }
-
- template<class T>
- inline
- T* SmartPointer<T>::get() const {
- return mData;
- }
-
- template<class T>
- inline
- SmartPointer<T>::operator bool() {
- return mData != 0;
- }
-
- template<class T>
- inline
- capu::uint32_t SmartPointer<T>::getRefCount() {
- if (mReferenceCount != 0)
- return *mReferenceCount;
- else
- return 0;
- }
-
- template<class T>
- template<class X>
- inline
- SmartPointer<X> SmartPointer<T>::unchecked_cast()
- {
- SmartPointer<X> p;
- p.mData = (X*)mData;
- p.mReferenceCount = mReferenceCount;
- incRefCount();
- return p;
- }
-
- template<class X, class T>
- SmartPointer<X> smartpointer_cast(SmartPointer<T>& ptr)
- {
- return ptr.template unchecked_cast<X>();
- }
-}
-
-#endif // __SMARTPOINTER_H__
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/ThreadPool.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/ThreadPool.h
deleted file mode 100644
index 95e4734..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/ThreadPool.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __THREADPOOL_H__
-#define __THREADPOOL_H__
-
-#include "capu/Config.h"
-#include "capu/container/Array.h"
-#include "capu/container/Queue.h"
-#include "capu/os/CondVar.h"
-#include "capu/os/Mutex.h"
-#include "capu/os/Thread.h"
-#include "capu/util/Runnable.h"
-#include "capu/util/SmartPointer.h"
-
-namespace capu
-{
-
- class ThreadPool{
- public:
- /**
- * creats a new Threadpool instance
- * @param threads amount of initial threads
- */
- ThreadPool();
-
- /**
- * creats a new Threadpool instance
- * @param size amounts of threads
- */
- ThreadPool(uint32_t size);
-
- /**
- * destructor
- */
- virtual ~ThreadPool();
-
- /**
- * Adds a runnable to the threadpool
- * @param runnable The runnable which should be executed by the threadpool
- */
- status_t add(SmartPointer<Runnable> runnable);
-
- /**
- * Waits until every thread has been terminated
- */
- status_t join();
-
- /**
- * Returns the number of threads used by the threadPool
- * @param runnable The runnable which should be executed by the threadpool
- */
- int32_t getSize();
-
- private:
- class PoolRunnable : public Runnable {
- public:
- PoolRunnable() {
- mPool = NULL;
- }
-
- PoolRunnable(ThreadPool* pool) {
- mPool = pool;
- }
-
- void run() {
- if (mPool == NULL) {
- return;
- }
- while (1) {
- mPool->mMutex.lock();
- while(mPool->mRunnableQueue->isEmpty() && !mPool->isClosed()) {
- if (mPool->mCloseRequested) {
- //if Queue is empty and close was requested
- mPool->mClosed = true;
- break;
- }
-
- mPool->mCV.wait(&mPool->mMutex);
- }
- if (mPool->isClosed()) {
- mPool->mMutex.unlock();
- break;
- }
- capu::SmartPointer<capu::Runnable> r = NULL;
- status_t result = mPool->mRunnableQueue->next(&r);
-
- mPool->mMutex.unlock();
- if (result == CAPU_OK) {
- if (r.get() != NULL) {
- r->run();
- }
- }
- }
- }
- private:
- ThreadPool *mPool;
- };
-
- class PoolWorker {
- public:
- PoolWorker()
- : mPool(NULL), mPoolRunnable(NULL), mThread(NULL) {
- }
-
- PoolWorker(ThreadPool *pool, int32_t id)
- : mPool(pool)
- {
- mPoolRunnable = new PoolRunnable(mPool);
- mThread = new Thread(mPoolRunnable);
-
- }
-
- virtual ~PoolWorker() {
- delete mPoolRunnable;
- delete mThread;
- }
-
- status_t startThread() {
- return mThread->start();
- }
-
- status_t joinThread() {
- return mThread->join();
- }
-
- private:
- int32_t mId;
- ThreadPool *mPool;
- PoolRunnable *mPoolRunnable;
- Thread *mThread;
-
- };
-
- status_t init();
-
- uint32_t mSize;
- Queue<SmartPointer<Runnable> > *mRunnableQueue;
- PoolWorker **mThreadArray;
- CondVar mCV;
- Mutex mMutex;
- bool_t mClosed;
- bool_t mCloseRequested;
-
- bool_t isClosed();
-
-
- };
-
-
-}
-
-#endif /* Thread_H */
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Traits.h b/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Traits.h
deleted file mode 100644
index 0a9ea65..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/include/capu/util/Traits.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef __TRAITS_H__
-#define __TRAITS_H__
-
-#include "capu/Config.h"
-
-namespace capu {
-
-#define CAPU_PRIMITIVE 1
-#define CAPU_CLASS 0
-
- //is CAPU_PRIMITIVE
- template<typename T> struct is_CAPU_PRIMITIVE { enum { Value = CAPU_CLASS }; };
- template<> struct is_CAPU_PRIMITIVE<int8_t > { enum { Value = CAPU_PRIMITIVE }; };
- template<> struct is_CAPU_PRIMITIVE<int16_t > { enum { Value = CAPU_PRIMITIVE }; };
- template<> struct is_CAPU_PRIMITIVE<int32_t > { enum { Value = CAPU_PRIMITIVE }; };
- template<> struct is_CAPU_PRIMITIVE<int64_t > { enum { Value = CAPU_PRIMITIVE }; };
- template<> struct is_CAPU_PRIMITIVE<uint32_t> { enum { Value = CAPU_PRIMITIVE }; };
- template<> struct is_CAPU_PRIMITIVE<uint64_t> { enum { Value = CAPU_PRIMITIVE }; };
- template<> struct is_CAPU_PRIMITIVE<float_t > { enum { Value = CAPU_PRIMITIVE }; };
- template<> struct is_CAPU_PRIMITIVE<double_t> { enum { Value = CAPU_PRIMITIVE }; };
- template<> struct is_CAPU_PRIMITIVE<bool_t > { enum { Value = CAPU_PRIMITIVE }; };
-
- //References Helper (T &)
- template<typename T, int TYPE> struct _ReferenceType {};
- template<typename T> struct _ReferenceType<T, CAPU_CLASS > { typedef T &Type; };
- template<typename T> struct _ReferenceType<T, CAPU_PRIMITIVE > { typedef T Type; };
-
- //ConstReferences Helper (const T &)
- template<typename T, int TYPE> struct _ConstReferenceType {};
- template<typename T> struct _ConstReferenceType<T, CAPU_CLASS > { typedef const T &Type; };
- template<typename T> struct _ConstReferenceType<T, CAPU_PRIMITIVE > { typedef const T Type; };
-
- //References (T &)
- template<typename T>
- struct ReferenceType
- {
- typedef typename _ReferenceType<T, is_CAPU_PRIMITIVE<T>::Value >::Type Type;
- };
-
- //ConstReferences (const T &)
- template<typename T>
- struct ConstReferenceType
- {
- typedef typename _ConstReferenceType<T, is_CAPU_PRIMITIVE<T>::Value >::Type Type;
- };
-
-}
-
-#endif /* __TRAITS_H__ */
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/src/os/Math.cpp b/binding-cpp/runtime/lib/capu/modules/capu/src/os/Math.cpp
deleted file mode 100644
index 3cdf172..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/src/os/Math.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <capu/os/Math.h>
-#include <capu/Config.h>
-
-namespace capu
-{
- const float_t Math::PI_f = 3.1415926535897932384626433832795028841971693993751058209749f;
- const double_t Math::PI_d = 3.1415926535897932384626433832795028841971693993751058209749;
-}
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/src/util/Logger.cpp b/binding-cpp/runtime/lib/capu/modules/capu/src/util/Logger.cpp
deleted file mode 100644
index 36511e2..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/src/util/Logger.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "capu/util/Logger.h"
-#include "capu/util/Appender.h"
-#include "capu/os/Memory.h"
-
-namespace capu {
-
- //
- // LoggerMessage
- //
-
- LoggerMessage::LoggerMessage()
- : mId(0)
- , mTimestamp(0)
- , mThreadId(NULL)
- , mLevel(CLL_INVALID)
- , mTag(NULL)
- , mFile(NULL)
- , mLine(0)
- , mMessage(NULL) {
- }
-
- LoggerMessage::~LoggerMessage() {
- if(mThreadId != NULL) {
- delete mThreadId;
- }
- if(mTag != NULL) {
- delete [] mTag;
- }
- if(mFile != NULL) {
- delete [] mFile;
- }
- if(mMessage != NULL) {
- delete [] mMessage;
- }
- }
-
- //
- // Logger
- //
-
- Logger::Logger(int32_t id)
- : mId(id)
- , mOpen(false) {
- Memory::Set(mAppenders, 0, sizeof(Appender*) * LOGGER_APPENDER_MAX);
- }
-
- Logger::~Logger() {
- if(mOpen) {
- close();
- }
- }
-
- status_t Logger::setAppender(Appender* appender) {
- for(int i = 0; i < LOGGER_APPENDER_MAX; i++) {
- if(mAppenders[i] == NULL) {
- mAppenders[i] = appender;
- return CAPU_OK;
- }
- }
- return CAPU_ERROR;
- }
-
- status_t Logger::removeAppender(Appender* appender) {
- for(int i = 0; i < LOGGER_APPENDER_MAX; i++) {
- if(mAppenders[i] == appender) {
- mAppenders[i] = NULL;
- return CAPU_OK;
- }
- }
- return CAPU_ERROR;
- }
-
- status_t Logger::open() {
- for(int i = 0; i < LOGGER_APPENDER_MAX; i++) {
- if(mAppenders[i] != NULL) {
- mAppenders[i]->open();
- }
- }
- mOpen = true;
- return CAPU_OK;
- }
-
- status_t Logger::vlog(LoggerLevel level, const char_t *tag, const char_t *file, int32_t line, const char_t *msgFormat, va_list args) {
-
- LoggerMessage msg;
- msg.setId(mId);
- msg.setTimestamp(0); // not implemented
- msg.setThreadId(0); // not implemented
- msg.setLevel(level);
- msg.setTag(tag);
- msg.setFile(file);
- msg.setLine(line);
-
- int32_t size = StringUtils::Vscprintf(msgFormat, args);
- char_t* buffer = new char_t[size + 1];
- StringUtils::Vsprintf(buffer, size + 1, msgFormat, args);
- msg.setMessage(buffer);
- delete [] buffer;
-
- // log message
- for(int i = 0; i < LOGGER_APPENDER_MAX; i++) {
- if(mAppenders[i] != NULL) {
- mAppenders[i]->log(&msg);
- }
- }
- return CAPU_OK;
- }
-
- status_t Logger::close() {
- for(int i = 0; i < LOGGER_APPENDER_MAX; i++) {
- if(mAppenders[i] != NULL) {
- mAppenders[i]->close();
- }
- }
- mOpen = false;
- return CAPU_OK;
- }
-
-}
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/src/util/ThreadPool.cpp b/binding-cpp/runtime/lib/capu/modules/capu/src/util/ThreadPool.cpp
deleted file mode 100644
index 9569d2c..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/src/util/ThreadPool.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "capu/util/ThreadPool.h"
-
-capu::ThreadPool::ThreadPool() : mSize(5) {
- init();
-}
-
-capu::ThreadPool::ThreadPool(capu::uint_t size) : mSize(size) {
- init();
-}
-
-capu::status_t capu::ThreadPool::init() {
- mClosed = false;
- mCloseRequested = false;
- mRunnableQueue = new capu::Queue<capu::SmartPointer<capu::Runnable> >();
- mThreadArray = new capu::ThreadPool::PoolWorker*[mSize];
- for (capu::uint32_t i = 0; i<mSize; i++) {
- capu::ThreadPool::PoolWorker *t = new capu::ThreadPool::PoolWorker(this, i);
- mThreadArray[i] = t;
- t->startThread();
- }
-
- return CAPU_OK;
-}
-
-capu::ThreadPool::~ThreadPool() {
- mClosed = true;
- join();
- delete mRunnableQueue;
- for (capu::uint32_t i = 0; i<mSize; i++) {
- capu::ThreadPool::PoolWorker *t = mThreadArray[i];
- delete t;
- }
- delete[] mThreadArray;
-}
-
-
-capu::status_t capu::ThreadPool::add(capu::SmartPointer<capu::Runnable> runnable) {
- if (runnable.get() == NULL || mClosed || mCloseRequested) {
- return CAPU_ERROR;
- }
- mMutex.lock();
- status_t result = mRunnableQueue->add(runnable);
- mCV.signal();
- mMutex.unlock();
- return result;
-}
-
-capu::status_t capu::ThreadPool::join() {
- mMutex.lock();
- mCloseRequested = true;
- mCV.broadcast();
- mMutex.unlock();
- status_t result = capu::CAPU_OK;
- for (capu::uint32_t i = 0; i<mSize; i++) {
- capu::ThreadPool::PoolWorker *t = mThreadArray[i];
- result = t->joinThread();
- if (result != capu::CAPU_OK) {
- return result;
- }
- }
- return result;
-}
-
-capu::int32_t capu::ThreadPool::getSize() {
- return mSize;
-}
-
-capu::bool_t capu::ThreadPool::isClosed() {
- return mClosed;
-}
-
-
-
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/container/ArrayTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/container/ArrayTest.cpp
deleted file mode 100644
index 1a6259b..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/container/ArrayTest.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <gtest/gtest.h>
-#include "capu/container/Array.h"
-#include "capu/Error.h"
-#include "capu/Config.h"
-
-TEST(Array, Constructor) {
- capu::Array<capu::uint32_t> emptyArray;
- EXPECT_EQ(0u, emptyArray.size());
-
- capu::Array<capu::uint32_t> *myArray = NULL;
- myArray = new capu::Array<capu::uint32_t>(10);
- EXPECT_TRUE(myArray != NULL);
- EXPECT_EQ(10u,myArray->size());
- delete myArray;
-}
-
-TEST(Array, SetAndGetValues) {
- capu::Array<capu::uint32_t> myArray(10);
- myArray.set(5);
- for (capu::int32_t i = 0; i< 10; i++) {
- EXPECT_EQ(5u,myArray[i]);
- }
-
- EXPECT_EQ(capu::CAPU_OK, myArray.set(3,0,3));
- EXPECT_EQ(3u,myArray[0]);
- EXPECT_EQ(3u,myArray[1]);
- EXPECT_EQ(3u,myArray[2]);
-
- EXPECT_EQ(capu::CAPU_OK, myArray.set(7,7,3));
- EXPECT_EQ(7u,myArray[7]);
- EXPECT_EQ(7u,myArray[8]);
- EXPECT_EQ(7u,myArray[9]);
-
- EXPECT_EQ(capu::CAPU_OK, myArray.set(4,4,3));
- EXPECT_EQ(4u,myArray[4]);
- EXPECT_EQ(4u,myArray[5]);
- EXPECT_EQ(4u,myArray[6]);
-
- capu::Array<capu::uint32_t> myArray2(20);
- myArray2.set(5);
- for (capu::int32_t i = 0; i< 20; i++) {
- EXPECT_EQ(5u,myArray2[i]);
- }
-
- EXPECT_EQ(capu::CAPU_OK,myArray2.set(3,0,3));
- EXPECT_EQ(3u,myArray2[0]);
- EXPECT_EQ(3u,myArray2[1]);
- EXPECT_EQ(3u,myArray2[2]);
-
- EXPECT_EQ(capu::CAPU_OK,myArray2.set(7,17,3));
- EXPECT_EQ(7u,myArray2[17]);
- EXPECT_EQ(7u,myArray2[18]);
- EXPECT_EQ(7u,myArray2[19]);
-
- EXPECT_EQ(capu::CAPU_OK,myArray2.set(4,5,12));
- EXPECT_EQ(5u,myArray2[4]);
- EXPECT_EQ(4u,myArray2[5]);
- EXPECT_EQ(4u,myArray2[6]);
- EXPECT_EQ(4u,myArray2[7]);
- EXPECT_EQ(4u,myArray2[8]);
- EXPECT_EQ(4u,myArray2[9]);
- EXPECT_EQ(4u,myArray2[10]);
- EXPECT_EQ(4u,myArray2[11]);
- EXPECT_EQ(4u,myArray2[12]);
- EXPECT_EQ(4u,myArray2[13]);
- EXPECT_EQ(4u,myArray2[14]);
- EXPECT_EQ(4u,myArray2[15]);
- EXPECT_EQ(4u,myArray2[16]);
- EXPECT_EQ(7u,myArray2[17]);
-
- myArray2[0] = 1;
- myArray2[1] = 2;
-
- EXPECT_EQ(1u,myArray2[0]);
- EXPECT_EQ(2u,myArray2[1]);
-
- EXPECT_EQ(capu::CAPU_OK,myArray2.set(4,0,20));
- EXPECT_EQ(capu::CAPU_ERANGE,myArray2.set(4,0,21));
- EXPECT_EQ(capu::CAPU_ERANGE,myArray2.set(4,1,20));
-}
-
-TEST(Array, Swap) {
- capu::Array<capu::uint32_t> myArray(10);
- myArray.set(5);
- myArray[3] = 10;
- myArray[7] = 15;
- EXPECT_EQ(10u,myArray[3]);
- EXPECT_EQ(15u,myArray[7]);
-
- EXPECT_EQ(capu::CAPU_OK,myArray.swap(3,7));
- EXPECT_EQ(15u,myArray[3]);
- EXPECT_EQ(10u,myArray[7]);
-
- EXPECT_EQ(capu::CAPU_ERANGE,myArray.swap(13,17));
- EXPECT_EQ(capu::CAPU_ERANGE,myArray.swap(3,17));
- EXPECT_EQ(capu::CAPU_ERANGE,myArray.swap(13,7));
-}
-
-TEST(Array, Move) {
- capu::Array<capu::uint32_t> myArray(10);
- myArray.set(5);
-
- myArray[0] = 10;
- myArray[1] = 15;
- myArray[2] = 20;
-
- EXPECT_EQ(capu::CAPU_OK,myArray.move(0,3,7));
- EXPECT_EQ(10u,myArray[7]);
- EXPECT_EQ(15u,myArray[8]);
- EXPECT_EQ(20u,myArray[9]);
-
- EXPECT_EQ(capu::CAPU_ERANGE,myArray.move(13,3,7));
- EXPECT_EQ(capu::CAPU_ERANGE,myArray.move(0,13,7));
- EXPECT_EQ(capu::CAPU_ERANGE,myArray.move(0,3,13));
-}
-
-TEST(Array, CopyConstructor)
-{
-
- capu::Array<capu::uint32_t> myArray(10);
- myArray.set(5);
-
- capu::Array<capu::uint32_t> myArray2(myArray);
-
- EXPECT_EQ(5u, myArray2[0]);
- EXPECT_EQ(5u, myArray2[4]);
- EXPECT_EQ(5u, myArray2[9]);
-}
-
-TEST(Array, Assignment)
-{
- capu::Array<capu::uint32_t> myEmptyArray;
-
- capu::Array<capu::uint32_t> myArray(10);
- myArray.set(5);
-
- myEmptyArray = myArray;
-
- EXPECT_EQ(5u, myEmptyArray[0]);
- EXPECT_EQ(5u, myEmptyArray[4]);
- EXPECT_EQ(5u, myEmptyArray[9]);
-
- capu::Array<capu::uint32_t> myArray2(10);
- myArray2 = myArray;
-
- EXPECT_EQ(5u, myArray2[0]);
- EXPECT_EQ(5u, myArray2[4]);
- EXPECT_EQ(5u, myArray2[9]);
-}
-
-TEST(Array, CopyMethodNormal)
-{
- capu::Array<capu::uint32_t> original(5);
- capu::uint32_t newVals[5];
-
- // fill with default values
- for(capu::uint32_t i=0;i<original.size();i++)
- {
- original[i] = i;
- newVals[i] = i+1;
- }
-
- capu::status_t status = original.copy(newVals, original.size());
- EXPECT_EQ(capu::CAPU_OK, status);
-
- for(capu::uint32_t i=0;i<original.size();i++)
- {
- EXPECT_EQ(i+1, original[i]);
- }
-}
-
-TEST(Array, CopyMethodNormalWithBiggerArray)
-{
- capu::Array<capu::uint32_t> original(5);
- capu::uint32_t newVals[50]; // this one's bigger
-
- // fill with default values
- for(capu::uint32_t i=0;i<original.size();i++)
- {
- original[i] = i;
- }
- for(capu::uint32_t i=0;i<50;i++)
- {
- newVals[i] = i+1;
- }
-
- capu::status_t status = original.copy(newVals, original.size()); // only copy the first 5 values
- EXPECT_EQ(capu::CAPU_OK, status);
-
- for(capu::uint32_t i=0;i<original.size();i++)
- {
- EXPECT_EQ(i+1, original[i]);
- }
-}
-
-TEST(Array, CopyMethodInvalidSize)
-{
- capu::Array<capu::uint32_t> original(5);
- for(capu::uint32_t i=0;i<original.size();i++)
- {
- original[i] = i;
- }
- capu::uint32_t newVals[3];
-
- capu::status_t status = original.copy(newVals, 3); // give invalid size
- EXPECT_EQ(capu::CAPU_ERANGE, status);
-
- // no changes in original array
- for(capu::uint32_t i=0;i<original.size();i++)
- {
- EXPECT_EQ(i, original[i]);
- }
-}
-
-TEST(Array, CopyMethodZeroSizeNormal)
-{
- capu::Array<capu::uint32_t> original(0);
- capu::uint32_t newVals[1];
-
- capu::status_t status = original.copy(newVals, original.size()); // copy with zero, no error expected
- EXPECT_EQ(capu::CAPU_OK, status);
-}
-
-TEST(Array, CopyMethodZeroSizeInvalidSize)
-{
- capu::Array<capu::uint32_t> original(0);
- capu::uint32_t newVals[1];
-
- capu::status_t status = original.copy(newVals, 1);
- EXPECT_EQ(capu::CAPU_ERANGE, status);
-}
-
-TEST(Array, SetRawData)
-{
- capu::Array<capu::uint32_t> array(3u);
-
- array.setRawData(0);
-
- EXPECT_EQ(0u, array[0]);
- EXPECT_EQ(0u, array[1]);
- EXPECT_EQ(0u, array[2]);
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/container/HashSetTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/container/HashSetTest.cpp
deleted file mode 100644
index 1065190..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/container/HashSetTest.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include "capu/container/HashSet.h"
-#include "capu/Error.h"
-#include "capu/Config.h"
-
-TEST(HashSet, Constructor_Default) {
- capu::HashSet<capu::int32_t>* list = new capu::HashSet<capu::int32_t > ();
- delete list;
-}
-
-TEST(HashSet, put) {
- capu::int32_t value2 = 10;
- capu::int32_t value = 5;
- capu::status_t status = capu::CAPU_OK;
-
- capu::HashSet<capu::int32_t>* h1 = new capu::HashSet<capu::int32_t > ();
-
- // add new key
- status = h1->put(value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // add new key
- status = h1->put(value2);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // add existing key
- status = h1->put(value2);
- EXPECT_TRUE(status == capu::CAPU_ERROR);
-
- delete h1;
-}
-
-TEST(HashSet, count) {
- capu::uint64_t count = 0;
- capu::int32_t value2 = 10;
- capu::int32_t value = 5;
- capu::status_t status = capu::CAPU_OK;
- capu::HashSet<capu::int32_t>* h1 = new capu::HashSet<capu::int32_t > ();
-
- //check count
- count = h1->count();
- EXPECT_TRUE(count == 0);
-
- // add new value
- status = h1->put(value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // add new value
- status = h1->put(value2);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- count = h1->count();
- EXPECT_TRUE(count == 2);
-
- status = h1->remove(value2);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- count = h1->count();
- EXPECT_TRUE(count == 1);
-
- delete h1;
-}
-
-TEST(HashSet, clear) {
- capu::int32_t value = 5;
- capu::int32_t value2 = 6;
- capu::status_t status = capu::CAPU_OK;
-
- capu::uint64_t count = 0;
-
- capu::HashSet<capu::int32_t>* h1 = new capu::HashSet<capu::int32_t > ();
- // add new keys
- status = h1->put(value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- //add new keys
- status = h1->put(value2);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // check count
- count = h1->count();
- EXPECT_TRUE(count == 2);
-
- //remove all
- status = h1->clear();
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- //check count
- count = h1->count();
- EXPECT_TRUE(count == 0);
-
- delete h1;
-}
-
-TEST(HashSet, remove) {
- capu::int32_t value = 5;
- capu::int32_t value2 = 6;
- capu::status_t status = capu::CAPU_OK;
-
- capu::uint64_t count = 0;
-
- capu::HashSet<capu::int32_t>* h1 = new capu::HashSet<capu::int32_t > ();
- // add new keys
- status = h1->put(value);
- EXPECT_TRUE(status == capu::CAPU_OK);
- //delete a non existing value
- status = h1->remove(value2);
- EXPECT_TRUE(status == capu::CAPU_ERANGE);
-
- //add new value
- status = h1->put(value2);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // check count
- count = h1->count();
- EXPECT_TRUE(count == 2);
-
- //delete existing value
- status = h1->remove(value2);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- //check count
- count = h1->count();
- EXPECT_TRUE(count == 1);
-
- delete h1;
-}
-
-TEST(HashSet, hasElement) {
- capu::int32_t value = 5;
- capu::int32_t value2 = 6;
- capu::status_t status = capu::CAPU_OK;
- capu::bool_t isElementinHashSet;
-
- capu::HashSet<capu::int32_t>* h1 = new capu::HashSet<capu::int32_t > ();
- // add new keys
- status = h1->put(value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- isElementinHashSet = h1->hasElement(value2);
- EXPECT_TRUE(isElementinHashSet == false);
-
- //add new value
- status = h1->put(value2);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- //delete existing value
- isElementinHashSet = h1->hasElement(value2);
- EXPECT_TRUE(isElementinHashSet == true);
-
- delete h1;
-}
-
-TEST(HashSetIterator, hasNext) {
- capu::int32_t value = 10;
- capu::int32_t value2 = 12;
-
- capu::status_t status = capu::CAPU_OK;
-
- capu::HashSet<capu::int32_t>* h1 = new capu::HashSet<capu::int32_t > ();
-
- //create iterator
- capu::HashSet<capu::int32_t>::Iterator it = h1->begin();
- //check hasNext
- EXPECT_TRUE(it.hasNext() == false);
-
- // add new values
- status = h1->put(value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- //add new value
- status = h1->put(value2);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- it = h1->begin();
- EXPECT_TRUE(it.hasNext() == true);
-
- delete h1;
-}
-
-TEST(HashSetIterator, next) {
- capu::int32_t value = 10;
- capu::int32_t value2 = 12;
-
- capu::status_t status = capu::CAPU_OK;
- capu::HashSet<capu::int32_t>* h1 = new capu::HashSet<capu::int32_t > ();
-
- capu::int32_t check_value = 0;
- capu::int32_t check_value2 = 0;
- //create iterator
- capu::HashSet<capu::int32_t>::Iterator it = h1->begin();
-
- //check hasNext
- EXPECT_TRUE(it.hasNext() == false);
-
- EXPECT_TRUE(it.next(&check_value) == capu::CAPU_ERANGE);
-
- // add new keys
- status = h1->put(value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- //add new value
- status = h1->put(value2);
- EXPECT_TRUE(status == capu::CAPU_OK);
- it = h1->begin();
-
- it.next(&check_value);
- EXPECT_TRUE(check_value == value || check_value == value2);
-
- it.next(&check_value2);
- EXPECT_TRUE(check_value == value || check_value == value2);
-
- EXPECT_FALSE(check_value == check_value2);
- delete h1;
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/container/HashTableTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/container/HashTableTest.cpp
deleted file mode 100644
index 6d419a0..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/container/HashTableTest.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include "capu/container/HashTable.h"
-#include "capu/Error.h"
-
-TEST(HashTable, Constructor_Default) {
- //create an empty linked list
- capu::HashTable<capu::int32_t, capu::int32_t>* list = new capu::HashTable<capu::int32_t, capu::int32_t > ();
- delete list;
- capu::HashTable<char*, capu::int32_t>* list2 = new capu::HashTable<char*, capu::int32_t > ();
- delete list2;
-}
-
-TEST(HashTable, put) {
- capu::int32_t key = 10;
- capu::int32_t value = 5;
- capu::status_t status = capu::CAPU_OK;
- capu::int64_t count = -1;
-
- capu::HashTable<capu::int32_t, capu::int32_t>* h1 = new capu::HashTable<capu::int32_t, capu::int32_t > ();
- // add new key
- status = h1->put(key, value);
- EXPECT_TRUE(status == capu::CAPU_OK);
- // check count
- count = h1->count();
- EXPECT_TRUE(count == 1);
- delete h1;
-}
-
-TEST(HashTable, count) {
- capu::int64_t count = -1;
-
- capu::HashTable<capu::int32_t, capu::int32_t>* h1 = new capu::HashTable<capu::int32_t, capu::int32_t > ();
- //check count
- count = h1->count();
- EXPECT_TRUE(count == 0);
-
- delete h1;
-}
-
-TEST(HashTable, get) {
- capu::int32_t key = 5;
- capu::int32_t key2 = 6;
- capu::int32_t value = 5;
- capu::status_t status = capu::CAPU_OK;
-
- capu::int32_t return_value = -1;
- capu::int64_t count = -1;
-
- capu::HashTable<capu::int32_t, capu::int32_t>* h1 =
- new capu::HashTable<capu::int32_t, capu::int32_t > ();
- // add new key
- status = h1->put(key, value);
- EXPECT_TRUE(status == capu::CAPU_OK);
- // check count
- count = h1->count();
- EXPECT_TRUE(count == 1);
-
- // get the added element
- status = h1->get(key, &return_value);
- EXPECT_TRUE(status == capu::CAPU_OK);
- //check its value
- EXPECT_TRUE(return_value == value);
- //get a element to null variable
- status = h1->get(key, NULL);
- EXPECT_TRUE(status == capu::CAPU_EINVAL);
- //get an element of non existing key
- status = h1->get(key2, &return_value);
- EXPECT_TRUE(status == capu::CAPU_ENOT_EXIST);
-
- delete h1;
-}
-
-TEST(HashTable, clear) {
- capu::int32_t key = 5;
- capu::int32_t key2 = 6;
- capu::int32_t value = 5;
- capu::status_t status = capu::CAPU_OK;
-
- capu::int64_t count = -1;
-
- capu::HashTable<capu::int32_t, capu::int32_t>* h1 = new capu::HashTable<capu::int32_t, capu::int32_t > ();
- // add new keys
- status = h1->put(key, value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- //add new keys
- status = h1->put(key2, value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // check count
- count = h1->count();
- EXPECT_TRUE(count == 2);
-
- //remove all
- status = h1->clear();
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- //check count
- count = h1->count();
- EXPECT_TRUE(count == 0);
-
- delete h1;
-}
-
-TEST(HashTable, remove) {
- capu::int32_t key = 5;
- capu::int32_t key2 = 6;
- capu::int32_t value = 5;
- capu::status_t status = capu::CAPU_OK;
-
- capu::int32_t return_value = -1;
- capu::int64_t count = -1;
-
- capu::HashTable<capu::int32_t, capu::int32_t>* h1 = new capu::HashTable<capu::int32_t, capu::int32_t > ();
- // add new keys
- status = h1->put(key, value);
- EXPECT_TRUE(status == capu::CAPU_OK);
- //delete a non existing key
- status = h1->remove(key2, &return_value);
- EXPECT_TRUE(status == capu::CAPU_ERANGE);
-
- //add new value
- status = h1->put(key2, value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // check count
- count = h1->count();
- EXPECT_TRUE(count == 2);
-
- //delete existing key
- status = h1->remove(key, &return_value);
- EXPECT_TRUE(status == capu::CAPU_OK);
- EXPECT_TRUE(value == return_value);
-
- //check count
- count = h1->count();
- EXPECT_TRUE(count == 1);
-
- delete h1;
-}
-
-TEST(HashTable, set_get_existing) {
- capu::int32_t key = 10;
-
- capu::int32_t key2 = 11;
- capu::int32_t value = 5;
- capu::status_t status = capu::CAPU_OK;
-
- capu::int32_t return_value = -1;
- capu::int64_t count = -1;
-
- capu::HashTable<capu::int32_t, capu::int32_t>* h1 = new capu::HashTable<capu::int32_t, capu::int32_t > ();
- // add new keys
- status = h1->put(key, value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- //add new value
- status = h1->put(key2, value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- value = 3;
- //add new value over existing one
- status = h1->put(key, value, &return_value);
- EXPECT_TRUE(status == capu::CAPU_OK);
- //check the retrieved old value
- EXPECT_TRUE(5 == return_value);
-
- //check the new value
- status = h1->get(key, &return_value);
- EXPECT_TRUE(3 == return_value);
-
- // check count
- count = h1->count();
- EXPECT_TRUE(count == 2);
-
- delete h1;
-
-}
-
-TEST(HashtableIterator, hasNext) {
- capu::int32_t key = 10;
- capu::int32_t key2 = 12;
-
- capu::int32_t value = 5;
- capu::status_t status = capu::CAPU_OK;
-
- capu::HashTable<capu::int32_t, capu::int32_t>* h1 = new capu::HashTable<capu::int32_t, capu::int32_t > ();
-
- //create iterator
- capu::HashTable<capu::int32_t, capu::int32_t>::Iterator it = h1->begin();
- //check hasNext
- EXPECT_TRUE(it.hasNext() == false);
-
- // add new keys
- status = h1->put(key, value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- //add new value
- status = h1->put(key2, value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- it = h1->begin();
- EXPECT_TRUE(it.hasNext() == true);
-
- delete h1;
-}
-
-TEST(HashtableIterator, next) {
- capu::int32_t key = 10;
- capu::int32_t key2 = 12;
-
- capu::int32_t value = 5;
- capu::int32_t value2 = 6;
- capu::status_t status = capu::CAPU_OK;
- capu::Pair<capu::int32_t, capu::int32_t> pair;
- capu::Pair<capu::int32_t, capu::int32_t> pair2;
- capu::HashTable<capu::int32_t, capu::int32_t>* h1 = new capu::HashTable<capu::int32_t, capu::int32_t > ();
-
- //create iterator
- capu::HashTable<capu::int32_t, capu::int32_t>::Iterator it = h1->begin();
-
- //check hasNext
- EXPECT_TRUE(it.hasNext() == false);
-
- EXPECT_TRUE(it.next(&pair) == capu::CAPU_ERANGE);
-
- // add new keys
- status = h1->put(key, value);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- //add new value
- status = h1->put(key2, value2);
- EXPECT_TRUE(status == capu::CAPU_OK);
- it = h1->begin();
-
- it.next(&pair);
- //we don't know the order the pairs have been added in the hashtable
- EXPECT_TRUE((pair.first == key && pair.second == value) || (pair.first == key2 && pair.second == value2));
-
- it.next(&pair2);
- EXPECT_TRUE((pair2.first == key && pair2.second == value) || (pair2.first == key2 && pair2.second == value2));
-
- EXPECT_FALSE(pair == pair2);
-
- delete h1;
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/container/ListTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/container/ListTest.cpp
deleted file mode 100644
index 2eb9e69..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/container/ListTest.cpp
+++ /dev/null
@@ -1,629 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <gtest/gtest.h>
-#include "capu/container/List.h"
-#include "capu/Error.h"
-#include "capu/Config.h"
-
-TEST(List, Constructor_Default) {
- //create an empty linked list
- capu::List<capu::int32_t*>* list = NULL;
- list = new capu::List<capu::int32_t*>();
- EXPECT_TRUE(list != NULL);
- delete list;
-}
-
-TEST(List, addTest) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 0;
- capu::status_t result;
-
- //append element to the linked list
- result = list->add(data1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- //append another element to linked list
- result = list->add(data2);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- //Get added elements to compare that if they are correctly added or not
- list->get(0, &data3);
- EXPECT_TRUE(data3 == data1);
-
- list->get(1, &data3);
- EXPECT_TRUE(data3 == data2);
-
- delete list;
-}
-
-TEST(List, addIndexTest) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 0;
- capu::status_t result;
-
-
-
- result = list->add(10, data1);
- EXPECT_TRUE(result == capu::CAPU_EINVAL);
-
-
- result = list->add(0, data2);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = list->add(1, data2);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = list->add(0, data2);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = list->add(1, data1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- //Get added elements to compare that if they are correctly added or not
- list->get(0, &data3);
- EXPECT_TRUE(data3 == data2);
-
- list->get(1, &data3);
- EXPECT_TRUE(data3 == data1);
-
- delete list;
-}
-
-TEST(List, removeAt) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 56;
- capu::status_t result;
-
- data1 = 32;
- data2 = 43;
- data3 = 56;
- //add some elements to linked list
- result = list->add(data1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = list->add(data3);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = list->add(data2);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- //removing element at index 1
- result = list->removeAt(1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- //removing element at index 1
- result = list->removeAt(1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- //removing element at index 0 (HEAD)
- result = list->removeAt(0, &data1);
- EXPECT_TRUE(result == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 32);
-
- //remove element from out of index
- result = list->removeAt(1000);
- EXPECT_TRUE(result == capu::CAPU_EINVAL);
-
- //check size of list
- EXPECT_TRUE(list->size() == 0);
-
- delete list;
-}
-
-TEST(List, getElementInConstList) {
- capu::List<capu::int32_t>* normalList = new capu::List<capu::int32_t > ();
- const capu::List<capu::int32_t>* constantList = normalList;
- capu::int32_t data1;
-
- capu::status_t result;
-
- data1 = 32;
-
- result = normalList->add(data1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = constantList->get(0, &data1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- delete normalList;
-}
-
-
-
-TEST(List, loopThroughConstList) {
- capu::List<capu::int32_t>* normalList = new capu::List<capu::int32_t > ();
- const capu::List<capu::int32_t>* constantList = normalList;
- capu::int32_t data1;
-
- capu::status_t result;
-
- data1 = 32;
-
- result = normalList->add(data1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
-
- capu::List<capu::int32_t>::Iterator iterator = constantList->begin();
- while (iterator.hasNext())
- {
- capu::int32_t* temp=0;;
- iterator.next(temp);
- }
-
- delete normalList;
-}
-
-TEST(List, get) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 56;
- capu::int32_t data4 = 0;
-
- capu::status_t result;
-
-
-
- //add some element to the linked list
- result = list->add(data1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = list->add(data3);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = list->add(data2);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- //get the added elements by using its index and compare the values with inserted elements
- result = list->get(0, &data4);
- EXPECT_TRUE(result == capu::CAPU_OK);
- EXPECT_TRUE(data1 == data4);
-
- result = list->get(1, &data4);
- EXPECT_TRUE(result == capu::CAPU_OK);
- EXPECT_TRUE(data3 == data4);
-
- result = list->get(2, &data4);
- EXPECT_TRUE(result == capu::CAPU_OK);
- EXPECT_TRUE(data2 == data4);
-
- result = list->get(123, NULL);
- EXPECT_TRUE(result == capu::CAPU_EINVAL);
-
- delete list;
-}
-
-TEST(List, size) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int_t result;
- capu::int32_t data1 = 32;;
-
- //size of empty list
- result = list->size();
- EXPECT_TRUE(result == 0);
-
- //add some elements and check the size for each step
- list->add(data1);
- result = list->size();
- EXPECT_TRUE(result == 1);
-
- list->add(data1);
- result = list->size();
- EXPECT_TRUE(result == 2);
-
- list->add(data1);
- result = list->size();
- EXPECT_TRUE(result == 3);
-
- list->removeAt(0);
- result = list->size();
- EXPECT_TRUE(result == 2);
-
- list->removeAt(1);
- result = list->size();
- EXPECT_TRUE(result == 1);
-
- delete list;
-}
-
-TEST(List, empty) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 44;
- capu::bool_t result;
-
- //check the empty list
- result = list->isEmpty();
- EXPECT_TRUE(result == true);
-
- //add some element
- list->add(data1);
- result = list->isEmpty();
- EXPECT_TRUE(result == false);
-
- delete list;
-}
-
-TEST(List, find) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 44;
- capu::int_t result;
-
-
-
- //check empty list
- result = list->find(data1);
- EXPECT_TRUE(result == -1);
-
- //add some elements
- list->add(data1);
- list->add(data2);
- list->add(data3);
-
- //find the elements
- result = list->find(data1);
- EXPECT_TRUE(result == 0);
-
- result = list->find(data2);
- EXPECT_TRUE(result == 1);
-
- result = list->find(data3);
- EXPECT_TRUE(result == 2);
-
- delete list;
-}
-
-TEST(List, contains) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 44;
-
- capu::int32_t check_value = 0;
- capu::bool_t result;
-
- data1 = 32;
- data2 = 43;
- data3 = 44;
-
- //check empty list
- result = list->contains(check_value);
- EXPECT_TRUE(result == false);
-
- // fill the linke
- list->add(data1);
- list->add(data1);
- list->add(data2);
- list->add(data3);
-
- //check an elements to be contained by linked list or not
- result = list->contains(check_value);
- EXPECT_TRUE(result == false);
-
- result = list->contains(data3);
- EXPECT_TRUE(result == true);
-
- delete list;
-}
-
-TEST(List, copyConstructor1) {
- capu::List<capu::int32_t> list;
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 44;
-
- //add some dummy values to the linked list
- list.add(data1);
- list.add(data2);
- list.add(data3);
-
- capu::List<capu::int32_t> copy(list);
-
- EXPECT_EQ(list.size(), copy.size());
- list.clear();
-
- EXPECT_EQ(0, copy.find(data1));
- EXPECT_EQ(1, copy.find(data2));
- EXPECT_EQ(2, copy.find(data3));
-}
-
-TEST(List, copyConstructor2) {
- // copy empty list and add values afterwards to original list
- capu::List<capu::int32_t> list;
- capu::List<capu::int32_t> copy(list);
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 44;
-
- copy.add(data1);
- copy.add(data2);
- copy.add(data3);
-
- EXPECT_EQ(0, copy.find(data1));
- EXPECT_EQ(1, copy.find(data2));
- EXPECT_EQ(2, copy.find(data3));
- EXPECT_TRUE(list.isEmpty());
-}
-
-TEST(List, clear) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 44;
- capu::status_t result;
-
- //add some dummy values to the linked list
- list->add(data1);
- list->add(data1);
- list->add(data2);
- list->add(data3);
-
- //remove all elements from the linked list
- result = list->clear();
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = list->add(data1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = list->get(0, &data2);
- EXPECT_TRUE(data1 == data2);
- delete list;
-}
-
-TEST(List, set) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
-
- EXPECT_TRUE(list->add(data1) == capu::CAPU_OK);
- EXPECT_TRUE(list->add(data2) == capu::CAPU_OK);
- EXPECT_TRUE(list->set(1, data1) == capu::CAPU_OK);
- EXPECT_TRUE(list->set(0, data1) == capu::CAPU_OK);
- EXPECT_TRUE(list->get(1, &data2) == capu::CAPU_OK);
- EXPECT_TRUE(list->set(2, data1) == capu::CAPU_EINVAL);
- EXPECT_TRUE(data2 == data1);
- delete list;
-}
-
-TEST(ListIterator, hasNext) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::List<capu::int32_t>::Iterator it = list->begin();
- EXPECT_TRUE(it.hasNext() == false);
-
- list->add(data1);
- list->add(data2);
-
- it = list->begin();
- capu::bool_t resultb = it.hasNext();
- EXPECT_TRUE(resultb == true);
- delete list;
-}
-
-TEST(ListIterator, next) {
- capu::List<capu::int32_t>* list = new capu::List<capu::int32_t > ();
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 0;
- capu::List<capu::int32_t>::Iterator it = list->begin();
- capu::int32_t cnt = 0;
- EXPECT_TRUE(it.hasNext() == false);
-
- list->add(data1);
- list->add(data2);
- it = list->begin();
- while (it.hasNext()) {
- it.next(&data3);
- if (cnt == 0)
- EXPECT_TRUE(data3 == data1);
- else
- EXPECT_TRUE(data3 == data2);
- cnt++;
- }
- delete list;
-}
-
-TEST(ListIterator, current){
- capu::List<capu::int32_t> list;
- capu::int32_t data1 = 0;
- capu::List<capu::int32_t>::Iterator it = list.begin();
-
- EXPECT_TRUE(it.current(&data1) == capu::CAPU_ERANGE);
- list.add(1);
- it = list.begin();
- EXPECT_TRUE(it.current(&data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 1);
- list.add(2);
- list.add(3);
-
-
- data1 = 0;
- capu::int32_t index = 1;
- for(it = list.begin(); it.hasNext(); it.next())
- {
- EXPECT_TRUE(it.current(&data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == index);
- ++index;
- }
-}
-
-TEST(ListIterator, removeAt){
- capu::List<capu::int32_t> list;
- capu::int32_t data1 = 0;
- capu::List<capu::int32_t>::Iterator it = list.begin();
-
- EXPECT_TRUE(list.removeAt(it) == capu::CAPU_EINVAL);
- list.add(1);
- it = list.begin();
- EXPECT_TRUE(list.removeAt(it, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(list.size() == 0);
- EXPECT_TRUE(data1 == 1);
-
- list.add(1);
- list.add(2);
- list.add(3);
-
- it = list.begin();
- it.next();
- list.removeAt(it, &data1);
- EXPECT_TRUE(data1 == 2);
-
- capu::int32_t index = 1;
-
- for(it = list.begin(); it.hasNext();)
- {
- it.next(&data1);
- EXPECT_TRUE(data1 == index);
- index += 2;
- }
-
- list.add(1,2);
-
- index = 1;
-
- it = list.begin();
- it.current(&data1);
- while(it.hasNext())
- {
- list.removeAt(it, &data1);
- EXPECT_TRUE(data1 == index);
- ++index;
- }
-}
-
-TEST(ListIterator, add){
- capu::List<capu::int32_t> list;
- capu::List<capu::int32_t>::Iterator iter = list.begin();
- capu::int32_t data1 = 0;
-
- list.add(iter, 1);
- list.add(iter, 2);
- list.add(iter, 3);
- EXPECT_TRUE(list.get(0, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 1);
- EXPECT_TRUE(list.get(1, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 2);
- EXPECT_TRUE(list.get(2, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 3);
-
- iter = list.begin();
- iter.next();
- list.add(iter, 4);
- EXPECT_TRUE(list.get(0, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 1);
- EXPECT_TRUE(list.get(1, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 4);
- EXPECT_TRUE(list.get(2, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 2);
- EXPECT_TRUE(list.get(3, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 3);
-
-
- iter.next();
- iter.next();
- list.add(iter, 5);
- EXPECT_TRUE(list.get(0, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 1);
- EXPECT_TRUE(list.get(1, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 4);
- EXPECT_TRUE(list.get(2, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 2);
- EXPECT_TRUE(list.get(3, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 3);
- EXPECT_TRUE(list.get(4, &data1) == capu::CAPU_OK);
- EXPECT_TRUE(data1 == 5);
-
- iter = list.begin();
- list.add(iter, 6);
- EXPECT_TRUE(list.get(0, &data1) == capu::CAPU_OK);
- EXPECT_EQ(6, data1);
- EXPECT_TRUE(list.get(1, &data1) == capu::CAPU_OK);
- EXPECT_EQ(1, data1);
- EXPECT_TRUE(list.get(2, &data1) == capu::CAPU_OK);
- EXPECT_EQ(4, data1);
- EXPECT_TRUE(list.get(3, &data1) == capu::CAPU_OK);
- EXPECT_EQ(2, data1);
- EXPECT_TRUE(list.get(4, &data1) == capu::CAPU_OK);
- EXPECT_EQ(3, data1);
- EXPECT_TRUE(list.get(5, &data1) == capu::CAPU_OK);
- EXPECT_EQ(5, data1);
-
-}
-
-TEST(ListIterator, currentIndex){
- capu::List<capu::int32_t> list;
- capu::int32_t data1 = 32;
- capu::int32_t data2 = 43;
- capu::int32_t data3 = 44;
-
- //add some dummy values to the linked list
- list.add(data1);
- list.add(data2);
- list.add(data3);
-
- capu::List<capu::int32_t>::Iterator iter = list.begin();
-
- EXPECT_EQ(0u, iter.currentIndex());
- iter.next();
- EXPECT_EQ(1u, iter.currentIndex());
- iter.next();
- EXPECT_EQ(2u, iter.currentIndex());
-}
-
-TEST(ListIterator, loopAdd){
- capu::List<capu::int32_t> list;
- capu::List<capu::int32_t>::Iterator iter = list.begin();
- capu::int32_t data1 = 0;
-
- list.add(iter, 1);
-
- iter = list.begin();
- while(iter.hasNext())
- {
- iter.next(&data1);
- }
-
- list.add(iter, 2);
-
- EXPECT_TRUE(list.get(0, &data1) == capu::CAPU_OK);
- EXPECT_EQ(1, data1);
- EXPECT_TRUE(list.get(1, &data1) == capu::CAPU_OK);
- EXPECT_EQ(2, data1);
-
- list.add(iter, 3);
- iter = list.begin();
- capu::int32_t i = 1;
- while(i <= 3)
- {
- EXPECT_TRUE(iter.current(&data1) == capu::CAPU_OK);
- EXPECT_EQ(i, data1);
- iter.next();
- i++;
- }
-
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/container/QueueTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/container/QueueTest.cpp
deleted file mode 100644
index ff0cb6a..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/container/QueueTest.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <gtest/gtest.h>
-#include "capu/container/Queue.h"
-
-TEST(Queue, Constructor_Default) {
- //create an empty linked Queue
- capu::Queue<capu::int32_t*>* queue = NULL;
- queue = new capu::Queue<capu::int32_t*>();
- EXPECT_TRUE(queue != NULL);
- delete queue;
-}
-
-TEST(Queue, add_remove_Test) {
- capu::Queue<capu::int32_t>* Queue = new capu::Queue<capu::int32_t > ();
- capu::int32_t data1;
- capu::int32_t data2;
- capu::int32_t data3;
- capu::int32_t test;
- capu::status_t result;
-
- data1 = 32;
- data2 = 43;
- data3 = 1211;
- //append element to the linked Queue
- result = Queue->add(data1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- //append another element to linked Queue
- result = Queue->add(data2);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = Queue->add(data3);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- //Empty Queue, and see if it works correctly
- //First Element
- capu::bool_t hasNext = Queue->hasNext();
- EXPECT_TRUE(hasNext);
- EXPECT_EQ(capu::CAPU_OK, Queue->next(&test));
- EXPECT_TRUE(test == data1);
- //Second Element
- hasNext = Queue->hasNext();
- EXPECT_TRUE(hasNext);
- EXPECT_EQ(capu::CAPU_OK, Queue->next(&test));
- EXPECT_TRUE(test == data2);
- //Third Element
- hasNext = Queue->hasNext();
- EXPECT_TRUE(hasNext);
- EXPECT_EQ(capu::CAPU_OK, Queue->next(&test));
- EXPECT_TRUE(test == data3);
- //Should be Empty
- hasNext = Queue->hasNext();
- EXPECT_FALSE(hasNext);
-
- delete Queue;
-}
-
-TEST(Queue, size) {
- capu::Queue<capu::int32_t>* Queue = new capu::Queue<capu::int32_t > ();
- capu::int32_t data1;
-
- capu::int_t result;
-
- data1 = 32;
-
- //size of empty Queue
- result = Queue->size();
- EXPECT_TRUE(result == 0);
-
- //add some elements and check the size for each step
- Queue->add(data1);
- result = Queue->size();
- EXPECT_TRUE(result == 1);
-
- Queue->add(data1);
- result = Queue->size();
- EXPECT_TRUE(result == 2);
-
- Queue->add(data1);
- result = Queue->size();
- EXPECT_TRUE(result == 3);
-
- Queue->next(NULL);
- result = Queue->size();
- EXPECT_TRUE(result == 2);
-
- Queue->next();
- result = Queue->size();
- EXPECT_TRUE(result == 1);
-
- delete Queue;
-}
-
-TEST(Queue, empty) {
- capu::Queue<capu::int32_t>* Queue = new capu::Queue<capu::int32_t > ();
- capu::int32_t data1;
-
- capu::bool_t result;
-
- data1 = 32;
-
- //check the empty Queue
- result = Queue->isEmpty();
- EXPECT_TRUE(result);
-
- //add some element
- Queue->add(data1);
- result = Queue->isEmpty();
- EXPECT_FALSE(result);
-
- delete Queue;
-}
-
-
-TEST(Queue, clear) {
- capu::Queue<capu::int32_t>* Queue = new capu::Queue<capu::int32_t > ();
- capu::int32_t data1;
- capu::int32_t data2;
- capu::int32_t data3;
- capu::status_t result;
-
- data1 = 32;
- data2 = 43;
- data3 = 44;
-
- //add some dummy values to the lQueue
- Queue->add(data1);
- Queue->add(data1);
- Queue->add(data2);
- Queue->add(data3);
-
- //remove all elements from the linked Queue
- result = Queue->clear();
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- result = Queue->add(data1);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
-
- capu::int32_t test;
- EXPECT_EQ(capu::CAPU_OK, Queue->next(&test));
- EXPECT_TRUE(data1 == test);
- delete Queue;
-}
-
-
-TEST(Queue, next) {
- capu::Queue<capu::int32_t>* Queue = new capu::Queue<capu::int32_t > ();
- capu::int32_t test;
- capu::int32_t data1;
- capu::int32_t data2;
-
- int cnt = 0;
- EXPECT_FALSE(Queue->hasNext());
- data1 = 32;
- data2 = 43;
- Queue->add(data1);
- Queue->add(data2);
-
- while (Queue->hasNext()) {
- EXPECT_EQ(capu::CAPU_OK, Queue->next(&test));
- if (cnt == 0) {
- EXPECT_TRUE(test == data1);
- } else {
- EXPECT_TRUE(test == data2);
- }
- cnt++;
- }
- delete Queue;
-}
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/container/RingBufferTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/container/RingBufferTest.cpp
deleted file mode 100644
index f3cca4f..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/container/RingBufferTest.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include "capu/container/RingBuffer.h"
-
-TEST(RingBuffer, TestBufferSize1)
-{
- capu::RingBuffer<capu::uint32_t> buffer(1);
- capu::uint32_t val1 = 42;
- capu::uint32_t val2 = 666;
-
- buffer.add(val1);
-
- capu::RingBuffer<capu::uint32_t>::Iterator it = buffer.begin();
- capu::uint32_t curr;
- EXPECT_TRUE(it.hasNext());
- it.next(&curr);
- EXPECT_EQ(val1, curr);
- EXPECT_FALSE(it.hasNext());
-
- buffer.add(val2);
-
- it = buffer.begin();
- curr = 0;
- EXPECT_TRUE(it.hasNext());
- it.next(&curr);
- EXPECT_EQ(val2, curr);
- EXPECT_FALSE(it.hasNext());
-}
-
-TEST(RingBuffer, TestIterationFullBuffer)
-{
- capu::RingBuffer<capu::uint32_t> buffer(5);
- capu::uint32_t count = 12;
- for(capu::uint32_t i = 0; i< count; i++) // flood buffer
- {
- buffer.add(i);
- }
-
- capu::uint32_t start = count - 5;
- capu::RingBuffer<capu::uint32_t>::Iterator it = buffer.begin();
- capu::uint32_t curr;
-
- EXPECT_TRUE(it.hasNext());
- while(it.hasNext())
- {
- it.next(&curr);
- EXPECT_EQ(start, curr);
- start++;
- }
- EXPECT_EQ(count, start);
-}
-
-TEST(RingBuffer, TestIterateWithInvalidAddress)
-{
- capu::RingBuffer<capu::uint32_t> buffer(5);
-
- capu::uint32_t i1 = 1;
- capu::uint32_t i2 = 2;
- capu::uint32_t i3 = 3;
-
- buffer.add(i1);
- buffer.add(i2);
- buffer.add(i3);
-
- capu::RingBuffer<capu::uint32_t>::Iterator it = buffer.begin();
- capu::uint32_t* curr = 0; // invalid address with no memory
- capu::status_t st = it.next(curr);
- EXPECT_EQ(static_cast<capu::uint32_t>(capu::CAPU_ENO_MEMORY), static_cast<capu::uint32_t>(st));
-
-}
-
-TEST(RingBuffer, TestIterationTooManyNextCalls)
-{
- capu::RingBuffer<capu::uint32_t> buffer(5);
-
- capu::uint32_t i1 = 1;
- capu::uint32_t i2 = 2;
- capu::uint32_t i3 = 3;
-
- buffer.add(i1);
- buffer.add(i2);
- buffer.add(i3);
-
- capu::RingBuffer<capu::uint32_t>::Iterator it = buffer.begin();
- capu::uint32_t curr;
-
- it.next(&curr);
- it.next(&curr);
- it.next(&curr);
- capu::status_t st = it.next(&curr); // too much!
- EXPECT_EQ(static_cast<capu::uint32_t>(capu::CAPU_ENOT_EXIST), static_cast<capu::uint32_t>(st));
- EXPECT_EQ(3u, curr);
-}
-
-TEST(RingBuffer, TestIterationEmptyBuffer)
-{
- capu::RingBuffer<capu::uint32_t> buffer(5);
- capu::RingBuffer<capu::uint32_t>::Iterator it = buffer.begin();
- EXPECT_FALSE(it.hasNext());
-}
-
-TEST(RingBuffer, TestZeroSizeBuffer)
-{
- capu::RingBuffer<capu::uint32_t> buffer(0);
- capu::uint32_t val = 42;
- // will not fail
- capu::status_t st = buffer.add(val);
- EXPECT_EQ(static_cast<capu::int32_t>(capu::CAPU_ERANGE), static_cast<capu::int32_t>(st));
-
- // iterator has no next
- capu::RingBuffer<capu::uint32_t>::Iterator it = buffer.begin();
- EXPECT_FALSE(it.hasNext());
-
- val = 0;
- st = it.next(&val);
- EXPECT_EQ(static_cast<capu::int32_t>(capu::CAPU_ENOT_EXIST), static_cast<capu::int32_t>(st));
- EXPECT_EQ(0u, val); // val is unchanged
-}
-
-
-TEST(RingBuffer, TestBufferWithPointers)
-{
- capu::uint32_t i1 = 1;
- capu::uint32_t i2 = 2;
- capu::uint32_t i3 = 3;
- capu::uint32_t i4 = 4;
- capu::uint32_t i5 = 5;
-
- capu::uint32_t* i1ptr = &i1;
- capu::uint32_t* i2ptr = &i2;
- capu::uint32_t* i3ptr = &i3;
- capu::uint32_t* i4ptr = &i4;
- capu::uint32_t* i5ptr = &i5;
-
- capu::RingBuffer<capu::uint32_t*> buffer(3);
- buffer.add(i1ptr);
- buffer.add(i2ptr);
- buffer.add(i3ptr);
- buffer.add(i4ptr);
- buffer.add(i5ptr);
-
- capu::RingBuffer<capu::uint32_t*>::Iterator it = buffer.begin();
- capu::uint32_t* currPtr = 0;
- EXPECT_TRUE(it.hasNext());
- it.next(&currPtr);
- EXPECT_EQ(i3ptr, currPtr);
- it.next(&currPtr);
- EXPECT_EQ(i4ptr, currPtr);
- it.next(&currPtr);
- EXPECT_EQ(i5ptr, currPtr);
-}
-
-TEST(RingBuffer, TestSize)
-{
- capu::RingBuffer<capu::uint32_t> buffer1(1000);
- EXPECT_EQ(1000u, buffer1.size());
-
- capu::RingBuffer<capu::uint32_t> buffer2(0);
- EXPECT_EQ(0u, buffer2.size());
-}
-
-//uncomment to run performance tests
-/*
-TEST(RingBuffer, TestBufferPerformance)
-{
- capu::RingBuffer<capu::uint32_t> buffer(1000);
-
- capu::uint32_t count = 1000000; // one million add-operations
- capu::uint32_t start = capu::PlatformTime::GetMilliseconds();
-
- for(capu::uint32_t i = 0; i < count; i++)
- {
- buffer.add(i);
- }
-
- capu::uint32_t dur = capu::PlatformTime::GetMilliseconds() - start;
- // printf("[HEAP] - %i add-operations take %i ms\n", count, dur);
- EXPECT_TRUE(dur < 100); // make sure we do not loose too much time!
-
- capu::StackBasedRingBuffer<capu::uint32_t, 1000> stackBuffer;
- start = capu::PlatformTime::GetMilliseconds();
-
- for(capu::uint32_t i = 0; i < count; i++)
- {
- stackBuffer.add(i);
- }
-
- dur = capu::PlatformTime::GetMilliseconds() - start;
- printf("[STACK] - %i add-operations take %i ms\n", count, dur);
-
-}
-
-*/
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/main.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/main.cpp
deleted file mode 100644
index e8f1512..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/main.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifdef BUILD_CHECK_MEMORY
-#ifdef OS_WINDOWS
-#include "vld.h"
-#endif
-#endif
-
-#include <iostream>
-#include "gtest/gtest.h"
-#include "capu/os/Time.h"
-
-GTEST_API_ int main(int argc, char **argv) {
- std::cout << "Running main() from capu-test\n";
-
- //initialize pseudo random generate used for all the tests
- srand(capu::Time::GetMilliseconds());
-
- bool wait = false;
- // special wait command
- for(int i = 0; i < argc; i++) {
- if(strcmp(argv[i], "--gtest_pause") == 0) {
- wait = true;
- argv[i] = const_cast<char*>("");
- }
- }
-
- testing::InitGoogleTest(&argc, argv);
- int testResult = RUN_ALL_TESTS();
-
- if(wait) {
- printf("press <enter> to exit!");
- getchar();
- }
-
- return testResult;
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/AtomicOperationTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/AtomicOperationTest.cpp
deleted file mode 100644
index 9cbbd49..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/AtomicOperationTest.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include "capu/os/AtomicOperation.h"
-
-//include tests depending on architecture
-#include "arch/AtomicOperation.inc"
-
-TEST(AtomicOperation,Add) {
- capu::uint32_t val = 100;
- capu::uint32_t ret = capu::AtomicOperation::AtomicAdd32(val, 3);
- EXPECT_EQ(103u,val);
- EXPECT_EQ(100u, ret);
-}
-
-TEST(AtomicOperation,Sub) {
- capu::uint32_t val = 13;
- capu::uint32_t ret = capu::AtomicOperation::AtomicSub32(val, 5);
- EXPECT_EQ(8u,val);
- EXPECT_EQ(13u, ret);
-}
-
-TEST(AtomicOperation,Inc) {
- capu::uint32_t val = 1;
- capu::uint32_t ret = capu::AtomicOperation::AtomicInc32(val);
- EXPECT_EQ(2u,val);
- EXPECT_EQ(1u, ret);
-}
-
-TEST(AtomicOperation,Dec) {
- capu::uint32_t val = 3;
- capu::uint32_t ret = capu::AtomicOperation::AtomicDec32(val);
- EXPECT_EQ(2u,val);
- EXPECT_EQ(3u, ret);
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/CondVarTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/CondVarTest.cpp
deleted file mode 100644
index ae8cae0..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/CondVarTest.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include "capu/os/CondVar.h"
-#include "capu/os/Thread.h"
-
-class GlobalVariables
-{
-public:
- static capu::int32_t loops;
- static capu::int32_t buffer;
- static capu::CondVar cv;
- static capu::Mutex mutex;
-};
-
-capu::int32_t GlobalVariables::loops = 10000;
-capu::CondVar GlobalVariables::cv;
-capu::Mutex GlobalVariables::mutex;
-capu::int32_t GlobalVariables::buffer = 0;
-
-class ThreadCondVarConsumer : public capu::Runnable
-{
-public:
- void run()
- {
- for(capu::int32_t i = 0; i < GlobalVariables::loops; i++) {
- EXPECT_TRUE(GlobalVariables::mutex.lock()== capu::CAPU_OK);
- while(GlobalVariables::buffer == 0) {
- EXPECT_TRUE(GlobalVariables::cv.wait(&GlobalVariables::mutex)== capu::CAPU_OK);
- }
- GlobalVariables::buffer--;
- EXPECT_TRUE(GlobalVariables::cv.signal()== capu::CAPU_OK);
- EXPECT_TRUE(GlobalVariables::mutex.unlock()== capu::CAPU_OK);
- }
- }
-};
-
-class ThreadCondVarProducerBroadcast : public capu::Runnable
-{
- public:
- void run()
- {
- for(capu::int32_t i = 0; i < GlobalVariables::loops * 3; i++) {
- EXPECT_TRUE(GlobalVariables::mutex.lock()== capu::CAPU_OK);
- while(GlobalVariables::buffer == 100) {
- EXPECT_TRUE(GlobalVariables::cv.wait(&GlobalVariables::mutex)== capu::CAPU_OK);
- }
- GlobalVariables::buffer++;
- EXPECT_TRUE(GlobalVariables::cv.broadcast()== capu::CAPU_OK);
- EXPECT_TRUE(GlobalVariables::mutex.unlock()== capu::CAPU_OK);
- }
- }
-};
-
-class ThreadCondVarProducerSignal : public capu::Runnable
-{
- public:
- void run()
- {
- for(capu::int32_t i = 0; i < GlobalVariables::loops; i++) {
- EXPECT_TRUE(GlobalVariables::mutex.lock()== capu::CAPU_OK);
- while(GlobalVariables::buffer == 100) {
- EXPECT_EQ(capu::CAPU_OK, GlobalVariables::cv.wait(&GlobalVariables::mutex));
- }
- GlobalVariables::buffer++;
- EXPECT_TRUE(GlobalVariables::cv.signal()== capu::CAPU_OK);
- EXPECT_TRUE(GlobalVariables::mutex.unlock()== capu::CAPU_OK);
- }
- }
-};
-
-TEST(CondVar,ConstructorTest)
-{
- capu::CondVar *_cv = new capu::CondVar();
- EXPECT_TRUE(_cv != NULL);
- delete _cv;
-}
-
-TEST(CondVar,WaitTest)
-{
- capu::CondVar *_cv = new capu::CondVar();
- EXPECT_TRUE(_cv->wait(NULL) == capu::CAPU_EINVAL);
- delete _cv;
-}
-
-TEST(CondVar,WaitAndBroadcastTest)
-{
- ThreadCondVarConsumer consumer;
- ThreadCondVarProducerBroadcast producer;
- //create two thread
- capu::Thread * CAPU_thread = new capu::Thread(&consumer);
- CAPU_thread->start();
- capu::Thread * CAPU_thread2 = new capu::Thread(&consumer);
- CAPU_thread2->start();
- capu::Thread * CAPU_thread3 = new capu::Thread(&consumer);
- CAPU_thread3->start();
- capu::Thread * CAPU_thread4 = new capu::Thread(&producer);
- CAPU_thread4->start();
-
- //wait for them to finish
- CAPU_thread->join();
- CAPU_thread2->join();
- CAPU_thread3->join();
- CAPU_thread4->join();
-
- //expected value
- EXPECT_EQ(0, GlobalVariables::buffer);
- delete CAPU_thread;
- delete CAPU_thread2;
- delete CAPU_thread3;
- delete CAPU_thread4;
-}
-
-TEST(CondVar,WaitAndSignalTest)
-{
- ThreadCondVarConsumer consumer;
- ThreadCondVarProducerSignal producer;
- //create two thread
- capu::Thread * CAPU_thread = new capu::Thread(&consumer);
- CAPU_thread->start();
- capu::Thread * CAPU_thread2 = new capu::Thread(&producer);
- CAPU_thread2->start();
- //wait for them to finish
- CAPU_thread->join();
- CAPU_thread2->join();
- //expected value
- EXPECT_EQ(0, GlobalVariables::buffer);
- delete CAPU_thread;
- delete CAPU_thread2;
-}
-
-
-TEST(CondVar,TimedWaitTest)
-{
- capu::Mutex mutex;
- capu::CondVar condvar;
- mutex.lock();
- //2 second wait and timeout
- EXPECT_TRUE(condvar.wait(&mutex, 2000) == capu::CAPU_ETIMEOUT);
- mutex.unlock();
-}
-
-//TODO add recursive mutext condvar test
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/FileTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/FileTest.cpp
deleted file mode 100644
index 18a7f40..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/FileTest.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include <gtest/gtest.h>
-#include "capu/os/File.h"
-
-TEST(File, ConstructorTest) {
- capu::File* f1 = new capu::File("foobar.txt", "r");
- EXPECT_TRUE(f1 != NULL);
- EXPECT_FALSE(f1->isOpen());
- delete f1;
-
- capu::File* f2 = new capu::File("test.txt", "w+");
- EXPECT_TRUE(f2 != NULL);
- EXPECT_TRUE(f2->isOpen());
- delete f2;
-}
-
-TEST(File, IsOpenTest) {
- capu::File* f1 = new capu::File("foobar.txt", "r");
- EXPECT_TRUE(f1 != NULL);
- EXPECT_FALSE(f1->isOpen());
- delete f1;
-
- capu::File* f2 = new capu::File("test.txt", "w+");
- EXPECT_TRUE(f2 != NULL);
- EXPECT_TRUE(f2->isOpen());
- delete f2;
-}
-
-TEST(File, WriteTest) {
- char buf1[15] = "This is a test";
- capu::status_t status;
-
- capu::File* f1 = new capu::File("test.txt", "w+");
- EXPECT_TRUE(f1 != NULL);
- EXPECT_TRUE(f1->isOpen());
-
- // invalid params
- status = f1->write(NULL, 0);
- EXPECT_TRUE(status == capu::CAPU_EINVAL);
-
- // write data
- status = f1->write(buf1, sizeof(buf1)-1);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- delete f1;
-}
-
-TEST(File, ReadTest) {
- char buf1[20] = "This is a test";
- char buf2[20];
-
- capu::status_t status;
- capu::int32_t read = 0;
-
- // read data
- capu::File* f1 = new capu::File("test1.txt", "r");
- EXPECT_TRUE(f1 != NULL);
- EXPECT_FALSE(f1->isOpen());
-
- // file not open
- status = f1->write(buf2, strlen(buf1));
- EXPECT_TRUE(status == capu::CAPU_ERROR);
-
- delete f1;
-
- // write data
- capu::File* f2 = new capu::File("test.txt", "w+");
- EXPECT_TRUE(f2 != NULL);
- EXPECT_TRUE(f2->isOpen());
-
- status = f2->write(buf1, strlen(buf1));
- EXPECT_TRUE(status == capu::CAPU_OK);
- delete f2;
-
- // read data
- capu::File* f3 = new capu::File("test.txt", "r");
- EXPECT_TRUE(f3 != NULL);
- EXPECT_TRUE(f3->isOpen());
-
- // invalid params
- status = f3->read(NULL, 0, NULL);
- EXPECT_TRUE(status == capu::CAPU_EINVAL);
-
- read = 0;
- memset(buf2, 0, sizeof(buf2));
- status = f3->read(buf2, strlen(buf1), &read);
- EXPECT_TRUE(status == capu::CAPU_OK);
- EXPECT_TRUE(read == (capu::uint32_t)strlen(buf1));
- delete f3;
-
- // read data
- capu::File* f4 = new capu::File("test.txt", "r");
- EXPECT_TRUE(f4 != NULL);
- EXPECT_TRUE(f4->isOpen());
-
- memset(buf2, 0, sizeof(buf2));
- status = f4->read(buf2, strlen(buf1), NULL);
- EXPECT_TRUE(status == capu::CAPU_OK);
- EXPECT_TRUE(read == (capu::uint32_t)strlen(buf1));
- delete f4;
-
- // read data Eof
- capu::File* f5 = new capu::File("test.txt", "r");
- EXPECT_TRUE(f5 != NULL);
- EXPECT_TRUE(f5->isOpen());
-
- read = 0;
- memset(buf2, 0, sizeof(buf2));
- status = f5->read(buf2, sizeof(buf2), &read);
- EXPECT_TRUE(status == capu::CAPU_EOF);
- EXPECT_TRUE(read == (capu::uint32_t)strlen(buf1));
- EXPECT_TRUE(strcmp(buf1, buf2) == 0);
- delete f5;
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/MemoryTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/MemoryTest.cpp
deleted file mode 100644
index e1106e2..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/MemoryTest.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <gtest/gtest.h>
-#include "capu/os/Memory.h"
-
-TEST(Memory,compare)
-{
- char string1[30] = "This is a String";
- char string2[30] = "This is a String";
- char string3[30] = "This is another String";
-
- EXPECT_EQ(0,capu::Memory::Compare(string1,string2,30));
- EXPECT_FALSE(0 == capu::Memory::Compare(string2,string3,30));
-}
-
-TEST(Memory,set)
-{
- char string[] = "Hello World";
- capu::Memory::Set(string,'m',5);
- EXPECT_EQ(0,capu::Memory::Compare("mmmmm World",string,strlen(string)));
-}
-
-TEST(Memory,copy)
-{
- char string1[30] = "This is a String";
- char string2[30];
- capu::Memory::Copy(string2,string1,strlen(string1)+1);
- EXPECT_EQ(0,capu::Memory::Compare(string1,string2,strlen(string1)));
-}
-
-
-TEST(Memory,move)
-{
- char string1[35] = "This is a boring String";
- capu::Memory::Move(string1+17,string1+10,13);
- char string2[35] = "This is a boring boring String";
- EXPECT_EQ(0,capu::Memory::Compare(string2,string1,35));
-}
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/MutexTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/MutexTest.cpp
deleted file mode 100644
index 15da077..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/MutexTest.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $Id$
-*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to you under the Apache License, Version
-* 2.0 (the "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include <gtest/gtest.h>
-#include "capu/os/Mutex.h"
-#include "capu/os/Thread.h"
-
-class ThreadLockTest : public capu::Runnable
-{
-public:
- static capu::Mutex lock;
- static capu::int32_t variable;
-
- ThreadLockTest(capu::int32_t sleepTime) {
- mSleepTime = sleepTime;
- }
-
- void run()
- {
- for(capu::int32_t i = 0; i<100; i++) {
- lock.lock();
- capu::int32_t temp = variable;
- capu::Thread::Sleep(mSleepTime) ;
- variable = ++temp;
- lock.unlock();
- }
- }
-
-private:
- capu::int32_t mSleepTime;
-};
-class ThreadNoLockTest : public capu::Runnable
-{
-public:
- static capu::int32_t variable2;
- static capu::Mutex lock2;
-
- void operator()(void * param)
- {
- for(capu::int32_t i = 0; i<100; i++) {
- capu::int32_t* sleepTime = (capu::int32_t *) param;
- capu::int32_t temp = variable2;
- lock2.lock();
- capu::Thread::Sleep(*sleepTime) ;
- variable2 = ++temp;
- lock2.unlock();
- }
- }
-};
-capu::Mutex ThreadLockTest::lock;
-capu::Mutex ThreadNoLockTest::lock2;
-capu::int32_t ThreadLockTest::variable = 0;
-capu::int32_t ThreadNoLockTest::variable2 = 0;
-
-TEST(Mutex,ConstructorTest)
-{
- capu::Mutex* lock = new capu::Mutex();
- EXPECT_TRUE(lock != NULL);
- delete lock;
-}
-
-TEST(Mutex,TrylockTest)
-{
- capu::Mutex lock;
- //lock the mutex
- EXPECT_TRUE(lock.lock()==capu::CAPU_OK);
- //use trylock to lock the recursive mutex
- EXPECT_TRUE(lock.trylock() == true);
- //release the lock twice
- EXPECT_TRUE(lock.unlock()==capu::CAPU_OK);
- EXPECT_TRUE(lock.unlock()==capu::CAPU_OK);
- //lock the mutex by using trylock
- EXPECT_TRUE(lock.trylock() == true);
- //unlock the mutex
- EXPECT_TRUE(lock.unlock()==capu::CAPU_OK);
-}
-
-TEST(Mutex,lockAndUnlockTest)
-{
- ThreadLockTest _testLock(5);
- ThreadLockTest _testLock2(10);
- ThreadLockTest _testLock3(15);
- ThreadLockTest _testNoLock(5);
- ThreadLockTest _testNoLock2(10);
- ThreadLockTest _testNoLock3(15);
-
-
- //EXECUTE 3 THREAD WITH A RACE CONDITION
- capu::Thread * _thread = new capu::Thread(&_testLock);
- _thread->start();
- capu::Thread * _thread2 = new capu::Thread(&_testLock2);
- _thread2->start();
- capu::Thread * _thread3 = new capu::Thread(&_testLock3);
- _thread3->start();
-
- _thread->join();
- _thread2->join();
- _thread3->join();
- EXPECT_EQ(300, ThreadLockTest::variable);
-
-//EXECUTE 3 THREAD WITH A RACE CONDITION
- capu::Thread * _thread4 = new capu::Thread(&_testNoLock);
- _thread4->start();
- capu::Thread * _thread5 = new capu::Thread(&_testNoLock2);
- _thread5->start();
- capu::Thread * _thread6 = new capu::Thread(&_testNoLock3);
- _thread6->start();
-
- _thread4->join();
- _thread5->join();
- _thread6->join();
- EXPECT_NE(300, ThreadNoLockTest::variable2);
-
-
- delete _thread;
- delete _thread2;
- delete _thread3;
- delete _thread4;
- delete _thread5;
- delete _thread6;
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/NumericLimitsTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/NumericLimitsTest.cpp
deleted file mode 100644
index 608c6aa..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/NumericLimitsTest.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <gtest/gtest.h>
-#include "capu/os/NumericLimits.h"
-
-TEST(NumericLimits,testLimits)
-{
- EXPECT_EQ(capu::NumericLimitMax<capu::int32_t>(), static_cast<capu::int32_t>(0x7fffffff));
- EXPECT_EQ(capu::NumericLimitMin<capu::int32_t>(), static_cast<capu::int32_t>(0x80000000));
- EXPECT_EQ(capu::NumericLimitMax<capu::int16_t>(), static_cast<capu::int32_t>(32767));
- EXPECT_EQ(capu::NumericLimitMin<capu::int16_t>(), static_cast<capu::int32_t>(-32768));
- EXPECT_EQ(capu::NumericLimitMax<capu::int8_t>(), static_cast<capu::int32_t>(127));
- EXPECT_EQ(capu::NumericLimitMin<capu::int8_t>(), static_cast<capu::int32_t>(-128));
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/ServerSocketTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/ServerSocketTest.cpp
deleted file mode 100644
index f911b92..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/ServerSocketTest.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include "capu/os/ServerSocket.h"
-#include "capu/Error.h"
-
-class RandomPort
-{
-public:
- /**
- * Gets a Random Port between 1024 and 10024
- */
- static capu::uint16_t get()
- {
- return (rand() % 10000) + 20000; // 0-1023 = Well Known, 1024-49151 = User, 49152 - 65535 = Dynamic
- }
-};
-
-TEST(ServerSocket, CloseTest) {
- capu::ServerSocket *socket = new capu::ServerSocket();
- //try to close serversocket
- EXPECT_TRUE(socket->close() == capu::CAPU_OK);
- //try to close already closed socket
- EXPECT_TRUE(socket->close() == capu::CAPU_SOCKET_ESOCKET);
- delete socket;
-}
-
-TEST(ServerSocket, BindTest) {
- capu::uint16_t port = RandomPort::get();
- capu::ServerSocket *socket = new capu::ServerSocket();
- //try to bind on a invalid port
- EXPECT_TRUE(socket->bind(0, "0.0.0.0") == capu::CAPU_EINVAL);
-
- //try to bind on a valid port and address
- EXPECT_TRUE(socket->bind(port) == capu::CAPU_OK);
- //call bind twice
- EXPECT_TRUE(socket->bind(port, "127.0.0.1") == capu::CAPU_ERROR);
-
- delete socket;
- capu::uint16_t port2 = RandomPort::get() + 10000;
- socket = new capu::ServerSocket();
- //try to bind 5 digit port
- EXPECT_TRUE(socket->bind(port2, "0.0.0.0") == capu::CAPU_OK);
- EXPECT_TRUE(socket->close() == capu::CAPU_OK);
- delete socket;
-
- socket = new capu::ServerSocket();
- //expect true if address is wrong
- EXPECT_TRUE(socket->bind(port, "0.0.0.600") == capu::CAPU_SOCKET_EADDR);
- EXPECT_TRUE(socket->close() == capu::CAPU_OK);
- //deallocate socket
- delete socket;
-}
-
-TEST(ServerSocket, ListenTest) {
- capu::uint16_t port = RandomPort::get();
- capu::ServerSocket *socket = new capu::ServerSocket();
-
- //try to start listening on a unbound socket
- EXPECT_TRUE(socket->listen(3) == capu::CAPU_EINVAL);
-
- //faulty bind and listen
- EXPECT_TRUE(socket->bind(port, "0.0.0.2564") == capu::CAPU_SOCKET_EADDR);
- EXPECT_TRUE(socket->listen(3) == capu::CAPU_EINVAL);
- //bind and listen in a correct way
- EXPECT_TRUE(socket->bind(port, "0.0.0.0") == capu::CAPU_OK);
- EXPECT_TRUE(socket->listen(3) == capu::CAPU_OK);
- delete socket;
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/SocketTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/SocketTest.cpp
deleted file mode 100644
index 4a56e7a..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/SocketTest.cpp
+++ /dev/null
@@ -1,380 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include "capu/os/ServerSocket.h"
-#include "capu/os/Thread.h"
-#include "capu/os/Socket.h"
-#include "capu/os/Mutex.h"
-#include "capu/os/CondVar.h"
-
-capu::Mutex mutex;
-capu::CondVar cv;
-capu::bool_t cond = false;
-
-class RandomPort
-{
-public:
- /**
- * Gets a Random Port between 1024 and 10024
- */
- static capu::uint16_t get()
- {
- return (rand() % 10000) + 40000; // 0-1023 = Well Known, 1024-49151 = User, 49152 - 65535 = Dynamic
- }
-};
-
-class ThreadClientTest : public capu::Runnable {
-
-capu::int16_t port;
-public:
- //client thread to test data exchange between client and server
- ThreadClientTest(capu::int16_t port) : port(port) {}
-
- void run() {
- capu::int32_t communication_variable;
- capu::int32_t numBytes = 0;
- //ALLOCATION AND SYNCH OF cient and server
- capu::Socket *cli_socket = new capu::Socket();
-
- //TRY TO CONNECT TO IPV6
- EXPECT_TRUE(cli_socket->connect((unsigned char *) "::1", port) == capu::CAPU_SOCKET_EADDR);
- //connects to he given id
- capu::status_t result = capu::CAPU_ERROR;
- //wait for server to start up
- mutex.lock();
- while (!cond) {
- cv.wait(&mutex);
- }
- cond = false;
- mutex.unlock();
- result = capu::CAPU_ERROR;
- capu::int32_t attemps = 0;
- while (result != capu::CAPU_OK && attemps < 10) {
- result = cli_socket->connect((unsigned char *) "localhost", port);
- attemps++;
- capu::Thread::Sleep(50);
- }
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- capu::int32_t i = 5;
- //send data
- EXPECT_TRUE(cli_socket->send((unsigned char*) &i, sizeof (capu::int32_t)) == capu::CAPU_OK);
-
- //receive
- capu::status_t res = cli_socket->receive((unsigned char *) &communication_variable, sizeof (capu::int32_t), numBytes);
- EXPECT_EQ(capu::CAPU_OK,res);
-
- //CHECK VALUE
- EXPECT_EQ(6,communication_variable);
-
- mutex.lock();
- cond = true;
- cv.signal();
- mutex.unlock();
-
- //socket close
- EXPECT_TRUE(cli_socket->close() == capu::CAPU_OK);
- //deallocating
- delete cli_socket;
- }
-};
-
-class ThreadTimeoutClientTest : public capu::Runnable {
- capu::int16_t port;
-public:
- //timeout test
- ThreadTimeoutClientTest(capu::int16_t port) : port(port) {}
-
- void run() {
- capu::int32_t communication_variable;
- capu::int32_t numBytes = 0;
- capu::Socket *cli_socket = new capu::Socket();
- //timeout is 2 second;
- cli_socket->setTimeout(2);
- //connects to he given id
- capu::status_t result = capu::CAPU_ERROR;
- //wait for server to start up
- mutex.lock();
- while (!cond) {
- cv.wait(&mutex);
- }
- cond = false;
- mutex.unlock();
- result = cli_socket->connect((unsigned char *) "localhost", port);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- capu::int32_t i = 5;
-
- //send data
- EXPECT_TRUE(cli_socket->send((unsigned char*) &i, sizeof (capu::int32_t)) == capu::CAPU_OK);
-
- //receive
- EXPECT_EQ(capu::CAPU_ETIMEOUT, cli_socket->receive((unsigned char *) &communication_variable, sizeof (capu::int32_t), numBytes));
-
- //client has received timeout, server can close socket
- mutex.lock();
- cond = true;
- cv.signal();
- mutex.unlock();
- //socket close
- EXPECT_TRUE(cli_socket->close() == capu::CAPU_OK);
- //deallocating
- delete cli_socket;
- }
-};
-
-class ThreadServerTest : public capu::Runnable {
- capu::int16_t port;
-public:
- //SERVER thread to test data exchange between client and server
- ThreadServerTest(capu::int16_t port) : port(port) {}
-
- void run() {
- capu::int32_t communication_variable;
- capu::int32_t numBytes = 0;
- //server socket allocation
- capu::ServerSocket *socket = new capu::ServerSocket();
-
- //bind to given address
- EXPECT_TRUE(socket->bind(port, "0.0.0.0") == capu::CAPU_OK);
- //start listening
- EXPECT_TRUE(socket->listen(5) == capu::CAPU_OK);
- //accept connection
-
- //server is ready to accept clients
- mutex.lock();
- cond = true;
- cv.signal();
- mutex.unlock();
- capu::Socket *new_socket = socket->accept();
-
- //receive data
- capu::status_t result = capu::CAPU_ERROR;
-
- result = new_socket->receive((unsigned char *) &communication_variable, sizeof (capu::int32_t), numBytes);
- EXPECT_TRUE(result == capu::CAPU_OK);
- //CHECK VALUE
- EXPECT_TRUE(communication_variable == 5);
- //update data
- communication_variable++;
-
- //send it back
- EXPECT_TRUE(new_socket->send((unsigned char *) &communication_variable, sizeof (capu::int32_t)) == capu::CAPU_OK);
-
- //wait with close until client has received data
- mutex.lock();
- while (!cond) {
- cv.wait(&mutex);
- }
- cond = false;
- mutex.unlock();
- //close session
- EXPECT_TRUE(new_socket->close() == capu::CAPU_OK);
- //deallocate session identifier
- delete new_socket;
- EXPECT_EQ(capu::CAPU_OK, socket->close());
- delete socket;
- }
-};
-
-class ThreadTimeoutServerTest : public capu::Runnable {
- capu::int16_t port;
-
-public:
- //timeout test
- ThreadTimeoutServerTest(capu::int16_t port) : port(port) {}
- inline void run() {
- capu::int32_t communication_variable;
- capu::int32_t numBytes = 0;
- //server socket allocation
- capu::ServerSocket *socket = new capu::ServerSocket();
-
- //bind to given address
- EXPECT_TRUE(socket->bind(port, "0.0.0.0") == capu::CAPU_OK);
- //start listening
- EXPECT_TRUE(socket->listen(5) == capu::CAPU_OK);
-
- //server is ready to accept clients
- mutex.lock();
- cond = true;
- cv.signal();
- mutex.unlock();
- //accept connection
- capu::Socket *new_socket = socket->accept();
- capu::status_t result = capu::CAPU_ERROR;
-
- result = new_socket->receive((unsigned char *) &communication_variable, sizeof (capu::int32_t), numBytes);
- EXPECT_EQ(capu::CAPU_OK, result);
- //CHECK VALUE
- EXPECT_TRUE(communication_variable == 5);
-
- //wait for timeout on client side
- mutex.lock();
- while (!cond) {
- cv.wait(&mutex);
- }
- cond = false;
- mutex.unlock();
-
- //close session
- EXPECT_TRUE(new_socket->close() == capu::CAPU_OK);
- //deallocate session identifier
- delete new_socket;
- EXPECT_EQ(capu::CAPU_OK, socket->close());
- delete socket;
- }
-};
-
-TEST(Socket, ConnectTest) {
- capu::Socket *socket = new capu::Socket();
- //pass null
- capu::uint16_t port = RandomPort::get();
- EXPECT_TRUE(socket->connect(NULL, port) == capu::CAPU_EINVAL);
-
- EXPECT_TRUE(socket->connect((unsigned char *)"www.test", port) == capu::CAPU_SOCKET_EADDR);
-
- delete socket;
-}
-
-TEST(Socket, CloseReceiveAndSendTest) {
- capu::Socket *socket = new capu::Socket();
- capu::int32_t i = 0;
- capu::int32_t numBytes = 0;
- EXPECT_TRUE(socket->close() == capu::CAPU_OK);
- //try to send data via closed socket
- EXPECT_TRUE(socket->send((unsigned char *) "asda", 4) == capu::CAPU_SOCKET_ESOCKET);
- //try to receive data from closed socket
- EXPECT_TRUE(socket->receive((unsigned char *) &i, 4, numBytes) == capu::CAPU_SOCKET_ESOCKET);
- //Deallocation of socket
- delete socket;
-}
-
-TEST(Socket, SetAndGetPropertiesTest) {
- capu::Socket *socket = new capu::Socket();
- capu::uint16_t port = RandomPort::get();
- capu::ServerSocket *serverSocket = new capu::ServerSocket();
- //TRY TO CHANGE THE PROPERTIES OF NOT CONNECTED SOCKET
- EXPECT_TRUE(socket->setBufferSize(1024) == capu::CAPU_OK);
- EXPECT_TRUE(socket->setKeepAlive(true) == capu::CAPU_OK);
- EXPECT_TRUE(socket->setLingerOption(true, 90) == capu::CAPU_OK);
- EXPECT_TRUE(socket->setNoDelay(false) == capu::CAPU_OK);
- EXPECT_TRUE(socket->setTimeout(90) == capu::CAPU_OK);
-
- capu::int32_t int_tmp;
- capu::bool_t bool_tmp;
-
- //CHECK THE PROPERTIES ARE CORRECTLY SET
- EXPECT_TRUE(socket->getBufferSize(int_tmp) == capu::CAPU_OK);
-
-
- //On Linux the kernel adjust the buffer size and set it to doubles of given size (at least)
- //therefore we have to check here for >=
- EXPECT_TRUE(int_tmp >= 1024);
- EXPECT_TRUE(socket->getKeepAlive(bool_tmp) == capu::CAPU_OK);
- EXPECT_TRUE(bool_tmp == true);
- EXPECT_TRUE(socket->getLingerOption(bool_tmp, int_tmp) == capu::CAPU_OK);
- EXPECT_TRUE(int_tmp == 90);
- EXPECT_TRUE(bool_tmp == true);
- EXPECT_TRUE(socket->getNoDelay(bool_tmp) == capu::CAPU_OK);
- EXPECT_TRUE(bool_tmp == false);
- EXPECT_TRUE(socket->getTimeout(int_tmp) == capu::CAPU_OK);
- EXPECT_TRUE(int_tmp == 90);
-
-
- serverSocket->bind(port, "0.0.0.0");
- serverSocket->listen(3);
-
- socket->connect((unsigned char *) "127.0.0.1", port);
-
- //TRY TO CHANGE THE PROPERTIES OF CONNECTED SOCKET
- EXPECT_TRUE(socket->setBufferSize(2024) == capu::CAPU_OK);
- EXPECT_TRUE(socket->setKeepAlive(false) == capu::CAPU_OK);
-
- EXPECT_TRUE(socket->setLingerOption(false, 0) == capu::CAPU_OK);
- EXPECT_TRUE(socket->setNoDelay(true) == capu::CAPU_OK);
- EXPECT_TRUE(socket->setTimeout(92) == capu::CAPU_OK);
-
- //CHECK THE PROPERTIES ARE CORRECTLY SET
- EXPECT_TRUE(socket->getBufferSize(int_tmp) == capu::CAPU_OK);
- //kernel adjust the buffer size and set it to doubles of given size (at least)
-
- EXPECT_TRUE(int_tmp >= 2024);
- EXPECT_TRUE(socket->getKeepAlive(bool_tmp) == capu::CAPU_OK);
- EXPECT_TRUE(bool_tmp == false);
- EXPECT_TRUE(socket->getLingerOption(bool_tmp, int_tmp) == capu::CAPU_OK);
- EXPECT_TRUE(bool_tmp == false);
- EXPECT_TRUE(socket->getNoDelay(bool_tmp) == capu::CAPU_OK);
- EXPECT_TRUE(bool_tmp == true);
- EXPECT_TRUE(socket->getTimeout(int_tmp) == capu::CAPU_OK);
- EXPECT_TRUE(int_tmp == 92);
-
- socket->close();
- //TRY TO CHANGE THE PROPERTIES OF CLOSED SOCKET
- EXPECT_TRUE(socket->setBufferSize(1024) == capu::CAPU_SOCKET_ESOCKET);
- EXPECT_TRUE(socket->setKeepAlive(true) == capu::CAPU_SOCKET_ESOCKET);
- EXPECT_TRUE(socket->setLingerOption(true, 90) == capu::CAPU_SOCKET_ESOCKET);
- EXPECT_TRUE(socket->setNoDelay(false) == capu::CAPU_SOCKET_ESOCKET);
- EXPECT_TRUE(socket->setTimeout(90) == capu::CAPU_SOCKET_ESOCKET);
- //TRY TO GET PROPERTIES OF CLOSED SOCKET
- EXPECT_TRUE(socket->getBufferSize(int_tmp) == capu::CAPU_SOCKET_ESOCKET);
- EXPECT_TRUE(socket->getKeepAlive(bool_tmp) == capu::CAPU_SOCKET_ESOCKET);
- EXPECT_TRUE(socket->getLingerOption(bool_tmp, int_tmp) == capu::CAPU_SOCKET_ESOCKET);
- EXPECT_TRUE(socket->getNoDelay(bool_tmp) == capu::CAPU_SOCKET_ESOCKET);
- EXPECT_TRUE(socket->getTimeout(int_tmp) == capu::CAPU_SOCKET_ESOCKET);
-
- delete socket;
- delete serverSocket;
-}
-
-TEST(SocketAndServerSocket, CommunicationTest) {
- cond = false;
- capu::uint16_t port = RandomPort::get();
- ThreadServerTest server(port);
- ThreadClientTest client(port);
- capu::Thread * server_thread = new capu::Thread(&server);
- server_thread->start();
- capu::Thread * client_thread = new capu::Thread(&client);
- client_thread->start();
-
- //Create two threads which will behave like client and server to test functionality
- server_thread->join();
- client_thread->join();
-
- delete client_thread;
- delete server_thread;
-}
-
-TEST(SocketAndServerSocket, TimeoutTest) {
- cond = false;
- capu::uint16_t port = RandomPort::get();
- ThreadTimeoutServerTest server(port);
- ThreadTimeoutClientTest client(port);
- capu::Thread * server_thread = new capu::Thread(&server);
- server_thread->start();
- capu::Thread * client_thread = new capu::Thread(&client);
- client_thread->start();
- //client_thread two threads which will behave like client and server to test functionality
- server_thread->join();
- client_thread->join();
-
- delete client_thread;
- delete server_thread;
-}
-
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/StringUtilsTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/StringUtilsTest.cpp
deleted file mode 100644
index 1d314cb..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/StringUtilsTest.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <gtest/gtest.h>
-#include "capu/os/StringUtils.h"
-
-
-TEST(StringUtils,Strcmp)
-{
- char string1[] = "My String";
- char string2[] = "My String";
- char string3[] = "Another String";
- EXPECT_EQ(0,capu::StringUtils::Strcmp(string1,string2));
- EXPECT_TRUE(0 <= capu::StringUtils::Strcmp(string1,string3));
-}
-
-TEST(StringUtils,Strncpy)
-{
- char string1[20] = "My String";
- char string2[20];
- capu::StringUtils::Strncpy(string2,20,string1);
- EXPECT_EQ(0,capu::StringUtils::Strcmp(string1,string2));
-}
-
-TEST(StringUtils,Strlen)
-{
- char string1[20] = "My String";
- EXPECT_TRUE(9 == capu::StringUtils::Strlen(string1));
-}
-
-TEST(StringUtils,Sprintf)
-{
- char string1[20];
- capu::StringUtils::Sprintf(string1,20,"%d",12345);
- EXPECT_EQ(0,capu::StringUtils::Strcmp("12345",string1));
- capu::StringUtils::Sprintf(string1,20,"%d %f",12345,12.45);
- EXPECT_EQ(0,capu::StringUtils::Strcmp("12345 12.450000",string1));
-}
-
-class VscprintfTest {
- public:
- static capu::int32_t Vscprintf(const char* format, ...) {
- capu::int32_t length = 0;
- va_list args;
- va_start(args, format);
- length = capu::StringUtils::Vscprintf("This is a test! %d", args);
- va_end(args);
- return length;
- }
-};
-
-TEST(StringUtils,Vscprintf)
-{
- capu::int32_t length = VscprintfTest::Vscprintf("This is a test! %d", 12345);
- EXPECT_EQ(21, length);
-}
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/ThreadTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/ThreadTest.cpp
deleted file mode 100644
index c9fa94c..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/ThreadTest.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <gtest/gtest.h>
-#include "capu/os/Thread.h"
-
-
-class ThreadTest : public capu::Runnable
-{
- public:
- static capu::int32_t variable;
-
- ThreadTest(capu::int32_t val)
- {
- variable = 0;
- mVal = val;
- }
-
- void run()
- {
- //1 second delay
- EXPECT_TRUE(capu::Thread::Sleep(1000)==capu::CAPU_OK);
- variable = mVal;
- }
- private:
- capu::int32_t mVal;
-};
-
-class ThreadTest2 : public capu::Runnable
-{
- public:
-
- ThreadTest2()
- {
- }
-
- void run()
- {
- capu::Thread::Sleep(1000);
- return;
- }
-};
-
-
-capu::int32_t ThreadTest::variable;
-
-TEST(Thread,startAndJoinTest)
-{
- ThreadTest _test(6);
- ThreadTest2 _test2;
- //CREATE THREAD
- capu::Thread * CAPU_thread = new capu::Thread(&_test);
- CAPU_thread->start();
- //WAIT UNTIL IT FINISH
- EXPECT_TRUE(CAPU_thread->join()==capu::CAPU_OK);
- //CHECK THE VALUE CALCULATED IN THREAD
- EXPECT_TRUE(ThreadTest::variable == 6);
- delete CAPU_thread;
- capu::Thread * CAPU_thread2 = new capu::Thread(&_test2);
- CAPU_thread2->start();
- EXPECT_TRUE(CAPU_thread2->join()==capu::CAPU_OK);
- delete CAPU_thread2;
-}
-
-TEST(Thread,startAndDestructorTest)
-{
- capu::int32_t newval = 6;
- ThreadTest _test(newval);
-
- capu::Thread * CAPU_thread = new capu::Thread(&_test);
- CAPU_thread->start();
- delete CAPU_thread;
-
- EXPECT_TRUE(ThreadTest::variable == newval);
-}
-
-
-TEST(Thread,sleepTest)
-{
- capu::int32_t newval = 5;
- ThreadTest _test(newval);
- //CREATE THREAD
- capu::Thread * CAPU_thread = new capu::Thread(&_test);
- CAPU_thread->start();
- //WAIT UNTIL IT FINISH
- EXPECT_TRUE(CAPU_thread->join()==capu::CAPU_OK);
- EXPECT_TRUE(ThreadTest::variable == newval);
- delete CAPU_thread;
-}
-
-TEST(Thread,contextTest)
-{
- capu::int32_t newval = 4;
- ThreadTest _test(newval);
- {
- capu::Thread thread(&_test);
- thread.start();
- }
- EXPECT_TRUE(ThreadTest::variable == newval);
-}
-
-TEST(Thread, getState)
-{
- ThreadTest2 r1;
- capu::Thread thread(&r1);
- capu::ThreadState state = thread.getState();
- EXPECT_EQ(capu::TS_NEW, state);
- thread.start();
- capu::Thread::Sleep(500);
- state = thread.getState();
- EXPECT_EQ(capu::TS_RUNNING, state);
- thread.join();
- state = thread.getState();
- EXPECT_EQ(capu::TS_TERMINATED, state);
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/TimeTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/TimeTest.cpp
deleted file mode 100644
index df2d8f2..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/TimeTest.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include "capu/Config.h"
-#include "capu/os/Thread.h"
-#include "capu/os/Time.h"
-
-TEST(Time,getMillisecondsTest)
-{
- capu::uint_t milliSeconds = capu::Time::GetMilliseconds();
- capu::Thread::Sleep(50);
- capu::uint_t milliSeconds2 = capu::Time::GetMilliseconds();
- EXPECT_TRUE((milliSeconds2 - milliSeconds) > 40);
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/UdpSocketTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/os/UdpSocketTest.cpp
deleted file mode 100644
index 5103939..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/UdpSocketTest.cpp
+++ /dev/null
@@ -1,298 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include "capu/os/UdpSocket.h"
-#include "capu/os/Thread.h"
-#include "capu/os/Mutex.h"
-#include "capu/os/CondVar.h"
-
-capu::Mutex mutex2;
-capu::CondVar cv2;
-capu::bool_t cond2;
-
-class RandomPort
-{
-public:
- /**
- * Gets a Random Port between 1024 and 10024
- */
- static capu::uint16_t get()
- {
- return (rand() % 10000) + 30000; // 0-1023 = Well Known, 1024-49151 = User, 49152 - 65535 = Dynamic
- }
-};
-
-
-class ThreadClientUdpTest : public capu::Runnable {
- capu::uint16_t port;
-public:
- //client thread to test data exchange between client and server
- ThreadClientUdpTest(capu::uint16_t port) : port(port) {}
- void run() {
- capu::int32_t communication_variable;
- capu::int32_t numBytes = 0;
- capu::UdpSocket *clientSocket = new capu::UdpSocket();
-
- capu::int32_t i = 5;
- //try to connect to ipv6
- EXPECT_TRUE(clientSocket->send((unsigned char*) &i, sizeof (capu::int32_t), "::1", port) == capu::CAPU_SOCKET_EADDR);
-
- //wait for other side to start up
- mutex2.lock();
- while (!cond2) {
- cv2.wait(&mutex2);
- }
- cond2 = false;
- mutex2.unlock();
- //send data
- EXPECT_TRUE(clientSocket->send((unsigned char*) &i, sizeof (capu::int32_t), "127.0.0.1", port) == capu::CAPU_OK);
-
- //receive
- capu::status_t result = capu::CAPU_ERROR;
-
- result = clientSocket->receive((unsigned char *) &communication_variable, sizeof (capu::int32_t), numBytes, 0);
- EXPECT_EQ(capu::CAPU_OK,result);
-
- //check value
- EXPECT_EQ(6,communication_variable);
-
- mutex2.lock();
- cond2 = true;
- cv2.signal();
- mutex2.unlock();
-
- //socket close
- EXPECT_EQ(capu::CAPU_OK, clientSocket->close());
-
- delete clientSocket;
- }
-};
-
-class ThreadTimeoutClientUdpTest : public capu::Runnable {
- capu::uint16_t port;
-public:
- //timeout test
- ThreadTimeoutClientUdpTest(capu::uint16_t port) : port(port) {}
- void run() {
- capu::int32_t communication_variable;
- capu::int32_t numBytes = 0;
- capu::Thread::Sleep(1000);
- //ALLOCATION AND SYNCH OF cient and server
- capu::UdpSocket *cli_socket = new capu::UdpSocket();
- //timeout is 2 second;
- cli_socket->setTimeout(2);
- capu::int32_t i = 5;
-
- //wait for other side to start up
- mutex2.lock();
- while (!cond2) {
- cv2.wait(&mutex2);
- }
- cond2 = false;
- mutex2.unlock();
-
- //send data
- EXPECT_EQ(capu::CAPU_OK, cli_socket->send((unsigned char*) &i, sizeof (capu::int32_t), "localhost", port));
-
- //receive
- EXPECT_EQ(capu::CAPU_ETIMEOUT, cli_socket->receive((unsigned char *) &communication_variable, sizeof (capu::int32_t), numBytes, 0));
-
- mutex2.lock();
- cond2 = true;
- cv2.signal();
- mutex2.unlock();
-
- //socket close
- EXPECT_TRUE(cli_socket->close() == capu::CAPU_OK);
- //deallocating
- delete cli_socket;
- }
-};
-
-class ThreadServerUdpTest : public capu::Runnable {
- capu::uint16_t port;
-public:
- //SERVER thread to test data exchange between client and server
- ThreadServerUdpTest(capu::uint16_t port) : port(port) {}
- void run() {
- capu::int32_t communication_variable;
- capu::int32_t numBytes = 0;
- //server socket allocation
- capu::UdpSocket *serverSocket = new capu::UdpSocket();
-
- //bind to given address
- EXPECT_TRUE(serverSocket->bind(port, "127.0.0.1") == capu::CAPU_OK);
-
- //receive data
- capu::UdpSocket::SocketAddrInfo remoteSocket;
- //receive
- capu::status_t result = capu::CAPU_ERROR;
-
- //send signal that server is ready to receive
- mutex2.lock();
- cond2 = true;
- cv2.signal();
- mutex2.unlock();
- result = serverSocket->receive((unsigned char *) &communication_variable, sizeof (capu::int32_t), numBytes, &remoteSocket);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- EXPECT_STREQ("127.0.0.1", remoteSocket.addr);
-
- //check value
- EXPECT_TRUE(communication_variable == 5);
-
- //update data
- communication_variable++;
-
- //send it back
- EXPECT_TRUE(serverSocket->send((unsigned char*) &communication_variable, sizeof (capu::int32_t), remoteSocket) == capu::CAPU_OK);
-
- mutex2.lock();
- while (!cond2) {
- cv2.wait(&mutex2);
- }
- cond2 = false;
- mutex2.unlock();
-
- //close session
- EXPECT_TRUE(serverSocket->close() == capu::CAPU_OK);
- delete serverSocket;
- }
-};
-
-class ThreadTimeoutServerUdpTest : public capu::Runnable {
- capu::uint16_t port;
-public:
- //timeout test
- ThreadTimeoutServerUdpTest(capu::uint16_t port) : port(port) {}
- void run() {
- capu::int32_t communication_variable;
- capu::int32_t numBytes = 0;
- //server socket allocation
- capu::UdpSocket *serverSocket = new capu::UdpSocket();
-
- //bind to given address
- EXPECT_TRUE(serverSocket->bind(port) == capu::CAPU_OK);
-
- //receive data
- capu::status_t result = capu::CAPU_ERROR;
-
- //send signal that server is ready to receive
- mutex2.lock();
- cond2 = true;
- cv2.signal();
- mutex2.unlock();
- result = serverSocket->receive((unsigned char *) &communication_variable, sizeof (capu::int32_t), numBytes, NULL);
- EXPECT_TRUE(result == capu::CAPU_OK);
-
- //check value
- EXPECT_TRUE(communication_variable == 5);
-
- mutex2.lock();
- while (!cond2) {
- cv2.wait(&mutex2);
- }
- cond2 = false;
- mutex2.unlock();
-
- //close session
- EXPECT_TRUE(serverSocket->close() == capu::CAPU_OK);
-
- delete serverSocket;
- }
-};
-
-
-TEST(UdpSocket, CloseReceiveAndSendTest) {
- capu::uint16_t port = RandomPort::get();
- capu::UdpSocket *socket = new capu::UdpSocket();
- capu::int32_t i = 0;
- capu::int32_t numBytes = 0;
- EXPECT_TRUE(socket->close() == capu::CAPU_OK);
- //try to send data via closed socket
- EXPECT_TRUE(socket->send((unsigned char *) "asda", 4, "localhost", port) == capu::CAPU_SOCKET_ESOCKET);
- //try to receive data from closed socket
- EXPECT_TRUE(socket->receive((unsigned char *) &i, 4, numBytes, NULL) == capu::CAPU_SOCKET_ESOCKET);
- //Deallocation of socket
- delete socket;
-}
-
-TEST(UdpSocket, SetAndGetPropertiesTest) {
- capu::UdpSocket *socket = new capu::UdpSocket();
- //TRY TO CHANGE THE PROPERTIES OF NOT CONNECTED SOCKET
- EXPECT_TRUE(socket->setBufferSize(1024) == capu::CAPU_OK);
- EXPECT_TRUE(socket->setTimeout(90) == capu::CAPU_OK);
-
- capu::int32_t int_tmp;
-
- //CHECK THE PROPERTIES ARE CORRECTLY SET
- EXPECT_TRUE(socket->getBufferSize(int_tmp) == capu::CAPU_OK);
- //On Linux the kernel adjust the buffer size and set it to doubles of given size (at least)
- //therefore we have to check here for >=
- EXPECT_TRUE(int_tmp >= 1024);
-
- EXPECT_TRUE(socket->getTimeout(int_tmp) == capu::CAPU_OK);
- EXPECT_TRUE(int_tmp == 90);
-
- socket->close();
- //TRY TO CHANGE THE PROPERTIES OF CLOSED SOCKET
- EXPECT_TRUE(socket->setBufferSize(1024) == capu::CAPU_SOCKET_ESOCKET);
- EXPECT_TRUE(socket->setTimeout(90) == capu::CAPU_SOCKET_ESOCKET);
- //TRY TO GET PROPERTIES OF CLOSED SOCKET
- EXPECT_TRUE(socket->getBufferSize(int_tmp) == capu::CAPU_SOCKET_ESOCKET);
- EXPECT_TRUE(socket->getTimeout(int_tmp) == capu::CAPU_SOCKET_ESOCKET);
-
- delete socket;
-}
-
-TEST(UdpSocketAndUdpServerSocket, CommunicationTest) {
- cond2 = false;
- capu::uint16_t port = RandomPort::get();
- ThreadServerUdpTest server(port);
- ThreadClientUdpTest client(port);
- capu::Thread * server_thread = new capu::Thread(&server);
- server_thread->start();
- capu::Thread * client_thread = new capu::Thread(&client);
- client_thread->start();
- //Create two threads which will behave like client and server to test functionality
- server_thread->join();
- client_thread->join();
-
- delete client_thread;
- delete server_thread;
-}
-
-TEST(UdpSocketAndUdpServerSocket, TimeoutTest) {
- cond2 = false;
- capu::uint16_t port = RandomPort::get();
- ThreadTimeoutServerUdpTest server(port);
- ThreadTimeoutClientUdpTest client(port);
- capu::Thread * server_thread = new capu::Thread(&server);
- server_thread->start();
- capu::Thread * client_thread = new capu::Thread(&client);
- client_thread->start();
- //Create two threads which will behave like client and server to test functionality
- server_thread->join();
- client_thread->join();
-
- delete client_thread;
- delete server_thread;
-}
-
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/arch/AtomicOperation.inc b/binding-cpp/runtime/lib/capu/modules/capu/test/os/arch/AtomicOperation.inc
deleted file mode 100644
index 0d3ad71..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/arch/AtomicOperation.inc
+++ /dev/null
@@ -1,24 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#if defined(ARCH_X86_32)
- #include "X86_32/AtomicOperation.inc"
-#elif defined(ARCH_X86_64)
- #include "X86_64/AtomicOperation.inc"
-#endif
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/arch/X86_32/AtomicOperation.inc b/binding-cpp/runtime/lib/capu/modules/capu/test/os/arch/X86_32/AtomicOperation.inc
deleted file mode 100644
index 6493801..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/arch/X86_32/AtomicOperation.inc
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-TEST(AtomicOperation, Add_Overflow_X86_32) {
- capu::uint32_t val = 4294967295u;
- capu::uint32_t ret = capu::AtomicOperation::AtomicAdd32(val, 3);
- EXPECT_EQ(2u, val);
- EXPECT_EQ(4294967295u, ret);
-}
-
-TEST(AtomicOperation, Sub_Overflow_X86_32) {
- capu::uint32_t val = 0;
- capu::uint32_t ret = capu::AtomicOperation::AtomicSub32(val, 5);
- EXPECT_EQ(4294967291u, val);
- EXPECT_EQ(0u, ret);
-}
\ No newline at end of file
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/os/arch/X86_64/AtomicOperation.inc b/binding-cpp/runtime/lib/capu/modules/capu/test/os/arch/X86_64/AtomicOperation.inc
deleted file mode 100644
index 9a27b38..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/os/arch/X86_64/AtomicOperation.inc
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- TEST(AtomicOperation,Add_NoOverflow_X86_64) {
- capu::uint32_t val = 4294967295u;
- capu::uint32_t ret = capu::AtomicOperation::AtomicAdd32(val, 3);
- EXPECT_EQ((capu::uint32_t) 4294967298u,val);
- EXPECT_EQ(ret, 4294967295u);
-}
-
-//disabled until *64 methods are implemented
-/*TEST(AtomicOperation,Add64_Overflow_X86_64) {
- capu::uint64_t val = 18446744073709551615u;
- capu::AtomicOperation::AtomicAdd64(val, 3);
- EXPECT_EQ((capu::uint32_t) 2,val);
-}
-
-TEST(AtomicOperation,Sub64_Overflow_X86_64) {
- capu::uint64_t val = 0;
- capu::AtomicOperation::AtomicSub64(val, 5);
- EXPECT_EQ((capu::uint32_t) 18446744073709551610u,val);
-}
-*/
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/util/LoggerTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/util/LoggerTest.cpp
deleted file mode 100644
index 4a9c58a..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/util/LoggerTest.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <gtest/gtest.h>
-#include "capu/util/Logger.h"
-#include "capu/util/Appender.h"
-
-class DummyAppender : public capu::Appender {
- public:
- class LoggerMessage;
-
- capu::status_t open() {
- return capu::CAPU_OK;
- }
-
- capu::status_t log(capu::LoggerMessage* message) {
- //printf("[%d] %s:%d\n", message->getTimestamp(), message->getFile(), message->getLine());
- return capu::CAPU_OK;
- }
-
- capu::status_t close() {
- return capu::CAPU_OK;
- }
-
-};
-
-TEST(Logger, Constructor_Default) {
- capu::Logger* log1 = new capu::Logger();
- EXPECT_TRUE(log1 != NULL);
- delete log1;
-}
-
-TEST(Logger, setAppender) {
- capu::Logger* log1 = new capu::Logger();
- EXPECT_TRUE(log1 != NULL);
-
- DummyAppender* appenders[11];
- for(int i = 0; i < LOGGER_APPENDER_MAX + 1; i++) {
- appenders[i] = new DummyAppender();
- }
-
- for(int i = 0; i < LOGGER_APPENDER_MAX; i++) {
- capu::status_t status = log1->setAppender(appenders[i]);
- EXPECT_TRUE(status == capu::CAPU_OK);
- }
-
- capu::status_t status = log1->setAppender(appenders[LOGGER_APPENDER_MAX]);
- EXPECT_TRUE(status == capu::CAPU_ERROR);
-
- log1->open();
- log1->close();
-
- for(int i = 0; i < LOGGER_APPENDER_MAX + 1; i++) {
- delete appenders[i];
- }
-
- delete log1;
-}
-
-TEST(Logger, log) {
- capu::status_t status;
-
- capu::Logger* l1 = new capu::Logger();
- EXPECT_TRUE(l1 != NULL);
-
- // set appender
- DummyAppender* a1 = new DummyAppender();
- status = l1->setAppender(a1);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- const char* TAG = "DummyTAG";
-
- // trace
- status = l1->trace(TAG, __FILE__, __LINE__, "Log trace message test");
- EXPECT_TRUE(status == capu::CAPU_OK);
- status = l1->trace(TAG, __FILE__, __LINE__, "Log trace message test with param %d", 1234);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // debug
- status = l1->debug(TAG, __FILE__, __LINE__, "Log debug message test");
- EXPECT_TRUE(status == capu::CAPU_OK);
- status = l1->debug(TAG, __FILE__, __LINE__, "Log debug message test with param %d", 1234);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // info
- status = l1->info(TAG, __FILE__, __LINE__, "Log info message test");
- EXPECT_TRUE(status == capu::CAPU_OK);
- status = l1->info(TAG, __FILE__, __LINE__, "Log info message test with param %d", 1234);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // warn
- status = l1->warn(TAG, __FILE__, __LINE__, "Log warn message test");
- EXPECT_TRUE(status == capu::CAPU_OK);
- status = l1->warn(TAG, __FILE__, __LINE__, "Log warn message test with param %d", 1234);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // error
- status = l1->error(TAG, __FILE__, __LINE__, "Log error message test");
- EXPECT_TRUE(status == capu::CAPU_OK);
- status = l1->error(TAG, __FILE__, __LINE__, "Log error message test with param %d", 1234);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // level
- status = l1->log(capu::CLL_ERROR, TAG, __FILE__, __LINE__, "Log error message test");
- EXPECT_TRUE(status == capu::CAPU_OK);
- status = l1->log(capu::CLL_ERROR, TAG, __FILE__, __LINE__, "Log error message test with param %d", 1234);
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // check log macros
- CAPU_LOG(l1, capu::CLL_ERROR, TAG, "Log error message test");
- CAPU_LOG(l1, capu::CLL_ERROR, TAG, "Log error message test with param %d", 123);
- CAPU_LOG_TRACE(l1, TAG, "Log error message test");
- CAPU_LOG_TRACE(l1, TAG, "Log error message test with param %d", 123);
- CAPU_LOG_DEBUG(l1, TAG, "Log error message test");
- CAPU_LOG_DEBUG(l1, TAG, "Log error message test with param %d", 123);
- CAPU_LOG_INFO(l1, TAG, "Log error message test");
- CAPU_LOG_INFO(l1, TAG, "Log error message test with param %d", 123);
- CAPU_LOG_WARN(l1, TAG, "Log error message test");
- CAPU_LOG_WARN(l1, TAG, "Log error message test with param %d", 123);
- CAPU_LOG_ERROR(l1, TAG, "Log error message test");
- CAPU_LOG_ERROR(l1, TAG, "Log error message test with param %d", 123);
-
- // open logger
- status = l1->open();
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- // close logger
- status = l1->close();
- EXPECT_TRUE(status == capu::CAPU_OK);
-
- delete a1;
- delete l1;
-}
-
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/util/SmartPointerTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/util/SmartPointerTest.cpp
deleted file mode 100644
index 163d664..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/util/SmartPointerTest.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
-0 *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include "capu/util/SmartPointer.h"
-
-class DummyClass {
-private:
- capu::int32_t mValue;
- FRIEND_TEST(SmartPointer, Constructors);
- FRIEND_TEST(SmartPointer, Deconstructor);
- FRIEND_TEST(SmartPointer, FileOperator);
- FRIEND_TEST(SmartPointer, DereferencingOperator);
-public:
- static capu::int32_t mRefCount;
-
-public:
- DummyClass() {
- mValue = 5;
- mRefCount++;
- }
-
- ~DummyClass() {
- mRefCount--;
- };
-
- void set(capu::int32_t value) {
- mValue = value;
- };
-};
-
-class ChildDummyClass : public DummyClass {
-public:
- ChildDummyClass() {
-
- }
-};
-
-capu::int32_t DummyClass::mRefCount = 0;
-
-TEST(SmartPointer, Constructors) {
- {
- capu::SmartPointer<DummyClass> ptr(new DummyClass());
- EXPECT_EQ((capu::uint32_t)1, ptr.getRefCount());
- EXPECT_EQ(1, DummyClass::mRefCount);
-
- //Copy constructor
- capu::SmartPointer<DummyClass> ptr2(ptr);
- EXPECT_EQ((capu::uint32_t)2, ptr.getRefCount());
- EXPECT_EQ((capu::uint32_t)2, ptr2.getRefCount());
- EXPECT_EQ(1, DummyClass::mRefCount);
- EXPECT_EQ(5, ptr2->mValue);
-
- }
- EXPECT_EQ(0,DummyClass::mRefCount);
-
- //constructor for castable type
- capu::SmartPointer<ChildDummyClass> childPtr(new ChildDummyClass());
- capu::SmartPointer<DummyClass> parentPtr(childPtr);
- EXPECT_EQ((capu::uint32_t)2,childPtr.getRefCount());
- EXPECT_EQ((capu::uint32_t)2,parentPtr.getRefCount());
-}
-
-TEST(SmartPointer, AssignmentOperator) {
- capu::SmartPointer<DummyClass> ptr = new DummyClass();
- EXPECT_EQ((capu::uint32_t)1, ptr.getRefCount());
-
- //copy
- capu::SmartPointer<DummyClass> ptr2 = ptr;
- EXPECT_EQ((capu::uint32_t)2, ptr.getRefCount());
-
- capu::SmartPointer<DummyClass> ptr3 = new DummyClass();
- ptr3 = NULL;
- EXPECT_EQ((capu::uint32_t)1, ptr3.getRefCount());
-
- capu::SmartPointer<DummyClass> ptr4 = ptr3;
- EXPECT_EQ((capu::uint32_t)2, ptr4.getRefCount());
- ptr3 = new DummyClass();
- EXPECT_EQ((capu::uint32_t)1,ptr3.getRefCount());
- EXPECT_EQ((capu::uint32_t)1,ptr4.getRefCount());
-
- //assignment of castable type
- capu::SmartPointer<ChildDummyClass> childPtr(new ChildDummyClass());
- capu::SmartPointer<DummyClass> parentPtr(new DummyClass());
- capu::SmartPointer<DummyClass> parentPtrCopy(parentPtr);
-
- EXPECT_EQ((capu::uint32_t)2,parentPtr.getRefCount());
- EXPECT_EQ((capu::uint32_t)2,parentPtrCopy.getRefCount());
-
- //assign
- parentPtr = childPtr;
- EXPECT_EQ((capu::uint32_t)2,childPtr.getRefCount());
- EXPECT_EQ((capu::uint32_t)2,parentPtr.getRefCount());
- EXPECT_EQ((capu::uint32_t)1,parentPtrCopy.getRefCount());
-
-}
-
-TEST(SmartPointer, FileOperator) {
- capu::SmartPointer<DummyClass> ptr = new DummyClass();
- EXPECT_EQ(5, ptr->mValue);
- ptr->set(13);
- EXPECT_EQ(13, ptr->mValue);
-}
-
-TEST(SmartPointer, DereferencingOperator) {
- DummyClass *dc = new DummyClass();
- capu::SmartPointer<DummyClass> ptr(dc);
- DummyClass *dc2 = &(*ptr);
- EXPECT_EQ(dc, dc2);
-}
-
-TEST(SmartPointer, getObject) {
- DummyClass *dc = new DummyClass();
- capu::SmartPointer<DummyClass> ptr(dc);
- DummyClass *dc2 = ptr.get();
- EXPECT_TRUE(dc2 != NULL);
- EXPECT_EQ(dc, dc2);
-}
-
-TEST(SmartPointer, BoolOperator) {
- capu::SmartPointer<DummyClass> ptr;
- ptr = new DummyClass();
- ASSERT_TRUE(ptr);
- ptr = NULL;
- ASSERT_FALSE(ptr);
-}
-
-TEST(SmartPointer, getRefCount) {
- capu::SmartPointer<DummyClass> ptr;
- ptr = new DummyClass();
- EXPECT_EQ((capu::uint32_t)1, ptr.getRefCount());
- ptr.~SmartPointer();
- EXPECT_EQ((capu::uint32_t)0, ptr.getRefCount());
-}
-
-TEST(SmartPointer, operatorTest) {
- capu::SmartPointer<DummyClass> ptr, ptr2;
- ptr = new DummyClass();
- EXPECT_EQ((capu::uint32_t)1, ptr.getRefCount());
- EXPECT_FALSE(ptr == ptr2);
- EXPECT_TRUE(ptr != ptr2);
- ptr2 = ptr;
- EXPECT_TRUE(ptr == ptr2);
- EXPECT_FALSE(ptr != ptr2);
-}
-
-TEST(SmartPointer,castTest) {
- capu::SmartPointer<DummyClass> ptr2;
- capu::SmartPointer<ChildDummyClass> ptr;
- ptr = new ChildDummyClass();
- EXPECT_EQ((capu::uint32_t)1, ptr.getRefCount());
- capu::SmartPointer<DummyClass> gecastet = ptr;
- EXPECT_EQ((capu::uint32_t)2, ptr.getRefCount());
-}
-
-TEST(SmartPointer,smartpointer_castTest) {
- capu::SmartPointer<DummyClass> spDummy;
-
- spDummy = new ChildDummyClass();
- EXPECT_EQ((capu::uint32_t)1, spDummy.getRefCount());
-
- // test cast to pointer and copy
- capu::SmartPointer<ChildDummyClass> spChildDummy = capu::smartpointer_cast<ChildDummyClass>(spDummy);
- EXPECT_EQ((capu::uint32_t)2, spDummy.getRefCount());
- EXPECT_EQ((capu::uint32_t)2, spChildDummy.getRefCount());
- // change pointer
- spDummy = new ChildDummyClass();
- EXPECT_EQ((capu::uint32_t)1, spDummy.getRefCount());
- EXPECT_EQ((capu::uint32_t)1, spChildDummy.getRefCount());
-}
diff --git a/binding-cpp/runtime/lib/capu/modules/capu/test/util/ThreadPoolTest.cpp b/binding-cpp/runtime/lib/capu/modules/capu/test/util/ThreadPoolTest.cpp
deleted file mode 100644
index 7cafed6..0000000
--- a/binding-cpp/runtime/lib/capu/modules/capu/test/util/ThreadPoolTest.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
-0 *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-#include "capu/util/ThreadPool.h"
-#include "capu/os/Mutex.h"
-#include "capu/os/AtomicOperation.h"
-
-class Globals {
-public:
- static capu::uint32_t var;
-};
-capu::uint32_t Globals::var = 0;
-
-class WorkToDo : public capu::Runnable {
-public:
- WorkToDo() {
-
- }
-
- void run() {
- capu::AtomicOperation::AtomicAdd32(Globals::var, 5);
- }
-};
-
-TEST(ThreadPool, ConstructorTest) {
- capu::ThreadPool* pool = new capu::ThreadPool();
- EXPECT_TRUE(pool != NULL);
- EXPECT_EQ(5, pool->getSize());
- delete pool;
- pool = new capu::ThreadPool(10);
- EXPECT_TRUE(pool != NULL);
- EXPECT_EQ(10, pool->getSize());
- delete pool;
-}
-
-TEST(ThreadPool, AddJoinTest) {
- capu::ThreadPool* pool = new capu::ThreadPool();
- for (capu::int32_t i = 0; i<100000; i++) {
- capu::SmartPointer<WorkToDo> w = new WorkToDo();
- EXPECT_EQ(capu::CAPU_OK, pool->add(w));
- }
- EXPECT_EQ(capu::CAPU_OK, pool->join());
- //check if all the work has been done which means that all threads have been executed
- EXPECT_EQ(500000u, Globals::var);
-
- //make sure adding is no more supported after pool has been closed
- capu::SmartPointer<WorkToDo> w = new WorkToDo();
- EXPECT_EQ(capu::CAPU_ERROR, pool->add(w));
-
- delete pool;
-}
diff --git a/binding-cpp/runtime/src/main/CMakeLists.txt b/binding-cpp/runtime/src/main/CMakeLists.txt
index badcb09..0ebd961 100644
--- a/binding-cpp/runtime/src/main/CMakeLists.txt
+++ b/binding-cpp/runtime/src/main/CMakeLists.txt
@@ -17,7 +17,7 @@
# set include dirs
include_directories (${PROJECT_SOURCE_DIR}/include)
-include_directories (${CAPU}/include/capu)
+include_directories (${LIBCAPU_INCLUDE_DIR})
#Add header files
SET(MAIN_INCLUDES
@@ -240,7 +240,7 @@
)
-IF (TARGET_OS STREQUAL "Linux")
+IF (TARGET_OS STREQUAL "Linux" AND TARGET_ARCH STREQUAL "X86_64") #build only 32 bit
set_target_properties (etch-cpp PROPERTIES COMPILE_FLAGS "-m32 -g" LINK_FLAGS "-m32")
ENDIF ()
diff --git a/binding-cpp/runtime/src/main/common/EtchObject.cpp b/binding-cpp/runtime/src/main/common/EtchObject.cpp
index f80dbcb..5059668 100644
--- a/binding-cpp/runtime/src/main/common/EtchObject.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchObject.cpp
@@ -32,8 +32,7 @@
}
const EtchObjectType* EtchObject::getObjectType() const {
- const EtchObjectType* ret;
- this->mTypes.get(mTypes.size()-1, &ret);
+ const EtchObjectType* ret = this->mTypes.get(mTypes.size()-1);
return ret;
}
@@ -42,9 +41,9 @@
capu::bool_t EtchObject::isInstanceOf(const EtchObjectType* type) const {
capu::List<const EtchObjectType*>::Iterator iter = mTypes.begin();
- while(iter.hasNext()) {
- const EtchObjectType* t = NULL;
- iter.next(&t);
+ while(iter != mTypes.end()) {
+ const EtchObjectType* t = *iter;
+ iter++;
if(t->equals(type)) {
return true;
}
@@ -61,6 +60,6 @@
}
status_t EtchObject::addObjectType(const EtchObjectType* type) {
- mTypes.add(type);
+ mTypes.insert(type);
return ETCH_OK;
}
diff --git a/binding-cpp/runtime/src/main/common/EtchServerSocket.cpp b/binding-cpp/runtime/src/main/common/EtchServerSocket.cpp
index 10e1a8b..99f8301 100644
--- a/binding-cpp/runtime/src/main/common/EtchServerSocket.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchServerSocket.cpp
@@ -46,7 +46,7 @@
}
EtchSocket* EtchServerSocket::accept() {
- capu::Socket *capu_soc = mServerSocket.accept();
+ capu::TcpSocket *capu_soc = mServerSocket.accept();
if(capu_soc == NULL)
return NULL;
EtchSocket *sock = new EtchSocket(capu_soc);
diff --git a/binding-cpp/runtime/src/main/common/EtchSocket.cpp b/binding-cpp/runtime/src/main/common/EtchSocket.cpp
index 62c1de1..8285a9e 100644
--- a/binding-cpp/runtime/src/main/common/EtchSocket.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchSocket.cpp
@@ -25,13 +25,13 @@
EtchSocket::EtchSocket() {
addObjectType(TYPE());
- mSocket = new capu::Socket();
+ mSocket = new capu::TcpSocket();
}
-EtchSocket::EtchSocket(capu::Socket* soc) {
+EtchSocket::EtchSocket(capu::TcpSocket* soc) {
addObjectType(TYPE());
if (soc == NULL)
- mSocket = new capu::Socket();
+ mSocket = new capu::TcpSocket();
else
mSocket = soc;
}
@@ -48,16 +48,17 @@
return mSocket->close();
}
-status_t EtchSocket::connect(unsigned char* dest_addr, capu::uint16_t port) {
+status_t EtchSocket::connect(const char* dest_addr, capu::uint16_t port) {
return mSocket->connect(dest_addr, port);
}
-status_t EtchSocket::receive(unsigned char * buffer, capu::int32_t length, capu::int32_t& numBytes) {
+status_t EtchSocket::receive(char * buffer, capu::int32_t length, capu::int32_t& numBytes) {
return mSocket->receive(buffer, length, numBytes);
}
-status_t EtchSocket::send(unsigned char* buffer, capu::int32_t length) {
- return mSocket->send(buffer, length);
+status_t EtchSocket::send(const char* buffer, capu::int32_t length) {
+ capu::int32_t numBytes = 0;
+ return mSocket->send(buffer, length, numBytes);
}
status_t EtchSocket::setBufferSize(capu::int32_t bufferSize) {
diff --git a/binding-cpp/runtime/src/main/common/EtchString.cpp b/binding-cpp/runtime/src/main/common/EtchString.cpp
index 9dd6aa8..cf30031 100644
--- a/binding-cpp/runtime/src/main/common/EtchString.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchString.cpp
@@ -17,6 +17,7 @@
*/
#include "capu/os/StringUtils.h"
+#include "capu/os/Memory.h"
#include "common/EtchString.h"
#include "util/EtchUtil.h"
@@ -57,7 +58,7 @@
//utf8
// TODO: refactor this an use a utf-8 strncpy function from capu
mData = new char[bufferSize + 1];
- capu::StringUtils::Strncpy(mData, bufferSize, (const char*)buffer);
+ capu::Memory::Copy(mData, (const char*)buffer, bufferSize);
mData [bufferSize] = 0x0;
}
} else {
@@ -172,7 +173,7 @@
if (mEncoding != ENCODING_UTF8) {
return capu::StringUtils::Strlen(mData);
} else {
- capu::int32_t result = 0;
+ capu::uint32_t result = 0;
etch_strlen_utf8(mData, result);
return result;
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedData.cpp b/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedData.cpp
index b08036d..7ff5613 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedData.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedData.cpp
@@ -106,21 +106,21 @@
}
capu::int8_t EtchBinaryTaggedData::checkShort(capu::int16_t v) {
- if ((v >= capu::NumericLimitMin<capu::int8_t>()) && (v <= capu::NumericLimitMax<capu::int8_t>()))
+ if ((v >= capu::NumericLimits::Min<capu::int8_t>()) && (v <= capu::NumericLimits::Max<capu::int8_t>()))
return checkByte((capu::int8_t) v);
return EtchTypeCode::SHORT;
}
capu::int8_t EtchBinaryTaggedData::checkInteger(capu::int32_t v) {
- if ((v >= capu::NumericLimitMin<capu::int16_t>()) && (v <= capu::NumericLimitMax<capu::int16_t>()))
+ if ((v >= capu::NumericLimits::Min<capu::int16_t>()) && (v <= capu::NumericLimits::Max<capu::int16_t>()))
return checkShort((capu::int16_t) v);
return EtchTypeCode::INT;
}
capu::int8_t EtchBinaryTaggedData::checkLong(capu::int64_t v) {
- if (v >= capu::NumericLimitMin<capu::int32_t>() && v <= capu::NumericLimitMax<capu::int32_t>())
+ if (v >= capu::NumericLimits::Min<capu::int32_t>() && v <= capu::NumericLimits::Max<capu::int32_t>())
return checkInteger((capu::int32_t) v);
return EtchTypeCode::LONG;
diff --git a/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataOutput.cpp b/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataOutput.cpp
index f4532a1..daecf93 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataOutput.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchBinaryTaggedDataOutput.cpp
@@ -127,13 +127,13 @@
status_t ret;
EtchType* t = sv->getType();
EtchStructValue::Iterator it = sv->begin();
- EtchStructValue::Pair pair;
+ EtchStructValue::HashTableEntry entry;
capu::SmartPointer<EtchValidator> tmp;
while (it.hasNext()) {
- if (it.next(&pair) == ETCH_OK) {
+ if (it.next(&entry) == ETCH_OK) {
- EtchField f = pair.first;
+ EtchField f = entry.key;
ret = writeField(&f);
if (ret != ETCH_OK) {
@@ -145,13 +145,14 @@
return ETCH_ERROR;
}
- ret = writeValue(tmp, pair.second);
+ ret = writeValue(tmp, entry.value);
if (ret != ETCH_OK) {
return ETCH_ERROR;
}
} else {
return ETCH_ERROR;
}
+
}
return ETCH_OK;
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchClass2TypeMap.cpp b/binding-cpp/runtime/src/main/serialization/EtchClass2TypeMap.cpp
index 63fcf07..9ed5394 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchClass2TypeMap.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchClass2TypeMap.cpp
@@ -22,7 +22,7 @@
#include "serialization/EtchClass2TypeMap.h"
EtchClass2TypeMap::EtchClass2TypeMap()
-: mC2T(ETCH_DEFAULT_C2TYPEMAP_HASH_SIZE), mLocked(false) {
+: mC2T(ETCH_DEFAULT_C2TYPEMAP_HASH_BIT_SIZE), mLocked(false) {
}
EtchClass2TypeMap::~EtchClass2TypeMap() {
diff --git a/binding-cpp/runtime/src/main/serialization/EtchFieldMap.cpp b/binding-cpp/runtime/src/main/serialization/EtchFieldMap.cpp
index cf0acb0..591d7a2 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchFieldMap.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchFieldMap.cpp
@@ -20,7 +20,7 @@
#include "serialization/EtchFieldMap.h"
EtchFieldMap::EtchFieldMap()
-: mById(ETCH_DEFAULT_FIELDMAP_HASH_SIZE), mByName(ETCH_DEFAULT_FIELDMAP_HASH_SIZE), mLocked(false) {
+: mById(ETCH_DEFAULT_FIELDMAP_HASH_BIT_SIZE), mByName(ETCH_DEFAULT_FIELDMAP_HASH_BIT_SIZE), mLocked(false) {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp b/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp
index ee8a9d6..d7232ec 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp
@@ -45,13 +45,13 @@
EtchHashTable<capu::SmartPointer<EtchObject>, capu::SmartPointer<EtchObject> >::Iterator it = table->begin();
capu::SmartPointer<EtchNativeArray<capu::SmartPointer<EtchObject> > > keysAndValuesArray = new EtchNativeArray<capu::SmartPointer<EtchObject> > (table->count()*2);
capu::int32_t i = 0;
- EtchHashTable<capu::SmartPointer<EtchObject>, capu::SmartPointer<EtchObject> >::Pair ptr;
+ EtchHashTable<capu::SmartPointer<EtchObject>, capu::SmartPointer<EtchObject> >::HashTableEntry entry;
while (it.hasNext()) {
- it.next(&ptr);
- keysAndValuesArray->set(i, ptr.first);
+ it.next(&entry);
+ keysAndValuesArray->set(i, entry.key);
i++;
- keysAndValuesArray->set(i, ptr.second);
+ keysAndValuesArray->set(i, entry.value);
i++;
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp b/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp
index 5b64659..4acc00c 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp
@@ -41,12 +41,10 @@
}
-status_t EtchStructValue::put(const EtchField &field, capu::SmartPointer<EtchObject> object, capu::SmartPointer<EtchObject> *old_value) {
+status_t EtchStructValue::put(const EtchField &field, capu::SmartPointer<EtchObject> object) {
if (object.get() == NULL) {
capu::SmartPointer<EtchObject> tmp;
status_t result = remove(field, &tmp);
- if (old_value != NULL)
- *old_value = tmp;
return result;
}
if (mLevel != LEVEL_NONE) {
@@ -60,7 +58,7 @@
if ((v.get() != NULL) && (!v->validate(object)))
return ETCH_EINVAL;
}
- return mTable.put(field, object, old_value);
+ return mTable.put(field, object);
}
EtchType* EtchStructValue::getType() {
@@ -84,12 +82,7 @@
}
status_t EtchStructValue::clear() {
- EtchHashTable<EtchField, capu::SmartPointer<EtchObject> >::Iterator it = mTable.begin();
- EtchHashTable<EtchField, capu::SmartPointer<EtchObject> >::Pair pair;
- while (it.hasNext()) {
- it.next(&pair);
- pair.second = NULL;
- }
+ mTable.clear();
return ETCH_OK;
}
@@ -102,7 +95,6 @@
return mTable.begin();
}
-
capu::bool_t EtchStructValue::isEmpty()
{
if(mTable.count() == 0) {
diff --git a/binding-cpp/runtime/src/main/serialization/EtchType.cpp b/binding-cpp/runtime/src/main/serialization/EtchType.cpp
index ced219c..7f6cd41 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchType.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchType.cpp
@@ -24,26 +24,26 @@
return &TYPE;
}
EtchType::EtchType()
-: mValidatorMap(ETCH_DEFAULT_TYPEVALIDATOR_HASH_SIZE), mId(0), mTimeout(0), mName(""), mSuperType(NULL), mResultType(NULL),
+: mValidatorMap(ETCH_DEFAULT_TYPEVALIDATOR_HASH_BIT_SIZE), mId(0), mTimeout(0), mName(""), mSuperType(NULL), mResultType(NULL),
mDirection(BOTH), mAsyncMode(NONE), mLocked(false), mComponentType(NULL), mHelper(NULL), mStubHelper(NULL) {
addObjectType(TYPE());
}
EtchType::EtchType(EtchString name)
-: mValidatorMap(ETCH_DEFAULT_TYPEVALIDATOR_HASH_SIZE), mTimeout(0), mName(name), mSuperType(NULL),
+: mValidatorMap(ETCH_DEFAULT_TYPEVALIDATOR_HASH_BIT_SIZE), mTimeout(0), mName(name), mSuperType(NULL),
mResultType(NULL), mDirection(BOTH), mAsyncMode(NONE), mLocked(false), mComponentType(NULL), mHelper(NULL), mStubHelper(NULL) {
mId = EtchHashEx::Digest(mName);
addObjectType(TYPE());
}
EtchType::EtchType(capu::uint32_t id, EtchString name)
-: mValidatorMap(ETCH_DEFAULT_TYPEVALIDATOR_HASH_SIZE), mId(id), mTimeout(0), mName(name), mSuperType(NULL),
+: mValidatorMap(ETCH_DEFAULT_TYPEVALIDATOR_HASH_BIT_SIZE), mId(id), mTimeout(0), mName(name), mSuperType(NULL),
mResultType(NULL), mDirection(BOTH), mAsyncMode(NONE), mLocked(false), mComponentType(NULL), mHelper(NULL), mStubHelper(NULL) {
addObjectType(TYPE());
}
EtchType::EtchType(const EtchType& other)
- : EtchObject(other), mValidatorMap(ETCH_DEFAULT_TYPEVALIDATOR_HASH_SIZE), mId(other.mId), mTimeout(other.mTimeout), mName(other.mName), mSuperType(other.mSuperType),
+ : EtchObject(other), mValidatorMap(ETCH_DEFAULT_TYPEVALIDATOR_HASH_BIT_SIZE), mId(other.mId), mTimeout(other.mTimeout), mName(other.mName), mSuperType(other.mSuperType),
mResultType(other.mResultType), mDirection(other.mDirection), mAsyncMode(other.mAsyncMode), mLocked(other.mLocked),
mComponentType(other.mComponentType), mHelper(other.mHelper), mStubHelper(other.mStubHelper) {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchTypeMap.cpp b/binding-cpp/runtime/src/main/serialization/EtchTypeMap.cpp
index 7a95070..294b4c5 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchTypeMap.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchTypeMap.cpp
@@ -22,16 +22,16 @@
// TODO: Check memory handling
EtchTypeMap::EtchTypeMap()
-: mById(ETCH_DEFAULT_TYPEMAP_HASH_SIZE), mByName(ETCH_DEFAULT_TYPEMAP_HASH_SIZE), mLocked(false) {
+: mById(ETCH_DEFAULT_TYPEMAP_HASH_BIT_SIZE), mByName(ETCH_DEFAULT_TYPEMAP_HASH_BIT_SIZE), mLocked(false) {
}
EtchTypeMap::~EtchTypeMap() {
- EtchHashTable<capu::int32_t, EtchType*, capu::Hash, capu::Comparator >::Iterator it = mById.begin();
+ EtchHashTable<capu::int32_t, EtchType*, EtchComparatorNative, EtchHashNative>::Iterator it = mById.begin();
while (it.hasNext()) {
- capu::Pair<capu::int32_t, EtchType*> pair;
- it.next(&pair);
- if (pair.second != NULL) {
- delete pair.second;
+ EtchHashTable<capu::int32_t, EtchType*, EtchComparatorNative, EtchHashNative>::HashTableEntry entry;
+ it.next(&entry);
+ if (entry.value != NULL) {
+ delete entry.value;
}
}
mById.clear();
@@ -89,20 +89,20 @@
if (set == NULL)
return ETCH_EINVAL;
EtchHashTable<EtchString, EtchType* >::Iterator it = mByName.begin();
- EtchHashTable<EtchString, EtchType* >::Pair pair;
+ EtchHashTable<EtchString, EtchType* >::HashTableEntry entry;
while (it.hasNext()) {
- it.next(&pair);
- set->put(pair.second);
+ it.next(&entry);
+ set->put(entry.value);
}
return ETCH_OK;
}
void EtchTypeMap::clear() {
EtchHashTable<EtchString, EtchType* >::Iterator it = mByName.begin();
- EtchHashTable<EtchString, EtchType* >::Pair pair;
+ EtchHashTable<EtchString, EtchType* >::HashTableEntry entry;
while (it.hasNext()) {
- it.next(&pair);
- delete pair.second;
+ it.next(&entry);
+ delete entry.value;
}
mByName.clear();
mById.clear();
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
index b895a72..80b8bbf 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
@@ -55,17 +55,17 @@
if (value->getObjectType()->equals(EtchShort::TYPE())) {
EtchShort *v = (EtchShort *) value.get();
- return ((v->get() >= capu::NumericLimitMin<capu::int8_t > ()) && (v->get() <= capu::NumericLimitMax<capu::int8_t > ()));
+ return ((v->get() >= capu::NumericLimits::Min<capu::int8_t > ()) && (v->get() <= capu::NumericLimits::Max<capu::int8_t > ()));
}
if (value->getObjectType()->equals(EtchInt32::TYPE())) {
EtchInt32 *v = (EtchInt32 *) value.get();
- return ((v->get() >= capu::NumericLimitMin<capu::int8_t > ()) && (v->get() <= capu::NumericLimitMax<capu::int8_t > ()));
+ return ((v->get() >= capu::NumericLimits::Min<capu::int8_t > ()) && (v->get() <= capu::NumericLimits::Max<capu::int8_t > ()));
}
if (value->getObjectType()->equals(EtchLong::TYPE())) {
EtchLong *v = (EtchLong *) value.get();
- return ((v->get() >= capu::NumericLimitMin<capu::int8_t > ()) && (v->get() <= capu::NumericLimitMax<capu::int8_t > ()));
+ return ((v->get() >= capu::NumericLimits::Min<capu::int8_t > ()) && (v->get() <= capu::NumericLimits::Max<capu::int8_t > ()));
}
//array handling
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp
index fcb6c1a..766c73f 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp
@@ -27,7 +27,7 @@
* Validator cache
*/
struct ValidatorCache {
- ValidatorCache() : id(0), validators(ETCH_DEFAULT_CUSTOMVALIDATORCACHE_HASH_SIZE) {}
+ ValidatorCache() : id(0), validators(ETCH_DEFAULT_CUSTOMVALIDATORCACHE_HASH_BIT_SIZE) {}
capu::uint64_t id;
EtchHashTable<EtchValidatorCustomKey, capu::SmartPointer<EtchValidator> > validators;
};
@@ -42,7 +42,7 @@
* Destructor
*/
virtual ~EtchValidatorCustomCaches() {
- capu::List<ValidatorCache*>::Iterator iter = mValidatorsCache.begin();
+ EtchList<ValidatorCache*>::Iterator iter = mValidatorsCache.begin();
while(iter.hasNext()) {
ValidatorCache* entry = NULL;
iter.next(&entry);
@@ -56,7 +56,7 @@
}
EtchHashTable<EtchValidatorCustomKey, capu::SmartPointer<EtchValidator> >& get(EtchRuntime* runtime) {
- capu::List<ValidatorCache*>::Iterator iter = mValidatorsCache.begin();
+ EtchList<ValidatorCache*>::Iterator iter = mValidatorsCache.begin();
while(iter.hasNext()) {
ValidatorCache* entry = NULL;
iter.next(&entry);
@@ -71,7 +71,7 @@
}
private:
- capu::List<ValidatorCache*> mValidatorsCache;
+ EtchList<ValidatorCache*> mValidatorsCache;
};
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
index 161b23a..a8b7655 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
@@ -60,7 +60,7 @@
if (value->getObjectType()->equals(EtchLong::TYPE())) {
EtchLong *v = (EtchLong *) value.get();
- return ((v->get() >= capu::NumericLimitMin<capu::int32_t > ()) && (v->get() <= capu::NumericLimitMax<capu::int32_t > ()));
+ return ((v->get() >= capu::NumericLimits::Min<capu::int32_t > ()) && (v->get() <= capu::NumericLimits::Max<capu::int32_t > ()));
}
//handle array
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
index 4336233..50f3481 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
@@ -59,12 +59,12 @@
if (value->getObjectType()->equals(EtchInt32::TYPE())) {
EtchInt32 *v = (EtchInt32 *) value.get();
- return ((v->get() >= capu::NumericLimitMin<capu::int16_t > ()) && (v->get() <= capu::NumericLimitMax<capu::int16_t > ()));
+ return ((v->get() >= capu::NumericLimits::Min<capu::int16_t > ()) && (v->get() <= capu::NumericLimits::Max<capu::int16_t > ()));
}
if (value->getObjectType()->equals(EtchLong::TYPE())) {
EtchLong *v = (EtchLong *) value.get();
- return ((v->get() >= capu::NumericLimitMin<capu::int16_t > ()) && (v->get() <= capu::NumericLimitMax<capu::int16_t > ()));
+ return ((v->get() >= capu::NumericLimits::Min<capu::int16_t > ()) && (v->get() <= capu::NumericLimits::Max<capu::int16_t > ()));
}
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
diff --git a/binding-cpp/runtime/src/main/support/EtchFreePool.cpp b/binding-cpp/runtime/src/main/support/EtchFreePool.cpp
index 558e18f..b25c0c2 100644
--- a/binding-cpp/runtime/src/main/support/EtchFreePool.cpp
+++ b/binding-cpp/runtime/src/main/support/EtchFreePool.cpp
@@ -19,6 +19,7 @@
#include "support/EtchFreePool.h"
#include "capu/os/Thread.h"
+#include "capu/util/Runnable.h"
#include "capu/os/Memory.h"
#include "capu/util/Runnable.h"
@@ -53,7 +54,6 @@
}
}
}
- delete this;
}
private:
@@ -71,10 +71,13 @@
addObjectType(TYPE());
mThreads = new capu::Thread*[mSizeMax];
capu::Memory::Set(mThreads, 0, sizeof(capu::Thread*)*mSizeMax);
+ mRunnables = new EtchFreePoolRunnable*[mSizeMax];
+ capu::Memory::Set(mRunnables, 0, sizeof(EtchFreePoolRunnable*)*mSizeMax);
}
EtchFreePool::~EtchFreePool() {
delete[] mThreads;
+ delete[] mRunnables;
}
status_t EtchFreePool::close() {
@@ -98,7 +101,9 @@
if(mThreads[i] != NULL) {
mThreads[i]->join();
delete mThreads[i];
+ delete mRunnables[i];
mThreads[i] = NULL;
+ mRunnables[i] = NULL;
}
}
mMutex.unlock();
@@ -124,13 +129,14 @@
return ETCH_ERROR;
}
- EtchFreePoolRunnable* tmp = new EtchFreePoolRunnable(this, runnable);
- capu::Thread* thread = new capu::Thread(tmp);
- thread->start();
+ EtchFreePoolRunnable *tmp = new EtchFreePoolRunnable(this, runnable);
+ capu::Thread* thread = new capu::Thread();
+ thread->start(*tmp);
for(capu::int32_t i = 0; i < mSizeMax; i++) {
if(mThreads[i] == NULL) {
mThreads[i] = thread;
+ mRunnables[i] = tmp;
mSize++;
mMutex.unlock();
return ETCH_OK;
@@ -149,6 +155,11 @@
if(capu::TS_TERMINATED == state) {
delete mThreads[i];
mThreads[i] = NULL;
+
+ if (mRunnables[i] != NULL) {
+ delete mRunnables[i];
+ mRunnables[i] = NULL;
+ }
mSize--;
}
}
diff --git a/binding-cpp/runtime/src/main/support/EtchMonitor.cpp b/binding-cpp/runtime/src/main/support/EtchMonitor.cpp
index 470d295..51a1ca9 100644
--- a/binding-cpp/runtime/src/main/support/EtchMonitor.cpp
+++ b/binding-cpp/runtime/src/main/support/EtchMonitor.cpp
@@ -60,7 +60,7 @@
status_t EtchMonitor::waitUntilEqIntern(const EtchString& desiredValue, capu::int32_t maxDelay) {
capu::uint64_t now = capu::Time::GetMilliseconds();
- capu::uint64_t end = (maxDelay > 0) ? now + maxDelay : capu::NumericLimitMax<capu::uint32_t>();
+ capu::uint64_t end = (maxDelay > 0) ? now + maxDelay : capu::NumericLimits::Max<capu::int64_t>();
capu::int64_t d = end - now;
while (!eq(mValue, desiredValue) && d > 0) {
@@ -117,7 +117,7 @@
status_t EtchMonitor::waitUntilNotEqIntern(const EtchString& undesiredValue, capu::uint32_t maxDelay, EtchString& current) {
capu::uint64_t now = capu::Time::GetMilliseconds();
- capu::uint64_t end = (maxDelay > 0) ? now + maxDelay : capu::NumericLimitMax<capu::uint32_t>();
+ capu::uint64_t end = (maxDelay > 0) ? now + maxDelay : capu::NumericLimits::Max<capu::int64_t>();
capu::int64_t d = end - now;
while (eq(mValue, undesiredValue) && d > 0) {
diff --git a/binding-cpp/runtime/src/main/support/EtchQueuedPool.cpp b/binding-cpp/runtime/src/main/support/EtchQueuedPool.cpp
index 392cf18..a64397b 100644
--- a/binding-cpp/runtime/src/main/support/EtchQueuedPool.cpp
+++ b/binding-cpp/runtime/src/main/support/EtchQueuedPool.cpp
@@ -80,7 +80,7 @@
}
status_t EtchQueuedPool::join() {
- mPool->join();
+ mPool->close();
return ETCH_OK;
}
diff --git a/binding-cpp/runtime/src/main/support/EtchRuntime.cpp b/binding-cpp/runtime/src/main/support/EtchRuntime.cpp
index 1cbc987..bb6a9c7 100644
--- a/binding-cpp/runtime/src/main/support/EtchRuntime.cpp
+++ b/binding-cpp/runtime/src/main/support/EtchRuntime.cpp
@@ -46,7 +46,7 @@
}
mMutex.lock();
- mListeners.add(listener);
+ mListeners.insert(listener);
mMutex.unlock();
return ETCH_OK;
}
@@ -56,7 +56,7 @@
mMutex.lock();
capu::int_t index = mListeners.find(listener);
if(index != -1) {
- mListeners.removeAt(index);
+ mListeners.erase(index);
status = ETCH_OK;
} else {
status = ETCH_ERROR;
@@ -81,9 +81,9 @@
mMutex.lock();
capu::List<EtchRuntimeListener*>::Iterator iter = mListeners.begin();
- while(iter.hasNext()) {
- EtchRuntimeListener* listener = NULL;
- iter.next(&listener);
+ while(iter != mListeners.end()) {
+ EtchRuntimeListener* listener = *iter;
+ iter++;
listener->onRuntimeChanged(this);
}
mMutex.unlock();
diff --git a/binding-cpp/runtime/src/main/transport/EtchPlainMailboxManager.cpp b/binding-cpp/runtime/src/main/transport/EtchPlainMailboxManager.cpp
index a93183e..67b4a25 100644
--- a/binding-cpp/runtime/src/main/transport/EtchPlainMailboxManager.cpp
+++ b/binding-cpp/runtime/src/main/transport/EtchPlainMailboxManager.cpp
@@ -20,19 +20,19 @@
#include "capu/os/Debug.h"
EtchPlainMailboxManager::EtchPlainMailboxManager(EtchRuntime* runtime, EtchTransportMessage* transport, const EtchString& uri, EtchResources* resources)
-: mRuntime(runtime), mSession(NULL), mTransport(transport), mUp(false), mMailboxes(ETCH_DEFAULT_MAILBOXMANAGER_HASH_SIZE) {
+: mRuntime(runtime), mSession(NULL), mTransport(transport), mUp(false), mMailboxes(ETCH_DEFAULT_MAILBOXMANAGER_HASH_BIT_SIZE) {
capu::Debug::Assert(mRuntime != NULL);
mTransport->setSession(this);
}
EtchPlainMailboxManager::~EtchPlainMailboxManager() {
EtchHashTable<EtchLong, EtchMailbox*>::Iterator it = mMailboxes.begin();
- EtchHashTable<EtchLong, EtchMailbox*>::Pair p;
+ EtchHashTable<EtchLong, EtchMailbox*>::HashTableEntry entry;
// TODO check thread safety
while (it.hasNext()) {
- it.next(&p);
- p.second->closeDelivery();
- delete p.second;
+ it.next(&entry);
+ entry.value->closeDelivery();
+ delete entry.value;
}
}
@@ -180,11 +180,11 @@
mUp = false;
// TODO check thread safety
EtchHashTable<EtchLong, EtchMailbox*>::Iterator it = mMailboxes.begin();
- EtchHashTable<EtchLong, EtchMailbox*>::Pair p;
+ EtchHashTable<EtchLong, EtchMailbox*>::HashTableEntry entry;
while (it.hasNext()) {
- it.next(&p);
- p.second->closeDelivery();
- delete p.second;
+ it.next(&entry);
+ entry.value->closeDelivery();
+ delete entry.value;
}
CAPU_LOG_TRACE(mRuntime->getLogger(), "EtchPlainMailboxManager", "Connection is down");
}
diff --git a/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp b/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp
index 6c01079..398823f 100644
--- a/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp
+++ b/binding-cpp/runtime/src/main/transport/EtchTcpConnection.cpp
@@ -54,7 +54,7 @@
status_t EtchTcpConnection::send(capu::int8_t* buf, capu::uint32_t off, capu::uint32_t len) {
if (mSocket != NULL) {
CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%d byte of data has been transmitted", len);
- return mSocket->send((unsigned char *) &buf[off], len);
+ return mSocket->send((capu::char_t*)&buf[off], len);
}
CAPU_LOG_WARN(mRuntime->getLogger(), "EtchTcpConnection", "%d byte of data has not been transmitted because there is no connection", len);
return ETCH_ERROR;
@@ -65,7 +65,7 @@
while (mIsStarted) {
capu::int32_t n;
- status_t result = mSocket->receive((unsigned char *) buf->getBuffer(), buf->getSize(), n);
+ status_t result = mSocket->receive((capu::char_t*)buf->getBuffer(), buf->getSize(), n);
if (result != ETCH_OK) {
CAPU_LOG_ERROR(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Receive() failed with error code %d", mHost.c_str(), mPort, result);
return result;
@@ -126,7 +126,7 @@
if (mSocket == NULL) {
mSocket = new EtchSocket();
}
- if (mSocket->connect((unsigned char *) mHost.c_str(), mPort) == ETCH_OK) {
+ if (mSocket->connect((capu::char_t*) mHost.c_str(), mPort) == ETCH_OK) {
mMutexConnection.unlock();
CAPU_LOG_TRACE(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Connection established", mHost.c_str(), mPort);
return ETCH_OK;
@@ -167,8 +167,8 @@
}
mIsStarted = true;
mMutex.unlock();
- mThread = new capu::Thread(this);
- mThread->start();
+ mThread = new capu::Thread();
+ mThread->start(*this);
CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Start command received and EtchTcpConnection Receiving Thread has started", mHost.c_str(), mPort);
return ETCH_OK;
}
@@ -182,8 +182,8 @@
}
mIsStarted = true;
mMutex.unlock();
- mThread = new capu::Thread(this);
- mThread->start();
+ mThread = new capu::Thread();
+ mThread->start(*this);
CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpConnection", "%s : %d => Start and wait command received and EtchTcpConnection Receiving Thread has started", mHost.c_str(), mPort);
return waitUp(((EtchInt32*) value.get())->get());
}
diff --git a/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp b/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp
index 8f37710..9714a0b 100644
--- a/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp
+++ b/binding-cpp/runtime/src/main/transport/EtchTcpListener.cpp
@@ -168,12 +168,12 @@
mMutex.lock();
mIsStarted = true;
mMutex.unlock();
- mThread = new capu::Thread(this);
+ mThread = new capu::Thread();
+ mThread->start(*this);
mConnectionChecker = new ConnectionChecker(this);
- mConnectionCheckerThread = new capu::Thread(mConnectionChecker);
- mThread->start();
+ mConnectionCheckerThread = new capu::Thread();
+ mConnectionCheckerThread->start(*mConnectionChecker);
CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Start command received and EtchTcpListener starts listening on port %d", mPort);
- mConnectionCheckerThread->start();
return ETCH_OK;
}
@@ -185,12 +185,12 @@
mMutex.lock();
mIsStarted = true;
mMutex.unlock();
- mThread = new capu::Thread(this);
+ mThread = new capu::Thread();
+ mThread->start(*this);
mConnectionChecker = new ConnectionChecker(this);
- mConnectionCheckerThread = new capu::Thread(mConnectionChecker);
- mThread->start();
+ mConnectionCheckerThread = new capu::Thread();
+ mConnectionCheckerThread->start(*mConnectionChecker);
CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Start and wait up command received and EtchTcpListener starts listening on port %d", mPort);
- mConnectionCheckerThread->start();
return waitUp(((EtchInt32*) value.get())->get());
}
@@ -231,7 +231,8 @@
close();
mThread->join();
mIsStarted = true;
- mThread = new capu::Thread(this);
+ mThread = new capu::Thread();
+ mThread->start(*this);
CAPU_LOG_DEBUG(mRuntime->getLogger(), "EtchTcpListener", "Reset command received and EtchTcpListener has been restarted the stop flag");
return ETCH_OK;
}
diff --git a/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp b/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp
index 517afef..491b059 100644
--- a/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp
+++ b/binding-cpp/runtime/src/main/transport/EtchTcpTransportFactory.cpp
@@ -113,7 +113,7 @@
if (mTransport != NULL) {
mTransport->setSession(this);
}
- mConnectionStacks = new capu::List<EtchStack*>();
+ mConnectionStacks = new EtchList<EtchStack*>();
}
EtchServerFactory* EtchTcpTransportFactory::MySessionListener::getSession() {
@@ -131,7 +131,7 @@
EtchTransportHelper::DestroyResources(mRuntime, mResources);
}
- capu::List<EtchStack*>::Iterator it = mConnectionStacks->begin();
+ EtchList<EtchStack*>::Iterator it = mConnectionStacks->begin();
while (it.hasNext()) {
EtchStack* st = NULL;
it.next(&st);
@@ -169,10 +169,10 @@
status_t EtchTcpTransportFactory::MySessionListener::sessionNotify(capu::SmartPointer<EtchObject> event) {
if (event->equals(&EtchTcpListener::CONNECTION_CHECK())) {
//go through the list of connection and check if the connection is still dead and we have to clean the stack up
- capu::List<EtchStack*>::Iterator it = mConnectionStacks->begin();
+ EtchList<EtchStack*>::Iterator it = mConnectionStacks->begin();
while (it.hasNext()) {
EtchStack* stack = NULL;
- status_t res = it.current(&stack);
+ status_t res = it.current(stack);
if (res == ETCH_OK) {
EtchTcpConnection* con = (EtchTcpConnection*) stack->getTransportData();
if (con != NULL) {
diff --git a/binding-cpp/runtime/src/main/util/EtchCircularQueue.cpp b/binding-cpp/runtime/src/main/util/EtchCircularQueue.cpp
index 8670f41..3c1c90a 100644
--- a/binding-cpp/runtime/src/main/util/EtchCircularQueue.cpp
+++ b/binding-cpp/runtime/src/main/util/EtchCircularQueue.cpp
@@ -125,7 +125,7 @@
// the queue is empty, not closed, and caller has requested a delay...
capu::int64_t now = capu::Time::GetMilliseconds();
- capu::int64_t end = (maxDelay > 0) ? now + maxDelay : capu::NumericLimitMax<capu::uint32_t>();
+ capu::int64_t end = (maxDelay > 0) ? now + maxDelay : capu::NumericLimits::Max<capu::int64_t>();
capu::int64_t d;
while ((d = end - now) > 0) {
@@ -191,8 +191,8 @@
}
// the queue is full, not closed, and the caller has requested a delay...
- capu::uint64_t now = capu::Time::GetMilliseconds();
- capu::uint64_t end = (maxDelay > 0) ? now + maxDelay : capu::NumericLimitMax<capu::uint32_t>();
+ capu::int64_t now = capu::Time::GetMilliseconds();
+ capu::int64_t end = (maxDelay > 0) ? now + maxDelay : capu::NumericLimits::Max<capu::int64_t>();
capu::int64_t d;
while((d = end - now) > 0) {
diff --git a/binding-cpp/runtime/src/main/util/EtchResources.cpp b/binding-cpp/runtime/src/main/util/EtchResources.cpp
index c37c625..fa3cdad 100644
--- a/binding-cpp/runtime/src/main/util/EtchResources.cpp
+++ b/binding-cpp/runtime/src/main/util/EtchResources.cpp
@@ -19,7 +19,7 @@
#include "util/EtchResources.h"
EtchResources::EtchResources()
-: mRelated(NULL), mRes(ETCH_DEFAULT_RESOURCES_HASH_SIZE) {
+: mRelated(NULL), mRes(ETCH_DEFAULT_RESOURCES_HASH_BIT_SIZE) {
}
diff --git a/binding-cpp/runtime/src/main/util/EtchURL.cpp b/binding-cpp/runtime/src/main/util/EtchURL.cpp
index 64a6161..fff3e98 100644
--- a/binding-cpp/runtime/src/main/util/EtchURL.cpp
+++ b/binding-cpp/runtime/src/main/util/EtchURL.cpp
@@ -19,7 +19,7 @@
#include "capu/os/StringUtils.h"
EtchURL::EtchURL()
- : terms(ETCH_DEFAULT_URL_TERMS_HASH_SIZE) {
+ : terms(ETCH_DEFAULT_URL_TERMS_HASH_BIT_SIZE) {
}
diff --git a/binding-cpp/runtime/src/main/util/EtchUtil.cpp b/binding-cpp/runtime/src/main/util/EtchUtil.cpp
index 67fb458..18f9c84 100644
--- a/binding-cpp/runtime/src/main/util/EtchUtil.cpp
+++ b/binding-cpp/runtime/src/main/util/EtchUtil.cpp
@@ -48,7 +48,7 @@
}
}
-status_t etch_strlen_utf8(const char *src, capu::int32_t &length) {
+status_t etch_strlen_utf8(const char *src, capu::uint32_t &length) {
if (src == NULL)
return ETCH_EINVAL;
length = 0;
diff --git a/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp b/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp
index 8d72b2b..26d32cb 100644
--- a/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp
@@ -62,7 +62,7 @@
}
TEST(EtchFloatTest, copyTest) {
- EtchFloat o1(2.123);
+ EtchFloat o1(static_cast<capu::float_t>(2.123));
EtchFloat o2(o1);
EtchFloat o3 = o2;
EXPECT_TRUE(o1.equals(&o2));
@@ -70,7 +70,7 @@
}
TEST(EtchFloatTest, isInstanceOf) {
- EtchObject* o1 = new EtchFloat(2.123);
+ EtchObject* o1 = new EtchFloat(static_cast<capu::float_t>(2.123));
EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
EXPECT_TRUE(o1->isInstanceOf(EtchFloat::TYPE()));
EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
diff --git a/binding-cpp/runtime/src/test/common/EtchHashSetTest.cpp b/binding-cpp/runtime/src/test/common/EtchHashSetTest.cpp
index a5380f8..e35c4ea 100644
--- a/binding-cpp/runtime/src/test/common/EtchHashSetTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchHashSetTest.cpp
@@ -20,15 +20,15 @@
#include "common/EtchError.h"
#include "common/EtchHashSet.h"
-#include "common/EtchHashNative.h"
#include "common/EtchComparatorNative.h"
+#include "common/EtchHashNative.h"
#include "common/EtchString.h"
TEST(EtchHashSet, Constructor_Default){
EtchHashSet<EtchString>* set = new EtchHashSet<EtchString > ();
delete set;
- EtchHashSet<char*, EtchHashNative, EtchComparatorNative >* set2 = new EtchHashSet<char*, EtchHashNative, EtchComparatorNative > ();
+ EtchHashSet<char*, EtchComparatorNative, EtchHashNative >* set2 = new EtchHashSet<char*, EtchComparatorNative, EtchHashNative > ();
delete set2;
}
@@ -51,7 +51,7 @@
status = h1->put(value2);
EXPECT_TRUE(status == ETCH_ERROR);
- EtchHashSet<char*, EtchHashNative, EtchComparatorNative >* h2 = new EtchHashSet<char*, EtchHashNative, EtchComparatorNative > ();
+ EtchHashSet<char*, EtchComparatorNative, EtchHashNative >* h2 = new EtchHashSet<char*, EtchComparatorNative, EtchHashNative > ();
// add new key
char* value3 = const_cast<char*>("val1");
@@ -211,9 +211,8 @@
it = h1->begin();
it.next(&check_value);
- EXPECT_TRUE(check_value.equals(&value));
-
it.next(&check_value);
- EXPECT_TRUE(check_value.equals(&value2));
+ EXPECT_EQ(ETCH_ERANGE,it.next());
+
delete h1;
}
diff --git a/binding-cpp/runtime/src/test/common/EtchHashTableTest.cpp b/binding-cpp/runtime/src/test/common/EtchHashTableTest.cpp
index a39c337..fd16d45 100644
--- a/binding-cpp/runtime/src/test/common/EtchHashTableTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchHashTableTest.cpp
@@ -18,8 +18,8 @@
#include <gtest/gtest.h>
#include "common/EtchHashTable.h"
-#include "common/EtchHashNative.h"
#include "common/EtchComparatorNative.h"
+#include "common/EtchHashNative.h"
#include "common/EtchInt32.h"
#include "common/EtchString.h"
@@ -27,7 +27,7 @@
EtchHashTable<EtchString, EtchInt32>* h1 = new EtchHashTable<EtchString, EtchInt32 > ();
delete h1;
- EtchHashTable<char*, capu::int32_t, EtchHashNative, EtchComparatorNative >* h2 = new EtchHashTable<char*, capu::int32_t, EtchHashNative, EtchComparatorNative > ();
+ EtchHashTable<char*, capu::int32_t, EtchComparatorNative, EtchHashNative >* h2 = new EtchHashTable<char*, capu::int32_t, EtchComparatorNative, EtchHashNative > ();
delete h2;
}
@@ -45,7 +45,7 @@
count = h1->count();
EXPECT_TRUE(count == 1);
- EtchHashTable<char*, capu::int32_t, EtchHashNative, EtchComparatorNative >* h2 = new EtchHashTable<char*, capu::int32_t, EtchHashNative, EtchComparatorNative > ();
+ EtchHashTable<char*, capu::int32_t, EtchComparatorNative, EtchHashNative >* h2 = new EtchHashTable<char*, capu::int32_t, EtchComparatorNative, EtchHashNative> ();
// add new key
char* key1 = const_cast<char*>("key1");
capu::int32_t value1 = 5;
@@ -90,8 +90,7 @@
EtchInt32 return_value(-1);
capu::uint64_t count = 5;
- EtchHashTable<EtchString, EtchInt32>* h1 =
- new EtchHashTable<EtchString, EtchInt32 > ();
+ EtchHashTable<EtchString, EtchInt32>* h1 = new EtchHashTable<EtchString, EtchInt32 > ();
// add new key
status = h1->put(key, value);
EXPECT_TRUE(status == ETCH_OK);
@@ -111,7 +110,7 @@
status = h1->get(key2, &return_value);
EXPECT_TRUE(status == ETCH_ENOT_EXIST);
- EtchHashTable<char*, capu::int32_t, EtchHashNative, EtchComparatorNative >* h2 = new EtchHashTable<char*, capu::int32_t, EtchHashNative, EtchComparatorNative > ();
+ EtchHashTable<char*, capu::int32_t, EtchComparatorNative, EtchHashNative >* h2 = new EtchHashTable<char*, capu::int32_t, EtchComparatorNative, EtchHashNative > ();
// add new key
char* key1 = const_cast<char*>("key1");
capu::int32_t value1 = 5;
@@ -122,7 +121,7 @@
status = h2->get(key1, &return_value1);
EXPECT_TRUE(status == ETCH_OK);
//check its value
- EXPECT_TRUE(return_value.get() == value.get());
+ EXPECT_TRUE(return_value1 == value1);
delete h1;
delete h2;
@@ -269,13 +268,12 @@
EtchHashTable<EtchString, EtchInt32>* h1 = new EtchHashTable<EtchString, EtchInt32 > ();
- EtchHashTable<EtchString, EtchInt32>::Pair pair;
//create iterator
EtchHashTable<EtchString, EtchInt32>::Iterator it = h1->begin();
//check hasNext
EXPECT_TRUE(it.hasNext() == false);
-
- EXPECT_TRUE(it.next(&pair) == ETCH_ERANGE);
+ EtchHashTable<EtchString, EtchInt32>::HashTableEntry entry;
+ EXPECT_TRUE(it.next(&entry) == ETCH_ERANGE);
// add new keys
status = h1->put(key, value);
@@ -287,13 +285,9 @@
it = h1->begin();
- it.next(&pair);
- EXPECT_TRUE(strcmp(pair.first.c_str(), key.c_str()) == 0);
- EXPECT_TRUE(pair.second.get() == value.get());
-
- it.next(&pair);
- EXPECT_TRUE(strcmp(pair.first.c_str(), key2.c_str()) == 0);
- EXPECT_TRUE(pair.second.get() == value.get());
+ EXPECT_EQ(ETCH_OK, it.next(&entry));
+ EXPECT_EQ(ETCH_OK, it.next(&entry));
+ EXPECT_EQ(ETCH_ERANGE, it.next(&entry));
delete h1;
}
diff --git a/binding-cpp/runtime/src/test/common/EtchListTest.cpp b/binding-cpp/runtime/src/test/common/EtchListTest.cpp
index 517178d..03e9159 100644
--- a/binding-cpp/runtime/src/test/common/EtchListTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchListTest.cpp
@@ -59,6 +59,7 @@
EtchInt32 data1;
EtchInt32 data2;
EtchInt32 data3;
+ EtchInt32 data4;
status_t result;
data1.set(32);
@@ -68,28 +69,28 @@
result = list->add(data1);
EXPECT_TRUE(result == ETCH_OK);
- result = list->add(data3);
- EXPECT_TRUE(result == ETCH_OK);
-
result = list->add(data2);
EXPECT_TRUE(result == ETCH_OK);
- //removing element at index 1
- result = list->removeAt(1);
+ result = list->add(data3);
EXPECT_TRUE(result == ETCH_OK);
- //removing element at index 1
- result = list->removeAt(1);
+ EtchList<EtchInt32>::Iterator it = list->begin();
+
+ result = list->removeAt(it, &data4);
EXPECT_TRUE(result == ETCH_OK);
+ EXPECT_TRUE(data4.get() == data1.get());
- //removing element at index 0 (HEAD)
- result = list->removeAt(0, &data1);
+ result = list->removeAt(it, &data4);
EXPECT_TRUE(result == ETCH_OK);
- EXPECT_TRUE(data1.get() == 32);
+ EXPECT_TRUE(data4.get() == data2.get());
- //remove element from out of index
- result = list->removeAt(1000);
- EXPECT_TRUE(result == ETCH_EINVAL);
+ result = list->removeAt(it, &data4);
+ EXPECT_TRUE(result == ETCH_OK);
+ EXPECT_TRUE(data4.get() == data3.get());
+
+ EXPECT_FALSE(it.hasNext());
+ EXPECT_EQ(ETCH_ERROR, it.next());
//check size of list
EXPECT_TRUE(list->size() == 0);
diff --git a/binding-cpp/runtime/src/test/common/EtchStringTest.cpp b/binding-cpp/runtime/src/test/common/EtchStringTest.cpp
index d141e09..ebef068 100644
--- a/binding-cpp/runtime/src/test/common/EtchStringTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchStringTest.cpp
@@ -146,16 +146,6 @@
delete s1;
}
-TEST(EtchStringTest, UTF8_Assignment_Test) {
- const capu::uint8_t utf8 [] = {0xF0, 0xA4, 0xAD, 0xA2, 0xE2, 0x82, 0xAC, 0xC2, 0xA2, 0x24};
- EtchString* s1 = new EtchString(NULL, 0, "utf-8");
- *s1 = (const char*)utf8;
- EXPECT_TRUE(s1->c_str() != NULL);
- EXPECT_TRUE(strncmp(s1->c_str(), (const char*)utf8, 10) == 0);
- delete s1;
-}
-//
-
TEST(EtchStringTest, UTF8_len_test) {
const capu::uint8_t utf8 [] = {0xF0, 0xA4, 0xAD, 0xA2, 0xE2, 0x82, 0xAC, 0xC2, 0xA2, 0x24};
EtchString *s = new EtchString((capu::int8_t*)utf8, 10, "utf-8");
diff --git a/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp
index 2c887a7..4cb912e 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp
@@ -105,32 +105,32 @@
static capu::int32_t* testInt() {
capu::int32_t n = 65536 + 2 + 2;
capu::int32_t k = 65536 + 2;
- capu::int32_t min = capu::NumericLimitMin<capu::int16_t > () - 1;
+ capu::int32_t min = capu::NumericLimits::Min<capu::int16_t > () - 1;
capu::int32_t *vals = new capu::int32_t[n];
capu::int32_t i = 0;
while (k > 0) {
vals[i++] = min++;
k--;
}
- vals[i++] = capu::NumericLimitMin<capu::int32_t > ();
- vals[i++] = capu::NumericLimitMax<capu::int32_t > ();
+ vals[i++] = capu::NumericLimits::Min<capu::int32_t > ();
+ vals[i++] = capu::NumericLimits::Max<capu::int32_t > ();
return vals;
}
static capu::int64_t* testLong() {
capu::int32_t n = 65536 + 2 + 6;
capu::int32_t k = 65536 + 2;
- capu::int32_t min = capu::NumericLimitMin<capu::int16_t > () - 1;
+ capu::int32_t min = capu::NumericLimits::Min<capu::int16_t > () - 1;
capu::int64_t* vals = new capu::int64_t[n];
capu::int32_t i = 0;
while (k > 0) {
vals[i++] = min++;
k--;
}
- vals[i++] = capu::NumericLimitMin<capu::int32_t > ();
- vals[i++] = capu::NumericLimitMax<capu::int32_t > ();
- vals[i++] = (capu::int64_t) capu::NumericLimitMin<capu::int32_t > () - (capu::int64_t)1L;
- vals[i++] = (capu::int64_t) capu::NumericLimitMax<capu::int32_t > () + (capu::int64_t)1L;
+ vals[i++] = capu::NumericLimits::Min<capu::int32_t > ();
+ vals[i++] = capu::NumericLimits::Max<capu::int32_t > ();
+ vals[i++] = (capu::int64_t) capu::NumericLimits::Min<capu::int32_t > () - (capu::int64_t)1L;
+ vals[i++] = (capu::int64_t) capu::NumericLimits::Max<capu::int32_t > () + (capu::int64_t)1L;
return vals;
}
@@ -285,7 +285,7 @@
// the parking lot, you don't wanna go there.
// byte values
- for (capu::int8_t i = capu::NumericLimitMin<capu::int8_t > (); i < capu::NumericLimitMax<capu::int8_t > (); i++) {
+ for (capu::int8_t i = capu::NumericLimits::Min<capu::int8_t > (); i < capu::NumericLimits::Max<capu::int8_t > (); i++) {
capu::SmartPointer<EtchByte> _byte = new EtchByte(i);
if (i >= EtchTypeCode::MIN_TINY_INT && i <= EtchTypeCode::MAX_TINY_INT)
EXPECT_TRUE(i == dataIn->checkValue(_byte));
@@ -295,11 +295,11 @@
}
}
// short values
- for (capu::int16_t i = capu::NumericLimitMin<capu::int16_t > (); i < capu::NumericLimitMax<capu::int16_t > (); i++) {
+ for (capu::int16_t i = capu::NumericLimits::Min<capu::int16_t > (); i < capu::NumericLimits::Max<capu::int16_t > (); i++) {
capu::SmartPointer<EtchShort> _short = new EtchShort(i);
if (i >= EtchTypeCode::MIN_TINY_INT && i <= EtchTypeCode::MAX_TINY_INT)
EXPECT_TRUE((capu::int8_t) i == dataIn->checkValue(_short));
- else if (i >= capu::NumericLimitMin<capu::int8_t > () && i <= capu::NumericLimitMax<capu::int8_t > ()) {
+ else if (i >= capu::NumericLimits::Min<capu::int8_t > () && i <= capu::NumericLimits::Max<capu::int8_t > ()) {
capu::int8_t var = EtchTypeCode::BYTE;
EXPECT_TRUE(var == dataIn->checkValue(_short));
} else {
@@ -314,10 +314,10 @@
capu::SmartPointer<EtchInt32> _int = new EtchInt32(array[i]);
if (array[i] >= EtchTypeCode::MIN_TINY_INT && array[i] <= EtchTypeCode::MAX_TINY_INT)
EXPECT_TRUE((capu::int8_t) array[i] == dataIn->checkValue(_int));
- else if ((array[i] >= capu::NumericLimitMin<capu::int8_t > ()) && (array[i] <= capu::NumericLimitMax<capu::int8_t > ())) {
+ else if ((array[i] >= capu::NumericLimits::Min<capu::int8_t > ()) && (array[i] <= capu::NumericLimits::Max<capu::int8_t > ())) {
capu::int8_t var = EtchTypeCode::BYTE;
EXPECT_TRUE(var == dataIn->checkValue(_int));
- } else if ((array[i] >= capu::NumericLimitMin<capu::int16_t > ()) && (array[i] <= capu::NumericLimitMax<capu::int16_t > ())) {
+ } else if ((array[i] >= capu::NumericLimits::Min<capu::int16_t > ()) && (array[i] <= capu::NumericLimits::Max<capu::int16_t > ())) {
capu::int8_t var = EtchTypeCode::SHORT;
EXPECT_TRUE(var == dataIn->checkValue(_int));
} else {
@@ -333,13 +333,13 @@
capu::SmartPointer<EtchLong> _long = new EtchLong(array2[i]);
if (array2[i] >= EtchTypeCode::MIN_TINY_INT && array2[i] <= EtchTypeCode::MAX_TINY_INT)
EXPECT_TRUE((capu::int8_t) array2[i] == dataIn->checkValue(_long));
- else if (array2[i] >= capu::NumericLimitMin<capu::int8_t > () && array2[i] <= capu::NumericLimitMax<capu::int8_t > ()) {
+ else if (array2[i] >= capu::NumericLimits::Min<capu::int8_t > () && array2[i] <= capu::NumericLimits::Max<capu::int8_t > ()) {
capu::int8_t var = EtchTypeCode::BYTE;
EXPECT_TRUE(var == dataIn->checkValue(_long));
- } else if (array2[i] >= capu::NumericLimitMin<capu::int16_t > () && array2[i] <= capu::NumericLimitMax<capu::int16_t > ()) {
+ } else if (array2[i] >= capu::NumericLimits::Min<capu::int16_t > () && array2[i] <= capu::NumericLimits::Max<capu::int16_t > ()) {
capu::int8_t var = EtchTypeCode::SHORT;
EXPECT_TRUE(var == dataIn->checkValue(_long));
- } else if (array2[i] >= capu::NumericLimitMin<capu::int32_t > () && array2[i] <= capu::NumericLimitMax<capu::int32_t > ()) {
+ } else if (array2[i] >= capu::NumericLimits::Min<capu::int32_t > () && array2[i] <= capu::NumericLimits::Max<capu::int32_t > ()) {
capu::int8_t var = EtchTypeCode::INT;
EXPECT_TRUE(var == dataIn->checkValue(_long));
} else {
diff --git a/binding-cpp/runtime/src/test/serialization/EtchComboValidatorTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchComboValidatorTest.cpp
index c93ca17..d95f6a2 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchComboValidatorTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchComboValidatorTest.cpp
@@ -52,30 +52,30 @@
TEST_F(EtchComboValidatorTest, validateTest) {
capu::SmartPointer<EtchObject> byte = NULL;
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<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::NumericLimits::Max<capu::int32_t>() + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
capu::SmartPointer<EtchObject> str = NULL;
capu::SmartPointer<EtchObject> str2 = new EtchString("hello");
//
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t>());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t>());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
//create combo validator
@@ -159,26 +159,26 @@
capu::SmartPointer<EtchObject> str = NULL;
capu::SmartPointer<EtchObject> str2 = new EtchString("hello");
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<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::NumericLimits::Max<capu::int32_t>() + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t>());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t>());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
//INT TEST
EXPECT_FALSE(element_validator->validate(longInteger5));
diff --git a/binding-cpp/runtime/src/test/serialization/EtchDefaultValueFactoryTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchDefaultValueFactoryTest.cpp
index b268f0b..448d94a 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchDefaultValueFactoryTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchDefaultValueFactoryTest.cpp
@@ -232,7 +232,7 @@
EtchString strRuntime = "_Etch_RuntimeException";
test->getType(strRuntime, type);
EtchStructValue *sv = new EtchStructValue(type, test);
- sv->put(EtchDefaultValueFactory::_mf_msg(), new EtchString("Error Message"), &deserialized);
+ sv->put(EtchDefaultValueFactory::_mf_msg(), new EtchString("Error Message"));
//construct the object
test->importCustomValue(sv, deserialized);
diff --git a/binding-cpp/runtime/src/test/serialization/EtchStructValueTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchStructValueTest.cpp
index 27d1b5a..6de9917 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchStructValueTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchStructValueTest.cpp
@@ -284,7 +284,6 @@
capu::SmartPointer<EtchObject> object = new EtchBool(true);
capu::SmartPointer<EtchObject> object2 = new EtchBool(false);
capu::SmartPointer<EtchObject> object3 = NULL;
- capu::SmartPointer<EtchObject> object4 = NULL;
capu::SmartPointer<EtchObject> object5 = new EtchInt32(32);
//check the empty struct value
@@ -299,7 +298,7 @@
EXPECT_TRUE(sv->put(field3, object5) == ETCH_ENOT_EXIST);
EXPECT_TRUE(sv->count() == 2);
//add a null element and expect a remove operation
- EXPECT_TRUE(sv->put(field1, object3, &object4) == ETCH_OK);
+ EXPECT_TRUE(sv->put(field1, object3) == ETCH_OK);
EXPECT_TRUE(sv->count() == 1);
delete sv;
@@ -334,7 +333,6 @@
capu::SmartPointer<EtchObject> object = new EtchBool(true);
capu::SmartPointer<EtchObject> object2 = new EtchBool(false);
capu::SmartPointer<EtchObject> object3 = NULL;
- capu::SmartPointer<EtchObject> object4 = NULL;
capu::SmartPointer<EtchObject> object5 = new EtchInt32(32);
//check the empty struct value
@@ -349,7 +347,7 @@
EXPECT_TRUE(sv->put(field3, object5) == ETCH_OK);
EXPECT_TRUE(sv->count() == 3);
//add a null element and expect a remove operation
- EXPECT_TRUE(sv->put(field1, object3, &object4) == ETCH_OK);
+ EXPECT_TRUE(sv->put(field1, object3) == ETCH_OK);
EXPECT_TRUE(sv->count() == 2);
delete sv;
@@ -384,7 +382,6 @@
capu::SmartPointer<EtchObject> object = new EtchBool(true);
capu::SmartPointer<EtchObject> object2 = new EtchBool(false);
capu::SmartPointer<EtchObject> object3 = NULL;
- capu::SmartPointer<EtchObject> object4 = NULL;
capu::SmartPointer<EtchObject> object5 = new EtchInt32(32);
//check the empty struct value
@@ -399,7 +396,7 @@
EXPECT_TRUE(sv->put(field3, object5) == ETCH_OK);
EXPECT_TRUE(sv->count() == 3);
//add a null element and expect a remove operation
- EXPECT_TRUE(sv->put(field1, object3, &object4) == ETCH_OK);
+ EXPECT_TRUE(sv->put(field1, object3) == ETCH_OK);
EXPECT_TRUE(sv->count() == 2);
delete sv;
@@ -436,7 +433,7 @@
//add another element
capu::SmartPointer<EtchObject> object2 = new EtchBool(false);
- EXPECT_TRUE(sv->put(field1, object2, &object) == ETCH_OK);
+ EXPECT_TRUE(sv->put(field1, object2) == ETCH_OK);
EXPECT_TRUE(sv->count() == 1);
//get element
diff --git a/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp
index 4d1c775..697d97a 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp
@@ -61,12 +61,12 @@
TEST_F(EtchValidatorDoubleTest, validateTest) {
capu::SmartPointer<EtchObject> byte = NULL;
- capu::SmartPointer<EtchObject> doubleTmp = new EtchDouble(capu::NumericLimitMax<capu::float_t>());
+ capu::SmartPointer<EtchObject> doubleTmp = new EtchDouble(capu::NumericLimits::Max<capu::float_t>());
capu::SmartPointer<EtchObject> doubleTmp1 = new EtchDouble(0);
- capu::SmartPointer<EtchObject> doubleTmp2 = new EtchDouble(capu::NumericLimitMin<capu::float_t>());
+ capu::SmartPointer<EtchObject> doubleTmp2 = new EtchDouble(capu::NumericLimits::Min<capu::float_t>());
capu::SmartPointer<EtchObject> doubleTmp3 = new EtchDouble(897.12);
//exceed limits of Float
- capu::SmartPointer<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::NumericLimits::Max<capu::float_t>() + (capu::double_t)2.12);
//incompatible type
capu::SmartPointer<EtchObject> str = new EtchString();
@@ -107,12 +107,12 @@
capu::SmartPointer<EtchValidator> elementValidator;
ptr->getElementValidator(elementValidator);
- capu::SmartPointer<EtchObject> doubleTmp = new EtchDouble(capu::NumericLimitMax<capu::float_t>());
+ capu::SmartPointer<EtchObject> doubleTmp = new EtchDouble(capu::NumericLimits::Max<capu::float_t>());
capu::SmartPointer<EtchObject> doubleTmp1 = new EtchDouble(0);
- capu::SmartPointer<EtchObject> doubleTmp2 = new EtchDouble(capu::NumericLimitMin<capu::float_t>());
+ capu::SmartPointer<EtchObject> doubleTmp2 = new EtchDouble(capu::NumericLimits::Min<capu::float_t>());
capu::SmartPointer<EtchObject> doubleTmp3 = new EtchDouble(897.12);
//exceed limits of Float
- capu::SmartPointer<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::NumericLimits::Max<capu::float_t>() + (capu::double_t)2.12);
//incompatible type
capu::SmartPointer<EtchObject> str = new EtchString();
diff --git a/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp
index 5a955c7..a1dbdd6 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp
@@ -62,9 +62,9 @@
TEST_F(EtchValidatorFloatTest, validateTest) {
capu::SmartPointer<EtchObject> byte = NULL;
- capu::SmartPointer<EtchObject> floatTmp = new EtchFloat(capu::NumericLimitMin<capu::float_t>());
+ capu::SmartPointer<EtchObject> floatTmp = new EtchFloat(capu::NumericLimits::Min<capu::float_t>());
capu::SmartPointer<EtchObject> floatTmp1 = new EtchFloat(0);
- capu::SmartPointer<EtchObject> floatTmp2 = new EtchFloat(capu::NumericLimitMax<capu::float_t>());
+ capu::SmartPointer<EtchObject> floatTmp2 = new EtchFloat(capu::NumericLimits::Max<capu::float_t>());
capu::SmartPointer<EtchObject> floatTmp3 = new EtchFloat(static_cast<capu::float_t>(897.12));
//incompatible type
@@ -106,9 +106,9 @@
capu::SmartPointer<EtchValidator> elementValidator;
ptr->getElementValidator(elementValidator);
- capu::SmartPointer<EtchObject> floatTmp = new EtchFloat(capu::NumericLimitMin<capu::float_t>());
+ capu::SmartPointer<EtchObject> floatTmp = new EtchFloat(capu::NumericLimits::Min<capu::float_t>());
capu::SmartPointer<EtchObject> floatTmp1 = new EtchFloat(0);
- capu::SmartPointer<EtchObject> floatTmp2 = new EtchFloat(capu::NumericLimitMax<capu::float_t>());
+ capu::SmartPointer<EtchObject> floatTmp2 = new EtchFloat(capu::NumericLimits::Max<capu::float_t>());
capu::SmartPointer<EtchObject> floatTmp3 = new EtchFloat(static_cast<capu::float_t>(897.12));
//incompatible type
diff --git a/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp
index 152d86d..a64613b 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp
@@ -59,29 +59,29 @@
TEST_F(EtchValidatorIntTest, validateTest) {
capu::SmartPointer<EtchObject> byte = NULL;
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<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::NumericLimits::Max<capu::int32_t>() + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
capu::SmartPointer<EtchObject> str = new EtchString();
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t>());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t>());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
capu::SmartPointer<EtchValidator> ptr = NULL;
@@ -137,29 +137,29 @@
capu::SmartPointer<EtchValidator> elementValidator;
ptr->getElementValidator(elementValidator);
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<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::NumericLimits::Max<capu::int32_t>() + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
capu::SmartPointer<EtchObject> str = new EtchString();
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t>());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t>());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
EXPECT_FALSE(elementValidator->validate(str));
diff --git a/binding-cpp/runtime/src/test/serialization/EtchValidatorLongTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchValidatorLongTest.cpp
index 854a001..33939aa 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchValidatorLongTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchValidatorLongTest.cpp
@@ -61,29 +61,29 @@
TEST_F(EtchValidatorLongTest, validateTest) {
capu::SmartPointer<EtchObject> byte = NULL;
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<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::NumericLimits::Max<capu::int32_t>() + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
capu::SmartPointer<EtchObject> str = new EtchString();
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t>());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t>());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
capu::SmartPointer<EtchValidator> ptr = NULL;
EXPECT_TRUE(EtchValidatorLong::Get(mRuntime, 0, ptr) == ETCH_OK);
@@ -135,29 +135,29 @@
capu::SmartPointer<EtchValidator> elementValidator;
ptr->getElementValidator(elementValidator);
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int32_t>());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int32_t>());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<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::NumericLimits::Max<capu::int32_t>() + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
capu::SmartPointer<EtchObject> str = new EtchString();
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t>());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t>());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
EXPECT_FALSE(elementValidator->validate(str));
diff --git a/binding-cpp/runtime/src/test/serialization/EtchValidatorObjectTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchValidatorObjectTest.cpp
index 93e4113..27907ee 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchValidatorObjectTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchValidatorObjectTest.cpp
@@ -74,32 +74,32 @@
TEST_F(EtchValidatorObjectTest, validateValueTest) {
capu::SmartPointer<EtchObject> byte = NULL;
capu::SmartPointer<EtchObject> result = NULL;
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int16_t > ());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t > ());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimitMax<capu::int16_t > () + 2);
+ capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t > () + 2);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int16_t > ());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int16_t > ());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int16_t > () + (capu::int64_t)2);
+ capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimits::Max<capu::int16_t > () + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t > ());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t > ());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
capu::SmartPointer<EtchObject> str = new EtchString();
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t > ());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t > ());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t > ());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t > ());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
capu::SmartPointer<EtchValidator> ptr = NULL;
@@ -133,32 +133,32 @@
ptr->getElementValidator(elementValidator);
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int16_t > ());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t > ());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimitMax<capu::int16_t > () + 2);
+ capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t > () + 2);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int16_t > ());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int16_t > ());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int16_t > () + (capu::int64_t)2);
+ capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimits::Max<capu::int16_t > () + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t > ());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t > ());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t > ());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
capu::SmartPointer<EtchObject> str = new EtchString();
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t > ());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t > ());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t > ());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t > ());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
EXPECT_TRUE(elementValidator->validate(str));
diff --git a/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp
index 504aa67..2e87dc8 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp
@@ -58,32 +58,32 @@
TEST_F(EtchValidatorShortTest, validateTest) {
capu::SmartPointer<EtchObject> byte = NULL;
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>() + 2);
+ capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t>() + 2);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int16_t>() + (capu::int64_t)2);
+ capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimits::Max<capu::int16_t>() + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
capu::SmartPointer<EtchObject> str = new EtchString();
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t>());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t>());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
capu::SmartPointer<EtchValidator> ptr = NULL;
EXPECT_TRUE(EtchValidatorShort::Get(mRuntime, 0, ptr) == ETCH_OK);
@@ -136,32 +136,32 @@
capu::SmartPointer<EtchValidator> elementValidator;
ptr->getElementValidator(elementValidator);
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>() + 2);
+ capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t>() + 2);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int16_t>() + (capu::int64_t)2);
+ capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimits::Max<capu::int16_t>() + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
capu::SmartPointer<EtchObject> str = new EtchString();
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t>());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t>());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
EXPECT_FALSE(elementValidator->validate(str));
diff --git a/binding-cpp/runtime/src/test/serialization/EtchValidatorStructValueTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchValidatorStructValueTest.cpp
index a009084..8847776 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchValidatorStructValueTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchValidatorStructValueTest.cpp
@@ -132,31 +132,31 @@
val->getElementValidator(elementValidator);
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>() + 2);
+ capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t>() + 2);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int16_t>() + (capu::int64_t)2);
+ capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimits::Max<capu::int16_t>() + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
capu::SmartPointer<EtchObject> str2 = new EtchString();
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t>());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t>());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
capu::SmartPointer<EtchObject> structValueval = new EtchStructValue(type, fac);
@@ -196,32 +196,32 @@
capu::SmartPointer<EtchObject> byte = NULL;
- capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> integer = new EtchInt32(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(0);
- capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> integer3 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> integer4 = new EtchInt32(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimitMax<capu::int16_t>() + 2);
+ capu::SmartPointer<EtchObject> integer5 = new EtchInt32(capu::NumericLimits::Max<capu::int16_t>() + 2);
- capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> longInteger = new EtchLong(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> longInteger2 = new EtchLong(0);
- capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> longInteger3 = new EtchLong(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> longInteger4 = new EtchLong(897);
//exceed limits of integer
- capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimitMax<capu::int16_t>() + (capu::int64_t)2);
+ capu::SmartPointer<EtchObject> longInteger5 = new EtchLong((capu::int64_t)capu::NumericLimits::Max<capu::int16_t>() + (capu::int64_t)2);
- capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimitMin<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger = new EtchShort(capu::NumericLimits::Min<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger2 = new EtchShort(0);
- capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimitMax<capu::int16_t>());
+ capu::SmartPointer<EtchObject> shortInteger3 = new EtchShort(capu::NumericLimits::Max<capu::int16_t>());
capu::SmartPointer<EtchObject> shortInteger4 = new EtchShort();
//incompatible type
capu::SmartPointer<EtchObject> str2 = new EtchString();
- capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimitMax<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte1 = new EtchByte(capu::NumericLimits::Max<capu::int8_t>());
capu::SmartPointer<EtchObject> byte2 = new EtchByte(0);
- capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimitMin<capu::int8_t>());
+ capu::SmartPointer<EtchObject> byte3 = new EtchByte(capu::NumericLimits::Min<capu::int8_t>());
capu::SmartPointer<EtchObject> byte4 = new EtchByte(32);
EtchStructValue * value = new EtchStructValue(type, fac);
diff --git a/binding-cpp/runtime/src/test/support/EtchMonitorTest.cpp b/binding-cpp/runtime/src/test/support/EtchMonitorTest.cpp
index 73feb62..c978f69 100644
--- a/binding-cpp/runtime/src/test/support/EtchMonitorTest.cpp
+++ b/binding-cpp/runtime/src/test/support/EtchMonitorTest.cpp
@@ -70,9 +70,9 @@
namespace {
-class R1 : public capu::Runnable {
+class Runnable1 : public capu::Runnable {
public:
- R1(EtchMonitor *monitor) {
+ Runnable1(EtchMonitor *monitor) {
mMonitor = monitor;
}
@@ -103,9 +103,9 @@
// blocking test
m->set(tmp2, current);
- R1* r1 = new R1(m);
- capu::Thread* t1 = new capu::Thread(r1);
- t1->start();
+ Runnable1* r1 = new Runnable1(m);
+ capu::Thread* t1 = new capu::Thread();
+ t1->start(*r1);
EXPECT_EQ(ETCH_OK, m->waitUntilNotEq(tmp2, current));
t1->join();
delete r1;
@@ -134,9 +134,9 @@
m->set(tmp2, current);
// blocking test
m->set(tmp2, current);
- R1* r1 = new R1(m);
- capu::Thread* t1 = new capu::Thread(r1);
- t1->start();
+ Runnable1* r1 = new Runnable1(m);
+ capu::Thread* t1 = new capu::Thread();
+ t1->start(*r1);
EXPECT_EQ(ETCH_OK, m->waitUntilEqAndSet(tmp1, tmp2, current));
t1->join();
delete r1;
@@ -164,9 +164,9 @@
m->set(tmp2, current);
// blocking test
m->set(tmp2, current);
- R1* r1 = new R1(m);
- capu::Thread* t1 = new capu::Thread(r1);
- t1->start();
+ Runnable1* r1 = new Runnable1(m);
+ capu::Thread* t1 = new capu::Thread();
+ t1->start(*r1);
EXPECT_EQ(ETCH_OK, m->waitUntilNotEqAndSet(tmp2, tmp1, current));
t1->join();
delete r1;
diff --git a/binding-cpp/runtime/src/test/support/EtchRemoteBaseTest.cpp b/binding-cpp/runtime/src/test/support/EtchRemoteBaseTest.cpp
index 5fb6caa..0c4e435 100644
--- a/binding-cpp/runtime/src/test/support/EtchRemoteBaseTest.cpp
+++ b/binding-cpp/runtime/src/test/support/EtchRemoteBaseTest.cpp
@@ -326,9 +326,8 @@
EXPECT_TRUE(ETCH_OK == replyMessage->getInReplyToMessageId(id));
capu::SmartPointer<EtchMessage> replymess = replyMessage;
capu::SmartPointer<EtchObject> data = new EtchLong(123);
- capu::SmartPointer<EtchObject> old;
EtchField field = replyType->getResponseField();
- replyMessage->put(field, data, &old);
+ replyMessage->put(field, data);
//call the sessionMessage of mailbox manager as if it is called from messagizer to deliver data from
EXPECT_TRUE(ETCH_OK == manager->sessionMessage(NULL, replymess));
capu::SmartPointer<EtchObject> result;
diff --git a/binding-cpp/runtime/src/test/transport/EtchDefaultDeliveryServiceTest.cpp b/binding-cpp/runtime/src/test/transport/EtchDefaultDeliveryServiceTest.cpp
index 6a56fd5..9e1fbc5 100644
--- a/binding-cpp/runtime/src/test/transport/EtchDefaultDeliveryServiceTest.cpp
+++ b/binding-cpp/runtime/src/test/transport/EtchDefaultDeliveryServiceTest.cpp
@@ -248,7 +248,7 @@
capu::SmartPointer<EtchObject> data = new EtchLong(123);
capu::SmartPointer<EtchObject> old;
EtchField field = replyType->getResponseField();
- replymessage->put(field, data, &old);
+ replymessage->put(field, data);
//call the sessionMessage of mailbox manager as if it is called from messagizer to deliver data from
status = mailboxManager->sessionMessage(NULL, replymessage);
diff --git a/binding-cpp/runtime/src/test/transport/EtchMessageTest.cpp b/binding-cpp/runtime/src/test/transport/EtchMessageTest.cpp
index 7035065..ae11581 100644
--- a/binding-cpp/runtime/src/test/transport/EtchMessageTest.cpp
+++ b/binding-cpp/runtime/src/test/transport/EtchMessageTest.cpp
@@ -192,7 +192,6 @@
capu::SmartPointer<EtchObject> object = new EtchBool(true);
capu::SmartPointer<EtchObject> object2 = new EtchBool(false);
capu::SmartPointer<EtchObject> object3 = NULL;
- capu::SmartPointer<EtchObject> object4 = NULL;
//check the empty struct value
EXPECT_TRUE(sv->count() == 0);
@@ -203,7 +202,7 @@
EXPECT_TRUE(sv->put(field2, object2) == ETCH_OK);
EXPECT_TRUE(sv->count() == 2);
//add a null element and expect a remove operation
- EXPECT_TRUE(sv->put(field1, object3, &object4) == ETCH_OK);
+ EXPECT_TRUE(sv->put(field1, object3) == ETCH_OK);
EXPECT_TRUE(sv->count() == 1);
delete sv;
@@ -239,7 +238,7 @@
//add another element
capu::SmartPointer<EtchObject> object2 = new EtchBool(false);
- EXPECT_TRUE(sv->put(field1, object2, &object) == ETCH_OK);
+ EXPECT_TRUE(sv->put(field1, object2) == ETCH_OK);
EXPECT_TRUE(sv->count() == 1);
//get element
EXPECT_TRUE(sv->get(field1, &object) == ETCH_OK);
diff --git a/binding-cpp/runtime/src/test/transport/EtchTcpConnectionTest.cpp b/binding-cpp/runtime/src/test/transport/EtchTcpConnectionTest.cpp
index 49a9a10..e922c82 100644
--- a/binding-cpp/runtime/src/test/transport/EtchTcpConnectionTest.cpp
+++ b/binding-cpp/runtime/src/test/transport/EtchTcpConnectionTest.cpp
@@ -64,7 +64,7 @@
EtchString _socket("socket");
EtchObject *tmp;
resources.put(_socket, connection, tmp);
- connection->send((unsigned char *) "mock", 4);
+ connection->send("mock", 4);
socket = connection;
return ETCH_OK;
}
diff --git a/binding-cpp/runtime/src/test/transport/EtchTcpListenerTest.cpp b/binding-cpp/runtime/src/test/transport/EtchTcpListenerTest.cpp
index 97dbf46..907fee0 100644
--- a/binding-cpp/runtime/src/test/transport/EtchTcpListenerTest.cpp
+++ b/binding-cpp/runtime/src/test/transport/EtchTcpListenerTest.cpp
@@ -54,7 +54,7 @@
EtchString _socket("socket");
EtchObject *tmp;
resources.put(_socket, connection, tmp);
- connection->send((unsigned char *) "mock", 4);
+ connection->send("mock", 4);
delete connection;
return ETCH_OK;
}
diff --git a/binding-cpp/runtime/src/test/util/EtchCircularQueueTest.cpp b/binding-cpp/runtime/src/test/util/EtchCircularQueueTest.cpp
index a751c2e..656cc90 100644
--- a/binding-cpp/runtime/src/test/util/EtchCircularQueueTest.cpp
+++ b/binding-cpp/runtime/src/test/util/EtchCircularQueueTest.cpp
@@ -156,9 +156,9 @@
namespace {
-class R1 : public capu::Runnable {
+class Runnable1 : public capu::Runnable {
public:
- R1(EtchCircularQueue* queue) {
+ Runnable1(EtchCircularQueue* queue) {
mQueue = queue;
}
@@ -174,9 +174,9 @@
EtchCircularQueue* mQueue;
};
-class R2 : public capu::Runnable {
+class Runnable2 : public capu::Runnable {
public:
- R2(EtchCircularQueue* queue) {
+ Runnable2(EtchCircularQueue* queue) {
mQueue = queue;
}
@@ -198,13 +198,13 @@
TEST(EtchCirclerQueueTest, concurrency) {
EtchCircularQueue* queue = new EtchCircularQueue(5);
- R1* r1 = new R1(queue);
- capu::Thread* t1 = new capu::Thread(r1);
- t1->start();
+ Runnable1* r1 = new Runnable1(queue);
+ capu::Thread* t1 = new capu::Thread();
+ t1->start(*r1);
- R2* r2 = new R2(queue);
- capu::Thread* t2 = new capu::Thread(r2);
- t2->start();
+ Runnable2* r2 = new Runnable2(queue);
+ capu::Thread* t2 = new capu::Thread();
+ t2->start(*r2);
t1->join();
t2->join();
diff --git a/binding-cpp/runtime/src/test/util/EtchUtilTest.cpp b/binding-cpp/runtime/src/test/util/EtchUtilTest.cpp
index 3ade3b7..42e778e 100644
--- a/binding-cpp/runtime/src/test/util/EtchUtilTest.cpp
+++ b/binding-cpp/runtime/src/test/util/EtchUtilTest.cpp
@@ -47,7 +47,7 @@
TEST(EtchUtilTest, etch_utf8_strlen) {
const char utf8 [] = {(char)0xF0, (char)0xA4, (char)0xAD, (char)0xA2, (char)0xE2, (char)0x82, (char)0xAC, (char)0xC2, (char)0xA2, (char)0x24, (char)0x0};
- capu::int32_t dstSize = 0;
+ capu::uint32_t dstSize = 0;
status_t retval = etch_strlen_utf8(NULL, dstSize);
EXPECT_TRUE(retval == ETCH_EINVAL);
diff --git a/binding-cpp/runtime/toolchains/Linux_ARMv7l.toolchain b/binding-cpp/runtime/toolchains/Linux_ARMv7l.toolchain
index e064624..72a2442 100644
--- a/binding-cpp/runtime/toolchains/Linux_ARMv7l.toolchain
+++ b/binding-cpp/runtime/toolchains/Linux_ARMv7l.toolchain
@@ -37,5 +37,7 @@
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+add_definitions("-DTARGET_OS=Linux")
+add_definitions("-DTARGET_ARCH=ARMV7L")
add_definitions("-DOS_LINUX")
add_definitions("-DARCH_ARMV7L")
diff --git a/binding-cpp/runtime/toolchains/Linux_X86_32.toolchain b/binding-cpp/runtime/toolchains/Linux_X86_32.toolchain
index 5bd29a7..138db92 100644
--- a/binding-cpp/runtime/toolchains/Linux_X86_32.toolchain
+++ b/binding-cpp/runtime/toolchains/Linux_X86_32.toolchain
@@ -28,5 +28,7 @@
SET(CMAKE_C_FLAGS_RELEASE "-m32 -Wall -O3 -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
+add_definitions("-DTARGET_OS=Linux")
+add_definitions("-DTARGET_ARCH=X86_32")
add_definitions("-DOS_LINUX")
add_definitions("-DARCH_X86_32")
diff --git a/binding-cpp/runtime/toolchains/Linux_X86_64.toolchain b/binding-cpp/runtime/toolchains/Linux_X86_64.toolchain
index d544f05..81a5e58 100644
--- a/binding-cpp/runtime/toolchains/Linux_X86_64.toolchain
+++ b/binding-cpp/runtime/toolchains/Linux_X86_64.toolchain
@@ -28,5 +28,7 @@
SET(CMAKE_C_FLAGS_RELEASE "-m64 -Wall -O3 -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
+add_definitions("-DTARGET_OS=Linux")
+add_definitions("-DTARGET_ARCH=X86_64")
add_definitions("-DOS_LINUX")
add_definitions("-DARCH_X86_64")
diff --git a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Linux_X86_64.toolchain b/binding-cpp/runtime/toolchains/MacOSX_X86_64.toolchain
similarity index 83%
rename from binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Linux_X86_64.toolchain
rename to binding-cpp/runtime/toolchains/MacOSX_X86_64.toolchain
index d544f05..141f07a 100644
--- a/binding-cpp/runtime/lib/capu/cmake/acme/toolchain/Linux_X86_64.toolchain
+++ b/binding-cpp/runtime/toolchains/MacOSX_X86_64.toolchain
@@ -13,14 +13,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-#
-SET(CMAKE_SYSTEM_NAME Linux)
+
+SET(CMAKE_SYSTEM_NAME MacOSX)
SET(CMAKE_SYSTEM_VERSION 1)
-SET(TARGET_OS Linux)
-SET(TARGET_ARCH X86_64)
-SET(TARGET_COMPILER GCC)
+SET(TARGET_OS MacOSX)
+SET(TARGET_ARCH x86_64)
+# SET(TARGET_COMPILER GCC)
SET(CMAKE_C_FLAGS_DEBUG "-m64 -ggdb -Wall -D_DEBUG")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
@@ -28,5 +28,7 @@
SET(CMAKE_C_FLAGS_RELEASE "-m64 -Wall -O3 -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
-add_definitions("-DOS_LINUX")
+add_definitions("-DTARGET_OS=MacOSX")
+add_definitions("-DTARGET_ARCH=X86_64")
+add_definitions("-DOS_MACOSX")
add_definitions("-DARCH_X86_64")
diff --git a/binding-cpp/runtime/toolchains/QNX_X86_32.toolchain b/binding-cpp/runtime/toolchains/QNX_X86_32.toolchain
index 37bd2b7..6d429c1 100644
--- a/binding-cpp/runtime/toolchains/QNX_X86_32.toolchain
+++ b/binding-cpp/runtime/toolchains/QNX_X86_32.toolchain
@@ -23,7 +23,7 @@
# Windows: set PATH=%QNX_HOST%\usr\bin;%PATH%
# Linux: export PATH=$QNX_HOST/usr/bin:$PATH
#4. execute cmake in build-folder:
-# cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=<path to capu>/cmake/acme/toolchain/QNX_X86.toolchain -DCMAKE_BUILD_TYPE=Debug|Release ..
+# cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=<path to toolchain>/QNX_X86.toolchain -DCMAKE_BUILD_TYPE=Debug|Release ..
#5. make
#
#------------------------------------------------------------------#
@@ -96,5 +96,10 @@
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+ADD_DEFINITIONS("-DTARGET_OS=QNX")
+ADD_DEFINITIONS("-DTARGET_ARCH=X86_32")
ADD_DEFINITIONS("-DOS_QNX")
ADD_DEFINITIONS("-DARCH_X86_32")
+
+# necessary for gmock
+ADD_DEFINITIONS("-DGTEST_HAS_PTHREAD=1")
diff --git a/binding-cpp/runtime/toolchains/Windows_X86_32.toolchain b/binding-cpp/runtime/toolchains/Windows_X86_32.toolchain
index f02f618..92ca6df 100644
--- a/binding-cpp/runtime/toolchains/Windows_X86_32.toolchain
+++ b/binding-cpp/runtime/toolchains/Windows_X86_32.toolchain
@@ -28,10 +28,15 @@
SET(CMAKE_C_FLAGS_DEBUG "/MDd /Zi /Od /RTC1 /D_DEBUG /MP8" )
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W3")
-
+add_definitions("-DTARGET_OS=Windows")
+add_definitions("-DTARGET_ARCH=X86_32")
add_definitions("-DOS_WINDOWS")
add_definitions("-DARCH_X86_32")
+
add_definitions("-D_VARIADIC_MAX=10") #this is needed for compiling gtest with visual studio 11
+add_definitions("-D_WIN32_WINNT=0x0501")
+add_definitions("-DWINVER=0x0501")
# enable the BUILD_CHECK_MEMORY flag if you would like to check for memory leaks with visual leak detector
#add_definitions("-DBUILD_CHECK_MEMORY")
+
diff --git a/binding-cpp/runtime/toolchains/Windows_X86_64.toolchain b/binding-cpp/runtime/toolchains/Windows_X86_64.toolchain
index ad07010..477a1ee 100644
--- a/binding-cpp/runtime/toolchains/Windows_X86_64.toolchain
+++ b/binding-cpp/runtime/toolchains/Windows_X86_64.toolchain
@@ -29,8 +29,12 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W3")
+add_definitions("-DTARGET_OS=Windows")
+add_definitions("-DTARGET_ARCH=X86_64")
add_definitions("-DOS_WINDOWS")
add_definitions("-DARCH_X86_64")
+add_definitions("-D_VARIADIC_MAX=10") #this is needed for compiling gtest with visual studio 11
+
# enable the BUILD_CHECK_MEMORY flag if you would like to check for memory leaks with visual leak detector
#add_definitions("-DBUILD_CHECK_MEMORY")
diff --git a/examples/helloworld/cpp/CMakeLists.txt b/examples/helloworld/cpp/CMakeLists.txt
index ce337b1..4f03462 100644
--- a/examples/helloworld/cpp/CMakeLists.txt
+++ b/examples/helloworld/cpp/CMakeLists.txt
@@ -35,7 +35,7 @@
SET(ETCH_CPP_HOME ${ETCH_HOME}/binding-cpp)
SET(ETCH_CPP_INCLUDE_DIR ${ETCH_CPP_HOME}/include)
SET(ETCH_CPP_LIBRARY_DIR ${ETCH_CPP_HOME}/lib)
-SET(ETCH_CPP_LIBRARY_DIR_PLATFORM_SPECIFIC ${ETCH_CPP_LIBRARY_DIR}/${TARGET_OS}_${TARGET_ARCH}/${ETCH_BUILD_TARGET})
+SET(ETCH_CPP_LIBRARY_DIR_PLATFORM_SPECIFIC ${ETCH_CPP_LIBRARY_DIR}/${TARGET_OS}_${TARGET_ARCH}/${CMAKE_BUILD_TYPE})
# set include dirs
include_directories (${ETCH_CPP_INCLUDE_DIR})
@@ -48,7 +48,7 @@
#STATUS
message(STATUS " ")
message(STATUS "====================================================")
-message(STATUS "build target: ${ETCH_BUILD_TARGET}")
+message(STATUS "build target: ${CMAKE_BUILD_TYPE}")
message(STATUS "using Etch home Dir: ${ETCH_HOME}")
message(STATUS "using include dir: ${ETCH_CPP_INCLUDE_DIR}")
message(STATUS "using library dir: ${ETCH_CPP_LIBRARY_DIR_PLATFORM_SPECIFIC}")
@@ -83,7 +83,9 @@
IF (TARGET_OS STREQUAL "Linux")
target_link_libraries(etch-cpp-helloworld-server etch capu pthread rt)
- set_target_properties(etch-cpp-helloworld-server PROPERTIES COMPILE_FLAGS "-m32 -g" LINK_FLAGS "-m32")
+ IF (TARGET_ARCH STREQUAL "X86_64")
+ set_target_properties(etch-cpp-helloworld-server PROPERTIES COMPILE_FLAGS "-m32 -g" LINK_FLAGS "-m32")
+ ENDIF()
ELSEIF(TARGET_OS STREQUAL "Windows")
target_link_libraries(etch-cpp-helloworld-server etch capu)
IF (BUILD_CHECK_MEMORY)
@@ -122,7 +124,9 @@
IF (TARGET_OS STREQUAL "Linux")
target_link_libraries(etch-cpp-helloworld-client etch capu pthread rt)
- set_target_properties(etch-cpp-helloworld-client PROPERTIES COMPILE_FLAGS "-m32 -g" LINK_FLAGS "-m32")
+ IF (TARGET_ARCH STREQUAL "X86_64")
+ set_target_properties(etch-cpp-helloworld-client PROPERTIES COMPILE_FLAGS "-m32 -g" LINK_FLAGS "-m32")
+ ENDIF()
ELSEIF(TARGET_OS STREQUAL "Windows")
target_link_libraries(etch-cpp-helloworld-client etch capu )
IF (BUILD_CHECK_MEMORY)