Util--  1.1
uniq_memory.hh
Go to the documentation of this file.
1 /* -*- C++ -*-
2  * $Id: uniq_memory.hh 961 2005-03-11 14:05:33Z fpy $
3  */
4 #ifndef UTILMM_SMART_UNIQ_MEMORY_HEADER
5 # define UTILMM_SMART_UNIQ_MEMORY_HEADER
6 
8 
9 namespace utilmm {
10  namespace smart {
11  namespace ref_count {
12 
28  template<typename Ty, class Hash>
29  struct hash_ptr
30  :public std::unary_function<Ty const *, size_t> {
41  size_t operator()(Ty const *arg) const;
42  }; // struct utilmm::smart::ref_count::hash_ptr<>
43 
44 
59  template<typename Ty, class Equal>
60  struct eq_ptr
61  :public std::binary_function<Ty const *, Ty const *, bool> {
74  bool operator()(Ty const *a, Ty const *b) const;
75  }; // struct utilmm::smart::ref_count::eq_ptr<>
76 
96  template<typename Ty, class Hash, class Equal>
97  class uniq_memory {
98  public:
100  typedef Ty const base_type;
101 
102  private:
105 
106  mem_type the_mem;
107 
108  public:
110  typedef typename mem_type::iterator mem_cell;
111 
119  return the_mem.end();
120  }
121 
134  mem_cell create(base_type *ptr);
135 
143  void destroy(mem_cell c);
144  }; // class utilmm::smart::ref_count::uniq_memory<>
145 
146  } // namespace utilmm::smart::ref_count
147  } // namespace utilmm::smart
148 } // namespace utilmm
149 
150 # define IN_UTILMM_SMART_UNIQ_MEMORY_HEADER
151 #include "utilmm/smart/bits/uniq_memory.tcc"
152 # undef IN_UTILMM_SMART_UNIQ_MEMORY_HEADER
153 #endif // UTILMM_SMART_UNIQ_MEMORY_HEADER
154 
void destroy(mem_cell c)
Destroy a memory cell.
Declaration of utilmm::hash_map.
In depth pointer equality functor.
Definition: uniq_memory.hh:60
Special hash functor for utilmm::smart::ref_count::uniq_memory.
Definition: uniq_memory.hh:29
map with hashing access
Definition: hash_map.hh:31
size_t operator()(Ty const *arg) const
Hashing call operator.
bool operator()(Ty const *a, Ty const *b) const
Call operator.
mem_cell create(base_type *ptr)
Attachment of a new pointer.
Unique instance memory manager.
Definition: uniq_memory.hh:97
Ty const base_type
Real pointed type.
Definition: uniq_memory.hh:100
iterator for table
Definition: iter.hh:24
iterator end()
end of table
Definition: hash_map.hh:111
mem_cell null_cell()
null cell creation
Definition: uniq_memory.hh:118
mem_type::iterator mem_cell
type of managed mem cells
Definition: uniq_memory.hh:110

Generated on Tue Oct 9 2018 10:12:45 for Util-- by doxygen 1.8.6
SourceForge.net Project Page