[master] fix indentation in EPTF_CLL_HashMap_ExternalFunctions.hh
Change-Id: I969afc4990e9246b9f565195d7d3b1870c0459ce
Signed-off-by: József Gyürüsi <jozsef.gyurusi@ericsson.com>
diff --git a/src/HashMap/EPTF_CLL_HashMap_ExternalFunctions.hh b/src/HashMap/EPTF_CLL_HashMap_ExternalFunctions.hh
index 07116af..27ea9fb 100644
--- a/src/HashMap/EPTF_CLL_HashMap_ExternalFunctions.hh
+++ b/src/HashMap/EPTF_CLL_HashMap_ExternalFunctions.hh
@@ -52,38 +52,38 @@
//using std::tr1;
#endif
#endif
-*/
+ */
#if (__GNUC__ < 4)//earlier than gcc 4.0
- #include <ext/hash_map>
- #if (__GNUC__ == 3 && __GNUC_MINOR__ >=1) //gcc [3.1 , 4.0[
- using __gnu_cxx::hash_map;
- using __gnu_cxx::hash;
- #define hash_ns __gnu_cxx::hash_map
- #else //earlier than gcc 3.1
- using std::hash_map;
- using std::hash;
- #define hash_ns std::hash_map
- #endif
+#include <ext/hash_map>
+#if (__GNUC__ == 3 && __GNUC_MINOR__ >=1) //gcc [3.1 , 4.0[
+using __gnu_cxx::hash_map;
+using __gnu_cxx::hash;
+#define hash_ns __gnu_cxx::hash_map
+#else //earlier than gcc 3.1
+using std::hash_map;
+using std::hash;
+#define hash_ns std::hash_map
+#endif
#else //from gcc 4.0
- #if (__GNUC__ == 4 && __GNUC_MINOR__ < 3 ) //gcc [4.0 , 4.3[
- #include <ext/hash_map>
- using __gnu_cxx::hash_map;
- using __gnu_cxx::hash;
- #define hash_ns __gnu_cxx::hash_map
- #else //from gcc 4.3
- #include <tr1/unordered_map>
- using std::tr1::unordered_map;
- #define hash_ns std::tr1::unordered_map
- #endif
+#if (__GNUC__ == 4 && __GNUC_MINOR__ < 3 ) //gcc [4.0 , 4.3[
+#include <ext/hash_map>
+using __gnu_cxx::hash_map;
+using __gnu_cxx::hash;
+#define hash_ns __gnu_cxx::hash_map
+#else //from gcc 4.3
+#include <tr1/unordered_map>
+using std::tr1::unordered_map;
+#define hash_ns std::tr1::unordered_map
+#endif
#endif
namespace EPTF__CLL__HashMap__Functions {
struct EPTF_HashMap_hash
{
-size_t
- operator()(const CHARSTRING& cs) const
+ size_t
+ operator()(const CHARSTRING& cs) const
{
unsigned long __h = 0;
const char* __s=cs;
@@ -151,7 +151,7 @@
if(this->size() > (unsigned)allowedMaxSize) {
TTCN_Logger::log(TTCN_WARNING, "hashmap `%s' exceeds acceptable max size of %d elements.", name.c_str(), allowedMaxSize);
TTCN_Logger::log(TTCN_WARNING, "increasing acceptable max size by a factor of %g",
- (double)EPTF__CLL__Common__Definitions::tsp__CLL__debug__increasePercentage4AcceptableMaxSize);
+ (double)EPTF__CLL__Common__Definitions::tsp__CLL__debug__increasePercentage4AcceptableMaxSize);
allowedMaxSize += (int) ((double)allowedMaxSize * (double)EPTF__CLL__Common__Definitions::tsp__CLL__debug__increasePercentage4AcceptableMaxSize);
TTCN_Logger::log(TTCN_WARNING, "new acceptable max size: %d", allowedMaxSize);
}
@@ -182,10 +182,10 @@
//////////////////////////////////////////////////////////
//FIXME
#define ASSERT_VALID_ID(pl_id) \
-\
- if(pl_id<0){TTCN_error("HashMap Error: pl_id<0");};\
- if(pl_id>=v_sizeOfHashMaps){TTCN_error("HashMap Error: pl_id>=v_sizeOfHashMaps");};\
- if(v_HashMap[pl_id]==NULL){TTCN_error("HashMap Error: v_HashMap[pl_id]==NULL");};\
+ \
+ if(pl_id<0){TTCN_error("HashMap Error: pl_id<0");};\
+ if(pl_id>=v_sizeOfHashMaps){TTCN_error("HashMap Error: pl_id>=v_sizeOfHashMaps");};\
+ if(v_HashMap[pl_id]==NULL){TTCN_error("HashMap Error: v_HashMap[pl_id]==NULL");};\
//typedef HashMapType<CHARSTRING, int, EPTF_HashMap_strHash > Str2IntHashMapType;
@@ -193,451 +193,451 @@
template<class T, class H, class F> class HashMapTypeCT
{
private:
- typedef HashMapType<T,H,F>* HashMapTypePtr;
- typedef typename HashMapType<T,H,F>::iterator HashMapTypeIter;
- typedef typename HashMapType<T,H,F>::hasher HashMapTypeHasher;
- int v_sizeOfHashMaps;
- int v_numberOfHashMaps;
- NamesHashMapType v_HashNames;
- HashMapTypePtr* v_HashMap;
+ typedef HashMapType<T,H,F>* HashMapTypePtr;
+ typedef typename HashMapType<T,H,F>::iterator HashMapTypeIter;
+ typedef typename HashMapType<T,H,F>::hasher HashMapTypeHasher;
+ int v_sizeOfHashMaps;
+ int v_numberOfHashMaps;
+ NamesHashMapType v_HashNames;
+ HashMapTypePtr* v_HashMap;
public:
- HashMapTypeCT(){
- v_sizeOfHashMaps = 0;
- v_numberOfHashMaps = 0;
- v_HashMap = NULL;
- }
- ~HashMapTypeCT(){
- NamesHashMapType::iterator Hashmap_Iter;
- Hashmap_Iter = v_HashNames.begin();
- while(Hashmap_Iter != v_HashNames.end()) {
- try {
- TTCN_Logger::begin_event(TTCN_WARNING);
- TTCN_Logger::log_event_str("f_EPTF_int2int_HashMap_Cleanup: deleting hashmap ");
- TTCN_Logger::log_event_str(Hashmap_Iter->first);
- TTCN_Logger::end_event();
- }
- catch (...)
- {
- TTCN_Logger::finish_event();
- throw;
- }
- v_HashMap[Hashmap_Iter->second]->clear();
- if(v_HashMap[Hashmap_Iter->second]!=NULL)
- {
- delete v_HashMap[Hashmap_Iter->second];
- v_HashMap[Hashmap_Iter->second] = NULL;
- }
- v_HashNames.erase(Hashmap_Iter);
- v_numberOfHashMaps--;
- Hashmap_Iter = v_HashNames.begin();
- }
- v_HashMap = NULL;
- v_sizeOfHashMaps = 0;
- v_numberOfHashMaps = 0;
- }
+ HashMapTypeCT(){
+ v_sizeOfHashMaps = 0;
+ v_numberOfHashMaps = 0;
+ v_HashMap = NULL;
+ }
+ ~HashMapTypeCT(){
+ NamesHashMapType::iterator Hashmap_Iter;
+ Hashmap_Iter = v_HashNames.begin();
+ while(Hashmap_Iter != v_HashNames.end()) {
+ try {
+ TTCN_Logger::begin_event(TTCN_WARNING);
+ TTCN_Logger::log_event_str("f_EPTF_int2int_HashMap_Cleanup: deleting hashmap ");
+ TTCN_Logger::log_event_str(Hashmap_Iter->first);
+ TTCN_Logger::end_event();
+ }
+ catch (...)
+ {
+ TTCN_Logger::finish_event();
+ throw;
+ }
+ v_HashMap[Hashmap_Iter->second]->clear();
+ if(v_HashMap[Hashmap_Iter->second]!=NULL)
+ {
+ delete v_HashMap[Hashmap_Iter->second];
+ v_HashMap[Hashmap_Iter->second] = NULL;
+ }
+ v_HashNames.erase(Hashmap_Iter);
+ v_numberOfHashMaps--;
+ Hashmap_Iter = v_HashNames.begin();
+ }
+ v_HashMap = NULL;
+ v_sizeOfHashMaps = 0;
+ v_numberOfHashMaps = 0;
+ }
- inline void assertValid(const INTEGER& pl_id){
- if(pl_id<0){TTCN_error("HashMap Error: pl_id<0");};
- if(pl_id>=v_sizeOfHashMaps){TTCN_error("HashMap Error: pl_id>=v_sizeOfHashMaps");};
- if(v_HashMap[pl_id]==NULL){TTCN_error("HashMap Error: v_HashMap[pl_id]==NULL");};
- }
- inline bool checkValid(const INTEGER& pl_id){
- if(pl_id<0){return false;};
- if(pl_id>=v_sizeOfHashMaps){return false;};
- if(v_HashMap[pl_id]==NULL){return false;};
- return true;
- }
- INTEGER newHashmap (const CHARSTRING& pl_name)
- {
- NamesHashMapType::iterator Hashmap_Iter = v_HashNames.find(pl_name);
+ inline void assertValid(const INTEGER& pl_id){
+ if(pl_id<0){TTCN_error("HashMap Error: pl_id<0");};
+ if(pl_id>=v_sizeOfHashMaps){TTCN_error("HashMap Error: pl_id>=v_sizeOfHashMaps");};
+ if(v_HashMap[pl_id]==NULL){TTCN_error("HashMap Error: v_HashMap[pl_id]==NULL");};
+ }
+ inline bool checkValid(const INTEGER& pl_id){
+ if(pl_id<0){return false;};
+ if(pl_id>=v_sizeOfHashMaps){return false;};
+ if(v_HashMap[pl_id]==NULL){return false;};
+ return true;
+ }
+ INTEGER newHashmap (const CHARSTRING& pl_name)
+ {
+ NamesHashMapType::iterator Hashmap_Iter = v_HashNames.find(pl_name);
- if ( Hashmap_Iter!=v_HashNames.end() )
- {
- try {
- TTCN_Logger::begin_event(TTCN_WARNING);
- TTCN_Logger::log_event_str("Can't create new HashMap. HashMap name is not unique: ");
- pl_name.log();
- TTCN_Logger::end_event();
- }
- catch (...)
- {
- TTCN_Logger::finish_event();
- throw;
- }
- return -1;
- }
- v_numberOfHashMaps++;
- if(v_numberOfHashMaps<v_sizeOfHashMaps)
- {
- for(int i=0; i<v_sizeOfHashMaps; i++) {
- if (v_HashMap[i]== NULL)
- {
- v_HashMap[i]=new HashMapType<T,H,F>;
- v_HashMap[i]->initDebug(pl_name);
- v_HashNames[pl_name] = i;
- return i;
- }
- }
- }
- else
- {
- v_HashNames[pl_name] = v_sizeOfHashMaps;
+ if ( Hashmap_Iter!=v_HashNames.end() )
+ {
+ try {
+ TTCN_Logger::begin_event(TTCN_WARNING);
+ TTCN_Logger::log_event_str("Can't create new HashMap. HashMap name is not unique: ");
+ pl_name.log();
+ TTCN_Logger::end_event();
+ }
+ catch (...)
+ {
+ TTCN_Logger::finish_event();
+ throw;
+ }
+ return -1;
+ }
+ v_numberOfHashMaps++;
+ if(v_numberOfHashMaps<v_sizeOfHashMaps)
+ {
+ for(int i=0; i<v_sizeOfHashMaps; i++) {
+ if (v_HashMap[i]== NULL)
+ {
+ v_HashMap[i]=new HashMapType<T,H,F>;
+ v_HashMap[i]->initDebug(pl_name);
+ v_HashNames[pl_name] = i;
+ return i;
+ }
+ }
+ }
+ else
+ {
+ v_HashNames[pl_name] = v_sizeOfHashMaps;
- // create a new array for hashMaps with new size (size+1)
- HashMapTypePtr* v_HashMap_new;
- v_HashMap_new = new HashMapTypePtr[v_sizeOfHashMaps+1];
- for(int i=0; i<v_sizeOfHashMaps; i++) {
- v_HashMap_new[i] = v_HashMap[i];
- }
- v_HashMap_new[v_sizeOfHashMaps] = new HashMapType<T,H,F>;
- v_HashMap_new[v_sizeOfHashMaps]->initDebug(pl_name);
- if (v_HashMap!=NULL) delete[] v_HashMap;
- v_HashMap = v_HashMap_new;
+ // create a new array for hashMaps with new size (size+1)
+ HashMapTypePtr* v_HashMap_new;
+ v_HashMap_new = new HashMapTypePtr[v_sizeOfHashMaps+1];
+ for(int i=0; i<v_sizeOfHashMaps; i++) {
+ v_HashMap_new[i] = v_HashMap[i];
+ }
+ v_HashMap_new[v_sizeOfHashMaps] = new HashMapType<T,H,F>;
+ v_HashMap_new[v_sizeOfHashMaps]->initDebug(pl_name);
+ if (v_HashMap!=NULL) delete[] v_HashMap;
+ v_HashMap = v_HashMap_new;
- return v_sizeOfHashMaps++;
- }
- //never reaches
- return -1;
- }
+ return v_sizeOfHashMaps++;
+ }
+ //never reaches
+ return -1;
+ }
- BOOLEAN getID(
- const CHARSTRING& pl_name,
- INTEGER& pl_id)
- {
+ BOOLEAN getID(
+ const CHARSTRING& pl_name,
+ INTEGER& pl_id)
+ {
- NamesHashMapType::iterator Hashmap_Iter;
- Hashmap_Iter = v_HashNames.find(pl_name);
+ NamesHashMapType::iterator Hashmap_Iter;
+ Hashmap_Iter = v_HashNames.find(pl_name);
- if ( Hashmap_Iter==v_HashNames.end() )
- {
- try {
- TTCN_Logger::begin_event(TTCN_WARNING);
- TTCN_Logger::log_event_str("Can't get ID. No HashMap found with this name: ");
- pl_name.log();
- TTCN_Logger::end_event();
- }
- catch (...)
- {
- TTCN_Logger::finish_event();
- throw;
- }
- pl_id = -1;
- return false;
- }
+ if ( Hashmap_Iter==v_HashNames.end() )
+ {
+ try {
+ TTCN_Logger::begin_event(TTCN_WARNING);
+ TTCN_Logger::log_event_str("Can't get ID. No HashMap found with this name: ");
+ pl_name.log();
+ TTCN_Logger::end_event();
+ }
+ catch (...)
+ {
+ TTCN_Logger::finish_event();
+ throw;
+ }
+ pl_id = -1;
+ return false;
+ }
- pl_id = Hashmap_Iter->second;
- return true;
- }
+ pl_id = Hashmap_Iter->second;
+ return true;
+ }
- void deleteHashMap(
- const CHARSTRING& pl_name)
- {
- NamesHashMapType::iterator Hashmap_Iter;
- Hashmap_Iter = v_HashNames.find(pl_name);
- if ( Hashmap_Iter==v_HashNames.end() )
- {
- try {
- TTCN_Logger::begin_event(TTCN_WARNING);
- TTCN_Logger::log_event_str("Can't get ID. HashMap not deleted. No HashMap found with this name: ");
- pl_name.log();
- TTCN_Logger::end_event();
- }
- catch (...)
- {
- TTCN_Logger::finish_event();
- throw;
- }
+ void deleteHashMap(
+ const CHARSTRING& pl_name)
+ {
+ NamesHashMapType::iterator Hashmap_Iter;
+ Hashmap_Iter = v_HashNames.find(pl_name);
+ if ( Hashmap_Iter==v_HashNames.end() )
+ {
+ try {
+ TTCN_Logger::begin_event(TTCN_WARNING);
+ TTCN_Logger::log_event_str("Can't get ID. HashMap not deleted. No HashMap found with this name: ");
+ pl_name.log();
+ TTCN_Logger::end_event();
+ }
+ catch (...)
+ {
+ TTCN_Logger::finish_event();
+ throw;
+ }
- return;
- }
- if(v_HashMap[Hashmap_Iter->second]!=NULL)
- {
- v_HashMap[Hashmap_Iter->second]->clear();
- delete v_HashMap[Hashmap_Iter->second];
- v_HashMap[Hashmap_Iter->second] = NULL;
- }
- v_HashNames.erase(Hashmap_Iter);
- v_numberOfHashMaps--;
- }
+ return;
+ }
+ if(v_HashMap[Hashmap_Iter->second]!=NULL)
+ {
+ v_HashMap[Hashmap_Iter->second]->clear();
+ delete v_HashMap[Hashmap_Iter->second];
+ v_HashMap[Hashmap_Iter->second] = NULL;
+ }
+ v_HashNames.erase(Hashmap_Iter);
+ v_numberOfHashMaps--;
+ }
- void deleteHashMap(
- const INTEGER& pl_id)
- {
- if (!checkValid(pl_id)) {
- try {
- TTCN_Logger::begin_event(TTCN_WARNING);
- TTCN_Logger::log_event_str("Can't delete hasmap: No HashMap found with this id: ");
- pl_id.log();
- TTCN_Logger::end_event();
- }
- catch (...)
- {
- TTCN_Logger::finish_event();
- throw;
- }
+ void deleteHashMap(
+ const INTEGER& pl_id)
+ {
+ if (!checkValid(pl_id)) {
+ try {
+ TTCN_Logger::begin_event(TTCN_WARNING);
+ TTCN_Logger::log_event_str("Can't delete hasmap: No HashMap found with this id: ");
+ pl_id.log();
+ TTCN_Logger::end_event();
+ }
+ catch (...)
+ {
+ TTCN_Logger::finish_event();
+ throw;
+ }
- return;
- }
- v_HashNames.erase(v_HashMap[pl_id]->getName());
- if(v_HashMap[pl_id]!=NULL)
- {
- v_HashMap[pl_id]->clear();
- delete v_HashMap[pl_id];
- v_HashMap[pl_id] = NULL;
- }
- v_numberOfHashMaps--;
- }
+ return;
+ }
+ v_HashNames.erase(v_HashMap[pl_id]->getName());
+ if(v_HashMap[pl_id]!=NULL)
+ {
+ v_HashMap[pl_id]->clear();
+ delete v_HashMap[pl_id];
+ v_HashMap[pl_id] = NULL;
+ }
+ v_numberOfHashMaps--;
+ }
- void dumpByID (const INTEGER& pl_id)
- {
- assertValid(pl_id);
- try {
- TTCN_Logger::begin_event(TTCN_USER);
- TTCN_Logger::log_event_str("----Dumping HashMap with ID: ");
- pl_id.log();
- TTCN_Logger::log_event_str(" begin----");
- }
- catch (...)
- {
- TTCN_Logger::finish_event();
- throw;
- }
+ void dumpByID (const INTEGER& pl_id)
+ {
+ assertValid(pl_id);
+ try {
+ TTCN_Logger::begin_event(TTCN_USER);
+ TTCN_Logger::log_event_str("----Dumping HashMap with ID: ");
+ pl_id.log();
+ TTCN_Logger::log_event_str(" begin----");
+ }
+ catch (...)
+ {
+ TTCN_Logger::finish_event();
+ throw;
+ }
- HashMapTypeIter Hashmap_Iter;
+ HashMapTypeIter Hashmap_Iter;
- for ( Hashmap_Iter = v_HashMap[pl_id]->begin();
- Hashmap_Iter != v_HashMap[pl_id]->end(); Hashmap_Iter++ )
- {
- //std::cout << Hashmap_Iter->first<<" "<< Hashmap_Iter->second <<std::endl;
- try {
- TTCN_Logger::log_event_str("\n (key,data): ");
- Hashmap_Iter->first.log(); // (INTEGER)key
- TTCN_Logger::log_char(' ');
- Hashmap_Iter->second.log(); // (T)data
- }
- catch (...) {
- TTCN_Logger::finish_event();
- throw;
- }
- }
+ for ( Hashmap_Iter = v_HashMap[pl_id]->begin();
+ Hashmap_Iter != v_HashMap[pl_id]->end(); Hashmap_Iter++ )
+ {
+ //std::cout << Hashmap_Iter->first<<" "<< Hashmap_Iter->second <<std::endl;
+ try {
+ TTCN_Logger::log_event_str("\n (key,data): ");
+ Hashmap_Iter->first.log(); // (INTEGER)key
+ TTCN_Logger::log_char(' ');
+ Hashmap_Iter->second.log(); // (T)data
+ }
+ catch (...) {
+ TTCN_Logger::finish_event();
+ throw;
+ }
+ }
- //std::cout <<"----Dumping HashMap with id: "<<pl_id<<" end----"<<std::endl;
- try {
- TTCN_Logger::log_event_str("\n----Dumping HashMap with ID: ");
- pl_id.log();
- TTCN_Logger::log_event_str(" end----");
- TTCN_Logger::end_event();
- }
- catch (...)
- {
- TTCN_Logger::finish_event();
- throw;
- }
+ //std::cout <<"----Dumping HashMap with id: "<<pl_id<<" end----"<<std::endl;
+ try {
+ TTCN_Logger::log_event_str("\n----Dumping HashMap with ID: ");
+ pl_id.log();
+ TTCN_Logger::log_event_str(" end----");
+ TTCN_Logger::end_event();
+ }
+ catch (...)
+ {
+ TTCN_Logger::finish_event();
+ throw;
+ }
- }
+ }
- void dump(const CHARSTRING& pl_name){
- try {
- TTCN_Logger::begin_event(TTCN_USER);
- TTCN_Logger::log_event_str("----Dumping HashMap called: ");
- pl_name.log();
- TTCN_Logger::log_event_str(" begin----");
- TTCN_Logger::end_event();
- }
- catch (...)
- {
- TTCN_Logger::finish_event();
- throw;
- }
+ void dump(const CHARSTRING& pl_name){
+ try {
+ TTCN_Logger::begin_event(TTCN_USER);
+ TTCN_Logger::log_event_str("----Dumping HashMap called: ");
+ pl_name.log();
+ TTCN_Logger::log_event_str(" begin----");
+ TTCN_Logger::end_event();
+ }
+ catch (...)
+ {
+ TTCN_Logger::finish_event();
+ throw;
+ }
- INTEGER pl_id;
- if(getID(pl_name,pl_id))
- {
+ INTEGER pl_id;
+ if(getID(pl_name,pl_id))
+ {
- dumpByID(pl_id);
+ dumpByID(pl_id);
- }
+ }
- //std::cout <<"----Dumping HashMap called: "<<pl_name<<" end----"<<std::endl;
- try {
- TTCN_Logger::begin_event(TTCN_USER);
- TTCN_Logger::log_event_str("----Dumping HashMap called: ");
- pl_name.log();
- TTCN_Logger::log_event_str(" end----");
- TTCN_Logger::end_event();
- }
- catch (...)
- {
- TTCN_Logger::finish_event();
- throw;
- }
- }
+ //std::cout <<"----Dumping HashMap called: "<<pl_name<<" end----"<<std::endl;
+ try {
+ TTCN_Logger::begin_event(TTCN_USER);
+ TTCN_Logger::log_event_str("----Dumping HashMap called: ");
+ pl_name.log();
+ TTCN_Logger::log_event_str(" end----");
+ TTCN_Logger::end_event();
+ }
+ catch (...)
+ {
+ TTCN_Logger::finish_event();
+ throw;
+ }
+ }
- void dumpAll ()
- {
- TTCN_Logger::log_str(TTCN_USER,"----Dumping all begin----");
+ void dumpAll ()
+ {
+ TTCN_Logger::log_str(TTCN_USER,"----Dumping all begin----");
- NamesHashMapType::iterator v_HashNames_Iter;
+ NamesHashMapType::iterator v_HashNames_Iter;
- for ( v_HashNames_Iter = v_HashNames.begin();
- v_HashNames_Iter != v_HashNames.end(); v_HashNames_Iter++ )
- {
- CHARSTRING pl_name = (CHARSTRING)v_HashNames_Iter->first;
- dump (pl_name);
- }
- TTCN_Logger::log_str(TTCN_USER,"----Dumping all end----");
- }
+ for ( v_HashNames_Iter = v_HashNames.begin();
+ v_HashNames_Iter != v_HashNames.end(); v_HashNames_Iter++ )
+ {
+ CHARSTRING pl_name = (CHARSTRING)v_HashNames_Iter->first;
+ dump (pl_name);
+ }
+ TTCN_Logger::log_str(TTCN_USER,"----Dumping all end----");
+ }
- void assign (
- const INTEGER& pl_id1,
- const INTEGER& pl_id2)
- {
- assertValid(pl_id1);
- assertValid(pl_id2);
- dumpAll ();
- *(v_HashMap[pl_id1]) = *(v_HashMap[pl_id2]);
- }
+ void assign (
+ const INTEGER& pl_id1,
+ const INTEGER& pl_id2)
+ {
+ assertValid(pl_id1);
+ assertValid(pl_id2);
+ dumpAll ();
+ *(v_HashMap[pl_id1]) = *(v_HashMap[pl_id2]);
+ }
- void swapHashmaps (
- const INTEGER& pl_id1,
- const INTEGER& pl_id2)
- {
- assertValid(pl_id1);
- assertValid(pl_id2);
+ void swapHashmaps (
+ const INTEGER& pl_id1,
+ const INTEGER& pl_id2)
+ {
+ assertValid(pl_id1);
+ assertValid(pl_id2);
- swap(v_HashMap[pl_id1],v_HashMap[pl_id2]);
- }
+ swap(v_HashMap[pl_id1],v_HashMap[pl_id2]);
+ }
- template <class KeytType> void insert (
- const INTEGER& pl_id,
- const KeytType& pl_key,
- const INTEGER& pl_data )
- {
- assertValid(pl_id);
+ template <class KeytType> void insert (
+ const INTEGER& pl_id,
+ const KeytType& pl_key,
+ const INTEGER& pl_data )
+ {
+ assertValid(pl_id);
- typedef std::pair<KeytType, INTEGER> hashMap_pair;
- //FIXME Error handling?!
- v_HashMap[pl_id]->insert(hashMap_pair(pl_key, pl_data));
+ typedef std::pair<KeytType, INTEGER> hashMap_pair;
+ //FIXME Error handling?!
+ v_HashMap[pl_id]->insert(hashMap_pair(pl_key, pl_data));
- //v_HashMap[pl_id]->checkAllowedMaxSize();
- }
+ //v_HashMap[pl_id]->checkAllowedMaxSize();
+ }
- template <class KeytType> void update (
- const INTEGER& pl_id,
- const KeytType& pl_key,
- const INTEGER& pl_data )
- {
- assertValid(pl_id);
+ template <class KeytType> void update (
+ const INTEGER& pl_id,
+ const KeytType& pl_key,
+ const INTEGER& pl_data )
+ {
+ assertValid(pl_id);
- HashMapTypeIter Hashmap_Iter = v_HashMap[pl_id]->find(pl_key);
+ HashMapTypeIter Hashmap_Iter = v_HashMap[pl_id]->find(pl_key);
- if ( v_HashMap[pl_id]->find(pl_key)!=v_HashMap[pl_id]->end() )
- {
- Hashmap_Iter->second=pl_data;
- }
- else
- {
- typedef std::pair<KeytType, INTEGER> hashMap_pair;
- v_HashMap[pl_id]->insert(hashMap_pair(pl_key, pl_data));
- //v_HashMap[pl_id]->checkAllowedMaxSize();
- }
- }
+ if ( v_HashMap[pl_id]->find(pl_key)!=v_HashMap[pl_id]->end() )
+ {
+ Hashmap_Iter->second=pl_data;
+ }
+ else
+ {
+ typedef std::pair<KeytType, INTEGER> hashMap_pair;
+ v_HashMap[pl_id]->insert(hashMap_pair(pl_key, pl_data));
+ //v_HashMap[pl_id]->checkAllowedMaxSize();
+ }
+ }
- template <class KeytType> BOOLEAN find (
- const INTEGER& pl_id,
- const KeytType& pl_key,
- INTEGER& pl_data )
- {
- assertValid(pl_id);
+ template <class KeytType> BOOLEAN find (
+ const INTEGER& pl_id,
+ const KeytType& pl_key,
+ INTEGER& pl_data )
+ {
+ assertValid(pl_id);
- HashMapTypeIter Hashmap_Iter = v_HashMap[pl_id]->find(pl_key);
+ HashMapTypeIter Hashmap_Iter = v_HashMap[pl_id]->find(pl_key);
- if ( Hashmap_Iter==v_HashMap[pl_id]->end() )
- {
- pl_data = -1;
- return false;
- }
+ if ( Hashmap_Iter==v_HashMap[pl_id]->end() )
+ {
+ pl_data = -1;
+ return false;
+ }
- pl_data = Hashmap_Iter->second;
- return true;
- }
+ pl_data = Hashmap_Iter->second;
+ return true;
+ }
- template <class KeytType> void erase (
- const INTEGER& pl_id,
- const KeytType& pl_key )
- {
- assertValid(pl_id);
+ template <class KeytType> void erase (
+ const INTEGER& pl_id,
+ const KeytType& pl_key )
+ {
+ assertValid(pl_id);
- int key_is_found;
+ int key_is_found;
- key_is_found=v_HashMap[pl_id]->erase(pl_key);
+ key_is_found=v_HashMap[pl_id]->erase(pl_key);
- if (!key_is_found)
- {
- try {
- TTCN_Logger::begin_event(TTCN_WARNING);
- TTCN_Logger::log_event_str("Could not erase. Could not find the key in HashMap. Key: ");
- pl_key.log();
- TTCN_Logger::end_event();
- }
- catch (...)
- {
- TTCN_Logger::finish_event();
- throw;
- }
- }
- }
+ if (!key_is_found)
+ {
+ try {
+ TTCN_Logger::begin_event(TTCN_WARNING);
+ TTCN_Logger::log_event_str("Could not erase. Could not find the key in HashMap. Key: ");
+ pl_key.log();
+ TTCN_Logger::end_event();
+ }
+ catch (...)
+ {
+ TTCN_Logger::finish_event();
+ throw;
+ }
+ }
+ }
- void clear (
- const INTEGER& pl_id )
- {
- assertValid(pl_id);
+ void clear (
+ const INTEGER& pl_id )
+ {
+ assertValid(pl_id);
- v_HashMap[pl_id]->clear();
- }
+ v_HashMap[pl_id]->clear();
+ }
- INTEGER size (
- const INTEGER& pl_id )
- {
- assertValid(pl_id);
+ INTEGER size (
+ const INTEGER& pl_id )
+ {
+ assertValid(pl_id);
- return v_HashMap[pl_id]->size();
- }
+ return v_HashMap[pl_id]->size();
+ }
- FLOAT maxSize (
- const INTEGER& pl_id )
- {
- assertValid(pl_id);
+ FLOAT maxSize (
+ const INTEGER& pl_id )
+ {
+ assertValid(pl_id);
- //std::cout <<"Maxsize: "<<v_HashMap[pl_id]->max_size() <<std::endl;
- return v_HashMap[pl_id]->max_size();
- }
+ //std::cout <<"Maxsize: "<<v_HashMap[pl_id]->max_size() <<std::endl;
+ return v_HashMap[pl_id]->max_size();
+ }
- template <class KeyType> INTEGER callHashFunc(
- const INTEGER& pl_id,
- const KeyType& pl_key)
- {
- assertValid(pl_id);
+ template <class KeyType> INTEGER callHashFunc(
+ const INTEGER& pl_id,
+ const KeyType& pl_key)
+ {
+ assertValid(pl_id);
- HashMapTypeHasher hashvalue;
+ HashMapTypeHasher hashvalue;
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3 || __GNUC__ > 4)
- hashvalue=v_HashMap[pl_id]->hash_function();
+ hashvalue=v_HashMap[pl_id]->hash_function();
#else
- hashvalue=v_HashMap[pl_id]->hash_funct();
+ hashvalue=v_HashMap[pl_id]->hash_funct();
#endif
- return hashvalue(pl_key);
- }
+ return hashvalue(pl_key);
+ }
- BOOLEAN empty (
- const INTEGER& pl_id )
- {
- assertValid(pl_id);
+ BOOLEAN empty (
+ const INTEGER& pl_id )
+ {
+ assertValid(pl_id);
- return v_HashMap[pl_id]->empty();
- }
+ return v_HashMap[pl_id]->empty();
+ }
- /*void resize (
+ /*void resize (
const INTEGER& pl_id,
const INTEGER& pl_hashsize)
{
@@ -647,55 +647,55 @@
//v_HashMap[pl_id]->checkAllowedMaxSize();
}*/
- INTEGER bucketCount (
- const INTEGER& pl_id )
- {
- assertValid(pl_id);
+ INTEGER bucketCount (
+ const INTEGER& pl_id )
+ {
+ assertValid(pl_id);
- return v_HashMap[pl_id]->bucket_count();
- }
+ return v_HashMap[pl_id]->bucket_count();
+ }
- template <class KeytType> BOOLEAN begin(
- const INTEGER& pl_id,
- KeytType& pl_key)
- {
- assertValid(pl_id);
+ template <class KeytType> BOOLEAN begin(
+ const INTEGER& pl_id,
+ KeytType& pl_key)
+ {
+ assertValid(pl_id);
- if ( v_HashMap[pl_id]->empty() )
- {
- //pl_key =0;
- return false;
- }
+ if ( v_HashMap[pl_id]->empty() )
+ {
+ //pl_key =0;
+ return false;
+ }
- HashMapTypeIter Hashmap_Iter;
- Hashmap_Iter = v_HashMap[pl_id]->begin();
- pl_key = (KeytType)Hashmap_Iter->first;
- return true;
- }
+ HashMapTypeIter Hashmap_Iter;
+ Hashmap_Iter = v_HashMap[pl_id]->begin();
+ pl_key = (KeytType)Hashmap_Iter->first;
+ return true;
+ }
- template <class KeytType> BOOLEAN next(
- const INTEGER& pl_id,
- KeytType& pl_iter)
- {
- assertValid(pl_id);
+ template <class KeytType> BOOLEAN next(
+ const INTEGER& pl_id,
+ KeytType& pl_iter)
+ {
+ assertValid(pl_id);
- if ( v_HashMap[pl_id]->empty() )
- {
- return false;
- }
+ if ( v_HashMap[pl_id]->empty() )
+ {
+ return false;
+ }
- HashMapTypeIter Hashmap_Iter;
- Hashmap_Iter = v_HashMap[pl_id]->find(pl_iter);
- if (++Hashmap_Iter!=v_HashMap[pl_id]->end())
- {
- pl_iter = (KeytType)Hashmap_Iter->first;
- return true;
- }
- else
- {
- return false;
- }
- }
+ HashMapTypeIter Hashmap_Iter;
+ Hashmap_Iter = v_HashMap[pl_id]->find(pl_iter);
+ if (++Hashmap_Iter!=v_HashMap[pl_id]->end())
+ {
+ pl_iter = (KeytType)Hashmap_Iter->first;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
};
template<class T, class H, class F> HashMapTypeCT<T,H,F>* f_EPTF_HashMap_InitComponent(){
@@ -737,10 +737,10 @@
///////////////////////////////////////////////////////////
template<class T, class H, class F> INTEGER f_EPTF_HashMap_New (
- HashMapTypeCT<T,H,F>* pl_comp,
- const CHARSTRING& pl_name)
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const CHARSTRING& pl_name)
{
- return pl_comp->newHashmap(pl_name);
+ return pl_comp->newHashmap(pl_name);
}
///////////////////////////////////////////////////////////
@@ -758,9 +758,9 @@
///////////////////////////////////////////////////////////
template<class T, class H, class F> BOOLEAN f_EPTF_HashMap_GetID (
- HashMapTypeCT<T,H,F>* pl_comp,
- const CHARSTRING& pl_name,
- INTEGER& pl_id)
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const CHARSTRING& pl_name,
+ INTEGER& pl_id)
{
return pl_comp->getID(pl_name, pl_id);
}
@@ -779,8 +779,8 @@
///////////////////////////////////////////////////////////
template<class T, class H, class F> void f_EPTF_HashMap_Delete (
- HashMapTypeCT<T,H,F>* pl_comp,
- const CHARSTRING& pl_name)
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const CHARSTRING& pl_name)
{
pl_comp->deleteHashMap(pl_name);
}
@@ -799,8 +799,8 @@
///////////////////////////////////////////////////////////
template<class T, class H, class F> void f_EPTF_HashMap_DumpByID (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id)
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id)
{
pl_comp->dumpByID(pl_id);
}
@@ -819,8 +819,8 @@
///////////////////////////////////////////////////////////
template<class T, class H, class F> void f_EPTF_HashMap_Dump (
- HashMapTypeCT<T,H,F>* pl_comp,
- const CHARSTRING& pl_name)
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const CHARSTRING& pl_name)
{
pl_comp->dump(pl_name);
}
@@ -858,11 +858,11 @@
///////////////////////////////////////////////////////////
template<class T, class H, class F> void f_EPTF_HashMap_Assign (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id1,
- const INTEGER& pl_id2)
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id1,
+ const INTEGER& pl_id2)
{
- pl_comp->assign(pl_id1,pl_id2);
+ pl_comp->assign(pl_id1,pl_id2);
}
@@ -886,10 +886,10 @@
///////////////////////////////////////////////////////////
template<class T, class H, class F> void f_EPTF_HashMap_Insert (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id,
- const INTEGER& pl_key,
- const INTEGER& pl_data )
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id,
+ const INTEGER& pl_key,
+ const INTEGER& pl_data )
{
pl_comp->insert(pl_id, pl_key, pl_data);
};
@@ -910,10 +910,10 @@
///////////////////////////////////////////////////////////
template<class T, class H, class F> void f_EPTF_HashMap_Update (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id,
- const INTEGER& pl_key,
- const INTEGER& pl_data )
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id,
+ const INTEGER& pl_key,
+ const INTEGER& pl_data )
{
pl_comp->update(pl_id, pl_key, pl_data);
};
@@ -936,10 +936,10 @@
///////////////////////////////////////////////////////////
template<class T, class H, class F> BOOLEAN f_EPTF_HashMap_Find (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id,
- const INTEGER& pl_key,
- INTEGER& pl_data )
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id,
+ const INTEGER& pl_key,
+ INTEGER& pl_data )
{
return pl_comp->find(pl_id, pl_key, pl_data);
}
@@ -961,9 +961,9 @@
/////////////////////////////////////////////////////////
template<class T, class H, class F> void f_EPTF_HashMap_Erase (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id,
- const INTEGER& pl_key )
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id,
+ const INTEGER& pl_key )
{
pl_comp->erase(pl_id, pl_key);
}
@@ -984,8 +984,8 @@
/////////////////////////////////////////////////////////
template<class T, class H, class F> void f_EPTF_HashMap_Clear (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id )
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id )
{
pl_comp->clear(pl_id);
}
@@ -1006,8 +1006,8 @@
//////////////////////////////////////////////////////////
template<class T, class H, class F> INTEGER f_EPTF_HashMap_Size (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id )
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id )
{
return pl_comp->size(pl_id);
}
@@ -1028,8 +1028,8 @@
//////////////////////////////////////////////////////////
template<class T, class H, class F> FLOAT f_EPTF_HashMap_MaxSize (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id )
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id )
{
return pl_comp->maxSize(pl_id);
}
@@ -1049,9 +1049,9 @@
//////////////////////////////////////////////////////////
template<class T, class H, class F> INTEGER f_EPTF_HashMap_CallHashFunc(
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id,
- const INTEGER& pl_key)
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id,
+ const INTEGER& pl_key)
{
return pl_comp->callHashFunc(pl_id, pl_key);
}
@@ -1072,8 +1072,8 @@
//////////////////////////////////////////////////////////
template<class T, class H, class F> BOOLEAN f_EPTF_HashMap_Empty (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id )
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id )
{
return pl_comp->empty();
}
@@ -1095,9 +1095,9 @@
//////////////////////////////////////////////////////////
template<class T, class H, class F> void f_EPTF_HashMap_Resize (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id,
- const INTEGER& pl_hashsize)
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id,
+ const INTEGER& pl_hashsize)
{
pl_comp->resize(pl_id, pl_hashsize);
};
@@ -1119,8 +1119,8 @@
//////////////////////////////////////////////////////////
template<class T, class H, class F> INTEGER f_EPTF_HashMap_BucketCount (
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id )
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id )
{
return pl_comp->bucketCount(pl_id);
};
@@ -1141,9 +1141,9 @@
//////////////////////////////////////////////////////////
template<class T, class H, class F> BOOLEAN f_EPTF_HashMap_Begin(
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id,
- INTEGER& pl_key)
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id,
+ INTEGER& pl_key)
{
return pl_comp->begin(pl_id);
}
@@ -1165,9 +1165,9 @@
//////////////////////////////////////////////////////////
template<class T, class H, class F> BOOLEAN f_EPTF_HashMap_Next(
- HashMapTypeCT<T,H,F>* pl_comp,
- const INTEGER& pl_id,
- INTEGER& pl_iter)
+ HashMapTypeCT<T,H,F>* pl_comp,
+ const INTEGER& pl_id,
+ INTEGER& pl_iter)
{
return pl_comp->next(pl_id, pl_iter);
}