#include <segdb.hh>
Public Types | |
| typedef unsigned long | seg_index |
| typedef unsigned long | gps_type |
| typedef unsigned long | chan_index |
| typedef std::vector< segment > | seg_vect |
| typedef std::vector< qbase > | base_vect |
Public Member Functions | |
| seg_db (seg_index nSeg, seg_index nChan) | |
| construct a segment database. | |
| ~seg_db (void) | |
| seg_db destructor | |
| bool | chan_valid (chan_index chan) const |
| Channel index test. | |
| void | clear (void) |
| std::ostream & | dump (std::ostream &out) const |
| Dump out the segment list. | |
| seg_index | end (void) const |
| Null index. | |
| seg_index | find (chan_index chan, gps_type start, gps_type stop) const |
| find a segment. | |
| seg_index | first_gt (chan_index chan, gps_type gps) const |
| find a segment. | |
| void | free (seg_index iseg) |
| Free a segment. | |
| seg_index | get_buffer (pool_mgr &pmgr, chan_index chan, double rate, int len, gps_type start, gps_type stop) |
| Find a segment to containing the data. | |
| seg_index | get_segment (pool_mgr &pmgr, int buf_class) |
| Find and unlink a free segment. | |
| seg_index | getOldest (int buf_class) |
| Find and unlink a free segment. | |
| void | insert (seg_index inx) |
| Insert a segment. | |
| bool | is_null (seg_index seg) const |
| Test for null pointer. | |
| seg_index | last_leq (chan_index ichn, gps_type gps) const |
| Find position in list for segment with gps t. | |
| void | make_new (seg_index inx) |
| Move segment to end of age queue. | |
| segment & | operator[] (seg_index seg) |
| Get a segment reference. | |
| const segment & | operator[] (seg_index seg) const |
| Get a segment reference. | |
| seg_index | reserve (chan_index chan, gps_type start) |
| Reserve a segment. | |
Classes | |
| class | linkage |
| Segment linkage class. More... | |
| class | qbase |
| Linked list anchor. More... | |
The segment database class contains a list of all memory-resident channel data segments. Each data-segment is represented by a segment object in the the pre-allocated vector. The segments objects are linked in two lists; a listof segments from each channel and a list of all segments in least recently used order. The linkage information for the two lists is maintained in separate vectors in the database.
| typedef unsigned long sends::seg_db::seg_index |
Data type to represent index into segment list.
| typedef unsigned long sends::seg_db::gps_type |
Data type for gps time.
| typedef unsigned long sends::seg_db::chan_index |
Data type for index into master channel list.
| typedef std::vector<segment> sends::seg_db::seg_vect |
Segment vector data type.
| typedef std::vector<qbase> sends::seg_db::base_vect |
Channel queue anchors.
| bool sends::seg_db::chan_valid | ( | chan_index | chan | ) | const [inline] |
Channel index test.
Test whether the channel index is valid
| chan | Channel index to test |
| void sends::seg_db::clear | ( | void | ) |
Clear the segments database by looping over all channel queues and releasing the associated segments.
| std::ostream& sends::seg_db::dump | ( | std::ostream & | out | ) | const |
Dump out the segment list.
Dump out the segments list.
| out | Output stream reference |
| seg_db::seg_index sends::seg_db::end | ( | void | ) | const [inline] |
| seg_index sends::seg_db::find | ( | chan_index | chan, | |
| gps_type | start, | |||
| gps_type | stop | |||
| ) | const |
find a segment.
Find the first segment containing the specified times for the specified channel. If no segments are found in the specified channel and times, the null index is returned.
| chan | Channel index | |
| start | Start time. | |
| stop | End time. |
| seg_index sends::seg_db::first_gt | ( | chan_index | chan, | |
| gps_type | gps | |||
| ) | const |
| void sends::seg_db::free | ( | seg_index | iseg | ) |
| seg_index sends::seg_db::get_buffer | ( | pool_mgr & | pmgr, | |
| chan_index | chan, | |||
| double | rate, | |||
| int | len, | |||
| gps_type | start, | |||
| gps_type | stop | |||
| ) |
Find a segment to containing the data.
Get a segment descriptor, that has, or will accomodate, the specified data. The reserve pointer is set to the stop time or the end of the buffer, as appropriate.
| pmgr | Buffer pool manager. | |
| chan | ID of channel for which the buffer with be allocated. | |
| rate | Channel sample rate. | |
| len | Channel data word length. | |
| start | Start time for which the buffer will be reserved. | |
| stop | End time for which the data will be reserved. |
Find and unlink a free segment.
Get a free segment descriptor. If an unused buffer is available, an unused segment is allocated and the buffer is attached. If no unused buffers or segments are found, the oldest appropriate unused segment is used. The descriptor is unlinked from both the age list and the channel list and it's index is returned.
| buf_class | Buffer class |
| seg_index sends::seg_db::getOldest | ( | int | buf_class | ) |
Find and unlink a free segment.
Get an unused segment descriptor with the specified buffer class, starting from the least recently used and working through the age list until an unused segment descriptor is found. The descriptor is unlinked from both the age list and the channel list and its index is returned.
| buf_class | Buffer class |
| void sends::seg_db::insert | ( | seg_index | inx | ) |
| bool sends::seg_db::is_null | ( | seg_index | seg | ) | const [inline] |
Test for null pointer.
Test if the specified index is the null pointer.
| seg | Index to be tested for null value. |
| seg_index sends::seg_db::last_leq | ( | chan_index | ichn, | |
| gps_type | gps | |||
| ) | const |
| void sends::seg_db::make_new | ( | seg_index | inx | ) |
| seg_index sends::seg_db::reserve | ( | chan_index | chan, | |
| gps_type | start | |||
| ) |
Reserve a segment.
Reserve the segment containing the specified time for the specified channel and return the segment index. If a matching segment is found, its use count is incremented and it is moved to the end of the age list. If no segments are found with the specified channel and time, the null index is returned.
| chan | Channel index | |
| start | Start time. |
1.5.5