code::Index Class Reference

Inheritance diagram for code::Index:

code::IndexBase code::ActionSource code::InMemoryIndex code::SQLIndex code::FAMIndex code::WebIndex code::XMLIndex code::XMLLBIndex code::PostgreSQLIndex List of all members.

Detailed Description

The Index class defines a way of getting an Index::Record given some selection criteria.

Provide a vector of strings (called selections) and you will get a vector of Index::Record each of which can be used to build a product.

See also:
XMLIndex XMLIndex implements this class by reading an XML index file
The following conventions are assumed:
  1. None of the selection criteria and none of the builder parameters has any white spaces embedded in it.
  2. The first selection criterion somehow encodes time in a lexicographically comparable manner. In other words, a timestamp of abc is more recent (comes later) than a timestamp of aba.

The event fired is one of the following:

  1. NewRecordEvent -- whenever a new record is added.
  2. NewTimeStampEvent -- whenver a product arrives with a more recent time stamp from the previous one. For radar data, this could mean that a new volume has started. This interface is deprecated since some data sources, notably dual-pol radar won't support it -- the real way to check for a new volume is to see if the elevation angle has decreased ...
  3. EndDatasetEvent -- some archived protocols support this. You may want to catch this event to exit your algorithm.

Subclass implementations Subclasses should normally just call addRecord for each of the records. The search methods implemented here are pretty efficient and should not need to be over-ridden.

Subclass implementors should also take care to implement a factory.

See also:
IndexFactory
Author:
Lakshman
Version:
Id
code_Index.h,v 1.53 2011/09/23 16:37:32 Valliappa.Lakshmanan 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

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.
virtual Record getRecord (const selections_t &selection) const =0
 Get the record matching the selection criteria.
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 getNextSelection (const selections_t &selection, selections_t *next_selection) const =0
 Get a list of posssibilities for the next selection.
virtual ~Index ()
 Index (std::vector< SmartPtr< ActionListener > > listeners, double ratio, const TimeInterval &maximumHistory)
 Users will normally create a subclass of Index, such as XMLIndex, etc.
 Index (const IndexBase &b=IndexBase())
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.
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.
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.
virtual Record getNextRecord (const Record &fromRecord, const Direction &dir) const =0
 Navigate starting at a particular record.
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.
virtual TimeInterval getHistoricalRange () const =0
 Returns the current historical range of 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 void getProductNames (std::vector< std::string > *inhere) const =0
 Returns the top-level product names encountered by this index.
virtual bool hasProduct (const std::string &productDataType) const =0
 Returns true if the index has ever encountered this product.
virtual void getProductCategories (const std::string &productName, std::set< std::string > &setmeCategories) const =0
 Get the categories present for this top-level product name.
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

void addRecord (const Index::Record &item)
 Given the record, adds it to all the internal maps.
virtual void doAddRecord (const Index::Record &item)
 called by addRecord on a valid record before it is broadcast to listeners.
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.
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 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 doAgeOff (const Time &cutoff)=0
 The InMemoryIndex normally maintains information about all the records seen.
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 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 Record doGetMostCurrentRecord () const =0
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

Protected Attributes

double simulationRatio
TimeInterval ageoffInterval
URL url

Friends

class Index::Record

Classes

class  EndDatasetEvent
 Posted by certain Index objects when they reach the end of the dataset. More...
class  NewRecordEvent
 Posted whenever a new record is added to this Index. More...
class  NewTimeStampEvent
 Posted whenever a new time stamp occurs. More...
class  Record
 A reference-counted class to keep track of the selections and builder params that are obtained using those selections. More...


Member Typedef Documentation

typedef std::vector<std::string> code::Index::selections_t

typedef std::vector< Index::Record > code::Index::VolumeRecords


Member Enumeration Documentation

enum code::Index::Direction

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

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

code::Index::Index ( std::vector< SmartPtr< ActionListener > >  listeners,
double  ratio,
const TimeInterval maximumHistory 
)

Users will normally create a subclass of Index, such as XMLIndex, etc.

See also:
IndexFactory
By providing ActionListeners at construction, you can create an index for which the event notification happens even for the initial records.

