PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/common/library/global_cache.e

http://github.com/tybor/Liberty
Specman e | 43 lines | 30 code | 6 blank | 7 comment | 2 complexity | 4e0577b62984795363687693923c2249 MD5 | raw file
 1note
 2   description:
 3      "."
 4   copyright:
 5      "[
 6               Copyright (C) 2008-2017: Paolo Redaelli
 7
 8               This library is free software; you can redistribute it and/or
 9               modify it under the terms of the GNU Lesser General Public License
10               as published by the Free Software Foundation; either version 2.1 of
11               the License, or (at your option) any later version.
12
13               This library is distributed in the hope that it will be useful, but
14               WITHOUT ANY WARRANTY; without even the implied warranty of
15               MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16               Lesser General Public License for more details.
17
18               You should have received a copy of the GNU Lesser General Public
19               License along with this library; if not, write to the Free Software
20               Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21               02110-1301 USA
22         ]"
23deferred class GLOBAL_CACHE
24   -- GLOBAL_CACHE gives access to the shared cache of GLOBALLY_CACHED
25   -- wrappers.
26
27insert
28   ANY
29      undefine copy, is_equal, fill_tagged_out_memory
30      end
31
32feature {WRAPPER, WRAPPER_HANDLER} -- Implementation
33   wrappers: HASHED_DICTIONARY[GLOBALLY_CACHED, POINTER]
34         -- Dictionary storing GLOBALLY_CACHED wrappers created in the program.  Key
35         -- is the address (pointer) to the wrapped C structure, value
36         -- is the corresponding Eiffel wrapper. This way you can get
37         -- back an already-created Eiffel wrapper.
38         --
39      once
40         create {HASHED_DICTIONARY[GLOBALLY_CACHED, POINTER]} Result.make
41      end
42
43end -- class GLOBAL_CACHE