[libgfc Index] [libgfc Hierarchy] [Headers]
GTimeSeries manages a time series. More...
#include <src/gtseries.h>
A time series is simply a list of episodes of (TIMESTAMP, EVENT_DESC),
where the TIMESTAMP is the time an event of interest happened.
The event here is a rather broad concept, it can be virtualy
anything worthing recording. THe EVENT_DESC is a pointer (not the actual
entity) to a record of the associated event. One
use of the EVENT_DESC is to store an record ID of an externaly stored
event. But it is really an opaque data structure as far as time series
is concerned.
When the list of episodes are sorted (as they always are), the order
is that the older (earlier) the episode, the smaller the value.
The main methods for GTimeSeries includes: inserting/deleting,
iterating and generalizing the timestamps etc.
When iterating the series, first call firstEpisode() or lastEpisode(),
depending on which direction you want to scan the episodes, which
will return a pointer to the correct episode; then call that episode's
nextEpisode() or prevEpisode() correspondingly.
Note: the time series stores only the pointer to episodes! So if you
want to store two episodes, they must be physically different
objects (allocated using two new() opeations). If you just
allocate one episode, and try to add two episodes to the series
by assigning two different timestamp to the same episode object,
it won't work! The doubly-linked list will be messed up if you
add the same objects twice!
Also note that it uses the GTimestamp class extensively, but
GTimeSeries isn't an ADT per se., aka, it can't be stored in a
database.
[public]
set the unit time for the series
[public]
return the current time unit for the series
[public]
add an episode into the series (in sorted order)
[public]
delete an episode from the series (and put back to the pool)
[public]
For every 'delta' time unit between 'from' (included) and 'to', generate an episode and add the episode to the series. The newly added episodes will be in sorted order.
[public]
same as above, except it accepts GTimestamps
[public]
delete all the episodes and reset to the new time unit if different
[public]
return number of episodes in the series
[public]
return the first episodes in the series
[public]
return the last episode (most recent one)
[public]
generalize the series to a larger unit (eg, hours -> days)
[public]
return true if the series is empty
Documentation generated by lqian@lqian-sun on Wed Jul 14 09:36:10 EDT 1999 | Kdoc |