MXADataModel Class Reference

Main class used to work with the DataModel paradigm. More...

Inherits IDataModel.

Inheritance diagram for MXADataModel:

Inheritance graph
[legend]
Collaboration diagram for MXADataModel:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~MXADataModel ()
 MXA_SHARED_POINTERS (MXADataModel)
 MXA_TYPE_MACRO (MXADataModel)
float getModelVersion ()
 Returns the MXA File version that the model adheres to.
void setModelVersion (float version)
 Sets the File Version of the MXA data file.
std::string getModelType ()
 Returns the type of file, should be MXA.
void setModelType (const std::string &modelType)
 Sets the file type. Should be MHD or MXA.
void setDefaultTypeAndVersion ()
 Sets the model type and version to the latest supported by this API.
void setDataRoot (const std::string &dataRoot)
 Sets the "Data Root".
std::string getDataRoot ()
 Returns the Data Root Value.
void addDataDimension (IDataDimension::Pointer dimension)
 Adds a Data Dimension to the end of the Data Dimension data structure thus making the index of the added dimension the largest of all the dimensions.
IDataDimension::Pointer addDataDimension (std::string name, std::string altName, int32 count, int32 startValue, int32 endValue, int32 increment, int32 uniform)
 Creates and adds a new Data Dimension to the Model.
int32 insertDataDimension (IDataDimension::Pointer dimension, int32 index)
 Inserts a Data Dimension at a given index position. If Needed the internal data structure holding the Data Dimenions will be expanded by adding NULL data dimension pointers into the data structure.
void squeezeDataDimensions ()
 This method will remove any NULL Data Dimensions from the internal data structure that holds the list of Data Dimensions.
int32 removeDataDimension (int32 index)
 Removes a data dimension by index.
int32 removeDataDimension (const std::string &dimensionName)
 Removed a Data Dimension by Name.
int32 moveDataDimension (int32 fromIndex, int32 toIndex)
 moves the data dimension at index 'fromIndex' to another index 'newIndex'. All Data Dimensions have new indices assigned to them after this operation.
int32 swapDataDimensions (int32 index1, int32 index2)
 Swaps a pair of Data Dimensions in the index list.
IDataDimension::ContainergetDataDimensions ()
 Returns the vector of Data Dimenions.
IDataDimension::Pointer getDataDimension (int32 index)
 Returns a Data dimension object given an index.
IDataDimension::Pointer getDataDimension (std::string dimName)
 Returns a Data Dimension object given the name of the data dimension.
int32 getNumberOfDataDimensions ()
 
Returns:
The Number of data dimensions

void addDataRecord (IDataRecord::Pointer record)
 Adds a Data Record given a DataRecord shared pointer.
void addDataRecord (IDataRecord::Pointer record, IDataRecord::Pointer parent)
 Adds a Data Record to the model with the given parent record as the data records parent.
int32 removeDataRecord (IDataRecord::Pointer record)
 Removes the Data Record from the Model.
IDataRecord::ContainergetDataRecords ()
 Returns the Hierarchy of Data Records.
IDataRecord::Pointer getDataRecordByNamedPath (const std::string &path, IDataRecord *parent=NULL)
 Returns a Data Record object from the given path.
IDataRecord::Pointer getDataRecordByInternalPath (const std::string &path, IDataRecord *parent=NULL)
 Returns a Data Record based on an internal path representation.
MXATypes::MXAError setRequiredMetaData (std::string researcherName, std::string dateCreated, std::string datasetName, std::string description, std::string distributionRights, std::string releaseNumber, std::string pedigree, std::string derivedSrcFile)
 Sets the required meta data fields.
MXATypes::MXAError setRequiredMetaData (std::map< std::string, std::string > &metadata)
 Sets the Required Meta Data Fields given a std::map object.
int32 setRequiredMetaData (IRequiredMetaData::Pointer metaData)
 Sets the required meta data.
