📄 ftcmanag.h
字号:
FT_Short ref_count; } FTC_CacheNode_Data; /* return a pointer to FTC_CacheNode_Data contained in a */ /* CacheNode's `data' field */#define FTC_CACHENODE_TO_DATA_P( n ) \ ( (FTC_CacheNode_Data*)&(n)->data )#define FTC_LIST_TO_CACHENODE( n ) ( (FTC_CacheNode)(n) ) /*************************************************************************/ /* */ /* <FuncType> */ /* FTC_CacheNode_SizeFunc */ /* */ /* <Description> */ /* A function used to compute the total size in bytes of a given */ /* cache node. It is used by the cache manager to compute the number */ /* of old nodes to flush when the cache is full. */ /* */ /* <Input> */ /* node :: A handle to the target cache node. */ /* */ /* cache_data :: A generic pointer passed to the destructor. */ /* */ /* <Return> */ /* The size of a given cache node in bytes. */ /* */ typedef FT_ULong (*FTC_CacheNode_SizeFunc)( FTC_CacheNode node, FT_Pointer cache_data ); /*************************************************************************/ /* */ /* <FuncType> */ /* FTC_CacheNode_DestroyFunc */ /* */ /* <Description> */ /* A function used to destroy a given cache node. It is called by */ /* the manager when the cache is full and old nodes need to be */ /* flushed out. */ /* */ /* <Input> */ /* node :: A handle to the target cache node. */ /* */ /* cache_data :: A generic pointer passed to the destructor. */ /* */ typedef void (*FTC_CacheNode_DestroyFunc)( FTC_CacheNode node, FT_Pointer cache_data ); /*************************************************************************/ /* */ /* <Struct> */ /* FTC_CacheNode_Class */ /* */ /* <Description> */ /* A very simple structure used to describe a cache node's class to */ /* the cache manager. */ /* */ /* <Fields> */ /* size_node :: A function used to size the node. */ /* */ /* destroy_node :: A function used to destroy the node. */ /* */ /* <Note> */ /* The cache node class doesn't include a `new_node' function because */ /* the cache manager never allocates cache node directly; it */ /* delegates this task to its cache objects. */ /* */ typedef struct FTC_CacheNode_Class_ { FTC_CacheNode_SizeFunc size_node; FTC_CacheNode_DestroyFunc destroy_node; } FTC_CacheNode_Class; /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** CACHE DEFINITIONS *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* <FuncType> */ /* FTC_Cache_InitFunc */ /* */ /* <Description> */ /* A function used to initialize a given cache object. */ /* */ /* <Input> */ /* cache :: A handle to the new cache. */ /* */ typedef FT_Error (*FTC_Cache_InitFunc)( FTC_Cache cache ); /*************************************************************************/ /* */ /* <FuncType> */ /* FTC_Cache_DoneFunc */ /* */ /* <Description> */ /* A function to finalize a given cache object. */ /* */ /* <Input> */ /* cache :: A handle to the target cache. */ /* */ typedef void (*FTC_Cache_DoneFunc)( FTC_Cache cache ); /*************************************************************************/ /* */ /* <Struct> */ /* FTC_Cache_Class */ /* */ /* <Description> */ /* A structure used to describe a given cache object class to the */ /* cache manager. */ /* */ /* <Fields> */ /* cache_byte_size :: The size of the cache object in bytes. */ /* */ /* init_cache :: The cache object initializer. */ /* */ /* done_cache :: The cache object finalizer. */ /* */ struct FTC_Cache_Class_ { FT_UInt cache_byte_size; FTC_Cache_InitFunc init_cache; FTC_Cache_DoneFunc done_cache; }; /*************************************************************************/ /* */ /* <Struct> */ /* FTC_CacheRec */ /* */ /* <Description> */ /* A structure used to describe an abstract cache object. */ /* */ /* <Fields> */ /* manager :: A handle to the parent cache manager. */ /* */ /* memory :: A handle to the memory manager. */ /* */ /* clazz :: A pointer to the cache class. */ /* */ /* node_clazz :: A pointer to the cache's node class. */ /* */ /* cache_index :: An index of the cache in the manager's table. */ /* */ /* cache_data :: Data passed to the cache node */ /* constructor/finalizer. */ /* */ typedef struct FTC_CacheRec_ { FTC_Manager manager; FT_Memory memory; FTC_Cache_Class* clazz; FTC_CacheNode_Class* node_clazz; FT_UInt cache_index; /* in manager's table */ FT_Pointer cache_data; /* passed to cache node methods */ } FTC_CacheRec; /* */FT_END_HEADER#endif /* __FTCMANAG_H__ *//* END */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -