Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

sedris::seHelperDataTable Class Reference
[Utility Classes]

#include <seHelperDataTable.h>

List of all members.

Public Member Functions

 seHelperDataTable ()
 Constructor.

 seHelperDataTable (const seHelperDataTable &other)
 Copy constructor.

seHelperDataTableoperator= (const seHelperDataTable &other)
 Assignment.

virtual ~seHelperDataTable ()
 Destructor.

void init (seDRMDataTable &data_table, SE_Integer_Positive tpd_index, const SE_Data_Table_Sub_Extent *extents=NULL)
const SE_Data_Table_Sub_Extent & getFullExtents ()
const SE_Data_Table_Sub_Extent & getHelperExtents ()
SE_Integer_Unsigned getCellCount ()
const SE_Table_Property_Description_Fields & getTPDFields ()
const SE_Data_Table_Data & getDTData ()
SE_Integer_Unsigned getCellIndex (SE_Short_Integer_Unsigned axes_count, SE_Integer_Unsigned axis_indices[])
void getDataValue (SE_Integer_Unsigned cell_index, SE_Single_Value &val)

Static Public Member Functions

void getDataValue (const SE_Data_Table_Data &dtd, SE_Integer_Unsigned cell_index, SE_Single_Value &val)
SE_Integer_Unsigned getValueTypeSize (SE_Data_Table_Data_Value_Type type)
 Returns the size of a data cell of the specified value type.

SE_Integer_Unsigned getTPDCount (seDRMDataTable &data_table)
SE_Integer_Unsigned getCellCount (SE_Data_Table_Sub_Extent &extents)
void allocateExtents (seDRMDataTable &data_table, SE_Data_Table_Sub_Extent &extents)
void deallocateExtents (SE_Data_Table_Sub_Extent &extents)
 Deallocates the extents allocated by allocateExtents().

void allocateDataTableData (SE_Data_Table_Data &dtd)
void deallocateDataTableData (SE_Data_Table_Data &dtd)
 Deallocates the data table data allocated by allocateDataTableData().

SE_Single_Value_Type mapDTDVTtoSVT (SE_Data_Table_Data_Value_Type type)

Protected Member Functions

void reset ()
 Resets the helper's data.

void copyFrom (const seHelperDataTable &other)
 Copy data from another.

void checkValid ()
 Checks the helper is valid.


Protected Attributes

SE_Data_Table_Sub_Extent _extents
 Extents of helper.

SE_Data_Table_Sub_Extent _full_extents
 Full extents.

SE_Table_Property_Description_Fields _tpd_flds
 TPD fields.

SE_Data_Table_Data _dt_data
 Data Table data retrieved.

SE_Integer_Unsigned * _axis_size
 For quick cell index computation.


Detailed Description

A helper for reading <Data Table> data. seHelperDataTable takes care of memory management for the data. You specify the desired <Table Property Description> and optionally the sub extents you want to retrieve. Additional methods allow for direct access to the data or wrapping into a single value.

Sample usage, cycle through all Data Table cells for a particular <Table Property Description>:

    seHelperDataTable hlpr;
    seDRMDataTable data_table;
    EDCS_Attribute_Code eac;

    //... retrieve the "data_table" object, choose tpd_index to retrieve
    //... set "eac" to the attribute code being used, from the TPD

    hlpr.init(data_table, tpd_index);
    SE_Integer_Unsigned cell_count = hlpr.getCellCount();

    for (SE_Integer_Unsigned cell_index=0; cell_index < cell_count;
        cell_index++)
    {
        SE_Single_Value val;

        hlpr.getDataValue(cell_index, val);
        SE_PrintSingleValue(eac, &val, NULL, 0); // eac is from the TPD
        SE_FreeSingleValue(&val, NULL); // don't forget to free!
    }

Sample usage, get cell value at a specific index by axis for a particular <Table Property Description> and sub-extents:

    seHelperDataTable hlpr;
    seDRMDataTable data_table;
    SE_Data_Table_Sub_Extent extents;

    //... retrieve the "data_table" object, choose tpd_index to retrieve
    //... decide sub-extents wanted from the data, or pass NULL for extents

    seHelperDataTable::allocateExtents(data_table, extents);
    // change extents values if needed

    hlpr.init(data_table, tpd_index, &extents);

    SE_Integer_Unsigned *indices = new SE_Integer_Unsigned[extents.axes_count];

    //... set "indices" array values to point to the cell you want

    // get the cell index into the data array
    SE_Integer_Unsigned cell_index = hlpr.getCellIndex(extents.axes_count, indices);

    //... from here you can index directly into the SE_Data_Table_Data
    // (see getDTData()), or put it into a single value as shown below:

    SE_Single_Value val;

    hlpr.getDataValue(cell_index, val);
    SE_PrintSingleValue(eac, &val, NULL, 0); // eac is from the TPD
    SE_FreeSingleValue(&val, NULL); // don't forget to free!

    // free resources
    seHelperDataTable::deallocateExtents(extents);
    delete[] index;