Parameters:
ratio The simulation ratio controls the speed at which event notification happens.
If the ratio is negative, new records are added as fast as possible, i.e. as soon as your algorithm via the registered listener's actionPerformed method has finished dealing with the previous record.

If the ratio is 1.0, then the simulation happens at real speed. If the ratio is 0.5, the simulation takes twice as long, i.e. your algorithm gets more time to deal with the data. If the ratio is 2.0, the simulation is twice as fast, i.e. your algorithm will get the data twice as fast.

Parameters:
maximumHistory controls the cutoff interval. Pruning will be done every time the index gets added to. Pass in TimeInterval() if you don't want to do any pruning.

code::Index::Index ( const IndexBase b = IndexBase()  ) 

See also:
IndexFactory Create an Index which is a regular, real-time or entire-archive Index. Any event notification (through addActionListener) happens only for new records that are subsequently created, and this happens in real-time.


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]

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]

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]

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]

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.

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]

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

Reimplemented in code::SQLIndex.

virtual void code::Index::doAgeOff ( const Time cutoff  )  [protected, pure virtual]

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.

Implemented in code::SQLIndex, and code::InMemoryIndex.

void code::Index::doEndDatasetNotification (  )  [protected]

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]

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()]

Implemented in code::SQLIndex.

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]

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 Record code::Index::doGetMostCurrentRecord ( const Time atTime,
const selections_t sel 
) const [protected, pure virtual]

Implemented in code::SQLIndex.

virtual Record code::Index::doGetMostCurrentRecord (  )  const [protected, pure virtual]

Implemented in code::SQLIndex, and code::InMemoryIndex.

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]

void code::Index::doNotifications ( const Index::Record item  )  [protected]

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.

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

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

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.

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

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.

virtual TimeInterval code::Index::getHistoricalRange (  )  const [pure virtual]

Returns the current historical range of this index.

Implemented in code::SQLIndex, and code::InMemoryIndex.

size_t code::Index::getHistoricalRecords ( const Time startTime,
const Time endTime,
const std::set< std::string > &  searchKeys,
std::vector< Record > *  records 
) const [inline, protected]

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]

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]

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

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]

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

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]

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]

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]

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]

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

Record code::Index::getMostCurrentRecord (  )  const [inline]

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]

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]

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]

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.

Implemented in code::SQLIndex.

virtual size_t code::Index::getNextSelection ( const selections_t selection,
selections_t next_selection 
) const [pure virtual]

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.

Implemented in code::SQLIndex.

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

returns the number of listeners linked to this source.

virtual void code::Index::getProductCategories ( const std::string &  productName,
std::set< std::string > &  setmeCategories 
) const [pure virtual]

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.

Implemented in code::SQLIndex, and code::InMemoryIndex.

virtual void code::Index::getProductNames ( std::vector< std::string > *  inhere  )  const [pure virtual]

Returns the top-level product names encountered by this index.

Due to age-offs, some of the listed products may not exist.

Implemented in code::SQLIndex, and code::InMemoryIndex.

virtual Record code::Index::getRecord ( const selections_t selection  )  const [pure virtual]

Get the record matching the selection criteria.

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

Implemented in code::SQLIndex.

virtual size_t code::Index::getRecords ( std::vector< Record > *  records  )  const [virtual]

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

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

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]

Returns true if the index has ever encountered this product.

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

Implemented in code::InMemoryIndex.

static bool code::Index::isBracketedBy ( const code::Index::Record test,
const code::Index::Record first,
const code::Index::Record second 
) [static]

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]

Checks the list of data sources and the list of Builders available.

virtual void code::Index::notifyNewRecordEvent ( const Index::Record item  )  [protected, virtual]

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]

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]

sets the source index of the passed in record to be ourself.

void code::Index::setMaximumHistory ( const TimeInterval newTI  ) 

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]

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]

Sleep as many seconds as required.

This method is called before the notifications start.


Friends And Related Function Documentation

friend class Index::Record [friend]


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:13 2012 for WDSS-IIw2 by  doxygen 1.4.7