Offers object and interface for accessing cached objects. Implemented by objectcache_impl_t.
Objectcache-Object | Offers object and interface for accessing cached objects. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file of Objectcache-Object. |
Types | |
struct objectcache_t | Export objectcache_t. |
struct objectcache_it | Export interface objectcache_it. |
objectcache_t | Uses iobj_DECLARE to declare interfaceable object. |
lifetime | |
objectcache_FREE | Static initializer. |
objectcache_it | The function table which describes the objectcache service. |
lock_iobuffer | See objectcache_impl_t.lockiobuffer_objectcacheimpl for an implementation. |
unlock_iobuffer | See objectcache_impl_t.unlockiobuffer_objectcacheimpl for an implementation. |
generic | |
genericcast_objectcacheit | Casts first parameter into pointer to objectcache_it. |
objectcache_it_DECLARE | Declares a function table for accessing an objectcache service. |
inline implementation | |
Macros | |
genericcast_objectcacheit | Implements objectcache_it.genericcast_objectcacheit. |
objectcache_it_DECLARE | Implements objectcache_it.objectcache_it_DECLARE. |
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2011 Jörg Seebohn
Header file of Objectcache-Object.
typedef struct objectcache_t objectcache_t
Export objectcache_t. objectcache_it implementing object.
typedef struct objectcache_it objectcache_it
Export interface objectcache_it.
iobj_DECLARE( objectcache_t, objectcache )
Uses iobj_DECLARE to declare interfaceable object. See also objectcache_impl_t which is the default implementation.
lifetime | |
objectcache_FREE | Static initializer. |
struct objectcache_it
The function table which describes the objectcache service. See objectcache_it_DECLARE for adaption of the interface to a specific implementation.
lock_iobuffer | See objectcache_impl_t.lockiobuffer_objectcacheimpl for an implementation. |
unlock_iobuffer | See objectcache_impl_t.unlockiobuffer_objectcacheimpl for an implementation. |
generic | |
genericcast_objectcacheit | Casts first parameter into pointer to objectcache_it. |
objectcache_it_DECLARE | Declares a function table for accessing an objectcache service. |
void ( * lock_iobuffer ) (struct objectcache_t * cache, /*out*/struct memblock_t ** iobuffer)
See objectcache_impl_t.lockiobuffer_objectcacheimpl for an implementation.
void ( * unlock_iobuffer ) (struct objectcache_t * cache, struct memblock_t ** iobuffer)
See objectcache_impl_t.unlockiobuffer_objectcacheimpl for an implementation.
objectcache_it * genericcast_objectcacheit( void * cache, TYPENAME objectcache_t ) ;
Casts first parameter into pointer to objectcache_it. The first parameter has to point to a type declared with objectcache_it_DECLARE. The second must be the same as in objectcache_it_DECLARE.
void objectcache_it_DECLARE( TYPENAME declared_it, TYPENAME objectcache_t ) ;
Declares a function table for accessing an objectcache service. Use this macro to define an interface which is structural compatible with the generic interface objectcache_it. The difference between the newly declared interface and the generic interface is the type of the first parameter.
See objectcache_it for a list of declared functions.
declared_it | The name of the structure which is declared as the functional objectcache interface. The name should have the suffix “_it”. |
objectcache_t | The type of the cache object which is the first parameter of all objectcache functions. |
#define genericcast_objectcacheit( cache, objectcache_t ) ( __extension__ ({ static_assert( offsetof(objectcache_it, lock_iobuffer) == offsetof(typeof(*(cache)), lock_iobuffer) && offsetof(objectcache_it, unlock_iobuffer) == offsetof(typeof(*(cache)), unlock_iobuffer), "ensure same structure") ; if (0) { (cache)->lock_iobuffer((objectcache_t*)0, (struct memblock_t**)0) ; (cache)->unlock_iobuffer((objectcache_t*)0, (struct memblock_t**)0) ; } (objectcache_it*) (cache) ; }))
Implements objectcache_it.genericcast_objectcacheit.
#define objectcache_it_DECLARE( declared_it, objectcache_t ) typedef struct declared_it declared_it ; struct declared_it { void (*lock_iobuffer) (objectcache_t * cache, /*out*/struct memblock_t ** iobuffer); void (*unlock_iobuffer) (objectcache_t * cache, struct memblock_t ** iobuffer) ; }
Implements objectcache_it.objectcache_it_DECLARE.
Export objectcache_t.
typedef struct objectcache_t objectcache_t
Uses iobj_DECLARE to declare interfaceable object.
iobj_DECLARE( objectcache_t, objectcache )
Export interface objectcache_it.
typedef struct objectcache_it objectcache_it
The function table which describes the objectcache service.
struct objectcache_it
Implements iobj_t.iobj_DECLARE.
#define iobj_DECLARE( declared_t, typenameprefix ) struct declared_t { struct typenameprefix##_t * object ; struct typenameprefix##_it * iimpl ; }
Static initializer.
#define objectcache_FREE iobj_FREE
See objectcache_impl_t.lockiobuffer_objectcacheimpl for an implementation.
void ( * lock_iobuffer ) (struct objectcache_t * cache, /*out*/struct memblock_t ** iobuffer)
Locks the io buffer and returns a pointer to it in iobuffer.
void lockiobuffer_objectcacheimpl( objectcache_impl_t * objectcache, /*out*/struct memblock_t ** iobuffer )
See objectcache_impl_t.unlockiobuffer_objectcacheimpl for an implementation.
void ( * unlock_iobuffer ) (struct objectcache_t * cache, struct memblock_t ** iobuffer)
Unlocks the locked io buffer and sets the pointer to NULL.
void unlockiobuffer_objectcacheimpl( objectcache_impl_t * objectcache, struct memblock_t ** iobuffer )
Casts first parameter into pointer to objectcache_it.
objectcache_it * genericcast_objectcacheit( void * cache, TYPENAME objectcache_t ) ;
Declares a function table for accessing an objectcache service.
void objectcache_it_DECLARE( TYPENAME declared_it, TYPENAME objectcache_t ) ;
Implements objectcache_it.genericcast_objectcacheit.
#define genericcast_objectcacheit( cache, objectcache_t ) ( __extension__ ({ static_assert( offsetof(objectcache_it, lock_iobuffer) == offsetof(typeof(*(cache)), lock_iobuffer) && offsetof(objectcache_it, unlock_iobuffer) == offsetof(typeof(*(cache)), unlock_iobuffer), "ensure same structure") ; if (0) { (cache)->lock_iobuffer((objectcache_t*)0, (struct memblock_t**)0) ; (cache)->unlock_iobuffer((objectcache_t*)0, (struct memblock_t**)0) ; } (objectcache_it*) (cache) ; }))
Implements objectcache_it.objectcache_it_DECLARE.
#define objectcache_it_DECLARE( declared_it, objectcache_t ) typedef struct declared_it declared_it ; struct declared_it { void (*lock_iobuffer) (objectcache_t * cache, /*out*/struct memblock_t ** iobuffer); void (*unlock_iobuffer) (objectcache_t * cache, struct memblock_t ** iobuffer) ; }
Holds pointers to all cached objects.
struct objectcache_impl_t