MIDAS
Loading...
Searching...
No Matches
SchemaHistoryBase::ReadBuffer Class Reference
Inheritance diagram for SchemaHistoryBase::ReadBuffer:
Collaboration diagram for SchemaHistoryBase::ReadBuffer:

Public Member Functions

 ReadBuffer (time_t first_time, time_t last_time, time_t interval)
 
 ~ReadBuffer ()
 
void Realloc (int wantalloc)
 
void Add (time_t t, double v)
 
void Finish ()
 
- Public Member Functions inherited from MidasHistoryBufferInterface
 MidasHistoryBufferInterface ()
 
virtual ~MidasHistoryBufferInterface ()
 

Public Attributes

time_t fFirstTime
 
time_t fLastTime
 
time_t fInterval
 
int fNumAdded
 
int fNumAlloc
 
int * fNumEntries
 
time_t ** fTimeBuffer
 
double ** fDataBuffer
 
time_t fPrevTime
 

Detailed Description

Definition at line 3229 of file history_schema.cxx.

Constructor & Destructor Documentation

◆ ReadBuffer()

SchemaHistoryBase::ReadBuffer::ReadBuffer ( time_t  first_time,
time_t  last_time,
time_t  interval 
)
inline

◆ ~ReadBuffer()

SchemaHistoryBase::ReadBuffer::~ReadBuffer ( )
inline

Definition at line 3261 of file history_schema.cxx.

3262 {
3263 }

Member Function Documentation

◆ Add()

void SchemaHistoryBase::ReadBuffer::Add ( time_t  t,
double  v 
)
inlinevirtual

Implements MidasHistoryBufferInterface.

Definition at line 3286 of file history_schema.cxx.

3287 {
3288 if (t < fFirstTime)
3289 return;
3290 if (t > fLastTime)
3291 return;
3292
3293 fNumAdded++;
3294
3295 if ((fPrevTime==0) || (t >= fPrevTime + fInterval)) {
3296 int pos = *fNumEntries;
3297
3298 Realloc(pos + 1);
3299
3300 (*fTimeBuffer)[pos] = t;
3301 (*fDataBuffer)[pos] = v;
3302
3303 (*fNumEntries) = pos + 1;
3304
3305 fPrevTime = t;
3306 }
3307 }
Here is the call graph for this function:

◆ Finish()

void SchemaHistoryBase::ReadBuffer::Finish ( )
inline

Definition at line 3309 of file history_schema.cxx.

3310 {
3311
3312 }
Here is the caller graph for this function:

◆ Realloc()

void SchemaHistoryBase::ReadBuffer::Realloc ( int  wantalloc)
inline

Definition at line 3265 of file history_schema.cxx.

3266 {
3267 if (wantalloc < fNumAlloc - 10)
3268 return;
3269
3270 int newalloc = fNumAlloc*2;
3271
3272 if (newalloc <= 1000)
3273 newalloc = wantalloc + 1000;
3274
3275 //printf("wantalloc %d, fNumEntries %d, fNumAlloc %d, newalloc %d\n", wantalloc, *fNumEntries, fNumAlloc, newalloc);
3276
3277 *fTimeBuffer = (time_t*)realloc(*fTimeBuffer, sizeof(time_t)*newalloc);
3278 assert(*fTimeBuffer);
3279
3280 *fDataBuffer = (double*)realloc(*fDataBuffer, sizeof(double)*newalloc);
3281 assert(*fDataBuffer);
3282
3283 fNumAlloc = newalloc;
3284 }
Here is the caller graph for this function:

Member Data Documentation

◆ fDataBuffer

double** SchemaHistoryBase::ReadBuffer::fDataBuffer

Definition at line 3241 of file history_schema.cxx.

◆ fFirstTime

time_t SchemaHistoryBase::ReadBuffer::fFirstTime

Definition at line 3232 of file history_schema.cxx.

◆ fInterval

time_t SchemaHistoryBase::ReadBuffer::fInterval

Definition at line 3234 of file history_schema.cxx.

◆ fLastTime

time_t SchemaHistoryBase::ReadBuffer::fLastTime

Definition at line 3233 of file history_schema.cxx.

◆ fNumAdded

int SchemaHistoryBase::ReadBuffer::fNumAdded

Definition at line 3236 of file history_schema.cxx.

◆ fNumAlloc

int SchemaHistoryBase::ReadBuffer::fNumAlloc

Definition at line 3238 of file history_schema.cxx.

◆ fNumEntries

int* SchemaHistoryBase::ReadBuffer::fNumEntries

Definition at line 3239 of file history_schema.cxx.

◆ fPrevTime

time_t SchemaHistoryBase::ReadBuffer::fPrevTime

Definition at line 3243 of file history_schema.cxx.

◆ fTimeBuffer

time_t** SchemaHistoryBase::ReadBuffer::fTimeBuffer

Definition at line 3240 of file history_schema.cxx.


The documentation for this class was generated from the following file: