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
 
intfNumEntries
 
time_t ** fTimeBuffer
 
double ** fDataBuffer
 
time_t fPrevTime
 

Detailed Description

Definition at line 3206 of file history_schema.cxx.

Constructor & Destructor Documentation

◆ ReadBuffer()

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

Definition at line 3222 of file history_schema.cxx.

3223 {
3224 fNumAdded = 0;
3225
3229
3230 fNumAlloc = 0;
3231 fNumEntries = NULL;
3232 fTimeBuffer = NULL;
3233 fDataBuffer = NULL;
3234
3235 fPrevTime = 0;
3236 }
DWORD last_time
Definition mana.cxx:3070
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:

◆ ~ReadBuffer()

SchemaHistoryBase::ReadBuffer::~ReadBuffer ( )
inline

Definition at line 3238 of file history_schema.cxx.

3239 {
3240 }

Member Function Documentation

◆ Add()

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

Implements MidasHistoryBufferInterface.

Definition at line 3263 of file history_schema.cxx.

3264 {
3265 if (t < fFirstTime)
3266 return;
3267 if (t > fLastTime)
3268 return;
3269
3270 fNumAdded++;
3271
3272 if ((fPrevTime==0) || (t >= fPrevTime + fInterval)) {
3273 int pos = *fNumEntries;
3274
3275 Realloc(pos + 1);
3276
3277 (*fTimeBuffer)[pos] = t;
3278 (*fDataBuffer)[pos] = v;
3279
3280 (*fNumEntries) = pos + 1;
3281
3282 fPrevTime = t;
3283 }
3284 }
Here is the call graph for this function:

◆ Finish()

void SchemaHistoryBase::ReadBuffer::Finish ( )
inline

Definition at line 3286 of file history_schema.cxx.

3287 {
3288
3289 }
Here is the caller graph for this function:

◆ Realloc()

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

Definition at line 3242 of file history_schema.cxx.

3243 {
3244 if (wantalloc < fNumAlloc - 10)
3245 return;
3246
3247 int newalloc = fNumAlloc*2;
3248
3249 if (newalloc <= 1000)
3250 newalloc = wantalloc + 1000;
3251
3252 //printf("wantalloc %d, fNumEntries %d, fNumAlloc %d, newalloc %d\n", wantalloc, *fNumEntries, fNumAlloc, newalloc);
3253
3255 assert(*fTimeBuffer);
3256
3257 *fDataBuffer = (double*)realloc(*fDataBuffer, sizeof(double)*newalloc);
3258 assert(*fDataBuffer);
3259
3261 }
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fDataBuffer

double** SchemaHistoryBase::ReadBuffer::fDataBuffer

Definition at line 3218 of file history_schema.cxx.

◆ fFirstTime

time_t SchemaHistoryBase::ReadBuffer::fFirstTime

Definition at line 3209 of file history_schema.cxx.

◆ fInterval

time_t SchemaHistoryBase::ReadBuffer::fInterval

Definition at line 3211 of file history_schema.cxx.

◆ fLastTime

time_t SchemaHistoryBase::ReadBuffer::fLastTime

Definition at line 3210 of file history_schema.cxx.

◆ fNumAdded

int SchemaHistoryBase::ReadBuffer::fNumAdded

Definition at line 3213 of file history_schema.cxx.

◆ fNumAlloc

int SchemaHistoryBase::ReadBuffer::fNumAlloc

Definition at line 3215 of file history_schema.cxx.

◆ fNumEntries

int* SchemaHistoryBase::ReadBuffer::fNumEntries

Definition at line 3216 of file history_schema.cxx.

◆ fPrevTime

time_t SchemaHistoryBase::ReadBuffer::fPrevTime

Definition at line 3220 of file history_schema.cxx.

◆ fTimeBuffer

time_t** SchemaHistoryBase::ReadBuffer::fTimeBuffer

Definition at line 3217 of file history_schema.cxx.


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