GeoTessCPPExamples
2.0
|
#include <GeoTessModelExtended.h>
Public Member Functions | |
GeoTessModelExtended () | |
GeoTessModelExtended (const string &modelInputFile, const string &relativeGridPath) | |
GeoTessModelExtended (const string &modelInputFile) | |
GeoTessModelExtended (vector< int > &attributeFilter) | |
GeoTessModelExtended (const string &modelInputFile, const string &relativeGridPath, vector< int > &attributeFilter) | |
GeoTessModelExtended (const string &modelInputFile, vector< int > &attributeFilter) | |
GeoTessModelExtended (const string &gridFileName, GeoTessMetaData *metaData) | |
GeoTessModelExtended (GeoTessGrid *grid, GeoTessMetaData *metaData) | |
GeoTessModelExtended (GeoTessModel *baseModel) | |
virtual | ~GeoTessModelExtended () |
string | getExtraData () |
void | setExtraData (const string &xData) |
Static Public Member Functions | |
static string | class_name () |
Protected Member Functions | |
void | loadModelAscii (IFStreamAscii &input, const string &inputDirectory, const string &relGridFilePath) |
void | loadModelBinary (IFStreamBinary &input, const string &inputDirectory, const string &relGridFilePath) |
void | writeModelAscii (IFStreamAscii &output, const string &gridFileName) |
void | writeModelBinary (IFStreamBinary &output, const string &gridFileName) |
Private Member Functions | |
void | initializeData () |
Private Attributes | |
string | extraData |
This class is an example of a class that extends GeoTessModel. It does everything a GeoTessModel can do but adds an extra data item to the model. In this example, the extra data is just a simple string called 'extraData', but in real models that extend GeoTessModel, it could be anything.
Classes that extend GeoTessModel should provide implementations of all the GeoTessModel constructors with the first thing that they do is call the super class constructor. This example does this.
In addition, classes that extend GeoTessModel must override 4 IO functions:
In addition to the 4 required IO functions, derived classes may want to implement these functions:
Finally, the derived class can implement any other functionality that is deemed appropriate. This simple example implements functions getExtraData() and setExtraData().Any resources allocated by the derived class should be deleted in its destructor.
Definition at line 103 of file GeoTessModelExtended.h.
geotess::GeoTessModelExtended::GeoTessModelExtended | ( | ) |
Default constructor.
This class is an example of a class that extends GeoTessModel. It does everything a GeoTessModel can do but adds an extra data item to the model. In this example, the extra data is just a simple String, but in real models that extend GeoTessModel, it could be anything.
Classes that extend GeoTessModel should provide implementations of all the GeoTessModel constructors with the first thing that they do is call the super class constructor.
In addition, classes that extend GeoTessModel should override 4 IO functions: loadModelBinary, writeModelBinary, loadModelAscii, writeModelAscii. See examples below.
The first thing that these methods do is call the super class implementations to read/write the standard GeoTessModel information. After that, the methods may read/write the application specific data from/to the end of the standard GeoTessModel file.
Definition at line 75 of file GeoTessModelExtended.cc.
geotess::GeoTessModelExtended::GeoTessModelExtended | ( | const string & | modelInputFile, |
const string & | relativeGridPath | ||
) |
Construct a new GeoTessModel object and populate it with information from the specified file.
modelInputFile | name of file containing the model. |
relativeGridPath | the relative path from the directory where the model is stored to the directory where the grid is stored. Often, the model and grid are stored together in the same file in which case this parameter is ignored. Sometimes, however, the grid is stored in a separate file and only the name of the grid file (without path information) is stored in the model file. In this case, the code needs to know which directory to search for the grid file. The default is "" (empty string), which will cause the code to search for the grid file in the same directory in which the model file resides. Bottom line is that the default value is appropriate when the grid is stored in the same file as the model, or the model file is in the same directory as the model file. |
Extend basemodel constructor by initializing extraData.
Definition at line 84 of file GeoTessModelExtended.cc.
geotess::GeoTessModelExtended::GeoTessModelExtended | ( | const string & | modelInputFile | ) |
Construct a new GeoTessModel object and populate it with information from the specified file.
relativeGridPath is assumed to be "" (empty string), which is appropriate when the grid information is stored in the same file as the model or when the grid is stored in a separate file located in the same directory as the model file.
modelInputFile | name of file containing the model. |
Extend basemodel constructor by initializing extraData.
Definition at line 94 of file GeoTessModelExtended.cc.
geotess::GeoTessModelExtended::GeoTessModelExtended | ( | vector< int > & | attributeFilter | ) |
Default constructor.
attributeFilter | the indexes of available attributes that should be loaded into memory. |
Extend basemodel constructor by initializing extraData.
Definition at line 104 of file GeoTessModelExtended.cc.
geotess::GeoTessModelExtended::GeoTessModelExtended | ( | const string & | modelInputFile, |
const string & | relativeGridPath, | ||
vector< int > & | attributeFilter | ||
) |
Construct a new GeoTessModel object and populate it with information from the specified file.
modelInputFile | name of file containing the model. |
relativeGridPath | the relative path from the directory where the model is stored to the directory where the grid is stored. Often, the model and grid are stored together in the same file in which case this parameter is ignored. Sometimes, however, the grid is stored in a separate file and only the name of the grid file (without path information) is stored in the model file. In this case, the code needs to know which directory to search for the grid file. The default is "" (empty string), which will cause the code to search for the grid file in the same directory in which the model file resides. Bottom line is that the default value is appropriate when the grid is stored in the same file as the model, or the model file is in the same directory as the model file. |
attributeFilter | the indexes of available attributes that should be loaded into memory. |
Extend basemodel constructor by initializing extraData.
Definition at line 113 of file GeoTessModelExtended.cc.
geotess::GeoTessModelExtended::GeoTessModelExtended | ( | const string & | modelInputFile, |
vector< int > & | attributeFilter | ||
) |
Construct a new GeoTessModel object and populate it with information from the specified file.
relativeGridPath is assumed to be "" (empty string), which is appropriate when the grid information is stored in the same file as the model or when the grid is stored in a separate file located in the same directory as the model file.
modelInputFile | name of file containing the model. |
attributeFilter | the indexes of available attributes that should be loaded into memory. |
Extend basemodel constructor by initializing extraData.
Definition at line 124 of file GeoTessModelExtended.cc.
geotess::GeoTessModelExtended::GeoTessModelExtended | ( | const string & | gridFileName, |
GeoTessMetaData * | metaData | ||
) |
Parameterized constructor, specifying the grid and metadata for the model. The grid is constructed and the data structures are initialized based on information supplied in metadata. The data structures are not populated with any information however (all Profiles are null). The application should populate the new model's Profiles after this constructor completes.
Before calling this constructor, the supplied MetaData object must be populated with required information by calling the following MetaData methods:
gridFileName | name of file from which to load the grid. |
metaData | MetaData the new GeoTessModel instantiates a reference to the supplied metaData. No copy is made. |
GeoTessException | if metadata is incomplete. |
Extend basemodel constructor by initializing extraData.
Definition at line 134 of file GeoTessModelExtended.cc.
geotess::GeoTessModelExtended::GeoTessModelExtended | ( | GeoTessGrid * | grid, |
GeoTessMetaData * | metaData | ||
) |
Parameterized constructor, specifying the grid and metadata for the model. The grid is constructed and the data structures are initialized based on information supplied in metadata. The data structures are not populated with any information however (all Profiles are null). The application should populate the new model's Profiles after this constructor completes.
Before calling this constructor, the supplied MetaData object must be populated with required information by calling the following MetaData methods:
grid | a pointer to the GeoTessGrid that will support this GeoTessModel. GeoTessModel assumes ownership of the supplied grid object and will delete it when it is done with it. |
metaData | MetaData the new GeoTessModel instantiates a reference to the supplied metaData. No copy is made. |
GeoTessException | if metadata is incomplete. |
Extend basemodel constructor by initializing extraData.
Definition at line 143 of file GeoTessModelExtended.cc.
geotess::GeoTessModelExtended::GeoTessModelExtended | ( | GeoTessModel * | baseModel | ) |
Construct a new GeoTessModelExtended by making a deep copy of an existing GeoTessModel and initializing the extra data with default values.
baseModel | pointer to an existing GeoTessModel. |
Definition at line 155 of file GeoTessModelExtended.cc.
|
virtual |
Destructor.
Definition at line 173 of file GeoTessModelExtended.cc.
|
inlinestatic |
Returns the class name.
Definition at line 175 of file GeoTessModelExtended.h.
string geotess::GeoTessModelExtended::getExtraData | ( | ) |
Retrieve the extra data stored by this derived class.
Definition at line 344 of file GeoTessModelExtended.cc.
|
inlineprivate |
Initialize the extraData.
Definition at line 116 of file GeoTessModelExtended.h.
|
protected |
Override GeoTessModel::loadModelAscii(). Applications don't call this protected method directly. It is call from GeoTessModel.loadModel().
input | ascii stream that provides input |
inputDirectory | the directory where the model file resides |
relGridFilePath | the relative path from the directory where the model file resides to the directory where the grid file resides. |
GeoTessException | Override GeoTessModel::loadModelAscii() |
input | ascii stream that provides input |
inputDirectory | the directory where the model file resides |
relGridFilePath | the relative path from the directory where the model file resides to the directory where the grid file resides. |
GeoTessException |
Definition at line 188 of file GeoTessModelExtended.cc.
|
protected |
Override GeoTessModel::loadModelBinary() Applications don't call this protected method directly. It is call from GeoTessModel.loadModel().
input | binary stream that provides input |
inputDirectory | the directory where the model file resides |
relGridFilePath | the relative path from the directory where the model file resides to the directory where the grid file resides. |
GeoTessException | Override GeoTessModel::loadModelBinary() |
input | binary stream that provides input |
inputDirectory | the directory where the model file resides |
relGridFilePath | the relative path from the directory where the model file resides to the directory where the grid file resides. |
GeoTessException |
Definition at line 240 of file GeoTessModelExtended.cc.
void geotess::GeoTessModelExtended::setExtraData | ( | const string & | xData | ) |
Modify the extra data stored by this derived class
xData | the new value |
Modify the extra data stored by this derived class
Definition at line 350 of file GeoTessModelExtended.cc.
|
protected |
Override GeoTessModel::writeModelAscii() Applications don't call this protected method directly. It is call from GeoTessModel.writeModel().
output | the output ascii stream to which model is written. |
gridFileName |
Definition at line 291 of file GeoTessModelExtended.cc.
|
protected |
Override GeoTessModel::writeModelBinary() Applications don't call this protected method directly. It is call from GeoTessModel.writeModel().
output | the output ascii stream to which model is written. |
gridFileName |
Definition at line 320 of file GeoTessModelExtended.cc.
|
private |
This string is just an example that represents whatever extra data the derived class might choose to implement.
Definition at line 111 of file GeoTessModelExtended.h.