code::PostgreSQLIndex Class Reference

Inheritance diagram for code::PostgreSQLIndex:

code::SQLIndex code::Index code::IndexBase code::ActionSource List of all members.

Detailed Description

Uses a Postgre database to implement a SQL index.

Author:
Lakshman
Version:
Id
code_PostgreSQLIndex.h,v 1.5 2009/06/02 20:17:39 lakshman Exp


Public Types

typedef std::vector< std::string > selections_t
typedef std::vector< Index::RecordVolumeRecords
 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

 PostgreSQLIndex (const IndexBase &b)
virtual ~PostgreSQLIndex ()
size_t findNewRecords ()
 Does a poll to the database, reads and notifies about records since the last call to this method.
virtual Record getRecord (const std::vector< std::string > &selection) const
 Get the record matching the selection criteria.
virtual size_t getNextSelection (const std::vector< std::string > &sel, std::vector< std::string > *next_sel) const
 Get a list of posssibilities for the next selection.
Index::Record getNextRecord (const Index::Record &fromRecord, const Index::Direction &dir) const
 Navigate starting at a particular record.
std::string doFormKey (const std::vector< std::string > &sel, size_t offset1, size_t offset2) const
 Subclasses must implement this to build a key string from.
Index::Record doGetMostCurrentRecord (const code::Time &atTime, const std::vector< std::string > &sel) const
Index::Record doGetMostCurrentRecord () const
TimeInterval getHistoricalRange () const
 Returns the current historical range of this index.
void getProductNames (std::vector< std::string > *inhere) const
 Returns the top-level product names encountered by this index.
void getProductCategories (const std::string &product_name, std::set< std::string > &setme) const
 Get the categories present for this top-level product name.
Index::Record getForecast (const Index::Record &curr) const
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
void doAgeOff (const Time &cutoff)
 The InMemoryIndex normally maintains information about all the records seen.
bool init (const std::string &dburl)
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.
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.
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 TimeIntervalgetMaximumHistory () 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.
virtual bool hasProduct (const std::string &productDataType) const =0
 Returns true if the index has ever encountered this product.
const URLgetURL () 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 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 bool connect (const std::string &dburl, std::string &tableName, std::string &tablePath, std::string &productNumberTable)
 connect to this database table, and give us back the tableName (for SQL queries) and the tablePath (for relative paths)
virtual bool executeQuery (const std::string &query, std::vector< std::vector< std::string > > &result) const
 result is a 2D array where the faster changing dimension is the column values.
virtual std::string escapeString (const std::string &strField) 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.
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.
virtual void doGetMostCurrentRecords (const Time &atTime, const std::set< selections_t > &criteria, std::map< selections_t, Index::Record > &setme) const =0

Protected Attributes

double simulationRatio
TimeInterval ageoffInterval
URL url

Friends

class Index::Record


Member Typedef Documentation

typedef std::vector<std::string> code::Index::selections_t [inherited]

typedef std::vector< Index::Record > code::Index::VolumeRecords [inherited]


Member Enumeration Documentation

enum code::Index::Direction [inherited]

The directions in which you can navigate starting from a valid Index::Record.

See also:
Index::getNextRecord
Author:
Lakshman
Version:
Id
code_Index.h,v 1.53 2011/09/23 16:37:32 Valliappa.Lakshmanan Exp
Enumerator:
NextTime  Step toward the next available time.
PreviousTime  Step toward the previously available time.
NextSubType  Step up to the next subtype.

For example, radar data is often arranged by elevations. The next subtype would give you the next higher elevation with the same data type. So, navigation from a reflectivity record with an elevation of 1.5 degrees might give you a reflectivty record with an elevation of 2.5 degrees.

PreviousSubType  Step up to the previous subtype.

For example, radar data is often arranged by elevations. The previous subtype would give you the next lower elevation with the same data type. So, navigation from a reflectivity record with an elevation of 1.5 degrees might give you a reflectivty record with an elevation of 0.5 degrees.


Constructor & Destructor Documentation

code::PostgreSQLIndex::PostgreSQLIndex ( const IndexBase b  ) 

virtual code::PostgreSQLIndex::~PostgreSQLIndex (  )  [virtual]


Member Function Documentation

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.

Parameters:
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.

Parameters:
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.

See also:
isKnownDataSource You don't have to add data sources for which Builders have been introduced.

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.
See also:
ageOff( const TimeInterval& ) since that method will work for archived indexes also.

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.

virtual bool code::PostgreSQLIndex::connect ( const std::string &  dburl,
std::string &  tableName,
std::string &  tablePath,
std::string &  productNumberTable 
) [protected, virtual]

connect to this database table, and give us back the tableName (for SQL queries) and the tablePath (for relative paths)

Implements code::SQLIndex.

void code::ActionSource::copyListenersFrom ( const ActionSource other  )  [inline, inherited]

copy all the listeners from the other source (replacing our own)

virtual void code::SQLIndex::doAddRecord ( const Index::Record item  )  [virtual, inherited]

called by addRecord on a valid record before it is broadcast to listeners.

Reimplemented from code::Index.

void code::SQLIndex::doAgeOff ( const Time cutoff  )  [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.
See also:
ageOff( const TimeInterval& ) since that method will work for archived indexes also.

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.

std::string code::SQLIndex::doFormKey ( const std::vector< std::string > &  sel,
size_t  offset1,
size_t  offset2 
) const [virtual, inherited]

Subclasses must implement this to build a key string from.

Returns:
the string to be assigned the new key value.
Parameters:
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()]

