code::Index::Record Class Reference

List of all members.

Detailed Description

A reference-counted class to keep track of the selections and builder params that are obtained using those selections.

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.

See also:
IndexRecordInformation which allows for greater functionality given an Index::Record.

Index

IndexFactory

IndexRecordInformation

Author:
Lakshman
Version:
Id
code_Index.h,v 1.53 2011/09/23 16:37:32 Valliappa.Lakshmanan Exp


Public Member Functions

SmartPtr< DataTypecreateObject (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_tgetSelections () 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 TimegetTime () const
 The time of the product referenced by this record.
const std::string & getDataSourceType () const
 What is the data source for this record?
SmartPtr< IndexRecordInformationgetInformation () 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 > &params, 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 > > &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.
 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 IndexgetSourceIndex () 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 TimeIntervalgetForecastInterval (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.


Constructor & Destructor Documentation

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.

Parameters:
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 );
       
For this object, getSourceIndex() will return null, since it was created explicitly and not retreived from an Index.

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

Creates an invalid record.


Member Function Documentation

SmartPtr<DataType> code::Index::Record::createObject ( size_t  i = 0  )  const

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.

Returns:
invalid-pointer on error.

const std::vector< std::string >& code::Index::Record::getBuilderParams ( size_t  i = 0  )  const [inline]

For a valid record, returns builder parameters.

If this record corresponds to a montage, specify the index of the DataType you want.

This is the full set of parameters, suitable for passing immediately to the Builder's getBuilderWithFullParams

See also:
Builder

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.

Returns:
invalid pointer if the IndexRecordInformation object could not be created.

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

Returns:
the number of records.

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]

Which Index object was this Record obtained from?

Returns:
0 if this object was created explicitly (not retreived from an index.)

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

Does this record match the specification? The specification may be of two forms:.

  1. DataType alone e.g: Reflectivity
  2. DataType:Subtype e.g: Reflectivity:00.50

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.


Friends And Related Function Documentation

friend class Index [friend]

friend class InMemoryIndex [friend]

bool operator< ( const Record a,
const Record b 
) [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.


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