#ifndef _ROSE_COMPRESSION_NOP_H__ #define _ROSE_COMPRESSION_NOP_H__ #undef try #undef catch #undef end #include /** @file A 'no-op' compression implementation This file implements a COMPRESSOR plugin that stores data in uncompressed form. */ #include #include "pstar.h" namespace rose { template class Nop { public: typedef TYPE TYP; static const int PLUGIN_ID = 2; inline void offset(TYPE o) {} inline size_t max_overrun() { return sizeof(TYPE); } inline slot_index_t append(int xid, const TYPE dat, byte_off_t * except, byte * exceptions, int *free_bytes) { slot_index_t ret = *numentries_ptr(); ((TYPE*)(numentries_ptr()+1))[ret] = dat; (*free_bytes) -= sizeof(TYPE); (*numentries_ptr())++; return ret; } inline TYPE *recordRead(int xid, slot_index_t slot, byte *exceptions, TYPE *buf) { if(slot < *numentries_ptr()) { *buf = ((TYPE*)(numentries_ptr()+1))[slot]; return buf; } else { return 0; } } inline std::pair* recordFind(int xid, slot_index_t start, slot_index_t stop, byte *exceptions, TYPE value, std::pair& scratch) { slot_index_t i; std::pair*ret = 0; TYPE *rec = 0; for(i = start; i< stop; i++) { TYPE t; rec = recordRead(xid,i,0,&t); if(*rec == value) { scratch.first = i; scratch.second = stop; ret = &scratch; i++; break; } } for(;i(mem_); } void * mem_; }; } #endif