IRequiredMetaData::Pointer getRequiredMetaData ()
 Returns the RequiredMeta Data in the provided std::map.
void addUserMetaData (const std::string &attributeKey, IMXAArray::Pointer umd)
 Adds User defined Meta data to the model.
void removeUserMetaData (const std::string &attributeKey)
 Removes specific user meta-data entry.
IMXAArray::Pointer getUserMetaData (const std::string &attributeKey)
 Returns a specific User meta data item.
void setUserMetaData (MXAAbstractAttributes &attributes)
 Sets all the user defined meta data for this model.Any previously defined meta data will be erased.
MXAAbstractAttributes getUserMetaData ()
 Returns the Data Structure used to hold the user defined Meta Data.
void addSupportFile (ISupportFile::Pointer supportFile, bool updateIndex=false)
 Adds a SupportFile Reference to the model.
ISupportFile::Container getSupportFiles ()
 Returns the list of SupportFile objects from the model.
ISupportFile::Pointer getSupportFile (int index)
 Returns a specific ISupportFile instance from the model or a NULL wrapped pointer in case nothing was found or index is out of bounds.
void printModel (std::ostream &os, int32 indent)
 Prints the Data Model to the provided std::ostream.
void printDataRecords (std::ostream &os, int32 indent)
 Prints the Data Records section of the model to the provided std::ostream.
void printDataDimensions (std::ostream &os, int32 indent)
 Prints the Data Dimension section of the model to the provided std::ostream.
void printRequiredMetaData (std::ostream &os, int32 indent)
 Prints the Required Meta Data section of the model to the provided std::ostream.
void printUserMetaData (std::ostream &os, int32 indent)
 Prints the User Meta Data section of the model to the provided std::ostream.
bool isValid (std::string &message)
 Performs some basic checks to make sure the model is valid.

Static Public Member Functions

static MXADataModel::Pointer New (float modelVersion=0.4f, const std::string &type=MXA::MXACurrentFileType, const std::string &dataRoot="Data")
 Static method to create a new blank model.
static MXADataModel::Pointer New (IDataModel::Pointer model)
 Static method to create a new by creating a deep copy of another model.
static MXATypes::MXAError validateRequiredMetaData (MXARequiredMetaData &requiredMetaData, std::string &message)
 Validates that all the required Meta data is not empty.

Protected Member Functions

 MXADataModel ()

Private Member Functions

 MXADataModel (const MXADataModel &)
void operator= (const MXADataModel &)

Private Attributes

float _fileVersion
std::string _fileType
std::string _dataRoot
IDataDimension::Container _dataDimensions
IDataRecord::Container _dataRecords
IRequiredMetaData::Pointer _requiredMetaData
MXAAbstractAttributes _userMetaData
ISupportFile::Container _supportFiles

Detailed Description

Main class used to work with the DataModel paradigm.

Author:
Mike Jackson
Date:
March 2007
Version:
1.36


Constructor & Destructor Documentation

MXADataModel::~MXADataModel (  )  [virtual]

MXADataModel::MXADataModel (  )  [protected]

MXADataModel::MXADataModel ( const MXADataModel  )  [private]


Member Function Documentation

MXADataModel::MXA_SHARED_POINTERS ( MXADataModel   ) 

MXADataModel::MXA_TYPE_MACRO ( MXADataModel   ) 

MXADataModel::Pointer MXADataModel::New ( float  modelVersion = 0.4f,
const std::string &  type = MXA::MXACurrentFileType,
const std::string &  dataRoot = "Data" 
) [static]

Static method to create a new blank model.

Returns:
A boost shard_ptr to the newly created model

static MXADataModel::Pointer MXADataModel::New ( IDataModel::Pointer  model  )  [static]

Static method to create a new by creating a deep copy of another model.

Returns:
A boost shard_ptr to the newly created model

MXATypes::MXAError MXADataModel::validateRequiredMetaData ( MXARequiredMetaData requiredMetaData,
std::string &  message 
) [static]

