GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSD / dev > qsu / linux-gcc
#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_member * | QFC_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_member * | QFC_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. |
CVS $Id: QFC_cache.h,v 1.4 2011/03/26 21:06:58 russell Exp $
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.
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.
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.
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.
non-NULL,the | member | |
NULL,member | was not found |
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.
==0,successful | removal | |
==-1,\a | member is not a member of the cache |
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.
==0,successful | removal | |
==-1,\a | member is not a member of the cache |
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.
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.
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.
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.
!=0,member | is valid | |
==0,member | is invalid |
References _QFC_member::key.