summaryrefslogtreecommitdiff
path: root/src/memb
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
commit658bfd183905576ed5f4dbe57a2ee82711b6ac93 (patch)
tree08cf25d1a1fb09b643a65c5b237c52bce791f307 /src/memb
parent42b79aa5c591dde88e78922a519802f948d9ea60 (diff)
tagging ychat-0.7.9.0ychat-0.7.9.0
Diffstat (limited to 'src/memb')
-rw-r--r--src/memb/CVS/Entries5
-rw-r--r--src/memb/CVS/Repository1
-rw-r--r--src/memb/CVS/Root1
-rw-r--r--src/memb/memb.h74
-rw-r--r--src/memb/memb.tmpl91
-rw-r--r--src/memb/tupel.h26
-rw-r--r--src/memb/tupel.tmpl38
7 files changed, 18 insertions, 218 deletions
diff --git a/src/memb/CVS/Entries b/src/memb/CVS/Entries
new file mode 100644
index 0000000..ba3a2e5
--- /dev/null
+++ b/src/memb/CVS/Entries
@@ -0,0 +1,5 @@
+/memb.h/1.2/Mon Feb 21 01:55:49 2005//
+/memb.tmpl/1.2/Mon Feb 21 01:55:49 2005//
+/tupel.h/1.2/Mon Feb 21 01:55:49 2005//
+/tupel.tmpl/1.2/Mon Feb 21 01:55:49 2005//
+D
diff --git a/src/memb/CVS/Repository b/src/memb/CVS/Repository
new file mode 100644
index 0000000..cf42388
--- /dev/null
+++ b/src/memb/CVS/Repository
@@ -0,0 +1 @@
+ychat/src/memb
diff --git a/src/memb/CVS/Root b/src/memb/CVS/Root
new file mode 100644
index 0000000..745de68
--- /dev/null
+++ b/src/memb/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot
diff --git a/src/memb/memb.h b/src/memb/memb.h
index 1997750..9c398ec 100644
--- a/src/memb/memb.h
+++ b/src/memb/memb.h
@@ -1,33 +1,8 @@
-/*:*
- *: File: ./src/memb/memb.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 MEMB_H
#define MEMB_H
#include "../incl.h"
-#include "../wrap.h"
-#include "../maps/hashmap.h"
+#include "../maps/nhashmap.h"
#include "tupel.h"
using namespace std;
@@ -36,58 +11,13 @@ template<class obj_type>
class memb
{
private:
- hashmap< mutexed_tupel<obj_type>* > map_elems;
+ nhashmap< mutexed_tupel<obj_type>* > map_elems;
public:
- memb()
- {}
- memb(vector<string> &vec_fields);
- void initialize(vector<string> &vec_fields);
inline obj_type get_elem(string s_key);
inline void set_elem(obj_type t_obj, string s_key);
-};
-
-struct memb_string : protected memb<string>
-{
- memb_string()
- {}
- memb_string(vector<string> &vec_fields) : memb<string>(vec_fields)
- {}
- void init_strings(vector<string> vec_fields)
- {
- initialize(vec_fields);
- }
- inline string get_string(string s_key);
- inline void set_string(string s_obj, string s_key);
-};
-struct memb_int : protected memb<int>
-{
- memb_int()
- {}
- void init_ints(vector<string> vec_fields)
- {
- initialize(vec_fields);
- }
- inline int get_int(string s_key);
- inline void set_int(int i_obj, string s_key);
};
-struct memb_bool : protected memb<bool>
-{
- memb_bool()
- {}
- void init_bools(vector<string> vec_fields)
- {
- initialize(vec_fields);
- }
- inline bool get_bool(string s_key);
- inline void set_bool(bool b_obj, string s_key);
-};
-
-class memb_base : public memb_string, public memb_int, public memb_bool
- {}
-;
-
#include "memb.tmpl"
#endif
diff --git a/src/memb/memb.tmpl b/src/memb/memb.tmpl
index 37eb2ab..0b4da0e 100644
--- a/src/memb/memb.tmpl
+++ b/src/memb/memb.tmpl
@@ -1,44 +1,3 @@
-/*:*
- *: File: ./src/memb/memb.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>
-memb<obj_type>::memb(vector<string> &vec_fields)
-{
- initialize(vec_fields);
-}
-
-template<class obj_type>
-void
-memb<obj_type>::initialize(vector<string> &vec_fields)
-{
- obj_type t_default;
- vector<string>::iterator iter;
- for (iter = vec_fields.begin(); iter != vec_fields.end(); ++iter)
- map_elems[*iter] = new mutexed_tupel<obj_type>(t_default);
-}
-
template<class obj_type>
obj_type
memb<obj_type>::get_elem(string s_key)
@@ -47,58 +6,12 @@ memb<obj_type>::get_elem(string s_key)
if ( p_tupel )
return p_tupel->get_elem();
- obj_type t_ret;
- return t_ret;
+ return obj_type();
}
template<class obj_type>
void
memb<obj_type>::set_elem(obj_type t_obj, string s_key)
{
- mutexed_tupel<obj_type> *p_tupel = map_elems.get_elem(s_key);
- if ( p_tupel )
- {
- p_tupel->set_elem(t_obj);
- return;
- }
-
- //wrap::system_message(MEMBERE+string("("+s_key+")"));
+ // mutexed_tupel<obj_type> *p_tupel = map_elems
}
-
-string
-memb_string::get_string(string s_key)
-{
- return get_elem(s_key);
-}
-
-void
-memb_string::set_string(string s_obj, string s_key)
-{
- set_elem(s_obj, s_key);
-}
-
-int
-memb_int::get_int(string s_key)
-{
- return get_elem(s_key);
-}
-
-void
-memb_int::set_int(int i_obj, string s_key)
-{
- set_elem(i_obj, s_key);
-}
-
-bool
-memb_bool::get_bool(string s_key)
-{
- return get_elem(s_key);
-}
-
-void
-memb_bool::set_bool(bool b_obj, string s_key)
-{
- set_elem(b_obj, s_key);
-}
-
-
diff --git a/src/memb/tupel.h b/src/memb/tupel.h
index f4cc288..bb1939e 100644
--- a/src/memb/tupel.h
+++ b/src/memb/tupel.h
@@ -1,27 +1,3 @@
-/*:*
- *: File: ./src/memb/tupel.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 TUPEL_H
#define TUPEL_H
@@ -37,9 +13,7 @@ class tupel
private:
pthread_mutex_t mut_tupel;
obj_type t_obj;
-
public:
-
tupel();
tupel(obj_type t_obj);
~tupel();
diff --git a/src/memb/tupel.tmpl b/src/memb/tupel.tmpl
index acc8c40..bdde516 100644
--- a/src/memb/tupel.tmpl
+++ b/src/memb/tupel.tmpl
@@ -1,53 +1,29 @@
-/*:*
- *: File: ./src/memb/tupel.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>
tupel<obj_type>::tupel()
{
- pthread_mutex_init(&mut_tupel, NULL);
+ pthread_mutex_init( &mut_tupel, NULL );
}
template<class obj_type>
tupel<obj_type>::tupel(obj_type t_obj)
{
this->t_obj = t_obj;
- pthread_mutex_init(&mut_tupel, NULL);
+ pthread_mutex_init( &mut_tupel, NULL );
}
template<class obj_type>
tupel<obj_type>::~tupel()
{
- pthread_mutex_destroy(&mut_tupel);
+ pthread_mutex_destroy( &mut_tupel );
}
template<class obj_type>
obj_type
tupel<obj_type>::get_elem()
{
- pthread_mutex_lock(&mut_tupel);
+ pthread_mutex_lock( &mut_tupel );
obj_type t_ret = t_obj;
- pthread_mutex_unlock(&mut_tupel);
+ pthread_mutex_unlock( &mut_tupel );
return t_ret;
}
@@ -55,7 +31,7 @@ template<class obj_type>
void
tupel<obj_type>::set_elem(obj_type t_obj)
{
- pthread_mutex_lock(&mut_tupel);
+ pthread_mutex_lock( &mut_tupel );
this->t_obj = t_obj;
- pthread_mutex_unlock(&mut_tupel);
+ pthread_mutex_unlock( &mut_tupel );
}