Re: SetPixelCacheMethods() vs. SyncPixelCache() vs. SyncCacheNexus() vs. SyncCacheView()

Bob Friesenhahn <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.core
Message-ID <[email protected]>
On Tue, 6 Jan 2004, Wolfgang Spraul wrote:

> I noticed some architectural overlap in cache.c/cache_view.c and wasn't sure
> which functions (if any) are "older" vs. "newer", or "preferred" or whatever.
> Basically, cache.c:GetCacheInfo() will initialize a set of cache function
> pointers with SetPixelCacheMethods() to point to SyncPixelCache() (for
> example). SyncPixelCache() will then in turn call SyncCacheNexus().
> Then, there are the "cache view" functions in cache_view.c, which generally
> seem to be small wrappers that call the "nexus" cache functions family. The
> website doc seems to mention only the cache view functions.
> All of those functions are flagged as MagickExport, i.e. meant to be called
> from outside.

Cache.c was written by John Cristy.  While it is true that we
successfully added a few GraphicsMagick enhancements to cache.c, for
any of us to properly understand how to extend it it, we have to study
the code just as you are doing.  It is not exactly light reading.
That means that none of us will be able to answer these detailed
questions without spending a day looking at the code ourselves.
Perhaps John Cristy would be willing to answer some of your questions.

We do eventually plan to extend the pixel cache design to support
compact grayscale, and (perhaps) bilevel pixel storage without
breaking the existing PixelPacket/Indexes API.

> Let's say I want to add another cache type (in addition to DiskCache,
> MemoryCache, MapCache). How should I do this? Should I add it to the existing
> functions in cache.c as new cases, or add new functions and use the function
> pointer setup mechanism?

I doubt that anyone in the world has used the function pointer setup
mechanism since the implementation has been used to satisify the needs
of cache.c.  If you need your code to be somewhat independent, then it
is worth giving it a try, otherwise using the existing patterns in
cache.c and adding code to cache.c may be easiest.

Bob
======================================
Bob Friesenhahn
[email protected]
http://www.simplesystems.org/users/bfriesen



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.