15 #define CACHE_LOOKUP_TABLE_SIZE 128
16 #define CACHE_DEFAULT_BUFFER_SIZE 32768
17 #define CACHE_CHANNEL_EXTEND_SIZE 10
18 #define CACHE_MAX_ITEM_SIZE 0x3FFF0
21 #define CACHE_ITEM_GAPB(item) (unsigned int)(((size_t)item+sizeof(CacheItem))&(sizeof(void*)-1))
23 #define CACHE_ITEM_DATA_POINTER(item) (void*)((unsigned char*)item+sizeof(CacheItem)+CACHE_ITEM_GAPB(item))
25 #define CACHE_ITEM_SIZEW(item,length) (unsigned int)((sizeof(CacheItem)+CACHE_ITEM_GAPB(item)+(((length)+3)&~0x3))>>2)
27 #define CACHE_NEXT_ITEM(item) ((item)+(item)->m_sizeW)
28 #define CACHE_BLOCK_ITEM_ADDR(chan,buf,block) (&(buf)->m_firstItem+(((unsigned int)(block)<<chan->m_positionToBlockShiftW)+(buf)->lookup[block].m_offsetW))
29 #define CACHE_ITEM_ADDR(buf,pos) (&(buf)->m_firstItem+(pos))
30 #define CACHE_ITEM_POSITIONW(buf,item) (unsigned int)(item-&buf->m_firstItem)
92 typedef std::map<const void *, struct CacheEntry*> CacheMap;
94 const CacheItem *getCurrentCacheItemInternal(
const void *device,
int channel,
CacheTS timestamp);
103 int addChannel(
const void *device,
const char *name,
unsigned int maxItemSize);
205 #define CACHE_HEADER \
206 struct CacheBuffer *m_next; \
207 unsigned int m_firstTimestamp; \
208 unsigned int m_lastTimestamp; \
210 unsigned int m_lastItemPositionW; \
211 unsigned int m_firstFreePositionW;\
212 struct CacheBlock lookup[CACHE_LOOKUP_TABLE_SIZE]
217 #define CACHE_BUFFER_HEADER_SIZE (sizeof(struct CacheBufferHeader))
const void * getCurrentCacheItem(const void *device, int channel, CacheTS timestamp)
void clearCacheFrom(const void *device, CacheTS timestamp)
int deleteChannel(const void *device, int channel)
int addChannel(const void *device, const char *name, unsigned int maxItemSize)
int deleteDevice(const void *device)
void * addCacheItem(const void *device, int channel, CacheTS timestamp, void *data, unsigned int length)
double * addCacheVectorIfDifferent(const void *device, int channel, CacheTS timestamp, double *data, unsigned int length, double threshold)
const void * getPreviousCacheItem(const void *device, int channel, CacheTS *timestamp)
ccl_global float * buffer
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
T length(const vec_base< T, Size > &a)
void setCacheTimestamp(Timestamp ×tamp)
unsigned short m_timeOffset
struct CacheItem m_firstItem
CacheItem * _findBlock(CacheBuffer *buffer, unsigned short timeOffset, unsigned int *highBlock)
struct CacheBuffer * m_firstBuffer
unsigned int m_maxItemSizeB
unsigned int m_blockSizeW
struct CacheBuffer * m_lastBuffer
CacheBuffer * allocBuffer()
unsigned char m_positionToBlockShiftW
unsigned int m_lastItemPositionW
unsigned int m_bufferSizeW
CacheItem * findItemEarlier(unsigned int timestamp, CacheBuffer **rBuffer)
unsigned short m_positionToOffsetMaskW
CacheItem * findItemOrLater(unsigned int timestamp, CacheBuffer **rBuffer)
unsigned int m_lastTimestamp
CacheChannel * m_channelArray
unsigned short m_timeOffset