Validates that all the required Meta data is not empty.

Parameters:
requiredMetaData 
message String to store messages regarding missing field
Returns:
Error - Negative is error. Zero or Positive is success

float MXADataModel::getModelVersion (  )  [virtual]

Returns the MXA File version that the model adheres to.

Returns:
MXA API Version

Implements IDataModel.

void MXADataModel::setModelVersion ( float  version  )  [virtual]

Sets the File Version of the MXA data file.

Parameters:
version The API Version we are going to write

Implements IDataModel.

std::string MXADataModel::getModelType (  )  [virtual]

Returns the type of file, should be MXA.

Returns:
The Model Type. Should be MXA::CurrentModelType

Implements IDataModel.

void MXADataModel::setModelType ( const std::string &  modelType  )  [virtual]

Sets the file type. Should be MHD or MXA.

Parameters:
modelType The Model Type for this model. Typically it should be MXA::CurrentModelType

Implements IDataModel.

void MXADataModel::setDefaultTypeAndVersion (  )  [virtual]

Sets the model type and version to the latest supported by this API.

Implements IDataModel.

void MXADataModel::setDataRoot ( const std::string &  dataRoot  )  [virtual]

Sets the "Data Root".

Parameters:
dataRoot 

Implements IDataModel.

std::string MXADataModel::getDataRoot (  )  [virtual]

Returns the Data Root Value.

Returns:

Implements IDataModel.

void MXADataModel::addDataDimension ( IDataDimension::Pointer  dimension  )  [virtual]

Adds a Data Dimension to the end of the Data Dimension data structure thus making the index of the added dimension the largest of all the dimensions.

Parameters:
dimension The IDataDimension to be added to the list of dimensions.

Implements IDataModel.

IDataDimension::Pointer MXADataModel::addDataDimension ( std::string  name,
std::string  altName,
int32  count,
int32  startValue,
int32  endValue,
int32  increment,
int32  uniform 
) [virtual]

Creates and adds a new Data Dimension to the Model.

Parameters:
name The name for the Data Dimensions
altName An Alternate Name for the Data Dimension
count The total number of
startValue The value this dimension starts at
endValue The ending value (inclusive) this dimension ends at
increment The value to increment the dimension when iterating
uniform Are the values uniform across the start to end values
Returns:
A boost::shared_ptr to the newly created Data Dimension

Implements IDataModel.

int32 MXADataModel::insertDataDimension ( IDataDimension::Pointer  dimension,
int32  index 
) [virtual]

Inserts a Data Dimension at a given index position. If Needed the internal data structure holding the Data Dimenions will be expanded by adding NULL data dimension pointers into the data structure.

Parameters:
dimension The Data Dimension to Insert
index The index to insert the Data Dimension at
Returns:
Error condition

Implements IDataModel.

void MXADataModel::squeezeDataDimensions (  )  [virtual]

This method will remove any NULL Data Dimensions from the internal data structure that holds the list of Data Dimensions.

Implements IDataModel.

int32 MXADataModel::removeDataDimension ( int32  index  )  [virtual]

Removes a data dimension by index.

Parameters:
index 

Implements IDataModel.

int32 MXADataModel::removeDataDimension ( const std::string &  dimensionName  ) 

Removed a Data Dimension by Name.

Parameters:
dimensionName The 'name' property of the Data Dimension to remove
Returns:
Error: Negative is error condition

int32 MXADataModel::moveDataDimension ( int32  fromIndex,
int32  toIndex 
) [virtual]

moves the data dimension at index 'fromIndex' to another index 'newIndex'. All Data Dimensions have new indices assigned to them after this operation.

Parameters:
fromIndex The current index of the data dimension to move
toIndex The new index to place the data dimension at
Returns:
Error condition

Implements IDataModel.

int32 MXADataModel::swapDataDimensions ( int32  index1,
int32  index2 
) [virtual]

Swaps a pair of Data Dimensions in the index list.