Implements code::Index.

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::SQLIndex::doGetHistoricalRecords ( const Time startTime,
const Time endTime,
const std::set< std::string > &  searchKeys,
std::vector< Record > *  records 
) const [virtual, inherited]

Index::Record code::SQLIndex::doGetMostCurrentRecord (  )  const [virtual, inherited]

Implements code::Index.

Index::Record code::SQLIndex::doGetMostCurrentRecord ( const code::Time atTime,
const std::vector< std::string > &  sel 
) 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]

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.

virtual std::string code::PostgreSQLIndex::escapeString ( const std::string &  strField  )  const [protected, virtual]

Implements code::SQLIndex.

virtual bool code::PostgreSQLIndex::executeQuery ( const std::string &  query,
std::vector< std::vector< std::string > > &  result 
) const [protected, virtual]

result is a 2D array where the faster changing dimension is the column values.

Returns:
false on query error or empty result.

Implements code::SQLIndex.

bool code::Index::fetchTraditionalVolume ( const code::Index::Record in,
VolumeRecords out 
) const [inherited]

Fetch a volume of records that contains this record.

Returns:
true if at least one valid entry is found.

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.

Returns:
true if at least one valid entry is found.

size_t code::SQLIndex::findNewRecords (  )  [inherited]

Does a poll to the database, reads and notifies about records since the last call to this method.

Returns:
number of new records.

void code::ActionSource::fireActionPerformed ( const std::string &  type  )  [inline, inherited]

Convenience function for subclasses to notify ActionListeners of events.

Parameters:
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.

Parameters:
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.

Parameters:
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).

Parameters:
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.

Returns:
a source-specific type identifier to indicate what action occurred.

Index::Record code::SQLIndex::getForecast ( const Index::Record curr  )  const [inherited]

TimeInterval code::SQLIndex::getHistoricalRange (  )  const [virtual, inherited]

Returns the current historical range of this index.

Implements code::Index.

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.
       }
       
Returns:
number of records found.
Parameters:
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.
This method is not as efficient as knowing the actual time of the product. However, it is the most efficient of the getHistoricalRecords() family of methods.

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.
       }
       
Returns:
number of records found.
Parameters:
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.
This method is not as efficient as knowing the actual time of the product.

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
       }
       
Returns:
number of records found.
Parameters:
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.
This method is not as efficient as knowing the actual time of the product.

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.

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.

Parameters:
atTime Records occuring after this time are ignored.
selection Criteria to match. the first string (time) is ignored.
Returns:
the most current matching record, or an invalid one if no match.

Record code::Index::getMostCurrentRecord ( const selections_t s  )  const [inline, inherited]

Return the Index's most current record matching the selection criteria.

Parameters:
selection Criteria to match. the first string (time) is ignored.
Returns:
the most current matching record, or an invalid one if no match.

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.

Parameters:
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().

Index::Record code::SQLIndex::getNextRecord ( const Index::Record fromRecord,
const Index::Direction dir 
) const [virtual, inherited]

Navigate starting at a particular record.

Parameters:
fromRecord the record to navigate from
dir the direction to navigate toward. Use one of the InMemoryIndex navigation directions.
Returns:
the next record in that direction, or an invalid record if no further record exists in that direction.

Implements code::Index.

virtual size_t code::SQLIndex::getNextSelection ( const std::vector< std::string > &  sel,
std::vector< std::string > *  next_sel 
) const [virtual, inherited]

Get a list of posssibilities for the next selection.

Parameters:
selection Your selection criteria. May be empty.
next_selection possible selections for the next criterion, set by this method.
Returns:
the number of possibilities. If zero is returned, then either it is the end of the road and you can use getRecord to get the record that matches or there are no records that match your selection criteria.

Implements code::Index.

size_t code::ActionSource::getNumListeners (  )  const [inline, inherited]

returns the number of listeners linked to this source.

void code::SQLIndex::getProductCategories ( const std::string &  product_name,
std::set< std::string > &  setme 
) 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.

void code::SQLIndex::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::SQLIndex::getRecord ( const std::vector< std::string > &  selection  )  const [virtual, inherited]

Get the record matching the selection criteria.

Returns:
matching record, or an invalid one if no matches.
Parameters:
selection your selection criteria.

Implements code::Index.

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.
       }
       
Returns:
number of records found.
Parameters:
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:
  1. (empty)
  2. Rfl
  3. Rfl, 23
  4. Rfl, 23, 0.5
next_selection Possible selections for the next criterion, filled in by this method. Maybe zero, if you don't need it.
See also:
getNextSelection
This method is implemented using the getRecord and getNextSelection methods.

const URL& code::IndexBase::getURL (  )  const [inline, inherited]

This will be set by IndexFactory if the Index is created using IndexFactory::createIndex.

If you construct the Index directly, the URL will be unavailable unless you explicitly call setURL()

Returns:
Complete URL, e.g: "rssd://karnak/data/realtime/radar/multi/code_index.lb&protocol=xmllb"

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::Index::hasProduct ( const std::string &  productDataType  )  const [pure virtual, inherited]

Returns true if the index has ever encountered this product.

Due to age=offs, the product may actually not exist.

Implemented in code::InMemoryIndex.

bool code::SQLIndex::init ( const std::string &  dburl  )  [inherited]

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.

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 )

Parameters:
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.

Parameters:
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.


Friends And Related Function Documentation

friend class Index::Record [friend, inherited]


Member Data Documentation

TimeInterval code::IndexBase::ageoffInterval [protected, inherited]

double code::IndexBase::simulationRatio [protected, inherited]

URL code::IndexBase::url [protected, inherited]


Generated on Fri May 4 13:40:12 2012 for WDSS-IIw2 by  doxygen 1.4.7