You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by ve...@apache.org on 2012/01/12 11:01:59 UTC

svn commit: r1230462 - in /incubator/etch/trunk/binding-cpp/runtime: include/common/ src/main/common/ src/test/common/

Author: veithm
Date: Thu Jan 12 10:01:58 2012
New Revision: 1230462

URL: http://svn.apache.org/viewvc?rev=1230462&view=rev
Log:
ETCH-137 Implementation of EtchHashTable Helpers

getHashCode and equals methods are added

Change-Id: Ibb6765a4d60950d2a191192e116315e2c971efc8

Modified:
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchBool.h
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchByte.h
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchDouble.h
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchFloat.h
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchInt32.h
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchLong.h
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObject.h
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchShort.h
    incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchBool.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchByte.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchDouble.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchFloat.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchInt32.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchLong.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchObject.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchShort.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchByteTest.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchInt32Test.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchLongTest.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchShortTest.cpp

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchBool.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchBool.h?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchBool.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchBool.h Thu Jan 12 10:01:58 2012
@@ -1,19 +1,19 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #ifndef __ETCHBOOL_H__
@@ -23,37 +23,49 @@
 #include "common/EtchError.h"
 
 class EtchBool :
-    public EtchObject
-{
+public EtchObject {
+
 public:
 
-    /**
-     * TypeId for EtchBool.
-     */
-    static const capu::int32_t TYPE_ID = EOTID_BOOL;
-
-    /**
-     * Constructs a EtchBool object.
-     */
-    EtchBool();
-
-    /**
-     * Constructs a EtchBool object with given value.
-     */
-    EtchBool(capu::bool_t value);
-
-    /**
-     * Sets bool value.
-     */
-    void set(capu::bool_t value);
-
-    /**
-     * Returns bool value.
-     */
-    capu::bool_t get();
+  /**
+   * TypeId for EtchBool.
+   */
+  static const capu::int32_t TYPE_ID = EOTID_BOOL;
+
+  /**
+   * Constructs a EtchBool object.
+   */
+  EtchBool();
+
+  /**
+   * Constructs a EtchBool object with given value.
+   */
+  EtchBool(capu::bool_t value);
+
+  /**
+   * Sets bool value.
+   */
+  void set(capu::bool_t value);
+
+  /**
+   * Returns bool value.
+   */
+  capu::bool_t get();
+
+  /**
+   * @return true if two object is equal
+   *         false otherwise
+   */
+  capu::bool_t equals(const EtchObject * other);
+
+  /**
+   * Returns hash code
+   */
+  capu::uint64_t getHashCode();
 
 private:
-    capu::bool_t m_value;
+
+  capu::bool_t mValue;
 };
 
 #endif

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchByte.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchByte.h?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchByte.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchByte.h Thu Jan 12 10:01:58 2012
@@ -1,19 +1,19 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #ifndef __ETCHBYTE_H__
@@ -23,37 +23,50 @@
 #include "common/EtchError.h"
 
 class EtchByte :
-    public EtchObject
-{
+public EtchObject {
+
 public:
 
-    /**
-     * TypeId for EtchByte.
-     */
-    static const capu::int32_t TYPE_ID = EOTID_BYTE;
-
-    /**
-     * Constructs a EtchByte object.
-     */
-    EtchByte();
-
-    /**
-     * Constructs a EtchByte object with given value.
-     */
-    EtchByte(capu::int8_t value);
-
-    /**
-     * Sets byte value.
-     */
-    void set(capu::int8_t value);
-
-    /**
-     * Returns byte value.
-     */
-    capu::int8_t get();
+  /**
+   * TypeId for EtchByte.
+   */
+  static const capu::int32_t TYPE_ID = EOTID_BYTE;
+
+  /**
+   * Constructs a EtchByte object.
+   */
+  EtchByte();
+
+  /**
+   * Constructs a EtchByte object with given value.
+   */
+  EtchByte(capu::int8_t value);
+
+  /**
+   * Sets byte value.
+   */
+  void set(capu::int8_t value);
+
+  /**
+   * Returns byte value.
+   */
+  capu::int8_t get();
+
+  /**
+   * @return true if two object is equal
+   *         false otherwise
+   */
+  capu::bool_t equals(const EtchObject * other);
+
+  /**
+   * Returns hash code
+   */
+  capu::uint64_t getHashCode();
 
 private:
-  capu::int8_t m_value;
+
+  capu::int8_t mValue;
+
 };
 
 #endif

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchDouble.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchDouble.h?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchDouble.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchDouble.h Thu Jan 12 10:01:58 2012
@@ -1,19 +1,19 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #ifndef __ETCHDOUBLE_H__
@@ -22,39 +22,51 @@
 #include "common/EtchObject.h"
 #include "common/EtchError.h"
 
-
 class EtchDouble :
-    public EtchObject
-{
+public EtchObject {
+
 public:
 
-    /**
-     * TypeId for EtchDouble.
-     */
-    static const capu::int32_t TYPE_ID = EOTID_DOUBLE;
-
-    /**
-     * Constructs a EtchDouble object.
-     */
-    EtchDouble();
-
-    /**
-     * Constructs a EtchDouble object with given value.
-     */
-    EtchDouble(capu::double_t value);
-
-    /**
-     * Sets double value.
-     */
-    void set(capu::double_t value);
-
-    /**
-     * Returns double value.
-     */
-    capu::double_t get();
+  /**
+   * TypeId for EtchDouble.
+   */
+  static const capu::int32_t TYPE_ID = EOTID_DOUBLE;
+
+  /**
+   * Constructs a EtchDouble object.
+   */
+  EtchDouble();
+
+  /**
+   * Constructs a EtchDouble object with given value.
+   */
+  EtchDouble(capu::double_t value);
+
+  /**
+   * Sets double value.
+   */
+  void set(capu::double_t value);
+
+  /**
+   * Returns double value.
+   */
+  capu::double_t get();
+
+  /**
+   * @return true if two object is equal
+   *         false otherwise
+   */
+  capu::bool_t equals(const EtchObject * other);
+
+  /**
+   * Returns hash code
+   */
+  capu::uint64_t getHashCode();
 
 private:
-    capu::double_t m_value;
+
+  capu::double_t mValue;
+
 };
 
 #endif

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchFloat.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchFloat.h?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchFloat.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchFloat.h Thu Jan 12 10:01:58 2012
@@ -1,19 +1,19 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #ifndef __ETCHFLOAT_H__
@@ -21,38 +21,52 @@
 
 #include "common/EtchObject.h"
 #include "common/EtchError.h"
+
 class EtchFloat :
-    public EtchObject
-{
+public EtchObject {
+
 public:
 
-    /**
-     * TypeId for EtchFloat.
-     */
-    static const capu::int32_t TYPE_ID = EOTID_FLOAT;
-
-    /**
-     * Constructs a EtchFloat object.
-     */
-    EtchFloat();
-
-    /**
-     * Constructs a EtchFloat object with given value.
-     */
-    EtchFloat(capu::float_t value);
-
-    /**
-     * Sets float value.
-     */
-    void set(capu::float_t value);
-
-    /**
-     * Returns float value.
-     */
-    capu::float_t get();
+  /**
+   * TypeId for EtchFloat.
+   */
+  static const capu::int32_t TYPE_ID = EOTID_FLOAT;
+
+  /**
+   * Constructs a EtchFloat object.
+   */
+  EtchFloat();
+
+  /**
+   * Constructs a EtchFloat object with given value.
+   */
+  EtchFloat(capu::float_t value);
+
+  /**
+   * Sets float value.
+   */
+  void set(capu::float_t value);
+
+  /**
+   * Returns float value.
+   */
+  capu::float_t get();
+
+  /**
+   * @return true if two object is equal
+   *         false otherwise
+   */
+  capu::bool_t equals(const EtchObject * other);
+
+  /**
+   * Returns hash code
+   */
+  capu::uint64_t getHashCode();
 
 private:
-    capu::float_t m_value;
+
+  capu::float_t mValue;
+
 };
 
 #endif

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchInt32.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchInt32.h?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchInt32.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchInt32.h Thu Jan 12 10:01:58 2012
@@ -1,19 +1,19 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #ifndef __ETCHINT32_H__
@@ -22,39 +22,51 @@
 #include "common/EtchObject.h"
 #include "common/EtchError.h"
 
-
 class EtchInt32 :
-    public EtchObject
-{
+public EtchObject {
+
 public:
 
-    /**
-     * TypeId for EtchString.
-     */
-    static const capu::int32_t TYPE_ID = EOTID_INT32;
-
-    /**
-     * Constructs a EtchInt32 object.
-     */
-    EtchInt32();
-
-    /**
-     * Constructs a EtchInt32 object with given value.
-     */
-    EtchInt32(capu::int32_t value);
-
-    /**
-     * Sets int32 value.
-     */
-    void set(capu::int32_t value);
-
-    /**
-     * Returns int32 value.
-     */
-    capu::int32_t get();
+  /**
+   * TypeId for EtchString.
+   */
+  static const capu::int32_t TYPE_ID = EOTID_INT32;
+
+  /**
+   * Constructs a EtchInt32 object.
+   */
+  EtchInt32();
+
+  /**
+   * Constructs a EtchInt32 object with given value.
+   */
+  EtchInt32(capu::int32_t value);
+
+  /**
+   * Sets int32 value.
+   */
+  void set(capu::int32_t value);
+
+  /**
+   * Returns int32 value.
+   */
+  capu::int32_t get();
+
+  /**
+   * Returns hash code
+   */
+  capu::uint64_t getHashCode();
+
+  /**
+   * @return true if two object is equal
+   *         false otherwise
+   */
+  capu::bool_t equals(const EtchObject * other);
 
 private:
-    capu::int32_t m_value;
+
+  capu::int32_t mValue;
+
 };
 
 #endif

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchLong.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchLong.h?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchLong.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchLong.h Thu Jan 12 10:01:58 2012
@@ -1,19 +1,19 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #ifndef __ETCHLONG_H__
@@ -23,37 +23,50 @@
 #include "common/EtchError.h"
 
 class EtchLong :
-    public EtchObject
-{
+public EtchObject {
+
 public:
 
-    /**
-     * TypeId for EtchLong.
-     */
-    static const capu::int32_t TYPE_ID = EOTID_LONG;
-
-    /**
-     * Constructs a EtchLong object.
-     */
-    EtchLong();
-
-    /**
-     * Constructs a EtchLong object with given value.
-     */
-    EtchLong(capu::int64_t value);
-
-    /**
-     * Sets long value.
-     */
-    void set(capu::int64_t value);
-
-    /**
-     * Returns long value.
-     */
-    capu::int64_t get();
+  /**
+   * TypeId for EtchLong.
+   */
+  static const capu::int32_t TYPE_ID = EOTID_LONG;
+
+  /**
+   * Constructs a EtchLong object.
+   */
+  EtchLong();
+
+  /**
+   * Constructs a EtchLong object with given value.
+   */
+  EtchLong(capu::int64_t value);
+
+  /**
+   * Sets long value.
+   */
+  void set(capu::int64_t value);
+
+  /**
+   * Returns long value.
+   */
+  capu::int64_t get();
+
+  /**
+   * Returns hash code
+   */
+  capu::uint64_t getHashCode();
+
+  /**
+   * @return true if two object is equal
+   *         false otherwise
+   */
+  capu::bool_t equals(const EtchObject * other);
 
 private:
-    capu::int64_t m_value;
+
+  capu::int64_t mValue;
+
 };
 
 #endif

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObject.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObject.h?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObject.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObject.h Thu Jan 12 10:01:58 2012
@@ -1,19 +1,19 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #ifndef __ETCHOBJECT_H__
@@ -22,50 +22,68 @@
 #include "EtchConfig.h"
 
 enum EtchObjectTypeIds {
-    EOTID_INT32     = 0,
-    EOTID_BOOL,
-    EOTID_BYTE,
-    EOTID_SHORT,
-    EOTID_LONG,
-    EOTID_DOUBLE,
-    EOTID_FLOAT,
-    EOTID_STRING,
-    EOTID_DATE,
-    EOTID_LIST,
-    EOTID_NATIVE_ARRAY,
-      
-    EOTID_NATIVE_INT8,
-    EOTID_NATIVE_INT16,
-    EOTID_NATIVE_INT32,
-    EOTID_NATIVE_INT64,
-    EOTID_NATIVE_DOUBLE,
-    EOTID_NATIVE_FLOAT,
-    EOTID_NATIVE_LONG,
-    EOTID_NATIVE_SHORT,
-    EOTID_NATIVE_BOOL,
-    EOTID_NATIVE_BYTE,
+
+  EOTID_INT32 = 0,
+  EOTID_BOOL,
+  EOTID_BYTE,
+  EOTID_SHORT,
+  EOTID_LONG,
+  EOTID_DOUBLE,
+  EOTID_FLOAT,
+  EOTID_STRING,
+  EOTID_DATE,
+  EOTID_LIST,
+  EOTID_NATIVE_ARRAY,
+  EOTID_HASHTABLE,
+  EOTID_SET,
+  EOTID_SOCKET,
+
+  EOTID_NATIVE_INT8,
+  EOTID_NATIVE_INT16,
+  EOTID_NATIVE_INT32,
+  EOTID_NATIVE_INT64,
+  EOTID_NATIVE_DOUBLE,
+  EOTID_NATIVE_FLOAT,
+  EOTID_NATIVE_LONG,
+  EOTID_NATIVE_SHORT,
+  EOTID_NATIVE_BOOL,
+  EOTID_NATIVE_BYTE,
 };
 
-class EtchObject
-{
+class EtchObject {
+
 public:
-    /**
-     * Constructor.
-     */
-    EtchObject(capu::int32_t typeId);
-    
-    /**
-     * Destructor.
-     */
-    virtual ~EtchObject();
-
-    /**
-     * Returns object type id.
-     */
-    capu::int32_t getObjectTypeId();
+
+  /**
+   * Constructor.
+   */
+  EtchObject(capu::int32_t typeId);
+
+  /**
+   * Destructor.
+   */
+  virtual ~EtchObject();
+
+  /**
+   * Returns object type id.
+   */
+  capu::int32_t getObjectTypeId() const;
+
+  /**
+   * Returns hash code
+   */
+  virtual capu::uint64_t getHashCode();
+
+  /**
+   * @return true if two object is equal
+   *         false otherwise
+   */
+  virtual capu::bool_t equals(const EtchObject * other);
 
 private:
-    capu::int32_t m_typeId;
+
+  capu::int32_t m_typeId;
+
 };
 
 #endif

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchShort.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchShort.h?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchShort.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchShort.h Thu Jan 12 10:01:58 2012
@@ -1,19 +1,19 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #ifndef __ETCHSHORT_H__
@@ -23,37 +23,50 @@
 #include "common/EtchError.h"
 
 class EtchShort :
-    public EtchObject
-{
+public EtchObject {
+
 public:
 
-    /**
-     * TypeId for EtchShort.
-     */
-    static const capu::int32_t TYPE_ID = EOTID_SHORT;
-
-    /**
-     * Constructs a EtchShort object.
-     */
-    EtchShort();
-
-    /**
-     * Constructs a EtchShort object with given value.
-     */
-    EtchShort(capu::int16_t value);
-
-    /**
-     * Sets short value.
-     */
-    void set(capu::int16_t value);
-
-    /**
-     * Returns short value.
-     */
-    capu::int16_t get();
+  /**
+   * TypeId for EtchShort.
+   */
+  static const capu::int32_t TYPE_ID = EOTID_SHORT;
+
+  /**
+   * Constructs a EtchShort object.
+   */
+  EtchShort();
+
+  /**
+   * Constructs a EtchShort object with given value.
+   */
+  EtchShort(capu::int16_t value);
+
+  /**
+   * Sets short value.
+   */
+  void set(capu::int16_t value);
+
+  /**
+   * Returns short value.
+   */
+  capu::int16_t get();
+
+  /**
+   * Returns hash code
+   */
+  capu::uint64_t getHashCode();
+
+  /**
+   * @return true if two object is equal
+   *         false otherwise
+   */
+  capu::bool_t equals(const EtchObject * other);
 
 private:
-    capu::int16_t m_value;
+
+  capu::int16_t mValue;
+
 };
 
 #endif

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchBool.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchBool.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchBool.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchBool.cpp Thu Jan 12 10:01:58 2012
@@ -1,41 +1,52 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include "common/EtchBool.h"
 
 EtchBool::EtchBool()
-    : EtchObject(EtchBool::TYPE_ID)
-    , m_value(false)
-{
+: EtchObject(EtchBool::TYPE_ID)
+, mValue(false){
 }
 
-EtchBool::EtchBool(bool value)
-    : EtchObject(EtchBool::TYPE_ID)
-    , m_value(value)
-{
+EtchBool::EtchBool(capu::bool_t value)
+: EtchObject(EtchBool::TYPE_ID)
+, mValue(value){
 }
 
-void EtchBool::set(bool value)
-{
-    m_value = value;
+void EtchBool::set(capu::bool_t value){
+  mValue = value;
 }
 
-bool EtchBool::get()
-{
-    return m_value;
+capu::bool_t EtchBool::get(){
+  return mValue;
+}
+
+capu::bool_t EtchBool::equals(const EtchObject * other){
+  if (other == NULL)
+    return false;
+  else if (other->getObjectTypeId() != EtchBool::TYPE_ID)
+    return false;
+  EtchBool* a = (EtchBool *) other;
+  return (a->mValue == this->mValue);
+}
+
+capu::uint64_t EtchBool::getHashCode(){
+  if (mValue)
+    return 0;
+  return 1;
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchByte.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchByte.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchByte.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchByte.cpp Thu Jan 12 10:01:58 2012
@@ -1,41 +1,52 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include "common/EtchByte.h"
 
 EtchByte::EtchByte()
-    : EtchObject(EtchByte::TYPE_ID)
-    , m_value(0)
-{
+: EtchObject(EtchByte::TYPE_ID)
+, mValue(0){
 }
 
 EtchByte::EtchByte(capu::int8_t value)
-    : EtchObject(EtchByte::TYPE_ID)
-    , m_value(value)
-{
+: EtchObject(EtchByte::TYPE_ID)
+, mValue(value){
 }
 
-void EtchByte::set(capu::int8_t value)
-{
-    m_value = value;
+void EtchByte::set(capu::int8_t value){
+  mValue = value;
 }
 
-capu::int8_t EtchByte::get()
-{
-    return m_value;
+capu::int8_t EtchByte::get(){
+  return mValue;
+}
+
+capu::bool_t EtchByte::equals(const EtchObject * other){
+  if (other == NULL)
+    return false;
+  else if (other->getObjectTypeId() != EtchByte::TYPE_ID)
+    return false;
+  EtchByte * a = (EtchByte*) other;
+  return (a->mValue == this->mValue);
+}
+
+capu::uint64_t EtchByte::getHashCode(){
+  //For better distribution
+  capu::uint64_t result = (capu::uint64_t) ((capu::int64_t) mValue + 128); 
+  return result;
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchDouble.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchDouble.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchDouble.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchDouble.cpp Thu Jan 12 10:01:58 2012
@@ -1,41 +1,52 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include "common/EtchDouble.h"
 
 EtchDouble::EtchDouble()
-    : EtchObject(EtchDouble::TYPE_ID)
-    , m_value(0.0L)
-{
+: EtchObject(EtchDouble::TYPE_ID)
+, mValue(0.0L){
 }
 
-EtchDouble::EtchDouble(double value)
-    : EtchObject(EtchDouble::TYPE_ID)
-    , m_value(value)
-{
+EtchDouble::EtchDouble(capu::double_t value)
+: EtchObject(EtchDouble::TYPE_ID)
+, mValue(value){
 }
 
-void EtchDouble::set(double value)
-{
-    m_value = value;
+void EtchDouble::set(capu::double_t value){
+  mValue = value;
 }
 
-double EtchDouble::get()
-{
-    return m_value;
+capu::double_t EtchDouble::get(){
+  return mValue;
 }
+
+capu::uint64_t EtchDouble::getHashCode(){
+   capu::uint64_t result = 0;
+  memcpy(&result, &mValue, sizeof(capu::double_t));
+  return result;
+}
+
+capu::bool_t EtchDouble::equals(const EtchObject * other){
+  if (other == NULL)
+    return false;
+  else if (other->getObjectTypeId() != EtchDouble::TYPE_ID)
+    return false;
+  EtchDouble * a = (EtchDouble *) other;
+  return (a->mValue == this->mValue);
+}
\ No newline at end of file

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchFloat.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchFloat.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchFloat.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchFloat.cpp Thu Jan 12 10:01:58 2012
@@ -1,41 +1,52 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include "common/EtchFloat.h"
 
 EtchFloat::EtchFloat()
-    : EtchObject(EtchFloat::TYPE_ID)
-    , m_value(0.0f)
-{
+: EtchObject(EtchFloat::TYPE_ID)
+, mValue(0.0f){
 }
 
-EtchFloat::EtchFloat(float value)
-    : EtchObject(EtchFloat::TYPE_ID)
-    , m_value(value)
-{
+EtchFloat::EtchFloat(capu::float_t value)
+: EtchObject(EtchFloat::TYPE_ID)
+, mValue(value){
 }
 
-void EtchFloat::set(float value)
-{
-    m_value = value;
+void EtchFloat::set(capu::float_t value){
+  mValue = value;
 }
 
-float EtchFloat::get()
-{
-    return m_value;
+capu::float_t EtchFloat::get(){
+  return mValue;
 }
+
+capu::uint64_t EtchFloat::getHashCode(){
+  capu::uint64_t result = 0;
+  memcpy(&result, &mValue, sizeof(capu::float_t));
+  return result;
+}
+
+capu::bool_t EtchFloat::equals(const EtchObject * other){
+  if (other == NULL)
+    return false;
+  else if (other->getObjectTypeId() != EtchFloat::TYPE_ID)
+    return false;
+  EtchFloat * a = (EtchFloat*) other;
+  return (a->mValue == this->mValue);
+}
\ No newline at end of file

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchInt32.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchInt32.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchInt32.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchInt32.cpp Thu Jan 12 10:01:58 2012
@@ -1,41 +1,50 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include "common/EtchInt32.h"
 
 EtchInt32::EtchInt32()
-    : EtchObject(EtchInt32::TYPE_ID)
-    , m_value(0)
-{
+: EtchObject(EtchInt32::TYPE_ID)
+, mValue(0){
 }
 
 EtchInt32::EtchInt32(capu::int32_t value)
-    : EtchObject(EtchInt32::TYPE_ID)
-    , m_value(value)
-{
+: EtchObject(EtchInt32::TYPE_ID)
+, mValue(value){
 }
 
-void EtchInt32::set(capu::int32_t value)
-{
-    m_value = value;
+void EtchInt32::set(capu::int32_t value){
+  mValue = value;
 }
 
-capu::int32_t EtchInt32::get()
-{
-    return m_value;
+capu::int32_t EtchInt32::get(){
+  return mValue;
+}
+
+capu::uint64_t EtchInt32::getHashCode(){
+  return static_cast <capu::uint64_t> (mValue);
+}
+
+capu::bool_t EtchInt32::equals(const EtchObject * other){
+  if (other == NULL)
+    return false;
+  else if (other->getObjectTypeId() != EtchInt32::TYPE_ID)
+    return false;
+  EtchInt32 *a = (EtchInt32*) other;
+  return (a->mValue == this->mValue);
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchLong.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchLong.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchLong.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchLong.cpp Thu Jan 12 10:01:58 2012
@@ -1,41 +1,50 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include "common/EtchLong.h"
 
 EtchLong::EtchLong()
-    : EtchObject(EtchLong::TYPE_ID)
-    , m_value(0)
-{
+: EtchObject(EtchLong::TYPE_ID)
+, mValue(0){
 }
 
 EtchLong::EtchLong(capu::int64_t value)
-    : EtchObject(EtchLong::TYPE_ID)
-    , m_value(value)
-{
+: EtchObject(EtchLong::TYPE_ID)
+, mValue(value){
 }
 
-void EtchLong::set(capu::int64_t value)
-{
-    m_value = value;
+void EtchLong::set(capu::int64_t value){
+  mValue = value;
 }
 
-capu::int64_t EtchLong::get()
-{
-    return m_value;
+capu::int64_t EtchLong::get(){
+  return mValue;
+}
+
+capu::uint64_t EtchLong::getHashCode(){
+  return static_cast <capu::uint64_t> (mValue);
+}
+
+capu::bool_t EtchLong::equals(const EtchObject * other){
+  if (other == NULL)
+    return false;
+  else if (other->getObjectTypeId() != EtchLong::TYPE_ID)
+    return false;
+  EtchLong * a = (EtchLong*) other;
+  return (a->mValue == this->mValue);
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchObject.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchObject.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchObject.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchObject.cpp Thu Jan 12 10:01:58 2012
@@ -1,33 +1,39 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include "common/EtchObject.h"
 
-EtchObject::EtchObject(capu::int32_t typeId)
-{
-    m_typeId = typeId;
+EtchObject::EtchObject(capu::int32_t typeId){
+  m_typeId = typeId;
 }
 
-capu::int32_t EtchObject::getObjectTypeId()
-{
-    return m_typeId;
+capu::int32_t EtchObject::getObjectTypeId() const{
+  return m_typeId;
 }
 
-EtchObject::~EtchObject()
-{
+EtchObject::~EtchObject(){
 }
+
+capu::uint64_t EtchObject::getHashCode(){
+  return (capu::uint64_t) this;
+}
+
+capu::bool_t EtchObject::equals(const EtchObject* other){
+  return (other == this);
+}
+

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchShort.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchShort.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchShort.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/common/EtchShort.cpp Thu Jan 12 10:01:58 2012
@@ -1,41 +1,52 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include "common/EtchShort.h"
 
 EtchShort::EtchShort()
-    : EtchObject(EtchShort::TYPE_ID)
-    , m_value(0)
-{
+: EtchObject(EtchShort::TYPE_ID)
+, mValue(0){
 }
 
 EtchShort::EtchShort(capu::int16_t value)
-    : EtchObject(EtchShort::TYPE_ID)
-    , m_value(value)
-{
+: EtchObject(EtchShort::TYPE_ID)
+, mValue(value){
 }
 
-void EtchShort::set(capu::int16_t value)
-{
-    m_value = value;
+void EtchShort::set(capu::int16_t value){
+  mValue = value;
 }
 
-capu::int16_t EtchShort::get()
-{
-    return m_value;
+capu::int16_t EtchShort::get(){
+  return mValue;
+}
+
+capu::uint64_t EtchShort::getHashCode(){
+  //for better distribution
+  capu::uint64_t result = (capu::uint64_t) ((capu::int64_t) mValue + 32768);
+  return result;
+}
+
+capu::bool_t EtchShort::equals(const EtchObject * other){
+  if (other == NULL)
+    return false;
+  else if (other->getObjectTypeId() != EtchShort::TYPE_ID)
+    return false;
+  EtchShort * a = (EtchShort*) other;
+  return (a->mValue == this->mValue);
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchBoolTest.cpp Thu Jan 12 10:01:58 2012
@@ -1,50 +1,61 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include <gtest/gtest.h>
 #include "common/EtchBool.h"
 
 // Tests positive input.
-TEST(EtchBoolTest, Constructor_Default) {
-    EtchBool* i1 = new EtchBool();
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchBool::TYPE_ID);
-    EXPECT_TRUE(i1->get() == false);
-    delete i1;
+
+TEST(EtchBoolTest, Constructor_Default){
+  EtchBool* i1 = new EtchBool();
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchBool::TYPE_ID);
+  EXPECT_TRUE(i1->get() == false);
+  delete i1;
+}
+
+TEST(EtchBoolTest, Constructor_Bool){
+  EtchBool* i1 = new EtchBool(true);
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchBool::TYPE_ID);
+  EXPECT_TRUE(i1->get() == true);
+  delete i1;
 }
 
-TEST(EtchBoolTest, Constructor_Bool) {
-    EtchBool* i1 = new EtchBool(true);
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchBool::TYPE_ID);
-    EXPECT_TRUE(i1->get() == true);
-    delete i1;
+TEST(EtchBoolTest, set){
+  EtchBool* i1 = new EtchBool();
+  i1->set(true);
+  EXPECT_TRUE(i1->get() == true);
+  delete i1;
 }
 
-TEST(EtchBoolTest, set) {
-    EtchBool* i1 = new EtchBool();
-    i1->set(true);
-    EXPECT_TRUE(i1->get() == true);
-    delete i1;
+TEST(EtchBoolTest, get){
+  EtchBool* i1 = new EtchBool();
+  EXPECT_TRUE(i1->get() == false);
+  i1->set(true);
+  EXPECT_TRUE(i1->get() == true);
+  delete i1;
 }
 
-TEST(EtchBoolTest, get) {
-    EtchBool* i1 = new EtchBool();
-    EXPECT_TRUE(i1->get() == false);
-    i1->set(true);
-    EXPECT_TRUE(i1->get() == true);
-    delete i1;
+TEST(EtchBoolTest, equals){
+  EtchBool i1, i2;
+  EXPECT_TRUE(i1.get() == false);
+  i1.set(true);
+  i2.set(false);
+  EXPECT_TRUE(i1.equals(&i2) == false);
+  i2.set(true);
+  EXPECT_TRUE(i1.equals(&i2) == true);
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchByteTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchByteTest.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchByteTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchByteTest.cpp Thu Jan 12 10:01:58 2012
@@ -1,50 +1,61 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include <gtest/gtest.h>
 #include "common/EtchByte.h"
 
 // Tests positive input.
-TEST(EtchByteTest, Constructor_Default) {
-    EtchByte* i1 = new EtchByte();
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchByte::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 0);
-    delete i1;
+
+TEST(EtchByteTest, Constructor_Default){
+  EtchByte* i1 = new EtchByte();
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchByte::TYPE_ID);
+  EXPECT_TRUE(i1->get() == 0);
+  delete i1;
+}
+
+TEST(EtchByteTest, Constructor_Byte){
+  EtchByte* i1 = new EtchByte(42);
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchByte::TYPE_ID);
+  EXPECT_TRUE(i1->get() == 42);
+  delete i1;
 }
 
-TEST(EtchByteTest, Constructor_Byte) {
-    EtchByte* i1 = new EtchByte(42);
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchByte::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 42);
-    delete i1;
+TEST(EtchByteTest, set){
+  EtchByte* i1 = new EtchByte();
+  i1->set(43);
+  EXPECT_TRUE(i1->get() == 43);
+  delete i1;
 }
 
-TEST(EtchByteTest, set) {
-    EtchByte* i1 = new EtchByte();
-    i1->set(43);
-    EXPECT_TRUE(i1->get() == 43);
-    delete i1;
+TEST(EtchByteTest, get){
+  EtchByte* i1 = new EtchByte();
+  EXPECT_TRUE(i1->get() == 0);
+  i1->set(41);
+  EXPECT_TRUE(i1->get() == 41);
+  delete i1;
 }
 
-TEST(EtchByteTest, get) {
-    EtchByte* i1 = new EtchByte();
-    EXPECT_TRUE(i1->get() == 0);
-    i1->set(41);
-    EXPECT_TRUE(i1->get() == 41);
-    delete i1;
+TEST(EtchByteTest, equals){
+  EtchByte i1, i2;
+  EXPECT_TRUE(i1.get() == false);
+  i1.set(40);
+  i2.set(41);
+  EXPECT_TRUE(i1.equals(&i2) == false);
+  i2.set(40);
+  EXPECT_TRUE(i1.equals(&i2) == true);
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchDoubleTest.cpp Thu Jan 12 10:01:58 2012
@@ -1,50 +1,61 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include <gtest/gtest.h>
 #include "common/EtchDouble.h"
 
 // Tests positive input.
-TEST(EtchDoubleTest, Constructor_Default) {
-    EtchDouble* i1 = new EtchDouble();
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchDouble::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 0.0L);
-    delete i1;
+
+TEST(EtchDoubleTest, Constructor_Default){
+  EtchDouble* i1 = new EtchDouble();
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchDouble::TYPE_ID);
+  EXPECT_TRUE(i1->get() == 0.0L);
+  delete i1;
+}
+
+TEST(EtchDoubleTest, Constructor_Double){
+  EtchDouble* i1 = new EtchDouble(42.0L);
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchDouble::TYPE_ID);
+  EXPECT_TRUE(i1->get() == 42.0L);
+  delete i1;
 }
 
-TEST(EtchDoubleTest, Constructor_Double) {
-    EtchDouble* i1 = new EtchDouble(42.0L);
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchDouble::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 42.0L);
-    delete i1;
+TEST(EtchDoubleTest, set){
+  EtchDouble* i1 = new EtchDouble();
+  i1->set(43.0L);
+  EXPECT_EQ(i1->get(), 43.0L);
+  delete i1;
 }
 
-TEST(EtchDoubleTest, set) {
-    EtchDouble* i1 = new EtchDouble();
-    i1->set(43.0L);
-    EXPECT_EQ(i1->get(), 43.0L);
-    delete i1;
+TEST(EtchDoubleTest, get){
+  EtchDouble* i1 = new EtchDouble();
+  EXPECT_TRUE(i1->get() == 0.0L);
+  i1->set(41.0L);
+  EXPECT_TRUE(i1->get() == 41.0L);
+  delete i1;
 }
 
-TEST(EtchDoubleTest, get) {
-    EtchDouble* i1 = new EtchDouble();
-    EXPECT_TRUE(i1->get() == 0.0L);
-    i1->set(41.0L);
-    EXPECT_TRUE(i1->get() == 41.0L);
-    delete i1;
+TEST(EtchDoubleTest, equals){
+  EtchDouble i1, i2;
+  EXPECT_TRUE(i1.get() == 0.0);
+  i1.set(40);
+  i2.set(41);
+  EXPECT_TRUE(i1.equals(&i2) == false);
+  i2.set(40);
+  EXPECT_TRUE(i1.equals(&i2) == true);
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchFloatTest.cpp Thu Jan 12 10:01:58 2012
@@ -1,50 +1,61 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include <gtest/gtest.h>
 #include "common/EtchFloat.h"
 
 // Tests positive input.
-TEST(EtchFloatTest, Constructor_Default) {
-    EtchFloat* i1 = new EtchFloat();
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchFloat::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 0.0f);
-    delete i1;
+
+TEST(EtchFloatTest, Constructor_Default){
+  EtchFloat* i1 = new EtchFloat();
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchFloat::TYPE_ID);
+  EXPECT_TRUE(i1->get() == 0.0f);
+  delete i1;
+}
+
+TEST(EtchFloatTest, Constructor_Float){
+  EtchFloat* i1 = new EtchFloat(42.0f);
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchFloat::TYPE_ID);
+  EXPECT_TRUE(i1->get() == 42.0f);
+  delete i1;
 }
 
-TEST(EtchFloatTest, Constructor_Float) {
-    EtchFloat* i1 = new EtchFloat(42.0f);
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchFloat::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 42.0f);
-    delete i1;
+TEST(EtchFloatTest, set){
+  EtchFloat* i1 = new EtchFloat();
+  i1->set(43.33f);
+  EXPECT_TRUE(i1->get() == 43.33f);
+  delete i1;
 }
 
-TEST(EtchFloatTest, set) {
-    EtchFloat* i1 = new EtchFloat();
-    i1->set(43.33f);
-    EXPECT_TRUE(i1->get() == 43.33f);
-    delete i1;
+TEST(EtchFloatTest, get){
+  EtchFloat* i1 = new EtchFloat();
+  EXPECT_TRUE(i1->get() == 0.0f);
+  i1->set(41.0f);
+  EXPECT_TRUE(i1->get() == 41.0f);
+  delete i1;
 }
 
-TEST(EtchFloatTest, get) {
-    EtchFloat* i1 = new EtchFloat();
-    EXPECT_TRUE(i1->get() == 0.0f);
-    i1->set(41.0f);
-    EXPECT_TRUE(i1->get() == 41.0f);
-    delete i1;
+TEST(EtchFloatTest, equals){
+  EtchFloat i1, i2;
+  EXPECT_TRUE(i1.get() == 0.0f);
+  i1.set(40);
+  i2.set(41);
+  EXPECT_TRUE(i1.equals(&i2) == false);
+  i2.set(40);
+  EXPECT_TRUE(i1.equals(&i2) == true);
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchInt32Test.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchInt32Test.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchInt32Test.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchInt32Test.cpp Thu Jan 12 10:01:58 2012
@@ -1,50 +1,61 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include <gtest/gtest.h>
 #include "common/EtchInt32.h"
 
 // Tests positive input.
-TEST(EtchInt32Test, Constructor_Default) {
-    EtchInt32* i1 = new EtchInt32();
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchInt32::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 0);
-    delete i1;
+
+TEST(EtchInt32Test, Constructor_Default){
+  EtchInt32* i1 = new EtchInt32();
+  EtchInt32(i1->getObjectTypeId() == EtchInt32::TYPE_ID);
+  EtchInt32(i1->get() == 0);
+  delete i1;
+}
+
+TEST(EtchInt32Test, Constructor_Int){
+  EtchInt32* i1 = new EtchInt32(42);
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchInt32::TYPE_ID);
+  EXPECT_TRUE(i1->get() == 42);
+  delete i1;
 }
 
-TEST(EtchInt32Test, Constructor_Int) {
-    EtchInt32* i1 = new EtchInt32(42);
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchInt32::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 42);
-    delete i1;
+TEST(EtchInt32Test, set){
+  EtchInt32* i1 = new EtchInt32();
+  i1->set(42);
+  EXPECT_TRUE(i1->get() == 42);
+  delete i1;
 }
 
-TEST(EtchInt32Test, set) {
-    EtchInt32* i1 = new EtchInt32();
-    i1->set(42);
-    EXPECT_TRUE(i1->get() == 42);
-    delete i1;
+TEST(EtchInt32Test, get){
+  EtchInt32* i1 = new EtchInt32();
+  EXPECT_TRUE(i1->get() == 0);
+  i1->set(42);
+  EXPECT_TRUE(i1->get() == 42);
+  delete i1;
 }
 
-TEST(EtchInt32Test, get) {
-    EtchInt32* i1 = new EtchInt32();
-    EXPECT_TRUE(i1->get() == 0);
-    i1->set(42);
-    EXPECT_TRUE(i1->get() == 42);
-    delete i1;
+TEST(EtchInt32Test, equals){
+  EtchInt32 i1, i2;
+  EXPECT_TRUE(i1.get() == false);
+  i1.set(40);
+  i2.set(41);
+  EXPECT_TRUE(i1.equals(&i2) == false);
+  i2.set(40);
+  EXPECT_TRUE(i1.equals(&i2) == true);
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchLongTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchLongTest.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchLongTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchLongTest.cpp Thu Jan 12 10:01:58 2012
@@ -1,50 +1,61 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include <gtest/gtest.h>
 #include "common/EtchLong.h"
 
 // Tests positive input.
-TEST(EtchLongTest, Constructor_Default) {
-    EtchLong* i1 = new EtchLong();
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchLong::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 0);
-    delete i1;
+
+TEST(EtchLongTest, Constructor_Default){
+  EtchLong* i1 = new EtchLong();
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchLong::TYPE_ID);
+  EXPECT_TRUE(i1->get() == 0);
+  delete i1;
+}
+
+TEST(EtchLongTest, Constructor_Long){
+  EtchLong* i1 = new EtchLong(42);
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchLong::TYPE_ID);
+  EXPECT_TRUE(i1->get() == 42);
+  delete i1;
 }
 
-TEST(EtchLongTest, Constructor_Long) {
-    EtchLong* i1 = new EtchLong(42);
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchLong::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 42);
-    delete i1;
+TEST(EtchLongTest, set){
+  EtchLong* i1 = new EtchLong();
+  i1->set(43000000);
+  EXPECT_TRUE(i1->get() == 43000000);
+  delete i1;
 }
 
-TEST(EtchLongTest, set) {
-    EtchLong* i1 = new EtchLong();
-    i1->set(43000000);
-    EXPECT_TRUE(i1->get() == 43000000);
-    delete i1;
+TEST(EtchLongTest, get){
+  EtchLong* i1 = new EtchLong();
+  EXPECT_TRUE(i1->get() == 0);
+  i1->set(41);
+  EXPECT_TRUE(i1->get() == 41);
+  delete i1;
 }
 
-TEST(EtchLongTest, get) {
-    EtchLong* i1 = new EtchLong();
-    EXPECT_TRUE(i1->get() == 0);
-    i1->set(41);
-    EXPECT_TRUE(i1->get() == 41);
-    delete i1;
+TEST(EtchLongTest, equals){
+  EtchLong i1, i2;
+  EXPECT_TRUE(i1.get() == false);
+  i1.set(40);
+  i2.set(41);
+  EXPECT_TRUE(i1.equals(&i2) == false);
+  i2.set(40);
+  EXPECT_TRUE(i1.equals(&i2) == true);
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchObjectTest.cpp Thu Jan 12 10:01:58 2012
@@ -20,8 +20,9 @@
 #include "common/EtchObject.h"
 
 // Tests positive input.
-TEST(EtchObjectTest, Constructor_Default) {
-    EtchObject* o1 = new EtchObject(42);
-    EXPECT_TRUE(o1->getObjectTypeId() == 42);
-    delete o1;
+
+TEST(EtchObjectTest, Constructor_Default){
+  EtchObject* o1 = new EtchObject(42);
+  EXPECT_TRUE(o1->getObjectTypeId() == 42);
+  delete o1;
 }

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchShortTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchShortTest.cpp?rev=1230462&r1=1230461&r2=1230462&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchShortTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchShortTest.cpp Thu Jan 12 10:01:58 2012
@@ -1,50 +1,61 @@
-/* $Id$ 
- * 
- * Licensed to the Apache Software Foundation (ASF) under one or more 
- * contributor license agreements. See the NOTICE file distributed with  
- * this work for additional information regarding copyright ownership. 
- * The ASF licenses this file to you under the Apache License, Version  
- * 2.0 (the "License"); you may not use this file except in compliance  
- * with the License. You may obtain a copy of the License at 
- * 
- * http://www.apache.org/licenses/LICENSE-2.0 
- * 
- * Unless required by applicable law or agreed to in writing, software 
- * distributed under the License is distributed on an "AS IS" BASIS, 
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and 
- * limitations under the License. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 #include <gtest/gtest.h>
 #include "common/EtchShort.h"
 
 // Tests positive input.
-TEST(EtchShortTest, Constructor_Default) {
-    EtchShort* i1 = new EtchShort();
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchShort::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 0);
-    delete i1;
+
+TEST(EtchShortTest, Constructor_Default){
+  EtchShort* i1 = new EtchShort();
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchShort::TYPE_ID);
+  EXPECT_TRUE(i1->get() == 0);
+  delete i1;
+}
+
+TEST(EtchShortTest, Constructor_Short){
+  EtchShort* i1 = new EtchShort(42);
+  EXPECT_TRUE(i1->getObjectTypeId() == EtchShort::TYPE_ID);
+  EXPECT_TRUE(i1->get() == 42);
+  delete i1;
 }
 
-TEST(EtchShortTest, Constructor_Short) {
-    EtchShort* i1 = new EtchShort(42);
-    EXPECT_TRUE(i1->getObjectTypeId() == EtchShort::TYPE_ID);
-    EXPECT_TRUE(i1->get() == 42);
-    delete i1;
+TEST(EtchShortTest, set){
+  EtchShort* i1 = new EtchShort();
+  i1->set(43);
+  EXPECT_TRUE(i1->get() == 43);
+  delete i1;
 }
 
-TEST(EtchShortTest, set) {
-    EtchShort* i1 = new EtchShort();
-    i1->set(43);
-    EXPECT_TRUE(i1->get() == 43);
-    delete i1;
+TEST(EtchShortTest, get){
+  EtchShort* i1 = new EtchShort();
+  EXPECT_TRUE(i1->get() == 0);
+  i1->set(41);
+  EXPECT_TRUE(i1->get() == 41);
+  delete i1;
 }
 
-TEST(EtchShortTest, get) {
-    EtchShort* i1 = new EtchShort();
-    EXPECT_TRUE(i1->get() == 0);
-    i1->set(41);
-    EXPECT_TRUE(i1->get() == 41);
-    delete i1;
+TEST(EtchShortTest, equals){
+  EtchShort i1, i2;
+  EXPECT_TRUE(i1.get() == false);
+  i1.set(40);
+  i2.set(41);
+  EXPECT_TRUE(i1.equals(&i2) == false);
+  i2.set(40);
+  EXPECT_TRUE(i1.equals(&i2) == true);
 }