Parameters:
index1 The first Data Dimension
index2 The second Data Dimension to swap with the first
Returns:
Error Condition

Implements IDataModel.

IDataDimension::Container & MXADataModel::getDataDimensions (  )  [virtual]

Returns the vector of Data Dimenions.

Returns:

Implements IDataModel.

IDataDimension::Pointer MXADataModel::getDataDimension ( int32  index  )  [virtual]

Returns a Data dimension object given an index.

Parameters:
index 
Returns:

Implements IDataModel.

IDataDimension::Pointer MXADataModel::getDataDimension ( std::string  dimName  )  [virtual]

Returns a Data Dimension object given the name of the data dimension.

Parameters:
dimName 
Returns:

Implements IDataModel.

int32 MXADataModel::getNumberOfDataDimensions (  )  [virtual]

Returns:
The Number of data dimensions

Implements IDataModel.

void MXADataModel::addDataRecord ( IDataRecord::Pointer  record  )  [virtual]

Adds a Data Record given a DataRecord shared pointer.

Parameters:
record 

Implements IDataModel.

void MXADataModel::addDataRecord ( IDataRecord::Pointer  record,
IDataRecord::Pointer  parent 
) [virtual]

Adds a Data Record to the model with the given parent record as the data records parent.

Parameters:
record The data record to add to the model
parent The parent of the data record
Returns:

Implements IDataModel.

int32 MXADataModel::removeDataRecord ( IDataRecord::Pointer  record  )  [virtual]

Removes the Data Record from the Model.

Parameters:
record The record to remove from the Data model
Returns:
Error Condition

Implements IDataModel.

IDataRecord::Container & MXADataModel::getDataRecords (  )  [virtual]

Returns the Hierarchy of Data Records.

Returns:

Implements IDataModel.

IDataRecord::Pointer MXADataModel::getDataRecordByNamedPath ( const std::string &  path,
IDataRecord parent = NULL 
) [virtual]

Returns a Data Record object from the given path.

Parameters:
path The path to the data record
parent The parent data record
Returns:

Implements IDataModel.

IDataRecord::Pointer MXADataModel::getDataRecordByInternalPath ( const std::string &  path,
IDataRecord parent = NULL 
) [virtual]

Returns a Data Record based on an internal path representation.

Parameters:
path 
parent 
Returns:

Implements IDataModel.

int32 MXADataModel::setRequiredMetaData ( std::string  researcherName,
std::string  dateCreated,
std::string  datasetName,
std::string  description,
std::string  distributionRights,
std::string  releaseNumber,
std::string  pedigree,
std::string  derivedSrcFile 
) [virtual]

Sets the required meta data fields.

Parameters:
researcherName 
dateCreated 
datasetName 
description 
distributionRights 
releaseNumber 
pedigree 
derivedSrcFile 
Returns:

Implements IDataModel.

int32 MXADataModel::setRequiredMetaData ( std::map< std::string, std::string > &  metadata  )  [virtual]

Sets the Required Meta Data Fields given a std::map object.

Parameters:
metadata 
Returns:

Implements IDataModel.

int32 MXADataModel::setRequiredMetaData ( IRequiredMetaData::Pointer  metaData  )  [virtual]

Sets the required meta data.

Parameters:
metaData IRequiredMetaData::Pointer object

Implements IDataModel.

IRequiredMetaData::Pointer MXADataModel::getRequiredMetaData (  )  [virtual]

Returns the RequiredMeta Data in the provided std::map.

Returns:
IRequiredMetaData::Pointer

Implements IDataModel.

void MXADataModel::addUserMetaData ( const std::string &  attributeKey,
IMXAArray::Pointer  umd 
) [virtual]

Adds User defined Meta data to the model.

Parameters:
attributeKey The attribute key name
umd The Key/Value pair to append to the model

Implements IDataModel.

void MXADataModel::removeUserMetaData ( const std::string &  attributeKey  )  [virtual]

Removes specific user meta-data entry.

