Can be used to build a unique DataType. Not meant to be subclassed. The record normally corresponds to only a single DataType. However, it is possible to define a record that corresponds to multiple data elements. This is useful when building a montage of data elements, such as a radar volume.
IndexFactory
Public Member Functions | |
SmartPtr< DataType > | createObject (size_t i=0) const |
Create the object referenced by this record. | |
const std::vector< std::string > & | getBuilderParams (size_t i=0) const |
For a valid record, returns builder parameters. | |
const selections_t & | getSelections () const |
For a valid record, returns selection criteria. | |
void | setSelections (const selections_t &sel) |
For a valid record, changes the selections to be what's passed in. | |
const Time & | getTime () const |
The time of the product referenced by this record. | |
const std::string & | getDataSourceType () const |
What is the data source for this record? | |
SmartPtr< IndexRecordInformation > | getInformation () const |
Returns an IndexRecordInformation that contains the information as it currently exists for this record. | |
const std::string & | getTimeStamp () const |
The first selection criterion somehow encodes time in a lexicographically comparable manner. | |
const std::string & | getDataType () const |
The second selection criterion is the data type for data records or the event name (e.g: "NewElevation") for event records. | |
const std::string & | getEventType () const |
The second selection criterion is the data type for data records or the event name (e.g: "NewElevation") for event records. | |
bool | matches (const std::string &spec) const |
Does this record match the specification? The specification may be of two forms:. | |
Record (const std::vector< std::string > ¶ms, const selections_t &selects, const code::Time &productTime) | |
To create a valid data record, pass in the selections and builder parameters. | |
Record (const std::vector< std::vector< std::string > > ¶ms, const selections_t &selects, const code::Time &productTime) | |
To create a valid montage record, pass in the selections and builder parameters for all of the records in the montage. | |
Record (std::vector< std::vector< std::string > > *params, selections_t *selects, const code::Time &productTime) | |
To create a valid montage record, pass in the selections and builder parameters for all of the records in the montage. | |
Record (const std::vector< Index::Record > &individual_records) | |
A convenient way to create a montage record from individual records. | |
Record (const selections_t &selects, const code::Time &eventTime) | |
To create a valid record that pertains to an event. | |
bool | isMontage () const |
Does this record correspond to a montage or to only one DataType? | |
bool | isEvent () const |
Does this record correspond to an event or to data? | |
size_t | getNumObjects () const |
How many DataTypes does this record correspond to? You can pass i in the range 0 to N-1 to the createObject() method. | |
Record () | |
Creates an invalid record. | |
bool | isValid () const |
std::string | getStatus () const |
This is useful for printing the record to screen for debugging or to relay status, such as in a listener:. | |
std::string | getKey () const |
Returns a unique key that can be used to differentiate this Record from another. | |
const Index * | getSourceIndex () const |
Which Index object was this Record obtained from? | |
size_t | getMontageRecords (std::vector< Record > *fillme) const |
Get the "sub" records of this montage of records. | |
const TimeInterval & | getForecastInterval (size_t i) const |
get the forecast interval of the ith product. | |
bool | isForecast () const |
does this record correspond to a forecast product? | |
const std::vector< std::string > & | getOriginalProduct () const |
Return the complete selections of the original product, if this is a forecast product. | |
const std::vector< TimeInterval > & | getForecastIntervals () const |
void | setForecast (const std::vector< std::string > &origSelections, const std::vector< code::TimeInterval > &interval) |
This record, after this method is called, corresponds to a forecast product. | |
void | setCreatorProcessId (const std::string &pname) |
Used in maintaining an audit trail of products. | |
const std::string & | getCreatorProcessId () const |
Static Public Member Functions | |
static void | setProcessIdForCreatedProducts (const std::string &pname) |
Friends | |
class | Index |
class | InMemoryIndex |
bool | operator< (const Record &a, const Record &b) |
Sorting of records happens by time, i.e. | |
std::ostream & | operator<< (std::ostream &, const code::Index::Record &rec) |
Deprecated This is useful for printing the record to screen for debugging. |
code::Index::Record::Record | ( | const std::vector< std::string > & | params, | |
const selections_t & | selects, | |||
const code::Time & | productTime | |||
) |
To create a valid data record, pass in the selections and builder parameters.
This corresponds to a single DataType.
For this object, getSourceIndex() will return null, since it was created explicitly and not retreived from an Index.
code::Index::Record::Record | ( | const std::vector< std::vector< std::string > > & | params, | |
const selections_t & | selects, | |||
const code::Time & | productTime | |||
) |
To create a valid montage record, pass in the selections and builder parameters for all of the records in the montage.
For this object, getSourceIndex() will return null, since it was created explicitly and not retreived from an Index.
code::Index::Record::Record | ( | std::vector< std::vector< std::string > > * | params, | |
selections_t * | selects, | |||
const code::Time & | productTime | |||
) |
To create a valid montage record, pass in the selections and builder parameters for all of the records in the montage.
Record assumes the ownership of the params and selects pointers.
For this object, getSourceIndex() will return null, since it was created explicitly and not retreived from an Index.
code::Index::Record::Record | ( | const std::vector< Index::Record > & | individual_records | ) |
A convenient way to create a montage record from individual records.
The time will be that of the first record, the datatype will be the datatype of the first record with the suffix "Vol".
code::Index::Record::Record | ( | const selections_t & | selects, | |
const code::Time & | eventTime | |||
) |
To create a valid record that pertains to an event.
selects | The selections have these elements: time string, event name and an optional event subcategory | |
eventTime | time that the event happened. Index::selections_t selects; selects.push_back( CalendarDate(eventTime).getString(false) ); selects.push_back( "NewVolume" ); Record rec( selects, eventTime ); myIndex.addRecord( rec ); |
code::Index::Record::Record | ( | ) | [inline] |
Creates an invalid record.
Create the object referenced by this record.
If this record corresponds to a montage, specify the index of the DataType you want.
Warning: The results of calling this method on a Index::Record created explicitly instead of being retreived from an Index are undefined.
const std::vector< std::string >& code::Index::Record::getBuilderParams | ( | size_t | i = 0 |
) | const [inline] |
const std::string& code::Index::Record::getCreatorProcessId | ( | ) | const [inline] |
const std::string& code::Index::Record::getDataSourceType | ( | ) | const [inline] |
What is the data source for this record?
The result is a string like "ORPG", not a string like "KTLX" i.e. the type of data source, but not the name of the actual data source.
Results of calling this method on a non-data record (such as an event record) are undefined.
const std::string& code::Index::Record::getDataType | ( | ) | const |
The second selection criterion is the data type for data records or the event name (e.g: "NewElevation") for event records.
const std::string& code::Index::Record::getEventType | ( | ) | const |
The second selection criterion is the data type for data records or the event name (e.g: "NewElevation") for event records.
const TimeInterval& code::Index::Record::getForecastInterval | ( | size_t | i | ) | const [inline] |
get the forecast interval of the ith product.
const std::vector< TimeInterval >& code::Index::Record::getForecastIntervals | ( | ) | const [inline] |
SmartPtr< IndexRecordInformation > code::Index::Record::getInformation | ( | ) | const |
Returns an IndexRecordInformation that contains the information as it currently exists for this record.
The Information object is not backed by the Record and will not change everytime the Record itself changes. You will have to call this method again to get a new IndexRecordInformation object in that case.
This method is expensive, so the obtained object must be reused as much as possible.
std::string code::Index::Record::getKey | ( | ) | const |
Returns a unique key that can be used to differentiate this Record from another.
size_t code::Index::Record::getMontageRecords | ( | std::vector< Record > * | fillme | ) | const |
Get the "sub" records of this montage of records.
WARNING: these "sub" records will not be available by searching the Index given by getSourceIndex()
size_t code::Index::Record::getNumObjects | ( | ) | const [inline] |
How many DataTypes does this record correspond to? You can pass i in the range 0 to N-1 to the createObject() method.
const std::vector<std::string>& code::Index::Record::getOriginalProduct | ( | ) | const [inline] |
Return the complete selections of the original product, if this is a forecast product.
Otherwise, results are undefined.
const selections_t& code::Index::Record::getSelections | ( | ) | const [inline] |
For a valid record, returns selection criteria.
const Index* code::Index::Record::getSourceIndex | ( | ) | const [inline] |
std::string code::Index::Record::getStatus | ( | ) | const |
This is useful for printing the record to screen for debugging or to relay status, such as in a listener:.
typedef const Index::NewRecordEvent* NewRecordEventP; NewRecordEventP hevt = dynamic_cast< NewRecordEventP >( e ); if( hevt ){ ErrorLogInfo << "Auto-update receipt of " << hevt->getRecord().getStatus() << "\n"; processNewRecord( hevt->getRecord() ); }
For all other purposes, you should use the makeString and constructRecord methods in XMLIndex
const Time& code::Index::Record::getTime | ( | ) | const [inline] |
The time of the product referenced by this record.
const std::string& code::Index::Record::getTimeStamp | ( | ) | const |
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.
Do not rely on the actual value of this time stamp, since it could vary depending on the data source. If you are interested in the value, you should be using the getTime() method.
bool code::Index::Record::isEvent | ( | ) | const [inline] |
Does this record correspond to an event or to data?
bool code::Index::Record::isForecast | ( | ) | const [inline] |
does this record correspond to a forecast product?
bool code::Index::Record::isMontage | ( | ) | const [inline] |
Does this record correspond to a montage or to only one DataType?
bool code::Index::Record::isValid | ( | ) | const [inline] |
bool code::Index::Record::matches | ( | const std::string & | spec | ) | const |
void code::Index::Record::setCreatorProcessId | ( | const std::string & | pname | ) | [inline] |
Used in maintaining an audit trail of products.
void code::Index::Record::setForecast | ( | const std::vector< std::string > & | origSelections, | |
const std::vector< code::TimeInterval > & | interval | |||
) |
This record, after this method is called, corresponds to a forecast product.
static void code::Index::Record::setProcessIdForCreatedProducts | ( | const std::string & | pname | ) | [inline, static] |
void code::Index::Record::setSelections | ( | const selections_t & | sel | ) | [inline] |
For a valid record, changes the selections to be what's passed in.
friend class Index [friend] |
friend class InMemoryIndex [friend] |
Sorting of records happens by time, i.e.
in chronological order.
Events at a particular time are placed before data from that time. This is so that, for example, you receive notification of a new tilt before you get that tilt's data.
std::ostream& operator<< | ( | std::ostream & | , | |
const code::Index::Record & | rec | |||
) | [friend] |
Deprecated This is useful for printing the record to screen for debugging.
For all other purposes, you should use the makeString and constructRecord methods in XMLIndex or the getStatus() method here.