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 3131 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 3147 of file history_schema.cxx.

3148 {
3149 fNumAdded = 0;
3150
3154
3155 fNumAlloc = 0;
3156 fNumEntries = NULL;
3157 fTimeBuffer = NULL;
3158 fDataBuffer = NULL;
3159
3160 fPrevTime = 0;
3161 }
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 3163 of file history_schema.cxx.

3164 {
3165 }

Member Function Documentation

◆ Add()

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

Implements MidasHistoryBufferInterface.

Definition at line 3188 of file history_schema.cxx.

3189 {
3190 if (t < fFirstTime)
3191 return;
3192 if (t > fLastTime)
3193 return;
3194
3195 fNumAdded++;
3196
3197 if ((fPrevTime==0) || (t >= fPrevTime + fInterval)) {
3198 int pos = *fNumEntries;
3199
3200 Realloc(pos + 1);
3201
3202 (*fTimeBuffer)[pos] = t;
3203 (*fDataBuffer)[pos] = v;
3204
3205 (*fNumEntries) = pos + 1;
3206
3207 fPrevTime = t;
3208 }
3209 }
Here is the call graph for this function:

◆ Finish()

void SchemaHistoryBase::ReadBuffer::Finish ( )
inline

Definition at line 3211 of file history_schema.cxx.

3212 {
3213
3214 }
Here is the caller graph for this function:

◆ Realloc()

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

Definition at line 3167 of file history_schema.cxx.

3168 {
3169 if (wantalloc < fNumAlloc - 10)
3170 return;
3171
3172 int newalloc = fNumAlloc*2;
3173
3174 if (newalloc <= 1000)
3175 newalloc = wantalloc + 1000;
3176
3177 //printf("wantalloc %d, fNumEntries %d, fNumAlloc %d, newalloc %d\n", wantalloc, *fNumEntries, fNumAlloc, newalloc);
3178
3180 assert(*fTimeBuffer);
3181
3182 *fDataBuffer = (double*)realloc(*fDataBuffer, sizeof(double)*newalloc);
3183 assert(*fDataBuffer);
3184
3186 }
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 3143 of file history_schema.cxx.

◆ fFirstTime

time_t SchemaHistoryBase::ReadBuffer::fFirstTime

Definition at line 3134 of file history_schema.cxx.

◆ fInterval

time_t SchemaHistoryBase::ReadBuffer::fInterval

Definition at line 3136 of file history_schema.cxx.

◆ fLastTime

time_t SchemaHistoryBase::ReadBuffer::fLastTime

Definition at line 3135 of file history_schema.cxx.

◆ fNumAdded

int SchemaHistoryBase::ReadBuffer::fNumAdded

Definition at line 3138 of file history_schema.cxx.

◆ fNumAlloc

int SchemaHistoryBase::ReadBuffer::fNumAlloc

Definition at line 3140 of file history_schema.cxx.

◆ fNumEntries

int* SchemaHistoryBase::ReadBuffer::fNumEntries

Definition at line 3141 of file history_schema.cxx.

◆ fPrevTime

time_t SchemaHistoryBase::ReadBuffer::fPrevTime

Definition at line 3145 of file history_schema.cxx.

◆ fTimeBuffer

time_t** SchemaHistoryBase::ReadBuffer::fTimeBuffer

Definition at line 3142 of file history_schema.cxx.


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