You can also use this class to modify the data in the Data Table. Just retrieve the data as shown above, modify the data by getting a reference to the DT Data structure, and pass it back to the Data Table object:

    seHelperDataTable hlpr;
    seDRMDataTable data_table;
    SE_Data_Table_Sub_Extent extents;

    //... initialize extents and helper, get cell index, as above

    const SE_Data_Table_Data &dtdata = hlpr.getDTData();

    // modify the index into dtdata
    dtdata.dt_array.single_long_float_values[cell_index] = x; // EXAMPLE

    // write back the modified data
    data_table.putDataTableData(1, &dtdata, &extents);

    // free resources...

Warning:
Operations with this class could be very expensive in terms of memory and cpu usage. Try to reduce the number of accesses to init() by caching this class as much as possible.

Be careful when using this class in STL containers, since some operations may require copy/reallocation of data which could adversely impact performance.

Author:
Warren Macchi


Constructor & Destructor Documentation

sedris::seHelperDataTable::seHelperDataTable  ) 
 

sedris::seHelperDataTable::seHelperDataTable const seHelperDataTable other  ) 
 

virtual sedris::seHelperDataTable::~seHelperDataTable  )  [virtual]
 


Member Function Documentation

void sedris::seHelperDataTable::allocateDataTableData SE_Data_Table_Data &  dtd  )  [static]
 

Allocates an array of cells for a particular value type. All non-dynamic fields should be set appropriately or this method will fail.

Note:
A typical use of this method is for writing new Data Table data, not for reading (since this helper provides that functionality). Use deallocateDataTableData() to deallocate the memory.

void sedris::seHelperDataTable::allocateExtents seDRMDataTable data_table,
SE_Data_Table_Sub_Extent &  extents
[static]
 

Retrieves the extents information for a <Data Table> object. Use deallocateExtents() to deallocate the memory.

void sedris::seHelperDataTable::checkValid  )  [inline, protected]
 

void sedris::seHelperDataTable::copyFrom const seHelperDataTable other  )  [protected]
 

void sedris::seHelperDataTable::deallocateDataTableData SE_Data_Table_Data &  dtd  )  [static]
 

void sedris::seHelperDataTable::deallocateExtents SE_Data_Table_Sub_Extent &  extents  )  [static]
 

SE_Integer_Unsigned sedris::seHelperDataTable::getCellCount SE_Data_Table_Sub_Extent &  extents  )  [static]
 

Retrieves the number of cells in the passed-in extents. You can use this method in combination with allocateExtents() to get information about the <Data Table> object before getting the actual data.

See also:
allocateExtents(), getTPDCount()

SE_Integer_Unsigned sedris::seHelperDataTable::getCellCount  ) 
 

Returns the number of cells in the helper's extents. This is the same value stored in the Data Table Data structure, obtained from getDTData().

SE_Integer_Unsigned sedris::seHelperDataTable::getCellIndex SE_Short_Integer_Unsigned  axes_count,
SE_Integer_Unsigned  axis_indices[]
 

Returns the index for an axis-indexed cell into the value pointers in the DT Data structure. The axes_count MUST match the number of axes in the <Data Table>, and the axis_indices values MUST be within the extents used to initialize this helper (that is, if the start extent for the first axis was 7, then axis_indices[0] must be >= 7).

See also:
getDTData(), getHelperExtents(), getFullExtents()
Parameters:
axes_count in: the number of entries in the axis_indices parameter, which should be equal to the number of axes in the Data Table.
axis_indices in: an array specifying the indices of the particular cell requested.

void sedris::seHelperDataTable::getDataValue const SE_Data_Table_Data &  dtd,
SE_Integer_Unsigned  cell_index,
SE_Single_Value &  val
[static]
 

Gets the value at the specified cell index.

Note:
You are responsible for freeing the value returned (e.g. string values).
Parameters:
dtd in: a reference to the DT Data structure to retrieve the value from
cell_index in: the cell index requested
val in/out: will be set to the value for the specified cell