Parameters:
attributeKey The user meta-data to remove

Implements IDataModel.

IMXAArray::Pointer MXADataModel::getUserMetaData ( const std::string &  attributeKey  )  [virtual]

Returns a specific User meta data item.

Parameters:
attributeKey The value of the attribute key

Implements IDataModel.

void MXADataModel::setUserMetaData ( MXAAbstractAttributes attributes  )  [virtual]

Sets all the user defined meta data for this model.Any previously defined meta data will be erased.

Parameters:
attributes Vector of MXAAbstractAttributePtr objects

Implements IDataModel.

MXAAbstractAttributes MXADataModel::getUserMetaData (  )  [virtual]

Returns the Data Structure used to hold the user defined Meta Data.

Implements IDataModel.

void MXADataModel::addSupportFile ( ISupportFile::Pointer  supportFile,
bool  updateIndex = false 
) [virtual]

Adds a SupportFile Reference to the model.

Parameters:
supportFile An ISupportFile object or subclass
updateIndex Update the internal index of the supportFile Object after it is added to the model

Implements IDataModel.

ISupportFile::Container MXADataModel::getSupportFiles (  )  [virtual]

Returns the list of SupportFile objects from the model.

Returns:
The list of Support files for this model.

Implements IDataModel.

ISupportFile::Pointer MXADataModel::getSupportFile ( int  index  )  [virtual]

Returns a specific ISupportFile instance from the model or a NULL wrapped pointer in case nothing was found or index is out of bounds.

Parameters:
index The index (zero based) of the ISupportFile instance to return
Returns:
Boost Shared Pointer wrapping an ISupportFile subclass instance or NULL if nothing was found.

Implements IDataModel.

void MXADataModel::printModel ( std::ostream &  os,
int32  indent 
) [virtual]

Prints the Data Model to the provided std::ostream.

Parameters:
os 
indent The number of spaces to use for indenting
Returns:

Implements IDataModel.

void MXADataModel::printDataRecords ( std::ostream &  os,
int32  indent 
) [virtual]

Prints the Data Records section of the model to the provided std::ostream.

Parameters:
os 
indent The number of spaces to use for indenting
Returns:

Implements IDataModel.

void MXADataModel::printDataDimensions ( std::ostream &  os,
int32  indent 
) [virtual]

Prints the Data Dimension section of the model to the provided std::ostream.

Parameters:
os 
indent The number of spaces to use for indenting
Returns:

Implements IDataModel.

void MXADataModel::printRequiredMetaData ( std::ostream &  os,
int32  indent 
) [virtual]

Prints the Required Meta Data section of the model to the provided std::ostream.

Parameters:
os 
indent The number of spaces to use for indenting
Returns:

Implements IDataModel.

void MXADataModel::printUserMetaData ( std::ostream &  os,
int32  indent 
) [virtual]

Prints the User Meta Data section of the model to the provided std::ostream.

Parameters:
os 
indent The number of spaces to use for indenting
Returns:

Implements IDataModel.

bool MXADataModel::isValid ( std::string &  message  )  [virtual]

Performs some basic checks to make sure the model is valid.

Parameters:
message String to store messages relating to errors/omissions about the model

Implements IDataModel.

void MXADataModel::operator= ( const MXADataModel  )  [private]


Member Data Documentation

float MXADataModel::_fileVersion [private]

std::string MXADataModel::_fileType [private]

std::string MXADataModel::_dataRoot [private]

IDataDimension::Container MXADataModel::_dataDimensions [private]

IDataRecord::Container MXADataModel::_dataRecords [private]

IRequiredMetaData::Pointer MXADataModel::_requiredMetaData [private]

MXAAbstractAttributes MXADataModel::_userMetaData [private]

ISupportFile::Container MXADataModel::_supportFiles [private]


The documentation for this class was generated from the following files:
Generated on Tue Nov 17 18:43:15 2009 for MXADataModel by  doxygen 1.5.2