Listing 3: An example program using ADEPT compression and decompression
void test()
{
ifstream nIntFile("IntegerSignal.txt");
int iValue;
vector<int> tiSignal;
// load the test signal
while(nIntFile >> iValue)
{
tiSignal.push_back(iValue);
}
for (vector<int>::iterator tiIt = tiSignal.begin();
tiIt != tiSignal.end();
tiIt++)
{
encoder_storeADEPT(*tiIt);
}
encoder_flush();
WORD wCoded;
vector<int> tiReconstruction;
TDecoder tChn0Decoder(tiReconstruction);
// decode what is read from Flash and store it in tiReconstruction
while(flash_read(wCoded))
{
tChn0Decoder.Decode(wCoded);
}
assert(tiReconstruction == tiSignal);
}