void sedris::seHelperDataTable::getDataValue SE_Integer_Unsigned  cell_index,
SE_Single_Value &  val
 

Gets the value at the specified cell index. You can get a cell index value for an axis-index by using getCellIndex().

Note:
You are responsible for freeing the value returned (e.g. string values).
See also:
getCellIndex()
Parameters:
cell_index in: the cell index requested
val in/out: will be set to the value for the specified cell

const SE_Data_Table_Data& sedris::seHelperDataTable::getDTData  ) 
 

Returns a reference to the data for the helper's extents. You can use the appropriate pointer indexed by the index returned by getCellIndex() to get to the value you want.

Since the data table data is managed by this class (users don't need to free it), you can keep an instance of this class as long as you need access to the Data Table's data. This is true even if the transmittal is closed or the Data Table object used to initialize the helper goes out of scope.

See also:
getCellIndex()

const SE_Data_Table_Sub_Extent& sedris::seHelperDataTable::getFullExtents  ) 
 

Returns the full extents of the <Data Table> data. If you want to retrieve the extents used to initialize this helper, use getHelperExtents().

See also:
getHelperExtents()

const SE_Data_Table_Sub_Extent& sedris::seHelperDataTable::getHelperExtents  ) 
 

Returns the extents used to retrieve the <Data Table> data. The extents returned are the same extents that were used to initialize this helper (which could be the full extents if none was specified).

See also:
getFullExtents()

SE_Integer_Unsigned sedris::seHelperDataTable::getTPDCount seDRMDataTable data_table  )  [static]
 

Retrieves the number of <Table Property Description>'s for a <Data Table> object. You can use this method in combination with allocateExtents() to get information about the <Data Table> object before getting the actual data.

See also:
getCellCount(), allocateExtents()

const SE_Table_Property_Description_Fields& sedris::seHelperDataTable::getTPDFields  ) 
 

Returns the fields of the <Table Property Description> used to initialize this helper.

See also:
init()

SE_Integer_Unsigned sedris::seHelperDataTable::getValueTypeSize SE_Data_Table_Data_Value_Type  type  )  [static]
 

void sedris::seHelperDataTable::init seDRMDataTable data_table,
SE_Integer_Positive  tpd_index,
const SE_Data_Table_Sub_Extent *  extents = NULL
 

Initialize the helper and retrieve data from a <Data Table>. The tpd_index is a 1-based index indicating which <Table Property Description> object the helper should retrieve data for.

Optional extents limits the retrieval of data to a subset of the full extents of the <Data Table> data. For performance reasons, always try to retrieve the largest extent you need to process (rather than several smaller extents).

You can use allocateExtents() to retrieve the extents of the data in a <Data Table> object before calling this function. This is useful, for example, to specify a reduced extent.

Note:
After calling this function, any previous data allocated by this class is freed (hence all previously returned pointers become invalid).
See also:
allocateExtents()
Parameters:
data_table in: the object handle to the Data Table
tpd_index in: the Table Property Description to be returned.
extents in (optional): specifies a sub-extent of data to be retrieved, rather than the full extents.

SE_Single_Value_Type sedris::seHelperDataTable::mapDTDVTtoSVT SE_Data_Table_Data_Value_Type  type  )  [static]
 

Returns an appropriate mapping for using Single Values.

Exceptions:
seException if the type can't be mapped to a single value.
Note:
SE_DTD_VT_INDEX_CODE and SE_DTD_VT_INDEX are mapped to SE_SVT_INDEX.

seHelperDataTable& sedris::seHelperDataTable::operator= const seHelperDataTable other  ) 
 

void sedris::seHelperDataTable::reset  )  [protected]
 


Member Data Documentation

SE_Integer_Unsigned* sedris::seHelperDataTable::_axis_size [protected]
 

SE_Data_Table_Data sedris::seHelperDataTable::_dt_data [protected]
 

SE_Data_Table_Sub_Extent sedris::seHelperDataTable::_extents [protected]
 

SE_Data_Table_Sub_Extent sedris::seHelperDataTable::_full_extents [protected]
 

SE_Table_Property_Description_Fields sedris::seHelperDataTable::_tpd_flds [protected]
 


The documentation for this class was generated from the following file:
SEDRIS Transmittal Access C++ API 4.0.0 beta - 14 Jul 2004
Copyright © 2004 SEDRIS Docs by Doxygen 1.3.2