00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
#ifndef _VRTESTCOUNTSINK_H_
00019
#define _VRTESTCOUNTSINK_H_
00020
00021
#include <VrSink.h>
00022
#include <pthread.h>
00023
00024
template<
class iType>
00025 class VrTestCountSink :
public VrSink<iType> {
00026 iType counter;
00027
public:
00028 virtual const char *
name() {
return "VrTestCountSink"; }
00029
virtual void work(timestamp ts,
unsigned int size,
iType *i[]);
00030
virtual void initialize();
00031 };
00032
00033
template<
class iType>
void
00034 VrTestCountSink<iType>::initialize()
00035 {
00036
counter=0;
00037 }
00038
00039
template<
class iType>
void
00040 VrTestCountSink<iType>::work(timestamp ts,
unsigned int size,
iType *i[])
00041 {
00042
00043
sync(ts);
00044
00045
int size_save = size;
00046 timestamp ts_save=ts;
00047
00048
while(size-- > 0) {
00049
00050
int n=ts;
00051
for(
int ii=0; ii<5;ii++)
00052 n += n % 13;
00053
00054
if(*i[0] !=
counter) {
00055 fprintf(stderr,
"Value at ts=%lld is %d instead of %d\n",
00056 ts, (
int) *i[0], (
int) ts);
00057 }
00058 i[0]++;
counter++;
00059 }
00060
00061
00062
00063
00064 }
00065
00066
#endif
00067
00068
00069
00070
00071