Inheritance diagram for code::XMLIndex:
See the documentation for the method constructRecord for the XML format. The XML file itself has this format:
<codeindex> ... ... </codeindex>with each of the item tags corresponding to an Index::Record.
Public Types | |
typedef std::vector< std::string > | selections_t |
typedef std::vector< Index::Record > | VolumeRecords |
NextTime | |
Step toward the next available time. | |
PreviousTime | |
Step toward the previously available time. | |
NextSubType | |
Step up to the next subtype. | |
PreviousSubType | |
Step up to the previous subtype. | |
enum | Direction { NextTime, PreviousTime, NextSubType, PreviousSubType } |
The directions in which you can navigate starting from a valid Index::Record. More... | |
Public Member Functions | |
XMLIndex (const URL &xmlFile, const IndexBase &baseClass=IndexBase()) | |
Parse the given XML file for the information. | |
virtual | ~XMLIndex () |
bool | isValid () const |
virtual Record | getRecord (const selections_t &sel) const |
virtual Record | getRecord (const selections_t &selection) const =0 |
Get the record matching the selection criteria. | |
virtual size_t | getRecords (std::vector< Record > *records) const |
size_t | getRecords (const selections_t &selection, std::vector< Record > *records, std::vector< std::string > *next_selection=0) const |
Obtain all the records that match the selections passed in. | |
virtual size_t | getRecords (std::vector< Record > *records) const |
Convenience method to get all records. | |
virtual std::string | doFormKey (const selections_t &sel, size_t sel_index_begin, size_t sel_index_end) const |
virtual bool | hasProduct (const std::string &productDataType) const |
Returns true if the index has ever encountered this product. | |
virtual Record | doGetMostCurrentRecord () const |
virtual Record | doGetMostCurrentRecord (const code::Time &atTime, const selections_t &sel) const |
virtual void | doGetMostCurrentRecords (const code::Time &atTime, const std::set< selections_t > &criteria, std::map< selections_t, Record > &setme) const |
virtual size_t | getNextSelection (const selections_t &sel, selections_t *setme_next) const |
virtual size_t | getNextSelection (const selections_t &selection, selections_t *next_selection) const =0 |
Get a list of posssibilities for the next selection. | |
virtual Record | getNextRecord (const Record &fromRecord, const Direction &dir) const |
virtual Record | getNextRecord (const Record &fromRecord, const Direction &dir) const =0 |
Navigate starting at a particular record. | |
virtual TimeInterval | getHistoricalRange () const |
Returns the current historical range of this index. | |
virtual void | getProductNames (std::vector< std::string > *inhere) const |
Returns the top-level product names encountered by this index. | |
virtual void | getProductCategories (const std::string &productName, std::set< std::string > &setmeCategories) const |
Get the categories present for this top-level product name. | |
const std::string & | getName () const |
Returns the source name if it has been set using setName(). | |
void | setName (const std::string &name) |
Set the name of this index. | |
std::string | formKey (const selections_t &sel, size_t offset1=0, size_t offset2=~0) const |
Forms the key to which the given selection criteria would be mapped. | |
virtual size_t | getHistoricalRecords (const Time &startTime, const Time &endTime, const selections_t &selection, std::vector< Record > *records) const |
Returns all the records which match the selection criteria (other than time) passed in. | |
size_t | getHistoricalRecords (const Time &startTime, const Time &endTime, const Index::Record &matchThis, std::vector< Record > *records) const |
Returns all the records which match the selection criteria of the record to match that is passed in. | |
virtual size_t | getHistoricalRecords (const Time &startTime, const Time &endTime, const std::vector< Index::Record > &matchThis, std::vector< Record > *records) const |
Returns all the records which match the selection criteria of any of the records to match that are passed in. | |
size_t | getHistoricalRecordsByDataType (const Time &startTime, const Time &endTime, const code::Index::Record &rec, std::vector< Record > *records) const |
The usual variation of getHistoricalRecords will match subtype also. | |
Record | getMostCurrentRecord () const |
Return the Index's most current record. | |
Record | getMostCurrentRecord (const Record &sel) const |
Return the Index's most current record matching the `sel' record's selection criteria. | |
Record | getMostCurrentRecord (const selections_t &s) const |
Return the Index's most current record matching the selection criteria. | |
Record | getMostCurrentRecord (const code::Time &atTime, const selections_t &sel) const |
Return the most current record (before atTime) matching the criteria. | |
void | getMostCurrentRecords (const code::Time &atTime, const std::set< selections_t > &criteria, std::map< selections_t, Record > &setme) const |
A batch form of getMostCurrentRecord(). | |
const TimeInterval & | getMaximumHistory () const |
returns the maximum history maintained by this index. | |
bool | fetchVirtualVolume (const code::Index::Record &in, VolumeRecords &out, Time *newVolumeStartTime=0) const |
Fetch the (latest) virtual volume of records. | |
bool | fetchTraditionalVolume (const code::Index::Record &in, VolumeRecords &out) const |
Fetch a volume of records that contains this record. | |
void | setMaximumHistory (const TimeInterval &newTI) |
Changes the maximum history maintained by this index. | |
bool | hasHistoryLongerThan (const TimeInterval &newTI) const |
Does this index have a history longer than the time interval passed in? A time interval less than or equal to zero indicates that the index doesn't do any pruning and is therefore treated as being infinite. | |
const URL & | getURL () const |
This will be set by IndexFactory if the Index is created using IndexFactory::createIndex. | |
void | setURL (const URL &u) |
Pass in complete URL, i.e. | |
void | copyListenersFrom (const ActionSource &other) |
copy all the listeners from the other source (replacing our own) | |
size_t | getNumListeners () const |
returns the number of listeners linked to this source. | |
std::string | getDir () |
Returns a source-specific disk directory. | |
void | addActionListener (SmartPtr< ActionListener > lstnr) |
Subscribe lstnr such that it receives all events from this ActionSource. | |
void | addActionListener (const std::string &event_type, SmartPtr< ActionListener > lstnr) |
Subscribe lstnr such that it receives only this event type from this ActionSource. | |
void | removeActionListener (SmartPtr< ActionListener > lstner) |
Unsubscribe lstnr such that it no longer receives events from this ActionSource. | |
void | removeActionListener (const std::string &eventType, SmartPtr< ActionListener > lstner) |
Unsubscribe the listener so that it does not respond to the the event type noted. | |
void | fireActionPerformed (const ActionEvent &e) |
Convenience function for subclasses to notify ActionListeners of events. | |
void | fireActionPerformed (const ActionEvent *e) |
Convenience function for subclasses to notify ActionListeners of events. | |
void | fireActionPerformed (const std::string &type) |
Convenience function for subclasses to notify ActionListeners of events. | |
Static Public Member Functions | |
static Index::Record | constructRecord (const std::string &xmlItem, const std::string &indexPath) |
Parses the given string (formatted as XML text corresponding to an item description -- enclosed within tags) and makes an Index::Record out of it. | |
static std::string | constructXMLString (const Index::Record &rec, const std::string &indexPath) |
Creates XML text corresponding to an item description -- enclosed within tags from the information provided in the Index::Record. | |
static Index::Record | extractRecord (const XML::Element &itemNode, const std::string &indexPath) |
Creates an Index::Record from an XML::Element of an item. | |
static void | extractRecords (const XML::Element &itemNode, const std::string &indexPath, std::vector< Index::Record > &rec) |
extracts records from an XML element; can handle both item and itemlist tags. | |
static bool | extractRecords (const std::string &xmlContent, const std::string &indexPath, std::vector< Index::Record > &rec) |
extracts records from an XML element; can handle both item and itemlist tags. | |
static std::string | getXMLChangeParam (const std::vector< std::string > &curr, const std::vector< std::string > &prev, const std::string &indexPath) |
Creates XML text for the param tag given the set of parameters. | |
static std::string | getIndexPath (const URL &file) |
Returns a URL fragment that specifies a file's location. | |
static bool | isBracketedBy (const code::Index::Record &test, const code::Index::Record &first, const code::Index::Record &second) |
is the test record in between the other two records based on subtype? first > second | |
static bool | isKnownDataSource (const std::string &dataSource) |
Checks the list of data sources and the list of Builders available. | |
static void | addKnownDataSource (const std::string &dataSource) |
Add a data source to be "known". | |
Protected Member Functions | |
virtual std::string | doFormKey (const selections_t &sel, size_t sel_index_begin, size_t sel_index_end) const =0 |
Subclasses must implement this to build a key string from. | |
virtual Record | doGetMostCurrentRecord (const Time &atTime, const selections_t &sel) const =0 |
virtual void | doGetMostCurrentRecords (const Time &atTime, const std::set< selections_t > &criteria, std::map< selections_t, Index::Record > &setme) const =0 |
virtual void | doAddRecord (const Record &item) |
virtual void | doAddRecord (const Index::Record &item) |
called by addRecord on a valid record before it is broadcast to listeners. | |
virtual size_t | doGetHistoricalRecords (const Time &startTime, const Time &endTime, const std::set< std::string > &searchKeys, std::vector< Record > *records) const |
virtual size_t | doGetHistoricalRecords (const Time &startTime, const Time &endTime, const std::set< std::string > &searchKeys, std::vector< Record > *setme) const =0 |
A work-horse called by all the getHistoricalRecords() methods. | |
virtual void | doAgeOff (const Time &cutoff) |
The InMemoryIndex normally maintains information about all the records seen. | |
size_t | getHistoricalRecords (const Time &startTime, const Time &endTime, const std::string &searchKey, std::vector< Record > *records) const |
A work-horse called by many of the getHistoricalRecords() methods. | |
size_t | getHistoricalRecords (const Time &startTime, const Time &endTime, const std::set< std::string > &searchKeys, std::vector< Record > *records) const |
A work-horse called by all the getHistoricalRecords() methods. | |
void | addRecord (const Index::Record &item) |
Given the record, adds it to all the internal maps. | |
void | doEndDatasetNotification () |
Notify interested parties that this data set is complete and that no new Records will come from this data set. | |
void | setAsSourceOf (Index::Record &rec) const |
sets the source index of the passed in record to be ourself. | |
void | sleepRequiredTime (const Time &newRecordTime) const |
Sleep as many seconds as required. | |
void | doNotifications (const Index::Record &item) |
Look at this record and do the notifications. | |
virtual void | notifyNewRecordEvent (const Index::Record &item) |
Look at this record and do the notification. | |
virtual void | notifyNewTimeStampEvent (const Index::Record &item) |
Look at this record and do the notification. | |
void | ageOff (const TimeInterval &cutoff) |
Prune off records older than cutoff (as measured from the most current record in the index). | |
void | ageOff (const Time &cutoff) |
the Index normally maintains information about all the records seen. | |
Protected Attributes | |
double | simulationRatio |
TimeInterval | ageoffInterval |
URL | url |
Static Protected Attributes | |
static const std::string | selectionSeparator |
The separation string. | |
Friends | |
class | Index::Record |
typedef std::vector<std::string> code::Index::selections_t [inherited] |
typedef std::vector< Index::Record > code::Index::VolumeRecords [inherited] |
enum code::Index::Direction [inherited] |
The directions in which you can navigate starting from a valid Index::Record.
Parse the given XML file for the information.
This will ensure that all the records are added. Hence, this index will become searchable.
xmlFile | the file to parse | |
baseClass | (optional) -- use for simulations, etc. |
virtual code::XMLIndex::~XMLIndex | ( | ) | [virtual] |
void code::ActionSource::addActionListener | ( | const std::string & | event_type, | |
SmartPtr< ActionListener > | lstnr | |||
) | [inline, inherited] |
Subscribe lstnr such that it receives only this event type from this ActionSource.
evt_type | the event type we are subscribing to | |
lstnr | the action listener to be subscribed. |
void code::ActionSource::addActionListener | ( | SmartPtr< ActionListener > | lstnr | ) | [inline, inherited] |
Subscribe lstnr such that it receives all events from this ActionSource.
l | the action listener to be subscribed. |
static void code::Index::addKnownDataSource | ( | const std::string & | dataSource | ) | [static, inherited] |
Add a data source to be "known".
Then, these records will be shown in the Index.
void code::Index::addRecord | ( | const Index::Record & | item | ) | [protected, inherited] |
Given the record, adds it to all the internal maps.
It is the responsibility of the subclass to somehow construct the record and to call this method.
void code::Index::ageOff | ( | const Time & | cutoff | ) | [protected, inherited] |
the Index normally maintains information about all the records seen.
It is possible to prune off records older than cutoff.
ageOff( Time::getCurrentTime() - TimeInterval::Hours(1.0) )will prune the index to keep records that are less than 1 hr old.
void code::Index::ageOff | ( | const TimeInterval & | cutoff | ) | [protected, inherited] |
Prune off records older than cutoff (as measured from the most current record in the index).
ageOff( TimeInterval::Hours(1.0) )will prune the index to keep records within 1 hr of the most current record in the index. All other records will be aged off.
negative (and zero) cutoff intervals are ignored.
static Index::Record code::XMLIndex::constructRecord | ( | const std::string & | xmlItem, | |
const std::string & | indexPath | |||
) | [static] |
Parses the given string (formatted as XML text corresponding to an item description -- enclosed within tags) and makes an Index::Record out of it.
Here is the format of the XML string for a Index::Record that corresponds to a single object:
<time fractional="0.000000"> 799875952 </time> <params> hires GzippedFile /home/wdssii/data/demo/KFWS/ VIL KFWS 50 0 </params> <selections> 1995:05:07-19:45:52--50 VIL </selections>and here is the format of a record that is a montage, i.e. is constructed from several parameters.
<time fractional="0.000000"> 799875952 </time> <params> hires GzippedFile /home/wdssii/data/demo/KFWS/ Reflectivity KFWS 50 2 </params> <params changes="6"> 1 </params> <params changes="5 6"> 49 9 </params> <selections> 1995:05:07-19:45:52--50 ReflectivityVolume 1.5 </selections>The params changes tag denotes the index of the parameter changed (starting at zero) and the value within the tag is the new value. Unchanged values are copied from the previous params tag.
While the use of space-separated strings deviates from "pure" XML parsing, the amount of space saved is worth it in a real-time system.
A special param "{indexlocation}" will be replaced by the relative path given.
static std::string code::XMLIndex::constructXMLString | ( | const Index::Record & | rec, | |
const std::string & | indexPath | |||
) | [static] |
Creates XML text corresponding to an item description -- enclosed within tags from the information provided in the Index::Record.
The indexPath will be used to construct a relative path if possible. This is a string match, so be careful about such factors as the presence/absence of hostname, a trailing slash etc.
Using this function is prefered to using the << operator in Index::Record because:
void code::ActionSource::copyListenersFrom | ( | const ActionSource & | other | ) | [inline, inherited] |
copy all the listeners from the other source (replacing our own)
virtual void code::Index::doAddRecord | ( | const Index::Record & | item | ) | [inline, protected, virtual, inherited] |
called by addRecord on a valid record before it is broadcast to listeners.
Reimplemented in code::SQLIndex.
virtual void code::InMemoryIndex::doAddRecord | ( | const Record & | item | ) | [protected, virtual, inherited] |
virtual void code::InMemoryIndex::doAgeOff | ( | const Time & | cutoff | ) | [protected, virtual, inherited] |
The InMemoryIndex normally maintains information about all the records seen.
It is possible to prune off records older than cutoff.
ageOff( Time::getCurrentTime() - TimeInterval::Hours(1.0) )will prune the index to keep records that are less than 1 hr old.
Implements code::Index.
void code::Index::doEndDatasetNotification | ( | ) | [protected, inherited] |
Notify interested parties that this data set is complete and that no new Records will come from this data set.
This method is optional -- after all, in a real-time index, there is no endDataSet is there? -- so you don't need to call it.
virtual std::string code::Index::doFormKey | ( | const selections_t & | sel, | |
size_t | sel_index_begin, | |||
size_t | sel_index_end | |||
) | const [protected, pure virtual, inherited] |
Subclasses must implement this to build a key string from.
sel | selections to use when building the key | |
begin | the first index of sel to used. in [0...end] | |
end | the first index, after `begin', to not use. in [begin...sel.size()] |
Implemented in code::SQLIndex.
virtual std::string code::InMemoryIndex::doFormKey | ( | const selections_t & | sel, | |
size_t | sel_index_begin, | |||
size_t | sel_index_end | |||
) | const [virtual, inherited] |
virtual size_t code::Index::doGetHistoricalRecords | ( | const Time & | startTime, | |
const Time & | endTime, | |||
const std::set< std::string > & | searchKeys, | |||
std::vector< Record > * | setme | |||
) | const [protected, pure virtual, inherited] |
A work-horse called by all the getHistoricalRecords() methods.
Has same behavior, except that it uses an implementation-specific search key obtained from the public interface elements.
virtual size_t code::InMemoryIndex::doGetHistoricalRecords | ( | const Time & | startTime, | |
const Time & | endTime, | |||
const std::set< std::string > & | searchKeys, | |||
std::vector< Record > * | records | |||
) | const [protected, virtual, inherited] |
virtual Record code::Index::doGetMostCurrentRecord | ( | const Time & | atTime, | |
const selections_t & | sel | |||
) | const [protected, pure virtual, inherited] |
Implemented in code::SQLIndex.
virtual Record code::InMemoryIndex::doGetMostCurrentRecord | ( | const code::Time & | atTime, | |
const selections_t & | sel | |||
) | const [virtual, inherited] |
virtual Record code::InMemoryIndex::doGetMostCurrentRecord | ( | ) | const [virtual, inherited] |
Implements code::Index.
virtual void code::Index::doGetMostCurrentRecords | ( | const Time & | atTime, | |
const std::set< selections_t > & | criteria, | |||
std::map< selections_t, Index::Record > & | setme | |||
) | const [protected, pure virtual, inherited] |
virtual void code::InMemoryIndex::doGetMostCurrentRecords | ( | const code::Time & | atTime, | |
const std::set< selections_t > & | criteria, | |||
std::map< selections_t, Record > & | setme | |||
) | const [virtual, inherited] |
void code::Index::doNotifications | ( | const Index::Record & | item | ) | [protected, inherited] |
Look at this record and do the notifications.
If your data source is different, and so the "normal" assumptions don't hold, then one or more of the notifyXXXEvent methods needs to be over-ridden.
static Index::Record code::XMLIndex::extractRecord | ( | const XML::Element & | itemNode, | |
const std::string & | indexPath | |||
) | [static] |
Creates an Index::Record from an XML::Element of an item.
The index path will be added to relative file locations so that the rest of the software always contains full and absolute paths.
static bool code::XMLIndex::extractRecords | ( | const std::string & | xmlContent, | |
const std::string & | indexPath, | |||
std::vector< Index::Record > & | rec | |||
) | [static] |
extracts records from an XML element; can handle both item and itemlist tags.
Returns false on parse error or empty element.
static void code::XMLIndex::extractRecords | ( | const XML::Element & | itemNode, | |
const std::string & | indexPath, | |||
std::vector< Index::Record > & | rec | |||
) | [static] |
extracts records from an XML element; can handle both item and itemlist tags.
bool code::Index::fetchTraditionalVolume | ( | const code::Index::Record & | in, | |
VolumeRecords & | out | |||
) | const [inherited] |
Fetch a volume of records that contains this record.
bool code::Index::fetchVirtualVolume | ( | const code::Index::Record & | in, | |
VolumeRecords & | out, | |||
Time * | newVolumeStartTime = 0 | |||
) | const [inherited] |
Fetch the (latest) virtual volume of records.
Note that this volume won't contain the in-record if the in-record is not the latest of its type. The time of the new volume is also returned, if non-zero is passed in. Records before this cutoff time belong to an already complete volume. Records >= cutoff belong to the newly forming volume.
void code::ActionSource::fireActionPerformed | ( | const std::string & | type | ) | [inline, inherited] |
Convenience function for subclasses to notify ActionListeners of events.
type | the type of the ActionEvent to be passed along to the action listeners. |
void code::ActionSource::fireActionPerformed | ( | const ActionEvent * | e | ) | [inline, inherited] |
Convenience function for subclasses to notify ActionListeners of events.
actionEvent | the event to be passed along to the action listeners. |
void code::ActionSource::fireActionPerformed | ( | const ActionEvent & | e | ) | [inline, inherited] |
Convenience function for subclasses to notify ActionListeners of events.
actionEvent | the event to be passed along to the action listeners. |
std::string code::Index::formKey | ( | const selections_t & | sel, | |
size_t | offset1 = 0 , |
|||
size_t | offset2 = ~0 | |||
) | const [inherited] |
Forms the key to which the given selection criteria would be mapped.
Uses only the criteria in the range [offset1,offset2) (the second not inclusive).
selection | the selection criteria | |
offset | [optional] which criteria to use. By default, start at zero (use all). |
std::string code::ActionSource::getDir | ( | ) | [inline, inherited] |
Returns a source-specific disk directory.
Default implementation does nothing --- this should be overridden.
virtual TimeInterval code::InMemoryIndex::getHistoricalRange | ( | ) | const [virtual, inherited] |
size_t code::Index::getHistoricalRecords | ( | const Time & | startTime, | |
const Time & | endTime, | |||
const std::set< std::string > & | searchKeys, | |||
std::vector< Record > * | records | |||
) | const [inline, protected, inherited] |
A work-horse called by all the getHistoricalRecords() methods.
Has same behavior, except that it uses an implementation-specific search key obtained from the public interface elements.
size_t code::Index::getHistoricalRecords | ( | const Time & | startTime, | |
const Time & | endTime, | |||
const std::string & | searchKey, | |||
std::vector< Record > * | records | |||
) | const [protected, inherited] |
A work-horse called by many of the getHistoricalRecords() methods.
Has same behavior, except that it uses an implementation-specific search key obtained from the public interface elements.
virtual size_t code::Index::getHistoricalRecords | ( | const Time & | startTime, | |
const Time & | endTime, | |||
const std::vector< Index::Record > & | matchThis, | |||
std::vector< Record > * | records | |||
) | const [virtual, inherited] |
Returns all the records which match the selection criteria of any of the records to match that are passed in.
The times of the records passed in are ignored.
For example, to get all the Reflectivity, Velocity and Scit records within the past half-hour, you would do this:
std::vector< Index::Record > recordsToMatch; recordsToMatch.push_back( Index::getRecord(...) ); // reflectivity recordsToMatch.push_back( Index::getRecord(...) ); // velocity recordsToMatch.push_back( Index::getRecord(...) ); // scit cells
Time endTime = Time::CurrentTime(); TimeInterval window( TimeInterval::Minutes(30) ); Time startTime = endTime - window;
std::vector< Index::Record > records;
if ( myindex.getHistoricalRecords( startTime, endTime, recordsToMatch, &records) ){ Here, records will contain the records that have the same data type as that of the records to be matched. }
startTime | start of search interval (inclusive) | |
endTime | end of search interval (inclusive) | |
matchThis | The records whose data types are to be matched. | |
records | Vector of records to fill in. |
size_t code::Index::getHistoricalRecords | ( | const Time & | startTime, | |
const Time & | endTime, | |||
const Index::Record & | matchThis, | |||
std::vector< Record > * | records | |||
) | const [inherited] |
Returns all the records which match the selection criteria of the record to match that is passed in.
The time of the record passed in is ignored.
For example, to get all the records within the past half-hour that match this record, you would do this:
Index::Record recordToMatch = ... Time endTime = Time::CurrentTime(); TimeInterval window( TimeInterval::Minutes(30) ); Time startTime = endTime - window;
std::vector< Index::Record > records;
if ( myindex.getHistoricalRecords( startTime, endTime, recordToMatch, &records) ){ Here, records will contain the records that have the same data type as that of the record to be matched. }
startTime | start of search interval (inclusive) | |
endTime | end of search interval (inclusive) | |
matchThis | The record whose data type is to be matched. | |
records | Vector of records to fill in. |
virtual size_t code::Index::getHistoricalRecords | ( | const Time & | startTime, | |
const Time & | endTime, | |||
const selections_t & | selection, | |||
std::vector< Record > * | records | |||
) | const [virtual, inherited] |
Returns all the records which match the selection criteria (other than time) passed in.
For example, to get all the 0.5 Reflectivity scans within the past half-hour, you would do this:
Time endTime = Time::CurrentTime(); TimeInterval window( TimeInterval::Minutes(60) ); Time startTime = endTime - window;
std::vector< Index::Record > records; Index::selections_t selection; Note: no time in the selection criteria! selection.push_back( TypeName::Reflectivity ); selection.push_back( "0.5" ); if ( myindex.getHistoricalRecords( startTime, endTime, selection, &records) ){ Here, records will contain the records for the 0.5 degree reflectivity scans within the past one hour }
startTime | start of search interval (inclusive) | |
endTime | end of search interval (inclusive) | |
selection | Criteria to match (do not include time!) | |
records | Vector of records to fill in. |
size_t code::Index::getHistoricalRecordsByDataType | ( | const Time & | startTime, | |
const Time & | endTime, | |||
const code::Index::Record & | rec, | |||
std::vector< Record > * | records | |||
) | const [inherited] |
The usual variation of getHistoricalRecords will match subtype also.
Using this version allows you to match all subtypes.
static std::string code::XMLIndex::getIndexPath | ( | const URL & | file | ) | [static] |
Returns a URL fragment that specifies a file's location.
It must contain the scheme, host, and directory portion of path. It may contain user, password, port, query, and fragment.
The URL fragment is returned as a string because it is intended for the parameters string vector.
Warning: Index path substitution is done via a simple string comparison, so beware of extraneous slashes, "localhost" vs. local host's name, implict vs. explicit port numbers, etc.
Warning: Care must be taken by Builders when constructing filenames with an indexPath. With our earlier notation ("xmllb:horus:/data/code_index.lb"), we could just concatenate indexPath and a relativePath to make a filename. Since URLs place their query and fragment sections after the path, this is no longer possible. Instead, construct a URL object from indexPath, then append relativePath to the end of url.path: <blockquote>
code::URL url = indexPath; url.path += "/" + rest_of_path;</blockquote>
How an indexPath is generated:
const TimeInterval& code::Index::getMaximumHistory | ( | ) | const [inline, inherited] |
returns the maximum history maintained by this index.
A time interval less than or equal to zero indicates that the index doesn't do any pruning.
Record code::Index::getMostCurrentRecord | ( | const code::Time & | atTime, | |
const selections_t & | sel | |||
) | const [inline, inherited] |
Return the most current record (before atTime) matching the criteria.
atTime | Records occuring after this time are ignored. | |
selection | Criteria to match. the first string (time) is ignored. |
Record code::Index::getMostCurrentRecord | ( | const selections_t & | s | ) | const [inline, inherited] |
Return the Index's most current record matching the selection criteria.
selection | Criteria to match. the first string (time) is ignored. |
Record code::Index::getMostCurrentRecord | ( | const Record & | sel | ) | const [inline, inherited] |
Return the Index's most current record matching the `sel' record's selection criteria.
Record code::Index::getMostCurrentRecord | ( | ) | const [inline, inherited] |
Return the Index's most current record.
void code::Index::getMostCurrentRecords | ( | const code::Time & | atTime, | |
const std::set< selections_t > & | criteria, | |||
std::map< selections_t, Record > & | setme | |||
) | const [inline, inherited] |
A batch form of getMostCurrentRecord().
This is much faster than calling getMostCurrentRecord() multiple times.
atTime | Records occuring after this time are ignored. | |
selection | A set of criteria to match. The first string (time) of each is ignored. | |
setme | A map criteria and Records that matched the input criteria. |
const std::string& code::Index::getName | ( | ) | const [inline, inherited] |
Returns the source name if it has been set using setName().
virtual Record code::Index::getNextRecord | ( | const Record & | fromRecord, | |
const Direction & | dir | |||
) | const [pure virtual, inherited] |
Navigate starting at a particular record.
fromRecord | the record to navigate from | |
dir | the direction to navigate toward. Use one of the InMemoryIndex navigation directions. |
Implemented in code::SQLIndex.
virtual Record code::InMemoryIndex::getNextRecord | ( | const Record & | fromRecord, | |
const Direction & | dir | |||
) | const [virtual, inherited] |
virtual size_t code::Index::getNextSelection | ( | const selections_t & | selection, | |
selections_t * | next_selection | |||
) | const [pure virtual, inherited] |
Get a list of posssibilities for the next selection.
selection | Your selection criteria. May be empty. | |
next_selection | possible selections for the next criterion, set by this method. |
Implemented in code::SQLIndex.
virtual size_t code::InMemoryIndex::getNextSelection | ( | const selections_t & | sel, | |
selections_t * | setme_next | |||
) | const [virtual, inherited] |
size_t code::ActionSource::getNumListeners | ( | ) | const [inline, inherited] |
returns the number of listeners linked to this source.
virtual void code::InMemoryIndex::getProductCategories | ( | const std::string & | productName, | |
std::set< std::string > & | setmeCategories | |||
) | const [virtual, inherited] |
Get the categories present for this top-level product name.
For example, returns 0.5, 1.5, etc. if Reflectivity is passed in.
The returned set has an empty string if there exists a product with no sub-category.
Due to age-offs, some of the listed products may not exist.
Implements code::Index.
virtual void code::InMemoryIndex::getProductNames | ( | std::vector< std::string > * | inhere | ) | const [virtual, inherited] |
Returns the top-level product names encountered by this index.
Due to age-offs, some of the listed products may not exist.
Implements code::Index.
virtual Record code::Index::getRecord | ( | const selections_t & | selection | ) | const [pure virtual, inherited] |
Get the record matching the selection criteria.
selection | your selection criteria. |
Implemented in code::SQLIndex.
virtual Record code::InMemoryIndex::getRecord | ( | const selections_t & | sel | ) | const [virtual, inherited] |
virtual size_t code::Index::getRecords | ( | std::vector< Record > * | records | ) | const [virtual, inherited] |
Convenience method to get all records.
size_t code::Index::getRecords | ( | const selections_t & | selection, | |
std::vector< Record > * | records, | |||
std::vector< std::string > * | next_selection = 0 | |||
) | const [inherited] |
Obtain all the records that match the selections passed in.
Example:
std::vector< Index::Record > records; std::vector< std::string > selection, next_selection; selection.push_back( "16:05:23 (12)" ); selection.push_back( TypeName::Reflectivity ); if ( myindex.getHistoricalRecords(selection, &records, &next_selection) ){ Here, records will contain the records for all the reflectivity elevation scans at the time passed in. next_selection will contain strings "0.5", "1.5", etc. }
selection | Your selection criteria (may be empty). | |
records | Records that match the selection criteria, filled in by this method. Rfl vol 23 elev 0.5 is matched by any of the following selection criteria:
| |
next_selection | Possible selections for the next criterion, filled in by this method. Maybe zero, if you don't need it. |
virtual size_t code::InMemoryIndex::getRecords | ( | std::vector< Record > * | records | ) | const [virtual, inherited] |
const URL& code::IndexBase::getURL | ( | ) | const [inline, inherited] |
static std::string code::XMLIndex::getXMLChangeParam | ( | const std::vector< std::string > & | curr, | |
const std::vector< std::string > & | prev, | |||
const std::string & | indexPath | |||
) | [static] |
bool code::Index::hasHistoryLongerThan | ( | const TimeInterval & | newTI | ) | const [inherited] |
Does this index have a history longer than the time interval passed in? A time interval less than or equal to zero indicates that the index doesn't do any pruning and is therefore treated as being infinite.
virtual bool code::InMemoryIndex::hasProduct | ( | const std::string & | productDataType | ) | const [virtual, inherited] |
Returns true if the index has ever encountered this product.
Due to age=offs, the product may actually not exist.
Implements code::Index.
static bool code::Index::isBracketedBy | ( | const code::Index::Record & | test, | |
const code::Index::Record & | first, | |||
const code::Index::Record & | second | |||
) | [static, inherited] |
is the test record in between the other two records based on subtype? first > second
static bool code::Index::isKnownDataSource | ( | const std::string & | dataSource | ) | [static, inherited] |
Checks the list of data sources and the list of Builders available.
bool code::XMLIndex::isValid | ( | ) | const [inline] |
virtual void code::Index::notifyNewRecordEvent | ( | const Index::Record & | item | ) | [protected, virtual, inherited] |
Look at this record and do the notification.
If your data source is different, and so the "normal" assumptions don't hold, this notifyXXXEvent method needs to be over-ridden.
virtual void code::Index::notifyNewTimeStampEvent | ( | const Index::Record & | item | ) | [protected, virtual, inherited] |
Look at this record and do the notification.
If your data source is different, and so the "normal" assumptions don't hold, this notifyXXXEvent method needs to be over-ridden.
void code::ActionSource::removeActionListener | ( | const std::string & | eventType, | |
SmartPtr< ActionListener > | lstner | |||
) | [inline, inherited] |
Unsubscribe the listener so that it does not respond to the the event type noted.
This works only if the listener was added via addActionListener( type, SmartPtr )
type | The event type | |
lstnr | The listener to remove |
void code::ActionSource::removeActionListener | ( | SmartPtr< ActionListener > | lstner | ) | [inline, inherited] |
Unsubscribe lstnr such that it no longer receives events from this ActionSource.
lstnr | the action listener to be unsubscribed. |
void code::Index::setAsSourceOf | ( | Index::Record & | rec | ) | const [protected, inherited] |
sets the source index of the passed in record to be ourself.
void code::Index::setMaximumHistory | ( | const TimeInterval & | newTI | ) | [inherited] |
Changes the maximum history maintained by this index.
If the new interval is less than what we originally had, the extra records are pruned. If the new interval is greater than what we originally had, we will slowly grow to that index. To obtain the missed records, this Index object has to be recreated. A time interval less than or equal to zero indicates that the index shouldn't do any pruning.
void code::Index::setName | ( | const std::string & | name | ) | [inline, inherited] |
Set the name of this index.
This is useful because then for every record you get out of this index, you can do:
rec.getSourceIndex()->getName()
void code::IndexBase::setURL | ( | const URL & | u | ) | [inline, inherited] |
Pass in complete URL, i.e.
"rssd://karnak/data/realtiem/radar/multi/code_index.lb&protocol=xmllb" This is called by IndexFactory::createIndex
void code::Index::sleepRequiredTime | ( | const Time & | newRecordTime | ) | const [protected, inherited] |
Sleep as many seconds as required.
This method is called before the notifications start.
friend class Index::Record [friend, inherited] |
TimeInterval code::IndexBase::ageoffInterval [protected, inherited] |
const std::string code::InMemoryIndex::selectionSeparator [static, protected, inherited] |
The separation string.
Assumes the selection criteria have no spaces.
double code::IndexBase::simulationRatio [protected, inherited] |
URL code::IndexBase::url [protected, inherited] |