ETCH-222 Refactored EtchObjectType hierarchy
Change-Id: Ia0df372b9d34e300d7a87537bdc34ec77e291501
git-svn-id: https://svn.apache.org/repos/asf/incubator/etch/trunk@1399111 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_cpp.vm b/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_cpp.vm
index 1adc191..2845e10 100644
--- a/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_cpp.vm
+++ b/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_cpp.vm
@@ -64,13 +64,11 @@
* Constructs the $n.name().
*/
$class::$n.name()::$n.name()()
-#if(!$n.isExcept())
- : EtchObject($class::$n.name()::TYPE())
-#else
- : EtchException("${n.name()}", ETCH_ERROR, EXCPTYPE_USERDEFINED, $class::$n.name()::TYPE())
+#if($n.isExcept())
+ : EtchException("${n.name()}", ETCH_ERROR, EXCPTYPE_USERDEFINED)
#end
{
- //nothing to do!
+ addObjectType($class::$n.name()::TYPE());
}
#if ($n.hasAnyParameters())
/**
@@ -85,16 +83,14 @@
*/
$class::$n.name()::$n.name()(#set($sep = "")#foreach($i in $n.getAllParameters())$sep$helper.getEtchTypeName($i.type(), true) $i.name() #set( $sep = ", " )#end)
#if($n.hasExtends())
- : $n.name()(#set($sep = "")#foreach($i in $n.getExtends().getAllParameters())$sep$i.name()#set( $sep = ", " ))#end#if(!$n.isExcept()),
- EtchObject($class::$n.name()::TYPE())#end
+ : $n.name()(#set($sep = "")#foreach($i in $n.getExtends().getAllParameters())$sep$i.name()#set( $sep = ", " ))#end
#else
-#if(!$n.isExcept())
- : EtchObject($class::$n.name()::TYPE())
-#else
- : EtchException("${n.name()}", ETCH_ERROR, EXCPTYPE_USERDEFINED, $class::$n.name()::TYPE())
+#if($n.isExcept())
+ : EtchException("${n.name()}", ETCH_ERROR, EXCPTYPE_USERDEFINED)
#end
#end
{
+ addObjectType($class::$n.name()::TYPE());
#foreach( $i in $n.getParameters() )
this->$i.name() = $i.name();
#end
diff --git a/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_h.vm b/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_h.vm
index 2d6ce96..e937e4f 100644
--- a/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_h.vm
+++ b/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_h.vm
@@ -83,9 +83,8 @@
#end
*/
#end
- class $n.name() :
- public EtchObject
- {
+ class $n.name()
+ : public EtchObject {
public:
static const EtchObjectType* TYPE();
enum _eval{
@@ -104,8 +103,13 @@
} Value;
- $n.name()() : EtchObject($n.name()::TYPE()) { }
- $n.name()(_eval eval) : EtchObject($n.name()::TYPE()) { Value = eval; }
+ $n.name()() {
+ addObjectType($n.name()::TYPE());
+ }
+ $n.name()(_eval eval) {
+ addObjectType($n.name()::TYPE());
+ Value = eval;
+ }
};
typedef capu::SmartPointer<$n.name()> $n.name()Ptr;
#end
@@ -218,7 +222,7 @@
#end
class $n.name()
#if($n.hasExtends())
- : public $n.getExtends().name(), public EtchObject
+ : public $n.getExtends().name()
#elseif($n.isExcept())
: public EtchException
#else
@@ -245,9 +249,7 @@
#end
#end
*/
- $n.name()(#set($sep = "")#foreach($i in $n.getAllParameters())$sep$helper.getEtchTypeName($i.type(), true) $i.name() #set( $sep = ", " )#end)#if(!$n.hasExtends());
-#else
- : $n.name();#end
+ $n.name()(#set($sep = "")#foreach($i in $n.getAllParameters())$sep$helper.getEtchTypeName($i.type(), true) $i.name() #set( $sep = ", " )#end);
#end
virtual ~$n.name()() {}
@@ -293,27 +295,20 @@
#end
};
typedef capu::SmartPointer<${n.name()}> $n.name()Ptr;
+ //TODO: we may not be able to serialize NativeArrays of custom user Types!
+ typedef capu::SmartPointer<EtchNativeArray<${n.name()}Ptr> > EtchNativeArray$n.name()Ptr;
#end
#elseif ($n.isBuiltin())
## nothing to do.
#elseif ($n.isEnumx())
typedef capu::SmartPointer<${n.name()}> $n.name()Ptr;
+ typedef capu::SmartPointer<EtchNativeArray<${n.name()}Ptr> > EtchNativeArray$n.name()Ptr;
#else
*** intf.vm: don't know what to do with $n ***
#end
#end
-#foreach($n in $intf.iterator())
-#if ($n.hasAnyParameters())
-#foreach( $i in $n.getAllParameters() )
-#if($i.type().dim() > 0)
- typedef capu::SmartPointer<EtchNativeArray<${n.name()}Ptr> > EtchNativeArray$n.name()Ptr;
- ##typedef EtchNativeArray<${n.name()}Ptr> EtchNativeArray$n.name()Obj;
-#end
-#end
-#end
-#end
};
}
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 98ebbbb..c11a985 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
@@ -205,8 +205,6 @@
status_t ${vf}::InitResults()
{
-//AF: TO-REVIEW: finde die Verwendung von Anonymer Enum bei EchtDirection und bei EtchAsyncMode unschoen
-
#foreach ( $n in $intf.iterator() )
#if ($n.isMessage())
${vf}::${n.vname( $helper )}->setDirection((EtchDirection)$n.msgDir());
diff --git a/binding-cpp/runtime/include/common/EtchArrayValue.h b/binding-cpp/runtime/include/common/EtchArrayValue.h
index c4273e3..fb1a4d6 100644
--- a/binding-cpp/runtime/include/common/EtchArrayValue.h
+++ b/binding-cpp/runtime/include/common/EtchArrayValue.h
@@ -61,6 +61,13 @@
*/
EtchArrayValue(capu::SmartPointer<EtchNativeArrayBase> array, capu::int32_t size);
+ /**
+ * Constructs an array value copy with no type info. This is used perhaps
+ * by extern struct serializers.
+ * @param other Array Value
+ */
+ EtchArrayValue(const EtchArrayValue& other);
+
virtual ~EtchArrayValue();
/**
@@ -97,6 +104,11 @@
*/
void setIndex(capu::int32_t val);
+ /**
+ * @return true if two object is equal
+ * false otherwise
+ */
+ virtual capu::bool_t equals(const EtchObject * other) const;
/**
* @param index
diff --git a/binding-cpp/runtime/include/common/EtchAuthenticationException.h b/binding-cpp/runtime/include/common/EtchAuthenticationException.h
index d8b02cd..5b82f55 100644
--- a/binding-cpp/runtime/include/common/EtchAuthenticationException.h
+++ b/binding-cpp/runtime/include/common/EtchAuthenticationException.h
@@ -25,10 +25,17 @@
static const EtchObjectType* TYPE();
- //Default Constructor
+ /**
+ * Constructs a EtchAuthenticationException object.
+ */
EtchAuthenticationException(EtchString &msg);
/**
+ * Constructs a copy of EtchAuthenticationException.
+ */
+ EtchAuthenticationException(const EtchAuthenticationException& other);
+
+ /**
* Destructor
*/
virtual ~EtchAuthenticationException();
diff --git a/binding-cpp/runtime/include/common/EtchBool.h b/binding-cpp/runtime/include/common/EtchBool.h
index 57e8405..8b58efd 100644
--- a/binding-cpp/runtime/include/common/EtchBool.h
+++ b/binding-cpp/runtime/include/common/EtchBool.h
@@ -44,6 +44,11 @@
EtchBool(capu::bool_t value);
/**
+ * Constructs a copy of EtchBool
+ */
+ EtchBool(const EtchBool& other);
+
+ /**
* Sets bool value.
*/
void set(capu::bool_t value);
diff --git a/binding-cpp/runtime/include/common/EtchByte.h b/binding-cpp/runtime/include/common/EtchByte.h
index ab6b04a..7f1a04d 100644
--- a/binding-cpp/runtime/include/common/EtchByte.h
+++ b/binding-cpp/runtime/include/common/EtchByte.h
@@ -44,6 +44,11 @@
EtchByte(capu::int8_t value);
/**
+ * Constructs a copy of EtchByte.
+ */
+ EtchByte(const EtchByte &value);
+
+ /**
* Sets byte value.
*/
void set(capu::int8_t value);
diff --git a/binding-cpp/runtime/include/common/EtchDate.h b/binding-cpp/runtime/include/common/EtchDate.h
index a62551a..3ea9fc6 100644
--- a/binding-cpp/runtime/include/common/EtchDate.h
+++ b/binding-cpp/runtime/include/common/EtchDate.h
@@ -40,6 +40,11 @@
*/
EtchDate(capu::time_t value);
+ /**
+ * Constructs a copy of EtchDate
+ */
+ EtchDate(const EtchDate& other);
+
//Destructor
virtual ~EtchDate();
diff --git a/binding-cpp/runtime/include/common/EtchDouble.h b/binding-cpp/runtime/include/common/EtchDouble.h
index b39d098..7cf2c7a 100644
--- a/binding-cpp/runtime/include/common/EtchDouble.h
+++ b/binding-cpp/runtime/include/common/EtchDouble.h
@@ -44,6 +44,11 @@
EtchDouble(capu::double_t value);
/**
+ * Constructs a copy of EtchDouble.
+ */
+ EtchDouble(const EtchDouble& other);
+
+ /**
* Sets double value.
*/
void set(capu::double_t value);
diff --git a/binding-cpp/runtime/include/common/EtchException.h b/binding-cpp/runtime/include/common/EtchException.h
index dce65e4..3d690c6 100644
--- a/binding-cpp/runtime/include/common/EtchException.h
+++ b/binding-cpp/runtime/include/common/EtchException.h
@@ -34,7 +34,9 @@
};
- //Constructor
+ /**
+ * Constructs a EtchException object.
+ */
EtchException();
/**
@@ -43,7 +45,14 @@
*/
EtchException(EtchString msg, status_t errcode, EtchExceptionType type);
- //destructor
+ /**
+ * Constructs a copy of EtchShort.
+ */
+ EtchException(const EtchException& other);
+
+ /**
+ * Destructor
+ */
virtual ~EtchException();
//overridden
@@ -70,18 +79,9 @@
static const EtchObjectType* TYPE();
protected:
-
EtchString mErrorMessage;
status_t mErrorcode;
EtchExceptionType mExcptype;
-
- /**
- * @param msg Message of exception
- * @param errcode Error Code such as ETCH_EINVAL etc.
- * @param type Exception Type such as EXCPTYPE_USERDEFINED etc.
- * @param type_id Typeid of Exception
- */
- EtchException(EtchString msg, status_t errcode, EtchExceptionType type, const EtchObjectType* type_id);
};
#endif /* ETCHEXCEPTION_H */
diff --git a/binding-cpp/runtime/include/common/EtchFloat.h b/binding-cpp/runtime/include/common/EtchFloat.h
index d976782..41cb857 100644
--- a/binding-cpp/runtime/include/common/EtchFloat.h
+++ b/binding-cpp/runtime/include/common/EtchFloat.h
@@ -44,6 +44,11 @@
EtchFloat(capu::float_t value);
/**
+ * Constructs a copy of EtchDouble.
+ */
+ EtchFloat(const EtchFloat& value);
+
+ /**
* Sets float value.
*/
void set(capu::float_t value);
diff --git a/binding-cpp/runtime/include/common/EtchHashSet.h b/binding-cpp/runtime/include/common/EtchHashSet.h
index ff3283c..783e006 100644
--- a/binding-cpp/runtime/include/common/EtchHashSet.h
+++ b/binding-cpp/runtime/include/common/EtchHashSet.h
@@ -51,6 +51,12 @@
inline EtchHashSet(capu::uint32_t size);
/**
+ * Copy Constructor
+ */
+ inline EtchHashSet(const EtchHashSet& other);
+
+
+ /**
* Destructor
*/
inline ~EtchHashSet();
@@ -103,15 +109,14 @@
};
template <class T, class H, class C>
-inline EtchHashSet<T, H, C>::EtchHashSet()
-: EtchObject(EtchHashSet<T, H, C>::TYPE()) {
-
+inline EtchHashSet<T, H, C>::EtchHashSet() {
+ addObjectType(EtchHashSet<T, H, C>::TYPE());
}
template <class T, class H, class C>
inline EtchHashSet<T, H, C>::EtchHashSet(capu::uint32_t size)
-: EtchObject(&EtchHashSet<T, H, C>::TYPE), mHashSet(size) {
-
+ : mHashSet(size) {
+ addObjectType(EtchHashSet<T, H, C>::TYPE());
}
template <class T, class H, class C>
@@ -121,6 +126,12 @@
}
template <class T, class H, class C>
+inline EtchHashSet<T, H, C>::EtchHashSet(const EtchHashSet& other)
+ : EtchObject(other), mHashSet(other.mHashSet) {
+
+}
+
+template <class T, class H, class C>
inline EtchHashSet<T, H, C>::~EtchHashSet() {
}
diff --git a/binding-cpp/runtime/include/common/EtchHashTable.h b/binding-cpp/runtime/include/common/EtchHashTable.h
index b954b3d..93f0452 100644
--- a/binding-cpp/runtime/include/common/EtchHashTable.h
+++ b/binding-cpp/runtime/include/common/EtchHashTable.h
@@ -51,9 +51,14 @@
inline EtchHashTable(capu::uint32_t size);
/**
+ * Copy Constructor
+ */
+ inline EtchHashTable(const EtchHashTable& other);
+
+ /**
* Destructure.
*/
- inline ~EtchHashTable();
+ inline virtual ~EtchHashTable();
/**
* put a new value to the EtchHashTable.
@@ -109,7 +114,7 @@
* Return iterator for iterating key value tuples.
* @return Iterator
*/
- inline Iterator begin();
+ inline Iterator begin() const;
};
@@ -121,14 +126,19 @@
template <class Key, class T, class H, class C>
inline EtchHashTable<Key, T, H, C>::EtchHashTable()
-: EtchObject(EtchHashTable<Key, T, H, C>::TYPE()), mHashTable(ETCH_DEFAULT_HASH_TABLE_SIZE) {
-
+: mHashTable(ETCH_DEFAULT_HASH_TABLE_SIZE) {
+ addObjectType(EtchHashTable<Key, T, H, C>::TYPE());
}
template <class Key, class T, class H, class C>
inline EtchHashTable<Key, T, H, C>::EtchHashTable(capu::uint32_t size)
-: EtchObject(EtchHashTable<Key, T, H, C>::TYPE()), mHashTable(size) {
+: mHashTable(size) {
+ addObjectType(EtchHashTable<Key, T, H, C>::TYPE());
+}
+template <class Key, class T, class H, class C>
+inline EtchHashTable<Key, T, H, C>::EtchHashTable(const EtchHashTable& other)
+: EtchObject(other), mHashTable(other.mHashTable) {
}
template <class Key, class T, class H, class C>
@@ -162,7 +172,7 @@
}
template <class Key, class T, class H, class C>
-inline typename EtchHashTable<Key, T, H, C>::Iterator EtchHashTable<Key, T, H, C>::begin() {
+inline typename EtchHashTable<Key, T, H, C>::Iterator EtchHashTable<Key, T, H, C>::begin() const {
return mHashTable.begin();
}
diff --git a/binding-cpp/runtime/include/common/EtchInt32.h b/binding-cpp/runtime/include/common/EtchInt32.h
index e620868..6fa8964 100644
--- a/binding-cpp/runtime/include/common/EtchInt32.h
+++ b/binding-cpp/runtime/include/common/EtchInt32.h
@@ -20,8 +20,6 @@
#define __ETCHINT32_H__
#include "common/EtchObject.h"
-#include "common/EtchObjectType.h"
-#include "common/EtchError.h"
class EtchInt32 :
public EtchObject {
@@ -45,6 +43,17 @@
EtchInt32(capu::int32_t value);
/**
+ * Constructs a EtchInt32 copy
+ */
+ EtchInt32(const EtchInt32& other);
+
+
+ /**
+ * Destructor.
+ */
+ virtual ~EtchInt32();
+
+ /**
* Sets int32 value.
*/
void set(capu::int32_t value);
@@ -69,7 +78,12 @@
* assigns an integer number to the stored value
*/
capu::int32_t& operator=(capu::int32_t const& other);
-
+
+ /**
+ * assigns an EtchInt32 to an EtchInt32
+ */
+ EtchInt32& operator=(EtchInt32 const& other);
+
/**
* increments and assigns the stored integer value
*/
diff --git a/binding-cpp/runtime/include/common/EtchList.h b/binding-cpp/runtime/include/common/EtchList.h
index c05d622..570a127 100644
--- a/binding-cpp/runtime/include/common/EtchList.h
+++ b/binding-cpp/runtime/include/common/EtchList.h
@@ -45,6 +45,11 @@
EtchList();
/**
+ * Copy Constructor
+ */
+ EtchList(const EtchList& other);
+
+ /**
* Destructor
*/
~EtchList();
@@ -154,12 +159,17 @@
}
template<class T, class C>
-EtchList<T, C>::EtchList()
-: EtchObject(EtchList<T, C>::TYPE()) {
-
+EtchList<T, C>::EtchList() {
+ addObjectType(EtchList<T, C>::TYPE());
}
template<class T, class C>
+EtchList<T, C>::EtchList(const EtchList& other)
+ : EtchObject(other), mList(other.mList) {
+}
+
+
+template<class T, class C>
EtchList<T, C>::~EtchList() {
}
diff --git a/binding-cpp/runtime/include/common/EtchLong.h b/binding-cpp/runtime/include/common/EtchLong.h
index fda1fa6..db1a071 100644
--- a/binding-cpp/runtime/include/common/EtchLong.h
+++ b/binding-cpp/runtime/include/common/EtchLong.h
@@ -44,6 +44,12 @@
EtchLong(capu::int64_t value);
/**
+ * Constructs a copy of EtchLong.
+ */
+ EtchLong(const EtchLong& other);
+
+
+ /**
* Sets long value.
*/
void set(capu::int64_t value);
diff --git a/binding-cpp/runtime/include/common/EtchNativeArray.h b/binding-cpp/runtime/include/common/EtchNativeArray.h
index ac5fb42..0b1964f 100644
--- a/binding-cpp/runtime/include/common/EtchNativeArray.h
+++ b/binding-cpp/runtime/include/common/EtchNativeArray.h
@@ -341,7 +341,7 @@
//TODO: enhance performance avoiding for-loop-copy
for (capu::int8_t i = 0; i < length; i++) {
mData[pos.pos[index]]->set(i,0,data[i]);
- }
+ }
} else {
//redirect to next sub array
return mData[pos.pos[index]]->set(pos, index+1, data, dataSize, offset, length, written);
@@ -470,8 +470,12 @@
public EtchObject {
public:
- EtchNativeArrayBase(const EtchObjectType* type)
- : EtchObject(type) {
+ EtchNativeArrayBase() {
+ }
+
+ EtchNativeArrayBase(const EtchNativeArrayBase& other)
+ : EtchObject(other) {
+
}
/**
@@ -528,6 +532,11 @@
EtchNativeArray(capu::int32_t length, capu::int32_t dim, T* array);
/**
+ * Copy Constructor
+ */
+ EtchNativeArray(const EtchNativeArray& other);
+
+ /**
* Destructor for Etch Nativearray.
* Frees array if content_owned was set.
*/
@@ -609,8 +618,8 @@
}
template<class T>
-EtchNativeArray<T>::EtchNativeArray(capu::int32_t length, capu::int32_t dim)
-: EtchNativeArrayBase(EtchNativeArray<T>::TYPE()) {
+EtchNativeArray<T>::EtchNativeArray(capu::int32_t length, capu::int32_t dim) {
+ addObjectType(EtchNativeArray<T>::TYPE());
if (dim == 1) {
mData = new EtchArrayData<T>(length);
} else {
@@ -619,8 +628,8 @@
}
template<class T>
-EtchNativeArray<T>::EtchNativeArray(capu::int32_t length, capu::int32_t dim, T* array)
-: EtchNativeArrayBase(EtchNativeArray<T>::TYPE()) {
+EtchNativeArray<T>::EtchNativeArray(capu::int32_t length, capu::int32_t dim, T* array) {
+ addObjectType(EtchNativeArray<T>::TYPE());
capu::int32_t bytesWritten;
if (dim == 1) {
mData = new EtchArrayData<T>(length);
@@ -630,7 +639,7 @@
capu::int32_t dimCount = dim;
capu::int32_t offset = 0;
for (capu::int32_t i = 0; i < length; i++) {
- mData->createArray(i, 0, 2,dim-1);
+ mData->createArray(i, 0, 2,dim-1);
mData->set(i, 0, &array[offset], length, 0, length, &bytesWritten);
offset += length;
}
@@ -640,12 +649,17 @@
}
template<class T>
-EtchNativeArray<T>::EtchNativeArray(capu::SmartPointer<EtchArray<T> > array)
-: EtchNativeArrayBase(EtchNativeArray<T>::TYPE()){
+EtchNativeArray<T>::EtchNativeArray(capu::SmartPointer<EtchArray<T> > array) {
+ addObjectType(EtchNativeArray<T>::TYPE());
mData = capu::smartpointer_cast<EtchArrayBase<T> > (array);
}
template<class T>
+EtchNativeArray<T>::EtchNativeArray(const EtchNativeArray& other)
+ : EtchNativeArrayBase(other), mData(other.mData) {
+}
+
+template<class T>
EtchNativeArray<T>::~EtchNativeArray() {
}
diff --git a/binding-cpp/runtime/include/common/EtchObject.h b/binding-cpp/runtime/include/common/EtchObject.h
index e6ade83..1b80768 100644
--- a/binding-cpp/runtime/include/common/EtchObject.h
+++ b/binding-cpp/runtime/include/common/EtchObject.h
@@ -21,7 +21,7 @@
#include "capu/util/SmartPointer.h"
#include "capu/container/List.h"
-#include "EtchError.h"
+#include "common/EtchError.h"
class EtchObjectType;
@@ -39,9 +39,9 @@
EtchObject();
/**
- * Constructor.
+ * Copy Constructor.
*/
- EtchObject(const EtchObjectType* type);
+ EtchObject(const EtchObject& other);
/**
* Destructor.
@@ -78,11 +78,7 @@
*/
virtual status_t addObjectType(const EtchObjectType* type);
- // TODO remove me if object hierachy was refactored
- virtual status_t setObjectType(const EtchObjectType* type);
-
private:
- const EtchObjectType* mType;
capu::List<const EtchObjectType*> mTypes;
};
diff --git a/binding-cpp/runtime/include/common/EtchObjectType.h b/binding-cpp/runtime/include/common/EtchObjectType.h
index 9de7672..18769ec 100644
--- a/binding-cpp/runtime/include/common/EtchObjectType.h
+++ b/binding-cpp/runtime/include/common/EtchObjectType.h
@@ -64,6 +64,7 @@
EOTID_AUTH_EXCEPTION,
EOTID_RUNTIME_EXCEPTION,
EOTID_ARRAY_VALUE,
+ EOTID_POOL,
EOTID_FREEPOOL,
EOTID_QUEUEDPOOL,
EOTID_WAIT_UP,
@@ -223,7 +224,7 @@
static const EtchObjectType* getType() {
return &EtchObjectType::NATIVE_INT16();
}
-
+
static const EtchObjectTypeTrait getTypeTrait() {
return EtchObjectType::VALUE;
}
@@ -286,7 +287,7 @@
static const EtchObjectType* getType() {
return &EtchObjectType::NATIVE_BOOL();
}
-
+
static const EtchObjectTypeTrait getTypeTrait() {
return EtchObjectType::VALUE;
}
@@ -312,7 +313,7 @@
static const EtchObjectType* getType() {
return &EtchObjectType::NATIVE_INT16();
}
-
+
static const EtchObjectTypeTrait getTypeTrait() {
return EtchObjectType::POINTER;
}
@@ -402,7 +403,7 @@
static const EtchObjectType * getType() {
return &EtchObjectType::NATIVE_INT16();
}
-
+
static const EtchObjectTypeTrait getTypeTrait() {
return EtchObjectType::SMART_POINTER;
}
@@ -465,7 +466,7 @@
static const EtchObjectType * getType() {
return &EtchObjectType::NATIVE_BOOL();
}
-
+
static const EtchObjectTypeTrait getTypeTrait() {
return EtchObjectType::SMART_POINTER;
}
diff --git a/binding-cpp/runtime/include/common/EtchRuntimeException.h b/binding-cpp/runtime/include/common/EtchRuntimeException.h
index 569882f..f88ac55 100644
--- a/binding-cpp/runtime/include/common/EtchRuntimeException.h
+++ b/binding-cpp/runtime/include/common/EtchRuntimeException.h
@@ -30,10 +30,24 @@
*/
static const EtchObjectType* TYPE();
- //Default Constructor
+ /**
+ * Constructs a EtchRuntimeException object.
+ */
+ EtchRuntimeException();
+
+ /**
+ * EtchRuntimeException
+ * @param msg Exception Message
+ * @param errcode Error Code
+ */
EtchRuntimeException(EtchString msg, status_t errcode);
/**
+ * Constructs a copy of EtchRuntimeException.
+ */
+ EtchRuntimeException(const EtchRuntimeException& other);
+
+ /**
* Destructor
*/
virtual ~EtchRuntimeException();
diff --git a/binding-cpp/runtime/include/common/EtchServerSocket.h b/binding-cpp/runtime/include/common/EtchServerSocket.h
index 6200058..e1aa9ea 100644
--- a/binding-cpp/runtime/include/common/EtchServerSocket.h
+++ b/binding-cpp/runtime/include/common/EtchServerSocket.h
@@ -39,6 +39,11 @@
EtchServerSocket();
/**
+ * Copy Constructor
+ */
+ EtchServerSocket(const EtchServerSocket& other);
+
+ /**
* Destructor
*/
virtual ~EtchServerSocket();
diff --git a/binding-cpp/runtime/include/common/EtchShort.h b/binding-cpp/runtime/include/common/EtchShort.h
index d03de8f..623b5e0 100644
--- a/binding-cpp/runtime/include/common/EtchShort.h
+++ b/binding-cpp/runtime/include/common/EtchShort.h
@@ -44,6 +44,11 @@
EtchShort(capu::int16_t value);
/**
+ * Constructs a copy of EtchShort.
+ */
+ EtchShort(const EtchShort& value);
+
+ /**
* Sets short value.
*/
void set(capu::int16_t value);
diff --git a/binding-cpp/runtime/include/common/EtchSocket.h b/binding-cpp/runtime/include/common/EtchSocket.h
index fc29a12..b4163a7 100644
--- a/binding-cpp/runtime/include/common/EtchSocket.h
+++ b/binding-cpp/runtime/include/common/EtchSocket.h
@@ -37,6 +37,12 @@
EtchSocket();
/**
+ * Copy Constructor
+ */
+ EtchSocket(const EtchSocket& other);
+
+
+ /**
* Destructor
*/
~EtchSocket();
diff --git a/binding-cpp/runtime/include/serialization/EtchField.h b/binding-cpp/runtime/include/serialization/EtchField.h
index a2ad908..dd82e50 100644
--- a/binding-cpp/runtime/include/serialization/EtchField.h
+++ b/binding-cpp/runtime/include/serialization/EtchField.h
@@ -50,6 +50,17 @@
EtchField(capu::uint32_t id, EtchString & name);
/**
+ * Copy Constructor
+ * @param other
+ */
+ EtchField(const EtchField& other);
+
+ /**
+ * Destructor
+ */
+ virtual ~EtchField();
+
+ /**
* returns the hash code
* @return hash value
*/
diff --git a/binding-cpp/runtime/include/serialization/EtchHashTableSerializer.h b/binding-cpp/runtime/include/serialization/EtchHashTableSerializer.h
index 1102ed5..8542ee4 100644
--- a/binding-cpp/runtime/include/serialization/EtchHashTableSerializer.h
+++ b/binding-cpp/runtime/include/serialization/EtchHashTableSerializer.h
@@ -37,7 +37,7 @@
/**
* Constructor
*/
- EtchHashTableSerializer(EtchType* type, EtchField* field);
+ EtchHashTableSerializer(EtchType* type, EtchField& field);
/**
* Destructor
diff --git a/binding-cpp/runtime/include/serialization/EtchStructValue.h b/binding-cpp/runtime/include/serialization/EtchStructValue.h
index f907d30..a75439f 100644
--- a/binding-cpp/runtime/include/serialization/EtchStructValue.h
+++ b/binding-cpp/runtime/include/serialization/EtchStructValue.h
@@ -65,6 +65,11 @@
EtchStructValue(EtchType* type, EtchValueFactory* vf, capu::uint32_t length);
/**
+ * Copy Constructor
+ */
+ EtchStructValue(const EtchStructValue& other);
+
+ /**
* Default Destructor
*/
virtual ~EtchStructValue();
@@ -142,7 +147,7 @@
/**
* @return an iterator which is pointing the beginning of collection
*/
- Iterator begin();
+ Iterator begin() const;
/**
* @return true if the struct value is empty, otherwise false
diff --git a/binding-cpp/runtime/include/serialization/EtchType.h b/binding-cpp/runtime/include/serialization/EtchType.h
index 063f90e..427df07 100644
--- a/binding-cpp/runtime/include/serialization/EtchType.h
+++ b/binding-cpp/runtime/include/serialization/EtchType.h
@@ -57,6 +57,11 @@
EtchType(capu::uint32_t id, EtchString name);
/**
+ * Copy Constructor
+ */
+ EtchType(const EtchType& other);
+
+ /**
* Default Destructor
*/
virtual ~EtchType();
diff --git a/binding-cpp/runtime/include/serialization/EtchTypeValidator.h b/binding-cpp/runtime/include/serialization/EtchTypeValidator.h
index d75c90b..a00423f 100644
--- a/binding-cpp/runtime/include/serialization/EtchTypeValidator.h
+++ b/binding-cpp/runtime/include/serialization/EtchTypeValidator.h
@@ -36,6 +36,11 @@
EtchTypeValidator(const EtchObjectType * type, const EtchObjectType* scalarClass, const EtchObjectType* arrayClass, capu::uint32_t nDims, capu::bool_t subclass = false);
/**
+ * Copy Constructor
+ */
+ EtchTypeValidator(const EtchTypeValidator& other);
+
+ /**
* Default Destructor
*/
virtual ~EtchTypeValidator();
diff --git a/binding-cpp/runtime/include/serialization/EtchValidator.h b/binding-cpp/runtime/include/serialization/EtchValidator.h
index 87f2552..c3cf9a0 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidator.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidator.h
@@ -28,9 +28,12 @@
class EtchValidator : public EtchObject {
public:
- EtchValidator(const EtchObjectType *type)
- : EtchObject(type) {
+ EtchValidator(const EtchObjectType *type) {
+ addObjectType(type);
+ }
+ EtchValidator(const EtchValidator& other)
+ : EtchObject(other) {
}
/**
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h b/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h
index 0bc8c38..1ba90c6 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorBoolean.h
@@ -33,6 +33,14 @@
*/
static const EtchObjectType* TYPE();
+ /**
+ * Copy Constructor
+ */
+ EtchValidatorBoolean(const EtchValidatorBoolean& other);
+
+ /**
+ * Destructor
+ */
virtual ~EtchValidatorBoolean();
/**
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorByte.h b/binding-cpp/runtime/include/serialization/EtchValidatorByte.h
index 31d76fb..f79104e 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorByte.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorByte.h
@@ -38,6 +38,14 @@
*/
static const EtchObjectType* TYPE();
+ /**
+ * Copy Constructor
+ */
+ EtchValidatorByte(const EtchValidatorByte& other);
+
+ /**
+ * Destructor
+ */
virtual ~EtchValidatorByte();
/**
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorCustom.h b/binding-cpp/runtime/include/serialization/EtchValidatorCustom.h
index 4da8c7c..6004393 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorCustom.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorCustom.h
@@ -43,6 +43,11 @@
EtchValidatorCustomKey();
/**
+ * Copy Constructor
+ */
+ EtchValidatorCustomKey(const EtchValidatorCustomKey& other);
+
+ /**
* Destructor
*/
virtual ~EtchValidatorCustomKey();
@@ -80,6 +85,8 @@
*/
static const EtchObjectType* TYPE();
+ EtchValidatorCustom(const EtchValidatorCustom& other);
+
/**
* Destructor
*/
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h b/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h
index b630c88..f1942d2 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorDouble.h
@@ -35,6 +35,14 @@
*/
static const EtchObjectType* TYPE();
+ /**
+ * Copy Constructor
+ */
+ EtchValidatorDouble(const EtchValidatorDouble& other);
+
+ /**
+ * Destructor
+ */
virtual ~EtchValidatorDouble();
/**
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h b/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h
index 5006f0f..c384209 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorFloat.h
@@ -35,6 +35,14 @@
*/
static const EtchObjectType* TYPE();
+ /**
+ * Copy Constructor
+ */
+ EtchValidatorFloat(const EtchValidatorFloat& other);
+
+ /**
+ * Destructor
+ */
virtual ~EtchValidatorFloat();
/**
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorInt.h b/binding-cpp/runtime/include/serialization/EtchValidatorInt.h
index 0132bd6..dc5cab1 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorInt.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorInt.h
@@ -39,6 +39,17 @@
static const EtchObjectType* TYPE();
/**
+ * Copy Constructor
+ */
+ EtchValidatorInt(const EtchValidatorInt& other);
+
+ /**
+ * Destructor
+ */
+ virtual ~EtchValidatorInt();
+
+
+ /**
* @see EtchValidator
*/
virtual status_t getElementValidator(capu::SmartPointer<EtchValidator> &val);
@@ -58,7 +69,7 @@
*/
static status_t Get(capu::uint32_t ndim, capu::SmartPointer<EtchValidator> &val);
- virtual ~EtchValidatorInt();
+
protected:
EtchValidatorInt(capu::uint32_t ndim);
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorLong.h b/binding-cpp/runtime/include/serialization/EtchValidatorLong.h
index c557cc8..3bcff79 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorLong.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorLong.h
@@ -37,7 +37,14 @@
*/
static const EtchObjectType* TYPE();
+ /**
+ * Copy Constructor
+ */
+ EtchValidatorLong(const EtchValidatorLong& other);
+ /**
+ * Destructor
+ */
virtual ~EtchValidatorLong();
/**
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorNone.h b/binding-cpp/runtime/include/serialization/EtchValidatorNone.h
index bac40b2..a1974d2 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorNone.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorNone.h
@@ -26,6 +26,14 @@
class EtchValidatorNone : public EtchValidator {
public:
+ /**
+ * Copy Constructor
+ */
+ EtchValidatorNone(const EtchValidatorNone& other);
+
+ /**
+ * Destructor
+ */
virtual ~EtchValidatorNone();
/**
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorObject.h b/binding-cpp/runtime/include/serialization/EtchValidatorObject.h
index fdd27e6..0d2bfe1 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorObject.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorObject.h
@@ -32,6 +32,14 @@
*/
static const EtchObjectType* TYPE();
+ /**
+ * Copy Constructor
+ */
+ EtchValidatorObject(const EtchValidatorObject& other);
+
+ /**
+ * Destructor
+ */
virtual ~EtchValidatorObject();
/**
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h b/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h
index 797885e..3f6a96a 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorRuntimeException.h
@@ -26,6 +26,14 @@
class EtchValidatorRuntimeException : public EtchValidator {
public:
+ /**
+ * Copy Constructor
+ */
+ EtchValidatorRuntimeException(const EtchValidatorRuntimeException& other);
+
+ /**
+ * Destructor
+ */
virtual ~EtchValidatorRuntimeException();
/**
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorShort.h b/binding-cpp/runtime/include/serialization/EtchValidatorShort.h
index 50df7aa..22b0b2d 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorShort.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorShort.h
@@ -38,6 +38,14 @@
*/
static const EtchObjectType* TYPE();
+ /**
+ * Copy Constructor
+ */
+ EtchValidatorShort(const EtchValidatorShort& other);
+
+ /**
+ * Destructor
+ */
virtual ~EtchValidatorShort();
/**
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorString.h b/binding-cpp/runtime/include/serialization/EtchValidatorString.h
index 93d6403..7f1a18f 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorString.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorString.h
@@ -33,6 +33,14 @@
*/
static const EtchObjectType* TYPE();
+ /**
+ * Copy Constructor
+ */
+ EtchValidatorString(const EtchValidatorString& other);
+
+ /**
+ * Destructor
+ */
virtual ~EtchValidatorString();
/**
diff --git a/binding-cpp/runtime/include/serialization/EtchValidatorStructValue.h b/binding-cpp/runtime/include/serialization/EtchValidatorStructValue.h
index 232fc67..730df00 100644
--- a/binding-cpp/runtime/include/serialization/EtchValidatorStructValue.h
+++ b/binding-cpp/runtime/include/serialization/EtchValidatorStructValue.h
@@ -29,6 +29,14 @@
class EtchValidatorStructValue : public EtchTypeValidator {
public:
+ /**
+ * Copy Constructor
+ */
+ EtchValidatorStructValue(const EtchValidatorStructValue& other);
+
+ /**
+ * Destructor
+ */
virtual ~EtchValidatorStructValue();
/**
@@ -55,7 +63,7 @@
* EtchObjectType for EtchRuntimeException.
*/
static const EtchObjectType* TYPE();
-
+
EtchType* getType();
protected:
diff --git a/binding-cpp/runtime/include/serialization/EtchValueFactory.h b/binding-cpp/runtime/include/serialization/EtchValueFactory.h
index ecfc6ee..d5830a5 100644
--- a/binding-cpp/runtime/include/serialization/EtchValueFactory.h
+++ b/binding-cpp/runtime/include/serialization/EtchValueFactory.h
@@ -51,6 +51,11 @@
EtchValueFactory();
/**
+ * Copy Constructor
+ */
+ EtchValueFactory(const EtchValueFactory& other);
+
+ /**
* Destructor
*/
virtual ~EtchValueFactory() {
diff --git a/binding-cpp/runtime/include/support/EtchPool.h b/binding-cpp/runtime/include/support/EtchPool.h
index f20312c..ad4116a 100644
--- a/binding-cpp/runtime/include/support/EtchPool.h
+++ b/binding-cpp/runtime/include/support/EtchPool.h
@@ -31,12 +31,24 @@
public:
/**
+ * EtchObjectType for EtchPool.
+ */
+ static const EtchObjectType* TYPE();
+
+ /**
* Creates a new instance of the EtchPool-Class.
*/
- EtchPool(const EtchObjectType* type)
- : EtchObject(type) {}
+ EtchPool() {
+ addObjectType(TYPE());
+ }
/**
+ * Creates a copy of the EtchPool-Class.
+ */
+ EtchPool(const EtchObject& other)
+ : EtchObject(other) {
+ }
+ /**
* Destructure.
*/
virtual ~EtchPool() {}
diff --git a/binding-cpp/runtime/include/support/EtchPoolRunnable.h b/binding-cpp/runtime/include/support/EtchPoolRunnable.h
index 0cabf61..26f23b0 100644
--- a/binding-cpp/runtime/include/support/EtchPoolRunnable.h
+++ b/binding-cpp/runtime/include/support/EtchPoolRunnable.h
@@ -36,12 +36,18 @@
virtual status_t run() = 0;
/**
+ * Destructor
+ */
+ virtual ~EtchPoolRunnable() {}
+
+ /**
* Sets an exception
* @param exception that occured
* @return ETCH_OK if no error
*/
status_t setException(capu::SmartPointer<EtchException> exception) {
mException = exception;
+ return ETCH_OK;
}
capu::bool_t hasException() {
diff --git a/binding-cpp/runtime/include/support/EtchStack.h b/binding-cpp/runtime/include/support/EtchStack.h
index a8bab43..4c4c9d4 100644
--- a/binding-cpp/runtime/include/support/EtchStack.h
+++ b/binding-cpp/runtime/include/support/EtchStack.h
@@ -30,7 +30,7 @@
/* *
* This class serves as a container for all layers created during the setup of a new stack (connection, packetizer, messagizer, ...).
*/
-class EtchStack : public EtchObject{
+class EtchStack : public EtchObject {
public:
/**
@@ -49,6 +49,12 @@
EtchStack();
/**
+ * Default Constructor
+ */
+ EtchStack(const EtchStack& other);
+
+
+ /**
* Destructor which cleans the whole stack
*/
virtual ~EtchStack();
@@ -87,7 +93,7 @@
* sets the delivery service
*/
void setDeliveryService(EtchDeliveryService* deliveryservice);
-
+
/**
* sets the stub implemenation
*/
diff --git a/binding-cpp/runtime/include/support/EtchStackClient.h b/binding-cpp/runtime/include/support/EtchStackClient.h
index b527bc4..a93bab0 100644
--- a/binding-cpp/runtime/include/support/EtchStackClient.h
+++ b/binding-cpp/runtime/include/support/EtchStackClient.h
@@ -38,6 +38,11 @@
EtchStackClient();
/**
+ * Copy Constructor
+ */
+ EtchStackClient(const EtchStackClient& other);
+
+ /**
* Destructor which cleans the whole stack
*/
virtual ~EtchStackClient();
diff --git a/binding-cpp/runtime/include/support/EtchStackServer.h b/binding-cpp/runtime/include/support/EtchStackServer.h
index 9db34af..0d74062 100644
--- a/binding-cpp/runtime/include/support/EtchStackServer.h
+++ b/binding-cpp/runtime/include/support/EtchStackServer.h
@@ -37,6 +37,11 @@
EtchStackServer();
/**
+ * Copy Constructor
+ */
+ EtchStackServer(const EtchStackServer& other);
+
+ /**
* Destructor which cleans the whole stack
*/
virtual ~EtchStackServer();
diff --git a/binding-cpp/runtime/include/support/EtchStubHelper.h b/binding-cpp/runtime/include/support/EtchStubHelper.h
index 888a4b3..0abfe76 100644
--- a/binding-cpp/runtime/include/support/EtchStubHelper.h
+++ b/binding-cpp/runtime/include/support/EtchStubHelper.h
@@ -44,11 +44,15 @@
* Constructs a StubHelper which uses synchronous mode to dispatch
* method from message.
*/
- EtchStubHelper()
- : EtchObject(EtchStubHelper::TYPE()) {
+ EtchStubHelper() {
+ addObjectType(TYPE());
// nothing to do.
}
+ EtchStubHelper(const EtchStubHelper& other)
+ : EtchObject(other) {
+ }
+
/**
* Dispatches the method from message.
* @param svc
diff --git a/binding-cpp/runtime/include/transport/EtchMessage.h b/binding-cpp/runtime/include/transport/EtchMessage.h
index 1929aff..f51d5cf 100644
--- a/binding-cpp/runtime/include/transport/EtchMessage.h
+++ b/binding-cpp/runtime/include/transport/EtchMessage.h
@@ -39,6 +39,11 @@
EtchMessage(EtchType *type, EtchValueFactory* vf, capu::uint32_t length);
/**
+ * Copy Constructor
+ */
+ EtchMessage(const EtchMessage& other);
+
+ /**
* Destructor
*/
virtual ~EtchMessage();
diff --git a/binding-cpp/runtime/include/transport/EtchTransport.h b/binding-cpp/runtime/include/transport/EtchTransport.h
index 1cf1981..20dde32 100644
--- a/binding-cpp/runtime/include/transport/EtchTransport.h
+++ b/binding-cpp/runtime/include/transport/EtchTransport.h
@@ -161,7 +161,15 @@
* @param maxDelay max delay in milliseconds.
*/
WaitUp(capu::int32_t maxDelay)
- : EtchObject(WaitUp::TYPE()), mMaxDelay(maxDelay) {
+ : mMaxDelay(maxDelay) {
+ addObjectType(TYPE());
+ }
+
+ /**
+ * Copy Constructor
+ */
+ WaitUp(const WaitUp& other)
+ : EtchObject(other), mMaxDelay(other.mMaxDelay) {
}
/**
@@ -184,12 +192,19 @@
return &TYPE;
}
+ /**
+ * Copy Constructor
+ */
+ WaitDown(const WaitDown& other)
+ : EtchObject(other), mMaxDelay(other.mMaxDelay) {
+ }
/**
* @param maxDelay max delay in milliseconds.
*/
WaitDown(capu::int32_t maxDelay)
- : EtchObject(WaitDown::TYPE()), mMaxDelay(maxDelay) {
+ : mMaxDelay(maxDelay) {
+ addObjectType(TYPE());
}
/**
diff --git a/binding-cpp/runtime/src/main/common/EtchArrayValue.cpp b/binding-cpp/runtime/src/main/common/EtchArrayValue.cpp
index 39f8eff..54e7c67 100644
--- a/binding-cpp/runtime/src/main/common/EtchArrayValue.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchArrayValue.cpp
@@ -39,13 +39,20 @@
}
EtchArrayValue::EtchArrayValue(capu::SmartPointer<EtchNativeArrayBase> array, capu::int32_t size, capu::int8_t typeCode, EtchType* customStructType, capu::int32_t dim)
-: EtchObject(EtchArrayValue::TYPE()), mArray(array), mTypeCode(typeCode),
+: mArray(array), mTypeCode(typeCode),
mCustomStructType(customStructType), mDim(dim), mAddIndex(size), mSize(size) {
+ addObjectType(TYPE());
}
EtchArrayValue::EtchArrayValue(capu::SmartPointer<EtchNativeArrayBase> array, capu::int32_t size)
-: EtchObject(EtchArrayValue::TYPE()), mArray(array), mTypeCode(0),
+: mArray(array), mTypeCode(0),
mCustomStructType(NULL), mDim(1), mAddIndex(size), mSize(size) {
+ addObjectType(TYPE());
+}
+
+EtchArrayValue::EtchArrayValue(const EtchArrayValue& other)
+ : EtchObject(other), mArray(other.mArray), mTypeCode(other.mTypeCode), mCustomStructType(other.mCustomStructType),
+ mDim(other.mDim), mAddIndex(other.mAddIndex), mSize(other.mSize) {
}
EtchArrayValue::~EtchArrayValue() {
@@ -80,6 +87,25 @@
return mCustomStructType;
}
+capu::bool_t EtchArrayValue::equals(const EtchObject* other) const {
+ if(other == NULL)
+ return false;
+ if(!other->isInstanceOf(TYPE()))
+ return false;
+ EtchArrayValue* value = (EtchArrayValue*) other;
+
+ capu::bool_t customTypeTest = false;
+ if(mCustomStructType == NULL)
+ customTypeTest = mCustomStructType == value->mCustomStructType;
+ else
+ customTypeTest = this->mCustomStructType->equals(value->mCustomStructType);
+
+ if(customTypeTest && this->mArray->isInstanceOf(value->mArray->TYPE())
+ && this->mSize == value->mSize && this->mDim == value->mDim && this->mAddIndex == value->mAddIndex)
+ return true;
+ return false;
+}
+
status_t EtchArrayValue::get(capu::uint32_t index, capu::SmartPointer<EtchObject> &result) {
if ((index >= getSize()) || (mArray.get() == NULL)) {
return ETCH_EINVAL;
diff --git a/binding-cpp/runtime/src/main/common/EtchAuthenticationException.cpp b/binding-cpp/runtime/src/main/common/EtchAuthenticationException.cpp
index 473521a..d9a7fa2 100644
--- a/binding-cpp/runtime/src/main/common/EtchAuthenticationException.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchAuthenticationException.cpp
@@ -23,8 +23,12 @@
}
EtchAuthenticationException::EtchAuthenticationException(EtchString& msg)
-: EtchException(msg, ETCH_ERROR, EXCPTYPE_BUILTIN, EtchAuthenticationException::TYPE()) {
+: EtchException(msg, ETCH_ERROR, EXCPTYPE_BUILTIN) {
+ addObjectType(TYPE());
+}
+EtchAuthenticationException::EtchAuthenticationException(const EtchAuthenticationException& other)
+: EtchException(other) {
}
EtchAuthenticationException::~EtchAuthenticationException() {
diff --git a/binding-cpp/runtime/src/main/common/EtchBool.cpp b/binding-cpp/runtime/src/main/common/EtchBool.cpp
index 6a51303..2caef54 100644
--- a/binding-cpp/runtime/src/main/common/EtchBool.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchBool.cpp
@@ -24,16 +24,20 @@
}
EtchBool::EtchBool()
-: EtchObject(EtchBool::TYPE())
-, mValue(false){
-
+: mValue(false){
+ addObjectType(TYPE());
}
EtchBool::EtchBool(capu::bool_t value)
-: EtchObject(EtchBool::TYPE())
-, mValue(value){
+ : mValue(value){
+ addObjectType(TYPE());
}
+EtchBool::EtchBool(const EtchBool& other)
+ : EtchObject(other), mValue(other.mValue) {
+}
+
+
void EtchBool::set(capu::bool_t value){
mValue = value;
}
diff --git a/binding-cpp/runtime/src/main/common/EtchByte.cpp b/binding-cpp/runtime/src/main/common/EtchByte.cpp
index f0e2f61..73d084d 100644
--- a/binding-cpp/runtime/src/main/common/EtchByte.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchByte.cpp
@@ -24,13 +24,17 @@
}
EtchByte::EtchByte()
-: EtchObject(EtchByte::TYPE())
-, mValue(0){
+: mValue(0) {
+ addObjectType(TYPE());
}
EtchByte::EtchByte(capu::int8_t value)
-: EtchObject(EtchByte::TYPE())
-, mValue(value){
+: mValue(value) {
+ addObjectType(TYPE());
+}
+
+EtchByte::EtchByte(const EtchByte &other)
+ : EtchObject(other), mValue(other.mValue) {
}
void EtchByte::set(capu::int8_t value){
@@ -52,6 +56,6 @@
capu::uint32_t EtchByte::getHashCode() const{
//For better distribution
- capu::uint32_t result = mValue + 128;
+ capu::uint32_t result = mValue + 128;
return result;
}
diff --git a/binding-cpp/runtime/src/main/common/EtchDate.cpp b/binding-cpp/runtime/src/main/common/EtchDate.cpp
index 450334e..c36505e 100644
--- a/binding-cpp/runtime/src/main/common/EtchDate.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchDate.cpp
@@ -24,11 +24,18 @@
}
EtchDate::EtchDate()
-: EtchObject(EtchDate::TYPE()), mValue(0) {
+: mValue(0) {
+ addObjectType(TYPE());
}
EtchDate::EtchDate(capu::time_t value)
-: EtchObject(EtchDate::TYPE()), mValue(value) {
+ : mValue(value) {
+ addObjectType(TYPE());
+}
+
+
+EtchDate::EtchDate(const EtchDate& other)
+ : EtchObject(other), mValue(other.mValue) {
}
EtchDate::~EtchDate() {
@@ -54,5 +61,5 @@
}
capu::uint32_t EtchDate::getHashCode() const{
- return static_cast<capu::uint32_t>(mValue ^ mValue >> 32);;
-}
\ No newline at end of file
+ return static_cast<capu::uint32_t>(mValue ^ mValue >> 32);
+}
diff --git a/binding-cpp/runtime/src/main/common/EtchDouble.cpp b/binding-cpp/runtime/src/main/common/EtchDouble.cpp
index cbe83cb..db90b47 100644
--- a/binding-cpp/runtime/src/main/common/EtchDouble.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchDouble.cpp
@@ -24,13 +24,17 @@
}
EtchDouble::EtchDouble()
-: EtchObject(EtchDouble::TYPE())
-, mValue(0.0L){
+: mValue(0.0L) {
+ addObjectType(TYPE());
}
EtchDouble::EtchDouble(capu::double_t value)
-: EtchObject(EtchDouble::TYPE())
-, mValue(value){
+: mValue(value) {
+ addObjectType(TYPE());
+}
+
+EtchDouble::EtchDouble(const EtchDouble& other)
+ : EtchObject(other), mValue(other.mValue) {
}
void EtchDouble::set(capu::double_t value){
diff --git a/binding-cpp/runtime/src/main/common/EtchException.cpp b/binding-cpp/runtime/src/main/common/EtchException.cpp
index 719bb60..124458a 100644
--- a/binding-cpp/runtime/src/main/common/EtchException.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchException.cpp
@@ -24,21 +24,16 @@
EtchException::EtchException()
: EtchObject(), mErrorMessage(""), mErrorcode(0), mExcptype(0) {
- EtchObject::addObjectType(EtchException::TYPE());
- // TODO change object hierachy
- EtchObject::setObjectType(EtchException::TYPE());
+ addObjectType(EtchException::TYPE());
}
EtchException::EtchException(EtchString msg, status_t errcode, EtchExceptionType type)
: EtchObject(), mErrorMessage(msg), mErrorcode(errcode), mExcptype(type) {
- EtchObject::addObjectType(EtchException::TYPE());
- // TODO change object hierachy
- EtchObject::setObjectType(EtchException::TYPE());
+ addObjectType(EtchException::TYPE());
}
-EtchException::EtchException(EtchString msg, status_t errcode, EtchExceptionType type, const EtchObjectType* type_id)
-: EtchObject(type_id), mErrorMessage(msg), mErrorcode(errcode), mExcptype(type) {
-
+EtchException::EtchException(const EtchException& other)
+ : EtchObject(other), mErrorMessage(other.mErrorMessage), mErrorcode(other.mErrorcode), mExcptype(other.mExcptype) {
}
EtchException::~EtchException() {
diff --git a/binding-cpp/runtime/src/main/common/EtchFloat.cpp b/binding-cpp/runtime/src/main/common/EtchFloat.cpp
index 77f69d2..207fafd 100644
--- a/binding-cpp/runtime/src/main/common/EtchFloat.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchFloat.cpp
@@ -24,13 +24,17 @@
}
EtchFloat::EtchFloat()
-: EtchObject(EtchFloat::TYPE())
-, mValue(0.0f){
+ : mValue(0.0f) {
+ addObjectType(TYPE());
}
EtchFloat::EtchFloat(capu::float_t value)
-: EtchObject(EtchFloat::TYPE())
-, mValue(value){
+ : mValue(value) {
+ addObjectType(TYPE());
+}
+
+EtchFloat::EtchFloat(const EtchFloat& other)
+ : EtchObject(other), mValue(other.mValue) {
}
void EtchFloat::set(capu::float_t value){
diff --git a/binding-cpp/runtime/src/main/common/EtchInt32.cpp b/binding-cpp/runtime/src/main/common/EtchInt32.cpp
index b599837..9703569 100644
--- a/binding-cpp/runtime/src/main/common/EtchInt32.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchInt32.cpp
@@ -17,6 +17,8 @@
*/
#include "common/EtchInt32.h"
+#include "common/EtchObjectType.h"
+#include "common/EtchError.h"
const EtchObjectType* EtchInt32::TYPE() {
const static EtchObjectType TYPE(EOTID_INT32, NULL);
@@ -24,15 +26,23 @@
}
EtchInt32::EtchInt32()
-: EtchObject(EtchInt32::TYPE())
-, mValue(0){
+ : mValue(0) {
+ addObjectType(TYPE());
}
EtchInt32::EtchInt32(capu::int32_t value)
-: EtchObject(EtchInt32::TYPE())
-, mValue(value){
+ : mValue(value) {
+ addObjectType(TYPE());
}
+EtchInt32::EtchInt32(const EtchInt32& other)
+ : EtchObject(other), mValue(other.mValue) {
+}
+
+EtchInt32::~EtchInt32() {
+}
+
+
void EtchInt32::set(capu::int32_t value){
mValue = value;
}
@@ -63,6 +73,15 @@
return mValue;
}
+EtchInt32& EtchInt32::operator=(EtchInt32 const& other)
+{
+ if(mValue != other.mValue)
+ {
+ mValue = other.mValue;
+ }
+ return *this;
+}
+
capu::int32_t& EtchInt32::operator++() //pre increment
{
++mValue;
diff --git a/binding-cpp/runtime/src/main/common/EtchLong.cpp b/binding-cpp/runtime/src/main/common/EtchLong.cpp
index f8db792..593f95b 100644
--- a/binding-cpp/runtime/src/main/common/EtchLong.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchLong.cpp
@@ -24,29 +24,33 @@
}
EtchLong::EtchLong()
-: EtchObject(EtchLong::TYPE())
-, mValue(0){
+ : mValue(0) {
+ addObjectType(TYPE());
}
EtchLong::EtchLong(capu::int64_t value)
-: EtchObject(EtchLong::TYPE())
-, mValue(value){
+ : mValue(value) {
+ addObjectType(TYPE());
}
-void EtchLong::set(capu::int64_t value){
+EtchLong::EtchLong(const EtchLong& other)
+ : EtchObject(other), mValue(other.mValue) {
+}
+
+void EtchLong::set(capu::int64_t value) {
mValue = value;
}
-capu::int64_t EtchLong::get(){
+capu::int64_t EtchLong::get() {
return mValue;
}
-capu::uint32_t EtchLong::getHashCode() const{
+capu::uint32_t EtchLong::getHashCode() const {
//first 32 bit xor second 32 bit of long
return static_cast<capu::uint32_t>(mValue ^ mValue >> 32);
}
-capu::bool_t EtchLong::equals(const EtchObject * other) const{
+capu::bool_t EtchLong::equals(const EtchObject * other) const {
if (other == NULL)
return false;
else if (!other->getObjectType()->equals(EtchLong::TYPE()))
diff --git a/binding-cpp/runtime/src/main/common/EtchObject.cpp b/binding-cpp/runtime/src/main/common/EtchObject.cpp
index 73c3713..bae5277 100644
--- a/binding-cpp/runtime/src/main/common/EtchObject.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchObject.cpp
@@ -24,20 +24,21 @@
return &TYPE;
}
-EtchObject::EtchObject()
- : mType(TYPE()) {
+EtchObject::EtchObject() {
addObjectType(TYPE());
}
-EtchObject::EtchObject(const EtchObjectType* type){
- mType = type;
+EtchObject::EtchObject(const EtchObject& other)
+ : mTypes(other.mTypes) {
}
-EtchObject::~EtchObject() {
+const EtchObjectType* EtchObject::getObjectType() const {
+ const EtchObjectType* ret;
+ this->mTypes.get(mTypes.size()-1, &ret);
+ return ret;
}
-const EtchObjectType* EtchObject::getObjectType() const{
- return mType;
+EtchObject::~EtchObject() {
}
capu::bool_t EtchObject::isInstanceOf(const EtchObjectType* type) const {
@@ -64,9 +65,3 @@
mTypes.add(type);
return ETCH_OK;
}
-
-status_t EtchObject::setObjectType(const EtchObjectType* type) {
- mType = type;
- return ETCH_OK;
-}
-
diff --git a/binding-cpp/runtime/src/main/common/EtchRuntimeException.cpp b/binding-cpp/runtime/src/main/common/EtchRuntimeException.cpp
index 85b508e..2ee06d3 100644
--- a/binding-cpp/runtime/src/main/common/EtchRuntimeException.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchRuntimeException.cpp
@@ -25,8 +25,12 @@
EtchRuntimeException::EtchRuntimeException(EtchString msg, status_t errcode)
-: EtchException(msg, errcode, EtchException::EXCPTYPE_BUILTIN, EtchRuntimeException::TYPE()) {
+: EtchException(msg, errcode, EtchException::EXCPTYPE_BUILTIN) {
+ addObjectType(TYPE());
+}
+EtchRuntimeException::EtchRuntimeException(const EtchRuntimeException& other)
+: EtchException(other) {
}
EtchRuntimeException::~EtchRuntimeException() {
diff --git a/binding-cpp/runtime/src/main/common/EtchServerSocket.cpp b/binding-cpp/runtime/src/main/common/EtchServerSocket.cpp
index f8afd33..3d26297 100644
--- a/binding-cpp/runtime/src/main/common/EtchServerSocket.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchServerSocket.cpp
@@ -24,9 +24,13 @@
return &TYPE;
}
-EtchServerSocket::EtchServerSocket()
-: EtchObject(EtchServerSocket::TYPE()) {
+EtchServerSocket::EtchServerSocket() {
+ addObjectType(TYPE());
+}
+
+EtchServerSocket::EtchServerSocket(const EtchServerSocket& other)
+ : EtchObject(other) {
}
EtchServerSocket::~EtchServerSocket() {
@@ -52,4 +56,4 @@
status_t EtchServerSocket::bind(capu::uint16_t port, const char* addr)
{
return mServerSocket.bind(port,addr);
-}
\ No newline at end of file
+}
diff --git a/binding-cpp/runtime/src/main/common/EtchShort.cpp b/binding-cpp/runtime/src/main/common/EtchShort.cpp
index 413039b..77626be 100644
--- a/binding-cpp/runtime/src/main/common/EtchShort.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchShort.cpp
@@ -24,30 +24,34 @@
}
EtchShort::EtchShort()
-: EtchObject(EtchShort::TYPE())
-, mValue(0){
+ : mValue(0) {
+ addObjectType(TYPE());
}
EtchShort::EtchShort(capu::int16_t value)
-: EtchObject(EtchShort::TYPE())
-, mValue(value){
+ : mValue(value) {
+ addObjectType(TYPE());
}
-void EtchShort::set(capu::int16_t value){
+EtchShort::EtchShort(const EtchShort& other)
+ : EtchObject(other), mValue(other.mValue) {
+}
+
+void EtchShort::set(capu::int16_t value) {
mValue = value;
}
-capu::int16_t EtchShort::get(){
+capu::int16_t EtchShort::get() {
return mValue;
}
-capu::uint32_t EtchShort::getHashCode() const{
+capu::uint32_t EtchShort::getHashCode() const {
//for better distribution
capu::uint32_t result = mValue + 32768;
return result;
}
-capu::bool_t EtchShort::equals(const EtchObject * other) const{
+capu::bool_t EtchShort::equals(const EtchObject * other) const {
if (other == NULL)
return false;
else if (!other->getObjectType()->equals(EtchShort::TYPE()))
diff --git a/binding-cpp/runtime/src/main/common/EtchSocket.cpp b/binding-cpp/runtime/src/main/common/EtchSocket.cpp
index 22bbea0..62c1de1 100644
--- a/binding-cpp/runtime/src/main/common/EtchSocket.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchSocket.cpp
@@ -23,19 +23,23 @@
return &TYPE;
}
-EtchSocket::EtchSocket()
-: EtchObject(EtchSocket::TYPE()) {
+EtchSocket::EtchSocket() {
+ addObjectType(TYPE());
mSocket = new capu::Socket();
}
-EtchSocket::EtchSocket(capu::Socket* soc)
-: EtchObject(EtchSocket::TYPE()) {
+EtchSocket::EtchSocket(capu::Socket* soc) {
+ addObjectType(TYPE());
if (soc == NULL)
mSocket = new capu::Socket();
else
mSocket = soc;
}
+EtchSocket::EtchSocket(const EtchSocket& other)
+ : EtchObject(other), mSocket(other.mSocket) {
+}
+
EtchSocket::~EtchSocket() {
delete mSocket;
}
diff --git a/binding-cpp/runtime/src/main/common/EtchString.cpp b/binding-cpp/runtime/src/main/common/EtchString.cpp
index cfec733..9dd6aa8 100644
--- a/binding-cpp/runtime/src/main/common/EtchString.cpp
+++ b/binding-cpp/runtime/src/main/common/EtchString.cpp
@@ -31,13 +31,13 @@
// TODO: String should support UTF-8 by default
EtchString::EtchString()
-: EtchObject(EtchString::TYPE())
-, mData(NULL), mDataSize(0), mEncoding(ENCODING_ASCII) {
+ : mData(NULL), mDataSize(0), mEncoding(ENCODING_ASCII) {
+ addObjectType(TYPE());
}
EtchString::EtchString(const char* string)
-: EtchObject(EtchString::TYPE())
-, mData(NULL), mDataSize(0), mEncoding(ENCODING_ASCII) {
+ : mData(NULL), mDataSize(0), mEncoding(ENCODING_ASCII) {
+ addObjectType(TYPE());
if (string != NULL) {
capu::uint32_t len = capu::StringUtils::Strlen(string);
mData = new char[len + 1];
@@ -47,9 +47,8 @@
}
EtchString::EtchString(const capu::int8_t* buffer, const capu::int32_t bufferSize, EtchString encoding)
-: EtchObject(EtchString::TYPE())
-, mData(NULL), mDataSize(0), mEncoding(ENCODING_ASCII) {
-
+: mData(NULL), mDataSize(0), mEncoding(ENCODING_ASCII) {
+ addObjectType(TYPE());
EtchString enc("utf-8");
if (encoding.equals(&enc)) {
mEncoding = ENCODING_UTF8;
@@ -73,7 +72,7 @@
}
EtchString::EtchString(const EtchString ©)
-: EtchObject(EtchString::TYPE()), mDataSize(copy.mDataSize), mEncoding(copy.mEncoding) {
+: EtchObject(copy), mDataSize(copy.mDataSize), mEncoding(copy.mEncoding) {
if (copy.mData == NULL)
return;
if (mEncoding != ENCODING_UTF8) {
diff --git a/binding-cpp/runtime/src/main/serialization/EtchField.cpp b/binding-cpp/runtime/src/main/serialization/EtchField.cpp
index 7a2a3c8..9bd47a8 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchField.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchField.cpp
@@ -26,16 +26,26 @@
}
EtchField::EtchField(capu::uint32_t id, EtchString& name)
-: EtchObject(EtchField::TYPE()), mId(id), mName(name) {
+ : mId(id), mName(name) {
+ addObjectType(EtchField::TYPE());
}
EtchField::EtchField(const EtchString& name)
-: EtchObject(EtchField::TYPE()), mId(0), mName(name) {
+ : mId(0), mName(name) {
+ addObjectType(EtchField::TYPE());
mId = EtchHashEx::Digest(name);
}
EtchField::EtchField()
-: EtchObject(EtchField::TYPE()), mId(0), mName("") {
+ : mId(0), mName("") {
+ addObjectType(EtchField::TYPE());
+}
+
+EtchField::~EtchField() {
+}
+
+EtchField::EtchField(const EtchField& other)
+ : EtchObject(other), mId(other.mId), mName(other.mName) {
}
capu::uint32_t EtchField::getHashCode() const{
diff --git a/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp b/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp
index bba1623..3ef9cd7 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp
@@ -27,8 +27,8 @@
return name;
}
-EtchHashTableSerializer::EtchHashTableSerializer(EtchType* type, EtchField* field)
-: mField(*field), mType(type) {
+EtchHashTableSerializer::EtchHashTableSerializer(EtchType* type, EtchField& field)
+: mField(field), mType(type) {
//TODO refactoring
mRuntime = EtchRuntime::getRuntime();
}
@@ -109,17 +109,17 @@
if (result != ETCH_OK) {
return result;
}
-
+
result = class2type->put(EtchNativeArray<capu::SmartPointer<EtchObject> >::TYPE(), type);
if (result != ETCH_OK) {
return result;
}
-
+
type->setComponentType(EtchHashTable<capu::SmartPointer<EtchObject>, capu::SmartPointer<EtchObject> >::TYPE());
-
+
//set the import export helper
- type->setImportExportHelper(new EtchHashTableSerializer(type, &field));
-
+ type->setImportExportHelper(new EtchHashTableSerializer(type, field));
+
//get validator
capu::SmartPointer<EtchValidator> tmp;
result = EtchValidatorObject::Get(1, tmp);
diff --git a/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp b/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp
index c6ace1d..5b64659 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchStructValue.cpp
@@ -24,13 +24,17 @@
}
EtchStructValue::EtchStructValue(EtchType* type, EtchValueFactory* vf)
-: EtchObject(EtchStructValue::TYPE()), mType(type), mLevel(vf->getLevel()), mTable(DEFAULT_SIZE) {
-
+ : mType(type), mLevel(vf->getLevel()), mTable(DEFAULT_SIZE) {
+ addObjectType(TYPE());
}
EtchStructValue::EtchStructValue(EtchType* type, EtchValueFactory* vf, capu::uint32_t length)
-: EtchObject(EtchStructValue::TYPE()), mType(type), mLevel(vf->getLevel()), mTable(length > 0 ? (length * 4 + 2) / 3 : DEFAULT_SIZE) {
+ : mType(type), mLevel(vf->getLevel()), mTable(length > 0 ? (length * 4 + 2) / 3 : DEFAULT_SIZE) {
+ addObjectType(TYPE());
+}
+EtchStructValue::EtchStructValue(const EtchStructValue& other)
+ : EtchObject(other), mType(other.mType), mLevel(other.mLevel), mTable(other.mTable) {
}
EtchStructValue::~EtchStructValue() {
@@ -93,7 +97,7 @@
return mTable.get(key, value);
}
-EtchStructValue::Iterator EtchStructValue::begin()
+EtchStructValue::Iterator EtchStructValue::begin() const
{
return mTable.begin();
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchType.cpp b/binding-cpp/runtime/src/main/serialization/EtchType.cpp
index a6a6620..fca30bf 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchType.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchType.cpp
@@ -23,21 +23,29 @@
const static EtchObjectType TYPE(EOTID_TYPE, NULL);
return &TYPE;
}
-
EtchType::EtchType()
-: EtchObject(EtchType::TYPE()), mId(0), mTimeout(0), mName(""), mSuperType(NULL),
-mResultType(NULL), mDirection(BOTH), mAsyncMode(NONE), mLocked(false), mComponentType(NULL), mHelper(NULL), mStubHelper(NULL) {
+: 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)
-: EtchObject(EtchType::TYPE()), mTimeout(0), mName(name), mSuperType(NULL),
+: mTimeout(0), mName(name), mSuperType(NULL),
mResultType(NULL), mDirection(BOTH), mAsyncMode(NONE), mLocked(false), mComponentType(NULL), mHelper(NULL), mStubHelper(NULL) {
- mId = EtchHashEx::Digest(mName);;
+ mId = EtchHashEx::Digest(mName);
+ addObjectType(TYPE());
}
EtchType::EtchType(capu::uint32_t id, EtchString name)
-: EtchObject(EtchType::TYPE()), mId(id), mTimeout(0), mName(name), mSuperType(NULL),
+: 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), 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) {
}
EtchType::~EtchType() {
@@ -49,7 +57,6 @@
//TODO: Check memory management
delete mStubHelper;
}
-
}
capu::uint64_t EtchType::getHashCode() {
diff --git a/binding-cpp/runtime/src/main/serialization/EtchTypeValidator.cpp b/binding-cpp/runtime/src/main/serialization/EtchTypeValidator.cpp
index 77a1996..472cc9c 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchTypeValidator.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchTypeValidator.cpp
@@ -25,7 +25,7 @@
if (mNDims == 0)
mExpectedType = new EtchObjectType(scalarClass->getTypeId(),scalarClass->getObjectComponentType());
- else if (mNDims > 0){
+ else if (mNDims > 0){
EtchObjectType *type = new EtchObjectType(EOTID_NATIVE_ARRAY, scalarClass);
mExpectedType = type;
mArrayComponentType = scalarClass;
@@ -33,6 +33,11 @@
}
+EtchTypeValidator::EtchTypeValidator(const EtchTypeValidator& other)
+ : EtchValidator(other), mNDims(other.mNDims), mExpectedType(other.mExpectedType),
+ mArrayComponentType(other.mArrayComponentType), mSubclass(other.mSubclass) {
+}
+
EtchTypeValidator::~EtchTypeValidator(){
delete mExpectedType;
}
@@ -50,4 +55,4 @@
return ETCH_OK;
else
return ETCH_ERROR;
-}
\ No newline at end of file
+}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp
index af3dbb9..1d39a0d 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp
@@ -37,6 +37,10 @@
mRuntime = EtchRuntime::getRuntime();
}
+EtchValidatorBoolean::EtchValidatorBoolean(const EtchValidatorBoolean& other)
+: EtchTypeValidator(other), mRuntime(other.mRuntime) {
+}
+
EtchValidatorBoolean::~EtchValidatorBoolean() {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
index 80090d3..e9a0061 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
@@ -37,6 +37,11 @@
mRuntime = EtchRuntime::getRuntime();
}
+EtchValidatorByte::EtchValidatorByte(const EtchValidatorByte& other)
+: EtchTypeValidator(other), mRuntime(other.mRuntime) {
+
+}
+
EtchValidatorByte::~EtchValidatorByte() {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp
index 91351c5..fa55c74 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp
@@ -82,17 +82,17 @@
}
EtchValidatorCustomKey::EtchValidatorCustomKey()
-: EtchObject(EtchValidatorCustomKey::TYPE())
-, mType(NULL)
-, mDims(0)
-, mSubclassOk(false) {
+ : mType(NULL), mDims(0), mSubclassOk(false) {
+ addObjectType(EtchValidatorCustomKey::TYPE());
}
EtchValidatorCustomKey::EtchValidatorCustomKey(const EtchObjectType * type, capu::int32_t dim, capu::bool_t sub)
-: EtchObject(EtchValidatorCustomKey::TYPE())
-, mType(type)
-, mDims(dim)
-, mSubclassOk(sub) {
+ : mType(type), mDims(dim), mSubclassOk(sub) {
+ addObjectType(EtchValidatorCustomKey::TYPE());
+}
+
+EtchValidatorCustomKey::EtchValidatorCustomKey(const EtchValidatorCustomKey& other)
+ : EtchObject(other), mType(other.mType), mDims(other.mDims), mSubclassOk(other.mSubclassOk) {
}
EtchValidatorCustomKey::~EtchValidatorCustomKey() {
@@ -122,6 +122,11 @@
mSubclass = sub;
}
+EtchValidatorCustom::EtchValidatorCustom(const EtchValidatorCustom& other)
+ : EtchTypeValidator(other) {
+
+}
+
EtchValidatorCustom::~EtchValidatorCustom() {
}
@@ -173,4 +178,4 @@
EtchHashTable<EtchValidatorCustomKey, capu::SmartPointer<EtchValidator> >& EtchValidatorCustom::Validators(EtchRuntime* runtime) {
static EtchValidatorCustomCaches validators;
return validators.get(runtime);
-}
\ No newline at end of file
+}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp
index 239489c..b4c83e2 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp
@@ -36,6 +36,11 @@
mRuntime = EtchRuntime::getRuntime();
}
+EtchValidatorDouble::EtchValidatorDouble(const EtchValidatorDouble& other)
+: EtchTypeValidator(other), mRuntime(other.mRuntime) {
+
+}
+
EtchValidatorDouble::~EtchValidatorDouble() {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp
index 86ef9bc..29d6808 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp
@@ -37,6 +37,11 @@
mRuntime = EtchRuntime::getRuntime();
}
+EtchValidatorFloat::EtchValidatorFloat(const EtchValidatorFloat& other)
+: EtchTypeValidator(other), mRuntime(other.mRuntime) {
+
+}
+
EtchValidatorFloat::~EtchValidatorFloat() {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
index bfeef41..2835bf8 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
@@ -37,6 +37,11 @@
mRuntime = EtchRuntime::getRuntime();
}
+EtchValidatorInt::EtchValidatorInt(const EtchValidatorInt& other)
+: EtchTypeValidator(other), mRuntime(other.mRuntime) {
+
+}
+
EtchValidatorInt::~EtchValidatorInt() {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp
index 75cd466..d480fd6 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp
@@ -37,6 +37,11 @@
mRuntime = EtchRuntime::getRuntime();
}
+EtchValidatorLong::EtchValidatorLong(const EtchValidatorLong& other)
+: EtchTypeValidator(other), mRuntime(other.mRuntime) {
+
+}
+
EtchValidatorLong::~EtchValidatorLong() {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorNone.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorNone.cpp
index 736d882..898631b 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorNone.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorNone.cpp
@@ -35,6 +35,11 @@
mRuntime = EtchRuntime::getRuntime();
}
+EtchValidatorNone::EtchValidatorNone(const EtchValidatorNone& other)
+: EtchValidator(other), mRuntime(other.mRuntime) {
+
+}
+
EtchValidatorNone::~EtchValidatorNone() {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp
index f6f7e4c..0cad0cb 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorObject.cpp
@@ -36,6 +36,11 @@
mSubclass = true;
}
+EtchValidatorObject::EtchValidatorObject(const EtchValidatorObject& other)
+: EtchTypeValidator(other), mRuntime(other.mRuntime) {
+
+}
+
EtchValidatorObject::~EtchValidatorObject() {
}
@@ -63,7 +68,7 @@
status_t EtchValidatorObject::Get(capu::uint32_t ndim, capu::SmartPointer<EtchValidator> &val) {
//TODO rafactor this
EtchRuntime* runtime = EtchRuntime::getRuntime();
-
+
if (ndim > MAX_NDIMS)
return ETCH_EINVAL;
if (ndim >= MAX_CACHED) {
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp
index 4ce7de5..2c606c2 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorRuntimeException.cpp
@@ -37,6 +37,11 @@
mRuntime = EtchRuntime::getRuntime();
}
+EtchValidatorRuntimeException::EtchValidatorRuntimeException(const EtchValidatorRuntimeException& other)
+: EtchValidator(other), mRuntime(other.mRuntime) {
+
+}
+
EtchValidatorRuntimeException::~EtchValidatorRuntimeException() {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
index a6e56b8..00a344b 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
@@ -37,6 +37,11 @@
mRuntime = EtchRuntime::getRuntime();
}
+EtchValidatorShort::EtchValidatorShort(const EtchValidatorShort& other)
+: EtchTypeValidator(other), mRuntime(other.mRuntime) {
+
+}
+
EtchValidatorShort::~EtchValidatorShort() {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp
index a9f7b53..864d119 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp
@@ -37,6 +37,11 @@
mRuntime = EtchRuntime::getRuntime();
}
+EtchValidatorString::EtchValidatorString(const EtchValidatorString& other)
+: EtchTypeValidator(other), mRuntime(other.mRuntime) {
+
+}
+
EtchValidatorString::~EtchValidatorString() {
}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValidatorStructValue.cpp b/binding-cpp/runtime/src/main/serialization/EtchValidatorStructValue.cpp
index 035bd2e..be99025 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValidatorStructValue.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValidatorStructValue.cpp
@@ -32,6 +32,11 @@
mRuntime = EtchRuntime::getRuntime();
}
+EtchValidatorStructValue::EtchValidatorStructValue(const EtchValidatorStructValue& other)
+: EtchTypeValidator(other), mType(other.mType), mRuntime(other.mRuntime) {
+
+}
+
EtchValidatorStructValue::~EtchValidatorStructValue() {
}
@@ -85,4 +90,4 @@
EtchType* EtchValidatorStructValue::getType() {
return mType;
-}
\ No newline at end of file
+}
diff --git a/binding-cpp/runtime/src/main/serialization/EtchValueFactory.cpp b/binding-cpp/runtime/src/main/serialization/EtchValueFactory.cpp
index d03c3be..2c24c84 100644
--- a/binding-cpp/runtime/src/main/serialization/EtchValueFactory.cpp
+++ b/binding-cpp/runtime/src/main/serialization/EtchValueFactory.cpp
@@ -23,8 +23,12 @@
return &TYPE;
}
-EtchValueFactory::EtchValueFactory()
-: EtchObject(EtchValueFactory::TYPE()) {
+EtchValueFactory::EtchValueFactory() {
+ addObjectType(EtchValueFactory::TYPE());
+}
+
+EtchValueFactory::EtchValueFactory(const EtchValueFactory& other)
+ : EtchObject(other) {
}
EtchString EtchValueFactory::getStringEncoding() {
diff --git a/binding-cpp/runtime/src/main/support/EtchFreePool.cpp b/binding-cpp/runtime/src/main/support/EtchFreePool.cpp
index 0d98c6a..558e18f 100644
--- a/binding-cpp/runtime/src/main/support/EtchFreePool.cpp
+++ b/binding-cpp/runtime/src/main/support/EtchFreePool.cpp
@@ -67,13 +67,10 @@
}
EtchFreePool::EtchFreePool(capu::int32_t size)
- : EtchPool(EtchFreePool::TYPE())
- , mSize(0)
- , mSizeMax(size)
- , mIsOpen(true) {
-
- mThreads = new capu::Thread*[mSizeMax];
- capu::Memory::Set(mThreads, 0, sizeof(capu::Thread*)*mSizeMax);
+ : mSize(0), mSizeMax(size), mIsOpen(true) {
+ addObjectType(TYPE());
+ mThreads = new capu::Thread*[mSizeMax];
+ capu::Memory::Set(mThreads, 0, sizeof(capu::Thread*)*mSizeMax);
}
EtchFreePool::~EtchFreePool() {
@@ -116,7 +113,7 @@
if(!mIsOpen) {
return ETCH_ERROR;
}
-
+
mMutex.lock();
// clean thread list
diff --git a/binding-cpp/runtime/src/main/support/EtchPool.cpp b/binding-cpp/runtime/src/main/support/EtchPool.cpp
index 2fe49ff..943d8da 100644
--- a/binding-cpp/runtime/src/main/support/EtchPool.cpp
+++ b/binding-cpp/runtime/src/main/support/EtchPool.cpp
@@ -20,3 +20,7 @@
#include "support/EtchPool.h"
+const EtchObjectType* EtchPool::TYPE() {
+ const static EtchObjectType TYPE(EOTID_POOL, NULL);
+ return &TYPE;
+}
diff --git a/binding-cpp/runtime/src/main/support/EtchQueuedPool.cpp b/binding-cpp/runtime/src/main/support/EtchQueuedPool.cpp
index 88534fa..5b3fdb6 100644
--- a/binding-cpp/runtime/src/main/support/EtchQueuedPool.cpp
+++ b/binding-cpp/runtime/src/main/support/EtchQueuedPool.cpp
@@ -65,10 +65,9 @@
}
EtchQueuedPool::EtchQueuedPool(capu::int32_t size)
- : EtchPool(EtchQueuedPool::TYPE())
- , mSizeMax(size)
- , mIsOpen(true) {
- mPool = new capu::ThreadPool(mSizeMax);
+: mSizeMax(size), mIsOpen(true) {
+ addObjectType(TYPE());
+ mPool = new capu::ThreadPool(mSizeMax);
}
EtchQueuedPool::~EtchQueuedPool() {
diff --git a/binding-cpp/runtime/src/main/support/EtchStack.cpp b/binding-cpp/runtime/src/main/support/EtchStack.cpp
index 0841cf0..9f0ef99 100644
--- a/binding-cpp/runtime/src/main/support/EtchStack.cpp
+++ b/binding-cpp/runtime/src/main/support/EtchStack.cpp
@@ -38,7 +38,18 @@
, mDeliveryService(NULL)
, mStub(NULL)
{
- EtchObject::addObjectType(EtchStack::TYPE());
+ addObjectType(EtchStack::TYPE());
+}
+
+EtchStack::EtchStack(const EtchStack& other) : EtchObject(other)
+, mTransportData(other.mTransportData)
+, mTransportPacket(other.mTransportPacket)
+, mTransportMessage(other.mTransportMessage)
+, mResources(other.mResources)
+, mValueFactory(other.mValueFactory)
+, mMailboxManager(other.mMailboxManager)
+, mDeliveryService(other.mDeliveryService)
+, mStub(other.mStub) {
}
EtchStack::~EtchStack() {
diff --git a/binding-cpp/runtime/src/main/support/EtchStackClient.cpp b/binding-cpp/runtime/src/main/support/EtchStackClient.cpp
index d910789..93e6fed 100644
--- a/binding-cpp/runtime/src/main/support/EtchStackClient.cpp
+++ b/binding-cpp/runtime/src/main/support/EtchStackClient.cpp
@@ -24,8 +24,13 @@
}
EtchStackClient::EtchStackClient() : EtchStack(), mStaticResources(NULL) {
- EtchObject::addObjectType(EtchStackClient::TYPE());
- EtchObject::setObjectType(EtchStackClient::TYPE());
+ addObjectType(EtchStackClient::TYPE());
+}
+
+EtchStackClient::EtchStackClient(const EtchStackClient& other)
+ : EtchStack(other), mStaticResources(other.mStaticResources)
+{
+
}
EtchStackClient::~EtchStackClient() {
diff --git a/binding-cpp/runtime/src/main/support/EtchStackServer.cpp b/binding-cpp/runtime/src/main/support/EtchStackServer.cpp
index 1e2d334..75a2aa3 100644
--- a/binding-cpp/runtime/src/main/support/EtchStackServer.cpp
+++ b/binding-cpp/runtime/src/main/support/EtchStackServer.cpp
@@ -23,11 +23,12 @@
}
EtchStackServer::EtchStackServer()
-: EtchStack()
- , mRemote(NULL)
-{
- EtchObject::addObjectType(EtchStackServer::TYPE());
- EtchObject::setObjectType(EtchStackServer::TYPE());
+: EtchStack(), mRemote(NULL) {
+ addObjectType(EtchStackServer::TYPE());
+}
+
+EtchStackServer::EtchStackServer(const EtchStackServer& other)
+: EtchStack(other), mRemote(other.mRemote) {
}
EtchStackServer::~EtchStackServer() {
diff --git a/binding-cpp/runtime/src/main/transport/EtchMessage.cpp b/binding-cpp/runtime/src/main/transport/EtchMessage.cpp
index 6cb9cae..a1e5e49 100644
--- a/binding-cpp/runtime/src/main/transport/EtchMessage.cpp
+++ b/binding-cpp/runtime/src/main/transport/EtchMessage.cpp
@@ -29,6 +29,10 @@
}
+EtchMessage::EtchMessage(const EtchMessage& other)
+ : EtchStructValue(other), mVf(other.mVf) {
+}
+
EtchMessage::~EtchMessage() {
}
diff --git a/binding-cpp/runtime/src/test/common/EtchArrayValueTest.cpp b/binding-cpp/runtime/src/test/common/EtchArrayValueTest.cpp
index 715ae08..a51cc5a 100644
--- a/binding-cpp/runtime/src/test/common/EtchArrayValueTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchArrayValueTest.cpp
@@ -195,5 +195,22 @@
delete av2;
}
+TEST(EtchArrayValueTest, copyTest) {
+ capu::SmartPointer<EtchNativeArray<capu::int8_t> > nativeTypeArray = new EtchNativeArray<capu::int8_t>(1);
+ nativeTypeArray->set(0, 1);
+ EtchArrayValue o1(nativeTypeArray, 1);
+ EtchArrayValue o2(o1);
+ EtchArrayValue o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+TEST(EtchArrayValueTest, isInstanceOf) {
+ capu::SmartPointer<EtchNativeArray<capu::int8_t> > nativeTypeArray = new EtchNativeArray<capu::int8_t>(1);
+ EtchObject* o1 = new EtchArrayValue(nativeTypeArray, 1);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchArrayValue::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
+}
diff --git a/binding-cpp/runtime/src/test/common/EtchAuthenticationExceptionTest.cpp b/binding-cpp/runtime/src/test/common/EtchAuthenticationExceptionTest.cpp
index 25dff3e..a13bb1c 100644
--- a/binding-cpp/runtime/src/test/common/EtchAuthenticationExceptionTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchAuthenticationExceptionTest.cpp
@@ -60,3 +60,22 @@
delete test2;
delete test3;
}
+
+TEST(EtchAuthenticationExceptionTest, copyTest) {
+ EtchString str("test message");
+ EtchAuthenticationException o1(str);
+ EtchAuthenticationException o2(o1);
+ EtchAuthenticationException o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchAuthenticationExceptionTest, isInstanceOf) {
+ EtchString str("test message");
+ EtchObject* o1 = new EtchAuthenticationException(str);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchException::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchAuthenticationException::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
+}
diff --git a/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp b/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp
index 63dc08f..a966270 100644
--- a/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp
@@ -18,44 +18,62 @@
#include <gtest/gtest.h>
#include "common/EtchBool.h"
+#include "common/EtchString.h"
// Tests positive input.
TEST(EtchBoolTest, Constructor_Default){
EtchBool* i1 = new EtchBool();
EXPECT_TRUE(i1->getObjectType()->equals(EtchBool::TYPE()));
- EXPECT_TRUE(i1->get() == false);
+ EXPECT_FALSE(i1->get());
delete i1;
}
TEST(EtchBoolTest, Constructor_Bool){
EtchBool* i1 = new EtchBool(true);
EXPECT_TRUE(i1->getObjectType()->equals(EtchBool::TYPE()));
- EXPECT_TRUE(i1->get() == true);
+ EXPECT_TRUE(i1->get());
delete i1;
}
TEST(EtchBoolTest, set){
EtchBool* i1 = new EtchBool();
i1->set(true);
- EXPECT_TRUE(i1->get() == true);
+ EXPECT_TRUE(i1->get());
delete i1;
}
TEST(EtchBoolTest, get){
EtchBool* i1 = new EtchBool();
- EXPECT_TRUE(i1->get() == false);
+ EXPECT_FALSE(i1->get());
i1->set(true);
- EXPECT_TRUE(i1->get() == true);
+ EXPECT_TRUE(i1->get());
delete i1;
}
TEST(EtchBoolTest, equals){
EtchBool i1, i2;
- EXPECT_TRUE(i1.get() == false);
+ EXPECT_FALSE(i1.get());
i1.set(true);
i2.set(false);
- EXPECT_TRUE(i1.equals(&i2) == false);
+ EXPECT_FALSE(i1.equals(&i2));
i2.set(true);
- EXPECT_TRUE(i1.equals(&i2) == true);
+ EXPECT_TRUE(i1.equals(&i2));
}
+
+TEST(EtchBoolTest, copyTest) {
+ EtchBool o1(true);
+ EtchBool o2(o1);
+ EtchBool o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchBoolTest, isInstanceOf) {
+ EtchObject* o1 = new EtchBool(true);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchBool::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
+}
+
diff --git a/binding-cpp/runtime/src/test/common/EtchByteTest.cpp b/binding-cpp/runtime/src/test/common/EtchByteTest.cpp
index 5b8364e..229563a 100644
--- a/binding-cpp/runtime/src/test/common/EtchByteTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchByteTest.cpp
@@ -18,44 +18,63 @@
#include <gtest/gtest.h>
#include "common/EtchByte.h"
+#include "common/EtchString.h"
// Tests positive input.
TEST(EtchByteTest, Constructor_Default){
EtchByte* i1 = new EtchByte();
EXPECT_TRUE(i1->getObjectType()->equals(EtchByte::TYPE()));
- EXPECT_TRUE(i1->get() == 0);
+ EXPECT_EQ(0, i1->get());
delete i1;
}
TEST(EtchByteTest, Constructor_Byte){
EtchByte* i1 = new EtchByte(42);
EXPECT_TRUE(i1->getObjectType()->equals(EtchByte::TYPE()));
- EXPECT_TRUE(i1->get() == 42);
+ EXPECT_EQ(42, i1->get());
delete i1;
}
TEST(EtchByteTest, set){
EtchByte* i1 = new EtchByte();
i1->set(43);
- EXPECT_TRUE(i1->get() == 43);
+ EXPECT_EQ(43, i1->get());
delete i1;
}
TEST(EtchByteTest, get){
EtchByte* i1 = new EtchByte();
- EXPECT_TRUE(i1->get() == 0);
+ EXPECT_EQ(0, i1->get());
i1->set(41);
- EXPECT_TRUE(i1->get() == 41);
+ EXPECT_EQ(41, i1->get());
delete i1;
}
TEST(EtchByteTest, equals){
EtchByte i1, i2;
- EXPECT_TRUE(i1.get() == false);
+ EXPECT_FALSE(i1.get());
i1.set(40);
i2.set(41);
- EXPECT_TRUE(i1.equals(&i2) == false);
+ EXPECT_FALSE(i1.equals(&i2));
i2.set(40);
- EXPECT_TRUE(i1.equals(&i2) == true);
+ EXPECT_TRUE(i1.equals(&i2));
}
+
+
+TEST(EtchByteTest, copyTest) {
+ EtchByte o1(2);
+ EtchByte o2(o1);
+ EtchByte o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchByteTest, isInstanceOf) {
+ EtchObject* o1 = new EtchByte(2);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchByte::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
+}
+
diff --git a/binding-cpp/runtime/src/test/common/EtchDateTest.cpp b/binding-cpp/runtime/src/test/common/EtchDateTest.cpp
index afe6199..0f7fcbb 100644
--- a/binding-cpp/runtime/src/test/common/EtchDateTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchDateTest.cpp
@@ -18,6 +18,7 @@
#include <gtest/gtest.h>
#include "common/EtchDate.h"
+#include "common/EtchString.h"
TEST(EtchDateTest, Constructor) {
EtchDate* i1 = new EtchDate();
@@ -49,3 +50,22 @@
i2.set(_time);
EXPECT_TRUE(i1.equals(&i2) == true);
}
+
+
+TEST(EtchDateTest, copyTest) {
+ EtchDate o1;
+ time_t _time = 1234567;
+ o1.set(_time);
+ EtchDate o2(o1);
+ EtchDate o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchDateTest, isInstanceOf) {
+ EtchObject* o1 = new EtchDate();
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchDate::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
+}
diff --git a/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp b/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp
index a28631f..7def193 100644
--- a/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp
@@ -18,44 +18,61 @@
#include <gtest/gtest.h>
#include "common/EtchDouble.h"
+#include "common/EtchString.h"
// Tests positive input.
TEST(EtchDoubleTest, Constructor_Default){
EtchDouble* i1 = new EtchDouble();
EXPECT_TRUE(i1->getObjectType()->equals(EtchDouble::TYPE()));
- EXPECT_TRUE(i1->get() == 0.0L);
+ EXPECT_EQ(0.0L, i1->get());
delete i1;
}
TEST(EtchDoubleTest, Constructor_Double){
EtchDouble* i1 = new EtchDouble(42.0L);
EXPECT_TRUE(i1->getObjectType()->equals(EtchDouble::TYPE()));
- EXPECT_TRUE(i1->get() == 42.0L);
+ EXPECT_EQ(42.0L, i1->get());
delete i1;
}
TEST(EtchDoubleTest, set){
EtchDouble* i1 = new EtchDouble();
i1->set(43.0L);
- EXPECT_EQ(i1->get(), 43.0L);
+ EXPECT_EQ(43.0L, i1->get());
delete i1;
}
TEST(EtchDoubleTest, get){
EtchDouble* i1 = new EtchDouble();
- EXPECT_TRUE(i1->get() == 0.0L);
+ EXPECT_EQ(0.0L, i1->get());
i1->set(41.0L);
- EXPECT_TRUE(i1->get() == 41.0L);
+ EXPECT_EQ(41.0L, i1->get());
delete i1;
}
TEST(EtchDoubleTest, equals){
EtchDouble i1, i2;
- EXPECT_TRUE(i1.get() == 0.0);
+ EXPECT_EQ(0.0L, i1.get());
i1.set(40);
i2.set(41);
- EXPECT_TRUE(i1.equals(&i2) == false);
+ EXPECT_FALSE(i1.equals(&i2));
i2.set(40);
- EXPECT_TRUE(i1.equals(&i2) == true);
+ EXPECT_TRUE(i1.equals(&i2));
+}
+
+TEST(EtchDoubleTest, copyTest) {
+ EtchDouble o1(2.123);
+ EtchDouble o2(o1);
+ EtchDouble o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchDoubleTest, isInstanceOf) {
+ EtchObject* o1 = new EtchDouble(2.123);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchDouble::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
}
diff --git a/binding-cpp/runtime/src/test/common/EtchExceptionTest.cpp b/binding-cpp/runtime/src/test/common/EtchExceptionTest.cpp
index 0163b22..36704ce 100644
--- a/binding-cpp/runtime/src/test/common/EtchExceptionTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchExceptionTest.cpp
@@ -18,6 +18,7 @@
#include <gtest/gtest.h>
#include "common/EtchException.h"
+#include "common/EtchString.h"
TEST(EtchExceptionTest, createTest) {
EtchString str("test message");
@@ -59,3 +60,19 @@
delete test2;
delete test3;
}
+
+TEST(EtchExceptionTest, copyTest) {
+ EtchException o1(EtchString("Message"), ETCH_ERROR, EtchException::EXCPTYPE_BUILTIN);
+ EtchException o2(o1);
+ EtchException o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchExceptionTest, isInstanceOf) {
+ EtchObject* o1 = new EtchException(EtchString("Message"), ETCH_ERROR, EtchException::EXCPTYPE_BUILTIN);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchException::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
+}
diff --git a/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp b/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp
index b29f999..8d72b2b 100644
--- a/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp
@@ -18,44 +18,61 @@
#include <gtest/gtest.h>
#include "common/EtchFloat.h"
+#include "common/EtchString.h"
// Tests positive input.
TEST(EtchFloatTest, Constructor_Default){
EtchFloat* i1 = new EtchFloat();
EXPECT_TRUE(i1->getObjectType()->equals(EtchFloat::TYPE()));
- EXPECT_TRUE(i1->get() == 0.0f);
+ EXPECT_EQ(0.0f, i1->get());
delete i1;
}
TEST(EtchFloatTest, Constructor_Float){
EtchFloat* i1 = new EtchFloat(42.0f);
EXPECT_TRUE(i1->getObjectType()->equals(EtchFloat::TYPE()));
- EXPECT_TRUE(i1->get() == 42.0f);
+ EXPECT_EQ(42.0f, i1->get());
delete i1;
}
TEST(EtchFloatTest, set){
EtchFloat* i1 = new EtchFloat();
i1->set(43.33f);
- EXPECT_TRUE(i1->get() == 43.33f);
+ EXPECT_EQ(43.33f, i1->get());
delete i1;
}
TEST(EtchFloatTest, get){
EtchFloat* i1 = new EtchFloat();
- EXPECT_TRUE(i1->get() == 0.0f);
+ EXPECT_EQ(0.0f, i1->get());
i1->set(41.0f);
- EXPECT_TRUE(i1->get() == 41.0f);
+ EXPECT_EQ(41.0f, i1->get());
delete i1;
}
TEST(EtchFloatTest, equals){
EtchFloat i1, i2;
- EXPECT_TRUE(i1.get() == 0.0f);
+ EXPECT_EQ(0.0f, i1.get());
i1.set(40);
i2.set(41);
- EXPECT_TRUE(i1.equals(&i2) == false);
+ EXPECT_FALSE(i1.equals(&i2));
i2.set(40);
- EXPECT_TRUE(i1.equals(&i2) == true);
+ EXPECT_TRUE(i1.equals(&i2));
+}
+
+TEST(EtchFloatTest, copyTest) {
+ EtchFloat o1(2.123);
+ EtchFloat o2(o1);
+ EtchFloat o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchFloatTest, isInstanceOf) {
+ EtchObject* o1 = new EtchFloat(2.123);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchFloat::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
}
diff --git a/binding-cpp/runtime/src/test/common/EtchInt32Test.cpp b/binding-cpp/runtime/src/test/common/EtchInt32Test.cpp
index cf401d9..4162f80 100644
--- a/binding-cpp/runtime/src/test/common/EtchInt32Test.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchInt32Test.cpp
@@ -18,6 +18,7 @@
#include <gtest/gtest.h>
#include "common/EtchInt32.h"
+#include "common/EtchString.h"
// Tests positive input.
@@ -31,33 +32,33 @@
TEST(EtchInt32Test, Constructor_Int){
EtchInt32* i1 = new EtchInt32(42);
EXPECT_TRUE(i1->getObjectType()->equals(EtchInt32::TYPE()));
- EXPECT_TRUE(i1->get() == 42);
+ EXPECT_EQ(42, i1->get());
delete i1;
}
TEST(EtchInt32Test, set){
EtchInt32* i1 = new EtchInt32();
i1->set(42);
- EXPECT_TRUE(i1->get() == 42);
+ EXPECT_EQ(42, i1->get());
delete i1;
}
TEST(EtchInt32Test, get){
EtchInt32* i1 = new EtchInt32();
- EXPECT_TRUE(i1->get() == 0);
+ EXPECT_EQ(0, i1->get());
i1->set(42);
- EXPECT_TRUE(i1->get() == 42);
+ EXPECT_EQ(42, i1->get());
delete i1;
}
TEST(EtchInt32Test, equals){
EtchInt32 i1, i2;
- EXPECT_TRUE(i1.get() == false);
+ EXPECT_FALSE(i1.get());
i1.set(40);
i2.set(41);
- EXPECT_TRUE(i1.equals(&i2) == false);
+ EXPECT_FALSE(i1.equals(&i2));
i2.set(40);
- EXPECT_TRUE(i1.equals(&i2) == true);
+ EXPECT_TRUE(i1.equals(&i2));
}
TEST(EtchInt32Test, operator_equal){
@@ -127,3 +128,19 @@
++b;
EXPECT_FALSE(a != b);
}
+
+TEST(EtchInt32Test, copyTest) {
+ EtchInt32 o1(2);
+ EtchInt32 o2(o1);
+ EtchInt32 o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchInt32Test, isInstanceOf) {
+ EtchObject* o1 = new EtchInt32(2);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchInt32::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
+}
diff --git a/binding-cpp/runtime/src/test/common/EtchListTest.cpp b/binding-cpp/runtime/src/test/common/EtchListTest.cpp
index 86fdf54..517178d 100644
--- a/binding-cpp/runtime/src/test/common/EtchListTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchListTest.cpp
@@ -19,6 +19,7 @@
#include <gtest/gtest.h>
#include "common/EtchInt32.h"
#include "common/EtchList.h"
+#include "common/EtchString.h"
TEST(EtchList, Constructor_Default) {
//create an empty linked list
@@ -369,3 +370,23 @@
}
+TEST(EtchList, copyTest) {
+ EtchList<EtchInt32> o1;
+ o1.add(EtchInt32(2));
+ o1.add(EtchInt32(3));
+ EtchList<EtchInt32> o2(o1);
+ EtchList<EtchInt32> o3 = o2;
+
+ EXPECT_EQ(o1.size(), o2.size());
+ EXPECT_EQ(o2.size(), o3.size());
+}
+
+TEST(EtchList, isInstanceOf) {
+ EtchObject* o1 = new EtchList<EtchInt32>();
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchList<EtchInt32>::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
+}
+
+
diff --git a/binding-cpp/runtime/src/test/common/EtchLongTest.cpp b/binding-cpp/runtime/src/test/common/EtchLongTest.cpp
index 18ca8fa..44f2839 100644
--- a/binding-cpp/runtime/src/test/common/EtchLongTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchLongTest.cpp
@@ -18,27 +18,28 @@
#include <gtest/gtest.h>
#include "common/EtchLong.h"
+#include "common/EtchString.h"
// Tests positive input.
TEST(EtchLongTest, Constructor_Default){
EtchLong* i1 = new EtchLong();
EXPECT_TRUE(i1->getObjectType()->equals(EtchLong::TYPE()));
- EXPECT_TRUE(i1->get() == 0);
+ EXPECT_EQ(0, i1->get());
delete i1;
}
TEST(EtchLongTest, Constructor_Long){
EtchLong* i1 = new EtchLong(42);
EXPECT_TRUE(i1->getObjectType()->equals(EtchLong::TYPE()));
- EXPECT_TRUE(i1->get() == 42);
+ EXPECT_EQ(42, i1->get());
delete i1;
}
TEST(EtchLongTest, set){
EtchLong* i1 = new EtchLong();
i1->set(43000000);
- EXPECT_TRUE(i1->get() == 43000000);
+ EXPECT_EQ(43000000, i1->get());
delete i1;
}
@@ -52,10 +53,26 @@
TEST(EtchLongTest, equals){
EtchLong i1, i2;
- EXPECT_TRUE(i1.get() == false);
+ EXPECT_FALSE(i1.get());
i1.set(40);
i2.set(41);
- EXPECT_TRUE(i1.equals(&i2) == false);
+ EXPECT_FALSE(i1.equals(&i2));
i2.set(40);
- EXPECT_TRUE(i1.equals(&i2) == true);
+ EXPECT_TRUE(i1.equals(&i2));
+}
+
+TEST(EtchLongTest, copyTest) {
+ EtchLong o1(2);
+ EtchLong o2(o1);
+ EtchLong o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchLongTest, isInstanceOf) {
+ EtchObject* o1 = new EtchLong(2);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchLong::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
}
diff --git a/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp b/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp
index 4327be7..2aca07d 100644
--- a/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp
@@ -71,9 +71,9 @@
TEST(EtchObjectTest, isInstanceOf) {
EtchObjectMy1Object* o1 = new EtchObjectMy1Object();
- EXPECT_EQ(true, o1->isInstanceOf(EtchObjectMy1Object::TYPE()));
- EXPECT_EQ(true, o1->isInstanceOf(EtchObject::TYPE()));
- EXPECT_EQ(false, o1->isInstanceOf(EtchObjectMy2Object::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchObjectMy1Object::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchObjectMy2Object::TYPE()));
delete o1;
-}
\ No newline at end of file
+}
diff --git a/binding-cpp/runtime/src/test/common/EtchRuntimeExceptionTest.cpp b/binding-cpp/runtime/src/test/common/EtchRuntimeExceptionTest.cpp
index e8cf2f5..3136eb9 100644
--- a/binding-cpp/runtime/src/test/common/EtchRuntimeExceptionTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchRuntimeExceptionTest.cpp
@@ -59,3 +59,20 @@
delete test2;
delete test3;
}
+
+TEST(EtchRuntimeExceptionTest, copyTest) {
+ EtchRuntimeException o1(EtchString("Message"), ETCH_ERROR);
+ EtchRuntimeException o2(o1);
+ EtchRuntimeException o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchRuntimeExceptionTest, isInstanceOf) {
+ EtchObject* o1 = new EtchRuntimeException(EtchString("Message"), ETCH_ERROR);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchException::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchRuntimeException::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
+}
diff --git a/binding-cpp/runtime/src/test/common/EtchShortTest.cpp b/binding-cpp/runtime/src/test/common/EtchShortTest.cpp
index 3bac905..56d8edd 100644
--- a/binding-cpp/runtime/src/test/common/EtchShortTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchShortTest.cpp
@@ -18,44 +18,61 @@
#include <gtest/gtest.h>
#include "common/EtchShort.h"
+#include "common/EtchString.h"
// Tests positive input.
TEST(EtchShortTest, Constructor_Default){
EtchShort* i1 = new EtchShort();
EXPECT_TRUE(i1->getObjectType()->equals(EtchShort::TYPE()));
- EXPECT_TRUE(i1->get() == 0);
+ EXPECT_EQ(0, i1->get());
delete i1;
}
TEST(EtchShortTest, Constructor_Short){
EtchShort* i1 = new EtchShort(42);
EXPECT_TRUE(i1->getObjectType()->equals(EtchShort::TYPE()));
- EXPECT_TRUE(i1->get() == 42);
+ EXPECT_EQ(42, i1->get());
delete i1;
}
TEST(EtchShortTest, set){
EtchShort* i1 = new EtchShort();
i1->set(43);
- EXPECT_TRUE(i1->get() == 43);
+ EXPECT_EQ(43, i1->get());
delete i1;
}
TEST(EtchShortTest, get){
EtchShort* i1 = new EtchShort();
- EXPECT_TRUE(i1->get() == 0);
+ EXPECT_EQ(0, i1->get());
i1->set(41);
- EXPECT_TRUE(i1->get() == 41);
+ EXPECT_EQ(41, i1->get());
delete i1;
}
TEST(EtchShortTest, equals){
EtchShort i1, i2;
- EXPECT_TRUE(i1.get() == false);
+ EXPECT_FALSE(i1.get());
i1.set(40);
i2.set(41);
- EXPECT_TRUE(i1.equals(&i2) == false);
+ EXPECT_FALSE(i1.equals(&i2));
i2.set(40);
- EXPECT_TRUE(i1.equals(&i2) == true);
+ EXPECT_TRUE(i1.equals(&i2));
+}
+
+TEST(EtchShortTest, copyTest) {
+ EtchShort o1(2);
+ EtchShort o2(o1);
+ EtchShort o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchShortTest, isInstanceOf) {
+ EtchObject* o1 = new EtchShort(2);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchShort::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
}
diff --git a/binding-cpp/runtime/src/test/common/EtchStringTest.cpp b/binding-cpp/runtime/src/test/common/EtchStringTest.cpp
index 584b0e7..d141e09 100644
--- a/binding-cpp/runtime/src/test/common/EtchStringTest.cpp
+++ b/binding-cpp/runtime/src/test/common/EtchStringTest.cpp
@@ -18,13 +18,14 @@
#include <gtest/gtest.h>
#include "common/EtchString.h"
+#include "common/EtchInt32.h"
// Tests positive input.
TEST(EtchStringTest, Constructor_Default) {
EtchString* s1 = new EtchString();
EXPECT_TRUE(s1->getObjectType()->equals(EtchString::TYPE()));
- EXPECT_TRUE(s1->c_str() == NULL);
+ EXPECT_EQ(NULL, s1->c_str());
delete s1;
}
@@ -198,4 +199,19 @@
status_t result;
result = str1.substring(0, 5, &tmp);
EXPECT_TRUE(result == ETCH_EUNIMPL);
-}
\ No newline at end of file
+}
+TEST(EtchStringTest, copyTest) {
+ EtchString o1("2");
+ EtchString o2(o1);
+ EtchString o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST(EtchStringTest, isInstanceOf) {
+ EtchObject* o1 = new EtchString("2");
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchString::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchInt32::TYPE()));
+ delete o1;
+}
diff --git a/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp
index 9463e09..da7aaea 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchBinaryTaggedDataInputOutputTest.cpp
@@ -208,7 +208,7 @@
}
static void bytes2msg(capu::int8_t* buf, capu::uint32_t length, capu::SmartPointer<EtchMessage> &msg, MyValueFactory &vf) {
- return bytes2msg(buf, length, msg, LEVEL_FULL, vf);
+ bytes2msg(buf, length, msg, LEVEL_FULL, vf);
}
static void bytes2msg(capu::int8_t* buf, capu::uint32_t length, capu::SmartPointer<EtchMessage> &msg, EtchLevel level, MyValueFactory &vf) {
diff --git a/binding-cpp/runtime/src/test/serialization/EtchDefaultValueFactoryTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchDefaultValueFactoryTest.cpp
index 7b58694..e504ff7 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchDefaultValueFactoryTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchDefaultValueFactoryTest.cpp
@@ -195,7 +195,7 @@
EtchStructValue* sv_unknown;
//TRY UNKNOWN VALUE
- capu::SmartPointer<EtchObject> unknown = new EtchObject(EtchObject::TYPE());
+ capu::SmartPointer<EtchObject> unknown = new EtchObject();
EXPECT_TRUE(test->exportCustomValue(unknown, sv_unknown) == ETCH_EINVAL);
//clear the added types
diff --git a/binding-cpp/runtime/src/test/serialization/EtchHashTableSerializerTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchHashTableSerializerTest.cpp
index f8c1c7c..f15e40c 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchHashTableSerializerTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchHashTableSerializerTest.cpp
@@ -92,7 +92,7 @@
EtchClass2TypeMap* c2type = new EtchClass2TypeMap();
EtchString typeName("type1");
EtchType* type = new EtchType(10, typeName);
- EtchType* result;
+ EtchType* result = 0;
EXPECT_TRUE(EtchHashTableSerializer::Init(type, c2type) == ETCH_OK);
c2type->get(EtchNativeArray<capu::SmartPointer<EtchObject> >::TYPE(), &result);
diff --git a/binding-cpp/runtime/src/test/serialization/EtchStructValueTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchStructValueTest.cpp
index 25ef623..3cdbbe0 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchStructValueTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchStructValueTest.cpp
@@ -498,3 +498,15 @@
delete factory;
}
+TEST_F(EtchStructValueTest, isInstanceOf) {
+ EtchString typeName("comp");
+ EtchType* comp = new EtchType(90, typeName);
+ EtchValueFactory* factory = new MockValueFactory_FULL();
+ EtchObject* o1 = new EtchStructValue(comp, factory);
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchStructValue::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchInt32::TYPE()));
+ delete o1;
+ delete comp;
+ delete factory;
+}
diff --git a/binding-cpp/runtime/src/test/serialization/EtchTypeTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchTypeTest.cpp
index 7d0e23d..b4d8739 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchTypeTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchTypeTest.cpp
@@ -164,3 +164,20 @@
EXPECT_TRUE(t.getSuperType() == NULL);
delete t2;
}
+
+TEST_F(EtchTypeTest, copyTest) {
+ EtchType o1(EtchString("test"));
+ EtchType o2(o1);
+ EtchType o3 = o2;
+ EXPECT_TRUE(o1.equals(&o2));
+ EXPECT_TRUE(o2.equals(&o3));
+}
+
+TEST_F(EtchTypeTest, isInstanceOf) {
+ EtchObject* o1 = new EtchType(EtchString("test"));
+ EXPECT_TRUE(o1->isInstanceOf(EtchObject::TYPE()));
+ EXPECT_TRUE(o1->isInstanceOf(EtchType::TYPE()));
+ EXPECT_FALSE(o1->isInstanceOf(EtchString::TYPE()));
+ delete o1;
+}
+
diff --git a/binding-cpp/runtime/src/test/serialization/EtchValidatorCustomTest.cpp b/binding-cpp/runtime/src/test/serialization/EtchValidatorCustomTest.cpp
index 7a27cdf..4b7bfbd 100644
--- a/binding-cpp/runtime/src/test/serialization/EtchValidatorCustomTest.cpp
+++ b/binding-cpp/runtime/src/test/serialization/EtchValidatorCustomTest.cpp
@@ -26,8 +26,8 @@
class MockGeneratedClass : public EtchObject {
public:
- MockGeneratedClass()
- : EtchObject(MockGeneratedClass::TYPE()) {
+ MockGeneratedClass() {
+ addObjectType(MockGeneratedClass::TYPE());
}
virtual ~MockGeneratedClass() {
@@ -144,7 +144,7 @@
capu::SmartPointer<EtchObject> integer2 = new EtchInt32(5);
capu::SmartPointer<EtchObject> integer3 = new EtchInt32(127);
capu::SmartPointer<EtchObject> byte2 = new EtchByte(3);
-
+
capu::SmartPointer<EtchValidator> ptr = NULL;
capu::SmartPointer<EtchObject> generatedClass = new MockGeneratedClass();
@@ -165,7 +165,7 @@
TEST_F(EtchValidatorCustomTest, elementValidatorTest) {
status_t status;
capu::SmartPointer<EtchValidator> ptr = NULL;
-
+
status = EtchValidatorCustom::Get(1, MockGeneratedClass::TYPE(), true, ptr);
EXPECT_EQ(ETCH_OK, status);
diff --git a/binding-cpp/runtime/src/test/transport/EtchMessageTest.cpp b/binding-cpp/runtime/src/test/transport/EtchMessageTest.cpp
index 327b2a6..1af5391 100644
--- a/binding-cpp/runtime/src/test/transport/EtchMessageTest.cpp
+++ b/binding-cpp/runtime/src/test/transport/EtchMessageTest.cpp
@@ -136,7 +136,7 @@
//Create Value Factory
EtchValueFactory* factory = new MockValueFactory7();
-
+
//create message
EtchMessage *sv = new EtchMessage(comp, factory);
EXPECT_TRUE(sv->getType()->equals(comp));