GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSD / dev > qsu / linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

QFC_cache.h File Reference

#include <QSD/QFR_file.h>

Typedefs

typedef struct _QFC_cache QFC_cache
typedef struct _QFR_fileCtx QFR_fileCtx
typedef struct _QFC_member QFC_member
typedef struct _QFC_file QFC_file
 Typedef for struct _QFC_file.
typedef struct _QFC_subscription QFC_subscription
 Typedef for struct _QFC_cacheSubscriber.

Functions

int QFC_sizeof (int nmembers)
 Returns the size, in bytes, of a cache needed to hold nmembers.
void * QFC_construct (QFC_cache *cache, int nmembers)
 Constructs a cache with nmembers.
void QFC_destruct (QFC_cache *cache)
 Destroys the cache. All subscribers are notified.
QFC_memberQFC_findByKey (QFC_cache *cache, unsigned int key)
 Locates the cache member by its key.
int QFC_validate (const QFC_cache *cache, const QFC_member *member, unsigned int key)
 Validates the member.
QFC_memberQFC_add (QFC_cache *cache, unsigned int key, const char *name, void *other)
 Adds the file to the cache. If the cache is full, the oldest member is removed. Subscribers will be notified on the replacement and posible removal.
int QFC_remove (QFC_cache *cache, QFC_member *member)
 Removes the member from the cache. Subscribers will be notified.
int QFC_removeByKey (QFC_cache *cache, unsigned int key)
 Removes the member from the cache be key.
int QFC_resolve (QFC_cache *cache, QFR_fileCtx *ctx, QFC_file *file, unsigned int key, const char *dirName, const char *fileName, QFR_resolver resolver)
void QFC_subscribe (QFC_cache *cache, QFC_subscription *subscription)
 Adds a subscription to the cache. The subscriber will be notified on member removal and replacement.
void QFC_unsubscribe (QFC_cache *cache, QFC_subscription *subscription)
 Removes a subscription to the cache.

Detailed Description

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: QFC_cache.h,v 1.4 2011/03/26 21:06:58 russell Exp $

Function Documentation

QFC_member* QFC_add ( QFC_cache cache,
unsigned int  key,
const char *  name,
void *  handle 
)

Adds the file to the cache. If the cache is full, the oldest member is removed. Subscribers will be notified on the replacement and posible removal.

Parameters:
cache The cache
key The file/cache key
name The name of the file. Only the pointer is captured, i.e. the name is not copied
handle A handle (arbitrary) to be associated with the file. This is usually some reference to the opened file or information about it.

References _QFC_cache::activelist, _QFC_cache::freelist, _QFC_memberSpecific::handle, _QFC_member::key, _QFC_member::name, _QFC_member::node, notify_remove(), notify_replace(), and _QFC_member::spc.

void* QFC_construct ( QFC_cache cache,
int  nmembers 
)

Constructs a cache with nmembers.

Returns:
Pointer to the memory immediately following the cache, i.e. cache + QFC__sizeof (nmembers)
Parameters:
cache The cache to construct. The size of the memory for the cache is normally allocated by QFC_sizeof.
nmembers The number of members in the cache.

References _QFC_cache::activelist, _QFC_cache::freelist, _QFC_cache::members, _QFC_cache::nmembers, _QFC_member::node, and _QFC_cache::subscriptions.

void QFC_destruct ( QFC_cache cache  ) 

Destroys the cache. All subscribers are notified.

Parameters:
cache The cache to destroy

References _QFC_cache::activelist, _QFC_memberSpecific::handle, _QFC_member::key, notify_remove(), and _QFC_member::spc.

QFC_member* QFC_findByKey ( QFC_cache cache,
unsigned int  key 
)

Locates the cache member by its key.

Return values:
non-NULL,the member
NULL,member was not found
Parameters:
cache The cache
key The file key

References _QFC_cache::activelist, _QFC_member::key, and _QFC_member::node.

Referenced by QFC_removeByKey().

int QFC_remove ( QFC_cache cache,
QFC_member member 
)

Removes the member from the cache. Subscribers will be notified.

Return values:
==0,successful removal
==-1,\a member is not a member of the cache
Parameters:
cache The cache
member The member to remove

References _QFC_cache::freelist, _QFC_cache::members, _QFC_cache::nmembers, and _QFC_member::node.

Referenced by QFC_removeByKey().

int QFC_removeByKey ( QFC_cache cache,
unsigned int  key 
)

Removes the member from the cache be key.

Return values:
==0,successful removal
==-1,\a member is not a member of the cache
Parameters:
cache The cache
key The key of member to remove

References QFC_findByKey(), and QFC_remove().

int QFC_sizeof ( int  nmembers  ) 

Returns the size, in bytes, of a cache needed to hold nmembers.

Returns:
The size, in bytes, of a cache needed to hold nmembers
Parameters:
nmembers The number of members in the cache

void QFC_subscribe ( QFC_cache cache,
QFC_subscription subscription 
)

Adds a subscription to the cache. The subscriber will be notified on member removal and replacement.

Parameters:
cache The cache
subscription The subscripion.

References _QFC_subscription::node, and _QFC_cache::subscriptions.

void QFC_unsubscribe ( QFC_cache cache,
QFC_subscription subscription 
)

Removes a subscription to the cache.

Parameters:
cache The cache
subscription The subscripion.

References _QFC_subscription::node.

int QFC_validate ( const QFC_cache cache,
const QFC_member member,
unsigned int  key 
)

Validates the member.

Return values:
!=0,member is valid
==0,member is invalid

References _QFC_member::key.


Generated on Sat Mar 26 14:08:24 2011 by  doxygen 1.5.8