lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [PATCH 1/5] Add loaded_files_cache<T> class


From: Greg Chicares
Subject: Re: [lmi] [PATCH 1/5] Add loaded_files_cache<T> class
Date: Thu, 28 Jul 2016 23:29:11 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.8.0

On 2012-06-15 16:19, Vaclav Slavik wrote:
> 
> this is the first in a series of patches that implement caching of
> xml_actuarial_table and DBDictionary. This one adds the reusable caching
> class we discussed.

commit 3085b77c86dce36685a646d387d920f577c04abe

Before committing, I:
 - updated the copyright date;
 - removed the RCS Id;
 - added required headers;
 - changed various names (including the file name); and
 - reordered certain members.
I've also added this new header to 'Makefile.am'.

> The class checks for modified files automatically. Types used with it
> must implement a T(filename) constructor; I think that's the simplest
> and most natural way of constructing objects from file data.
> 
> I ended up using pointers in the end, because DBDictionary is uncopyable
> -- and unlike xml_actuarial_table, cannot be easily made copyable. I use

It looks like we could make it copyable the same way we made class Input
copyable. But there's no need for that because copying would still be
more expensive than using a shared_ptr...

> shared_ptr<> instead of raw pointers for ease of destruction and I use
> shared_ptr<> instead of some other form of pointers because it neatly
> solves another problem: an entry in the cache could be invalidated by
> another access if the underlying file changed. But that shouldn't affect
> the instance already retrieved (nor should a pointer to a cached copy
> used somewhere suddenly become invalid) and shared pointers solve that
> neatly.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]