summaryrefslogtreecommitdiff
path: root/src/maps
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:42 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:42 +0200
commit42b79aa5c591dde88e78922a519802f948d9ea60 (patch)
tree92cd4e576656837bb99214d8c09c3fec3201474f /src/maps
parent520f54d6219b7c625b4e07463ac393e6982ddab6 (diff)
tagging ychat-0.7.9.4ychat-0.7.9.4
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.h6
-rw-r--r--src/maps/mtools.tmpl5
-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.tmpl26
8 files changed, 22 insertions, 169 deletions
diff --git a/src/maps/hashmap.h b/src/maps/hashmap.h
index 0a0535a..1bdc515 100644
--- a/src/maps/hashmap.h
+++ b/src/maps/hashmap.h
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/maps/hashmap.h
- *:
- *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
- *:
- *: 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
@@ -30,13 +6,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;
};
@@ -55,10 +31,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>
{
@@ -66,7 +42,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 b3524b9..9ee2f36 100644
--- a/src/maps/hashmap.tmpl
+++ b/src/maps/hashmap.tmpl
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/maps/hashmap.tmpl
- *:
- *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
- *:
- *: 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..4ee45b8 100644
--- a/src/maps/mtools.h
+++ b/src/maps/mtools.h
@@ -1,7 +1,6 @@
#ifndef MTOOLS_H
#define MTOOLS_H
-
template <class type_>
struct mtools
{
@@ -9,7 +8,4 @@ struct mtools
};
#include "mtools.tmpl"
-
-#endif
-
-
+#endif
diff --git a/src/maps/mtools.tmpl b/src/maps/mtools.tmpl
index dd3f89e..6917131 100644
--- a/src/maps/mtools.tmpl
+++ b/src/maps/mtools.tmpl
@@ -3,9 +3,10 @@
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 6443219..7f17a55 100644
--- a/src/maps/nhashmap.h
+++ b/src/maps/nhashmap.h
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/maps/nhashmap.h
- *:
- *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
- *:
- *: 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
@@ -31,10 +7,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 c1f02ce..3ea1934 100644
--- a/src/maps/nhashmap.tmpl
+++ b/src/maps/nhashmap.tmpl
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/maps/nhashmap.tmpl
- *:
- *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
- *:
- *: 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 445ea77..99dd7c8 100644
--- a/src/maps/shashmap.h
+++ b/src/maps/shashmap.h
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/maps/shashmap.h
- *:
- *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
- *:
- *: 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
@@ -34,13 +10,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;
@@ -54,7 +30,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 4e91d33..c864d28 100644
--- a/src/maps/shashmap.tmpl
+++ b/src/maps/shashmap.tmpl
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/maps/shashmap.tmpl
- *:
- *: yChat; Homepage: www.yChat.org; Version 0.8.3-CURRENT
- *:
- *: 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()
{
@@ -67,7 +43,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;
}