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/10/17 08:51:06 UTC
svn commit: r1399118 - in /incubator/etch/trunk/binding-cpp/runtime/include:
common/EtchComparator.h common/EtchObjectHash.h
serialization/EtchClass2TypeMap.h
Author: veithm
Date: Wed Oct 17 06:51:06 2012
New Revision: 1399118
URL: http://svn.apache.org/viewvc?rev=1399118&view=rev
Log:
ETCH-243 Refactored EtchObjectType hashing
Separate of hash and comparator functionality from EtchObject
Change-Id: I499a46ad0d77899eccd54f41471e4e17b71eac42
Modified:
incubator/etch/trunk/binding-cpp/runtime/include/common/EtchComparator.h
incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectHash.h
incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchClass2TypeMap.h
Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchComparator.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchComparator.h?rev=1399118&r1=1399117&r2=1399118&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchComparator.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchComparator.h Wed Oct 17 06:51:06 2012
@@ -29,10 +29,6 @@ public:
inline capu::bool_t operator() (const EtchObject &first, const EtchObject &second) const {
return first.equals(&second);
}
-
- inline capu::bool_t operator() (const EtchObjectType &first, const EtchObjectType &second) const {
- return first.equals(&second);
- }
};
template <class T>
@@ -42,10 +38,6 @@ public:
inline capu::bool_t operator() (const EtchObject* first, const EtchObject* second) const {
return first->equals(second);
}
-
- inline capu::bool_t operator() (const EtchObjectType* first, const EtchObjectType* second) const {
- return first->equals(second);
- }
};
template <class T>
@@ -55,10 +47,6 @@ public:
inline capu::bool_t operator() (const capu::SmartPointer<EtchObject>& first, const capu::SmartPointer<EtchObject>& second) const {
return first->equals(second.get());
}
-
- inline capu::bool_t operator() (const capu::SmartPointer<EtchObjectType>& first, const capu::SmartPointer<EtchObjectType>& second) const {
- return first->equals(second.get());
- }
};
#endif
Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectHash.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectHash.h?rev=1399118&r1=1399117&r2=1399118&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectHash.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectHash.h Wed Oct 17 06:51:06 2012
@@ -35,18 +35,6 @@ public:
static capu::uint32_t Digest(const capu::SmartPointer<EtchObject>& key) {
return key->getHashCode();
}
-
- static capu::uint32_t Digest(const EtchObjectType &key) {
- return key.getHashCode();
- }
-
- static capu::uint32_t Digest(const EtchObjectType* key) {
- return key->getHashCode();
- }
-
- static capu::uint32_t Digest(const capu::SmartPointer<EtchObjectType>& key) {
- return key->getHashCode();
- }
};
#endif
Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchClass2TypeMap.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchClass2TypeMap.h?rev=1399118&r1=1399117&r2=1399118&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchClass2TypeMap.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchClass2TypeMap.h Wed Oct 17 06:51:06 2012
@@ -64,8 +64,50 @@ public:
*/
void lock();
+ /**
+ * Hashing Functions for the EtchClass2TypeMap
+ */
+ class Hash {
+ public:
+ static capu::uint32_t Digest(const EtchObjectType &key) {
+ return key.getHashCode();
+ }
+
+ static capu::uint32_t Digest(const EtchObjectType* key) {
+ return key->getHashCode();
+ }
+
+ static capu::uint32_t Digest(const capu::SmartPointer<EtchObjectType>& key) {
+ return key->getHashCode();
+ }
+ };
+
+ /**
+ * Comperator Functions for the EtchClass2TypeMap
+ */
+ template <class T>
+ class Comparator {
+ public:
+ inline capu::bool_t operator() (const EtchObjectType &first, const EtchObjectType &second) const {
+ return first.equals(&second);
+ }
+ };
+ template <class T>
+ class Comparator <T*> {
+ public:
+ inline capu::bool_t operator() (const EtchObjectType* first, const EtchObjectType* second) const {
+ return first->equals(second);
+ }
+ };
+ template <class T>
+ class Comparator <capu::SmartPointer<T> > {
+ public:
+ inline capu::bool_t operator() (const capu::SmartPointer<EtchObjectType>& first, const capu::SmartPointer<EtchObjectType>& second) const {
+ return first->equals(second.get());
+ }
+ };
private:
- EtchHashTable<const EtchObjectType*, EtchType* > mC2T;
+ EtchHashTable<const EtchObjectType*, EtchType*, EtchClass2TypeMap::Hash, EtchClass2TypeMap::Comparator<const EtchObjectType*> > mC2T;
capu::bool_t mLocked;