summaryrefslogtreecommitdiff
path: root/src/maps
diff options
context:
space:
mode:
Diffstat (limited to 'src/maps')
-rw-r--r--src/maps/hashmap.h38
-rw-r--r--src/maps/hashmap.tmpl24
-rw-r--r--src/maps/mtools.h30
-rw-r--r--src/maps/mtools.tmpl29
-rw-r--r--src/maps/nhashmap.h32
-rw-r--r--src/maps/nhashmap.tmpl24
-rw-r--r--src/maps/shashmap.h36
-rw-r--r--src/maps/shashmap.tmpl32
8 files changed, 216 insertions, 29 deletions
diff --git a/src/maps/hashmap.h b/src/maps/hashmap.h
index b3a3212..771c190 100644
--- a/src/maps/hashmap.h
+++ b/src/maps/hashmap.h
@@ -1,3 +1,27 @@
+/*:*
+ *: File: ./src/maps/hashmap.h
+ *:
+ *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
#ifndef HASHMAP_H
#define HASHMAP_H
@@ -6,13 +30,13 @@
using namespace std;
template<class key_type_>
-struct compare_allocator
+struct compare_allocator
{
inline bool operator()(key_type_ t_key_1, key_type_ t_key_2) const;
};
template<class key_type_>
-struct equals_allocator
+struct equals_allocator
{
inline bool operator()(key_type_ t_key_1, key_type_ t_key_2) const;
};
@@ -31,10 +55,10 @@ struct self_hash
template
<
-class obj_type,
-class key_type_ = string,
-class hash_type = size_hash<string>,
-class alloc_type = compare_allocator<string>
+ class obj_type,
+ class key_type_ = string,
+ class hash_type = size_hash<string>,
+ class alloc_type = compare_allocator<string>
>
struct hashmap : public __gnu_cxx::hash_map<key_type_, obj_type, hash_type, alloc_type>
{
@@ -42,7 +66,7 @@ struct hashmap : public __gnu_cxx::hash_map<key_type_, obj_type, hash_type, allo
virtual inline obj_type get_elem(key_type_ t_key);
virtual inline obj_type get_set_elem(obj_type t_obj, key_type_ t_key);
virtual inline obj_type get_or_callback_set
- (obj_type (*func)(void*), void* p_void, key_type_ t_key);
+ (obj_type (*func)(void*), void* p_void, key_type_ t_key);
virtual inline vector<key_type_>* get_key_vector();
virtual inline bool exists(key_type_ t_key);
virtual inline void run_func( void (*func)(obj_type) );
diff --git a/src/maps/hashmap.tmpl b/src/maps/hashmap.tmpl
index 9ee2f36..ea1ee41 100644
--- a/src/maps/hashmap.tmpl
+++ b/src/maps/hashmap.tmpl
@@ -1,3 +1,27 @@
+/*:*
+ *: File: ./src/maps/hashmap.tmpl
+ *:
+ *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
template<class key_type_>
bool
compare_allocator<key_type_>::operator()(key_type_ t_key_1, key_type_ t_key_2) const
diff --git a/src/maps/mtools.h b/src/maps/mtools.h
index f32a49e..c506674 100644
--- a/src/maps/mtools.h
+++ b/src/maps/mtools.h
@@ -1,7 +1,30 @@
+/*:*
+ *: File: ./src/maps/mtools.h
+ *:
+ *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
#ifndef MTOOLS_H
#define MTOOLS_H
-
template <class type_>
struct mtools
{
@@ -9,7 +32,4 @@ struct mtools
};
#include "mtools.tmpl"
-
-#endif
-
-
+#endif
diff --git a/src/maps/mtools.tmpl b/src/maps/mtools.tmpl
index dd3f89e..3fb4a5f 100644
--- a/src/maps/mtools.tmpl
+++ b/src/maps/mtools.tmpl
@@ -1,11 +1,36 @@
+/*:*
+ *: File: ./src/maps/mtools.tmpl
+ *:
+ *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
#ifndef MTOOLS_TMPL
#define MTOOLS_TMPL
template <class type_>
void
-mtools<type_>::delete_obj( type_ type_obj ) {
+mtools<type_>::delete_obj( type_ type_obj )
+{
if ( type_obj )
- delete type_obj;
+ delete type_obj;
}
#endif
diff --git a/src/maps/nhashmap.h b/src/maps/nhashmap.h
index f440230..1c14a1c 100644
--- a/src/maps/nhashmap.h
+++ b/src/maps/nhashmap.h
@@ -1,3 +1,27 @@
+/*:*
+ *: File: ./src/maps/nhashmap.h
+ *:
+ *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
#ifndef NHASHMAP_H
#define NHASHMAP_H
@@ -7,10 +31,10 @@ using namespace std;
template
<
-class obj_type,
-class key_type_ = string,
-class hash_type = size_hash<string>,
-class alloc_type = compare_allocator<string>
+ class obj_type,
+ class key_type_ = string,
+ class hash_type = size_hash<string>,
+ class alloc_type = compare_allocator<string>
>
struct nhashmap : public shashmap<obj_type, key_type_, hash_type, alloc_type>
{
diff --git a/src/maps/nhashmap.tmpl b/src/maps/nhashmap.tmpl
index 3ea1934..57afb81 100644
--- a/src/maps/nhashmap.tmpl
+++ b/src/maps/nhashmap.tmpl
@@ -1,3 +1,27 @@
+/*:*
+ *: File: ./src/maps/nhashmap.tmpl
+ *:
+ *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
template<class obj_type, class key_type_, class hash_type, class alloc_type>
obj_type
nhashmap<obj_type, key_type_, hash_type, alloc_type>::get_elem(key_type_ t_key)
diff --git a/src/maps/shashmap.h b/src/maps/shashmap.h
index f692e32..1d8d585 100644
--- a/src/maps/shashmap.h
+++ b/src/maps/shashmap.h
@@ -1,3 +1,27 @@
+/*:*
+ *: File: ./src/maps/shashmap.h
+ *:
+ *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
#ifndef SHASHMAP_H
#define SHASHMAP_H
@@ -10,13 +34,13 @@ using namespace std;
template
<
-class obj_type,
-class key_type_ = string,
-class hash_type = size_hash<string>,
-class alloc_type = compare_allocator<string>
+ class obj_type,
+ class key_type_ = string,
+ class hash_type = size_hash<string>,
+ class alloc_type = compare_allocator<string>
>
class shashmap : protected hashmap<obj_type, key_type_, hash_type, alloc_type>,
- public dumpable
+ public dumpable
{
private:
pthread_mutex_t mut_shashmap;
@@ -30,7 +54,7 @@ public:
virtual inline void set_elem(obj_type t_obj, key_type_ t_key);
virtual inline obj_type get_set_elem(obj_type t_obj, key_type_ t_key);
virtual inline obj_type get_or_callback_set
- (obj_type (*func)(void*), void* p_void, key_type_ t_key);
+ (obj_type (*func)(void*), void* p_void, key_type_ t_key);
virtual inline void add_elem(obj_type t_obj, key_type_ t_key);
virtual inline void add_elem_insecure(obj_type t_obj, key_type_ t_key);
virtual inline obj_type get_elem(key_type_ t_key);
diff --git a/src/maps/shashmap.tmpl b/src/maps/shashmap.tmpl
index 0bd5796..7a1c9ae 100644
--- a/src/maps/shashmap.tmpl
+++ b/src/maps/shashmap.tmpl
@@ -1,3 +1,27 @@
+/*:*
+ *: File: ./src/maps/shashmap.tmpl
+ *:
+ *: yChat; Homepage: www.yChat.org; Version 0.7.9.5-RELEASE
+ *:
+ *: Copyright (C) 2003 Paul C. Buetow, Volker Richter
+ *: Copyright (C) 2004 Paul C. Buetow
+ *: Copyright (C) 2005 EXA Digital Solutions GbR
+ *:
+ *: This program is free software; you can redistribute it and/or
+ *: modify it under the terms of the GNU General Public License
+ *: as published by the Free Software Foundation; either version 2
+ *: of the License, or (at your option) any later version.
+ *:
+ *: This program is distributed in the hope that it will be useful,
+ *: but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *: GNU General Public License for more details.
+ *:
+ *: You should have received a copy of the GNU General Public License
+ *: along with this program; if not, write to the Free Software
+ *: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *:*/
+
template<class obj_type, class key_type_, class hash_type, class alloc_type>
shashmap<obj_type, key_type_, hash_type, alloc_type>::shashmap()
{
@@ -43,7 +67,7 @@ shashmap<obj_type, key_type_, hash_type, alloc_type>::get_or_callback_set
{
pthread_mutex_lock( &mut_shashmap );
obj_type t_ret = hashmap<obj_type, key_type_, hash_type, alloc_type>::get_or_callback_set
- (func, p_void, t_key);
+ (func, p_void, t_key);
pthread_mutex_unlock( &mut_shashmap );
return t_ret;
}
@@ -144,14 +168,12 @@ template<class obj_type, class key_type_, class hash_type, class alloc_type>
void
shashmap<obj_type, key_type_, hash_type, alloc_type>::dumpit()
{
- dumpable::add
- ("[shashmap]");
+ dumpable::add("[shashmap]");
vector<key_type_>* p_vec = get_key_vector();
typename vector<key_type_>::iterator iter;
for (iter = p_vec->begin(); iter != p_vec->end(); ++iter)
- dumpable::add
- (*iter);
+ dumpable::add(*iter);
delete p_vec;
}