diff options
| author | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:41 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:41 +0200 |
| commit | 9cd3ccffd5372dfde3af478e3f832f18db4be3f1 (patch) | |
| tree | 631c295a4a4a16b57502b847626763a279bf6df7 /ychat-0.7.7.0/src/memb | |
| parent | 13aaf70af703748fe096e0664c305cd202637ad2 (diff) | |
tagging tags
Diffstat (limited to 'ychat-0.7.7.0/src/memb')
| -rw-r--r-- | ychat-0.7.7.0/src/memb/CVS/Entries | 5 | ||||
| -rw-r--r-- | ychat-0.7.7.0/src/memb/CVS/Repository | 1 | ||||
| -rw-r--r-- | ychat-0.7.7.0/src/memb/CVS/Root | 1 | ||||
| -rw-r--r-- | ychat-0.7.7.0/src/memb/memb.h | 23 | ||||
| -rw-r--r-- | ychat-0.7.7.0/src/memb/memb.tmpl | 17 | ||||
| -rw-r--r-- | ychat-0.7.7.0/src/memb/tupel.h | 26 | ||||
| -rw-r--r-- | ychat-0.7.7.0/src/memb/tupel.tmpl | 37 |
7 files changed, 110 insertions, 0 deletions
diff --git a/ychat-0.7.7.0/src/memb/CVS/Entries b/ychat-0.7.7.0/src/memb/CVS/Entries new file mode 100644 index 0000000..ba3a2e5 --- /dev/null +++ b/ychat-0.7.7.0/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/ychat-0.7.7.0/src/memb/CVS/Repository b/ychat-0.7.7.0/src/memb/CVS/Repository new file mode 100644 index 0000000..cf42388 --- /dev/null +++ b/ychat-0.7.7.0/src/memb/CVS/Repository @@ -0,0 +1 @@ +ychat/src/memb diff --git a/ychat-0.7.7.0/src/memb/CVS/Root b/ychat-0.7.7.0/src/memb/CVS/Root new file mode 100644 index 0000000..745de68 --- /dev/null +++ b/ychat-0.7.7.0/src/memb/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous@buetow.org:/usr/home/cvs/cvsroot diff --git a/ychat-0.7.7.0/src/memb/memb.h b/ychat-0.7.7.0/src/memb/memb.h new file mode 100644 index 0000000..9c398ec --- /dev/null +++ b/ychat-0.7.7.0/src/memb/memb.h @@ -0,0 +1,23 @@ +#ifndef MEMB_H +#define MEMB_H + +#include "../incl.h" +#include "../maps/nhashmap.h" +#include "tupel.h" + +using namespace std; + +template<class obj_type> +class memb +{ +private: + nhashmap< mutexed_tupel<obj_type>* > map_elems; + +public: + inline obj_type get_elem(string s_key); + inline void set_elem(obj_type t_obj, string s_key); + +}; + +#include "memb.tmpl" +#endif diff --git a/ychat-0.7.7.0/src/memb/memb.tmpl b/ychat-0.7.7.0/src/memb/memb.tmpl new file mode 100644 index 0000000..0b4da0e --- /dev/null +++ b/ychat-0.7.7.0/src/memb/memb.tmpl @@ -0,0 +1,17 @@ +template<class obj_type> +obj_type +memb<obj_type>::get_elem(string s_key) +{ + mutexed_tupel<obj_type> *p_tupel = map_elems.get_elem(s_key); + if ( p_tupel ) + return p_tupel->get_elem(); + + 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 +} diff --git a/ychat-0.7.7.0/src/memb/tupel.h b/ychat-0.7.7.0/src/memb/tupel.h new file mode 100644 index 0000000..bb1939e --- /dev/null +++ b/ychat-0.7.7.0/src/memb/tupel.h @@ -0,0 +1,26 @@ +#ifndef TUPEL_H +#define TUPEL_H + +#include "../incl.h" + +#define mutexed_tupel tupel + +using namespace std; + +template<class obj_type> +class tupel +{ +private: + pthread_mutex_t mut_tupel; + obj_type t_obj; +public: + tupel(); + tupel(obj_type t_obj); + ~tupel(); + + inline obj_type get_elem(); + inline void set_elem(obj_type t_obj); +}; + +#include "tupel.tmpl" +#endif diff --git a/ychat-0.7.7.0/src/memb/tupel.tmpl b/ychat-0.7.7.0/src/memb/tupel.tmpl new file mode 100644 index 0000000..bdde516 --- /dev/null +++ b/ychat-0.7.7.0/src/memb/tupel.tmpl @@ -0,0 +1,37 @@ +template<class obj_type> +tupel<obj_type>::tupel() +{ + 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 ); +} + +template<class obj_type> +tupel<obj_type>::~tupel() +{ + pthread_mutex_destroy( &mut_tupel ); +} + +template<class obj_type> +obj_type +tupel<obj_type>::get_elem() +{ + pthread_mutex_lock( &mut_tupel ); + obj_type t_ret = t_obj; + pthread_mutex_unlock( &mut_tupel ); + return t_ret; +} + +template<class obj_type> +void +tupel<obj_type>::set_elem(obj_type t_obj) +{ + pthread_mutex_lock( &mut_tupel ); + this->t_obj = t_obj; + pthread_mutex_unlock( &mut_tupel ); +} |
