OSSIM - Open Source Software Image Map
Version 1.9.0 (20180803)
|
Contains instance data from one data record (DR). More...
#include <ossimIso8211.h>
Public Member Functions | |
ossimDDFRecord (ossimDDFModule *) | |
~ossimDDFRecord () | |
ossimDDFRecord * | Clone () |
Make a copy of a record. More... | |
ossimDDFRecord * | CloneOn (ossimDDFModule *) |
Recreate a record referencing another module. More... | |
void | Dump (FILE *) |
Write out record contents to debugging file. More... | |
int | GetFieldCount () |
Get the number of DDFFields on this record. More... | |
ossimDDFField * | FindField (const char *, int=0) |
Find the named field within this record. More... | |
ossimDDFField * | GetField (int) |
Fetch field object based on index. More... | |
int | GetIntSubfield (const char *, int, const char *, int, int *=NULL) |
Fetch value of a subfield as an integer. More... | |
double | GetFloatSubfield (const char *, int, const char *, int, int *=NULL) |
Fetch value of a subfield as a float (double). More... | |
const char * | GetStringSubfield (const char *, int, const char *, int, int *=NULL) |
Fetch value of a subfield as a string. More... | |
int | SetIntSubfield (const char *pszField, int iFieldIndex, const char *pszSubfield, int iSubfieldIndex, int nValue) |
Set an integer subfield in record. More... | |
int | SetStringSubfield (const char *pszField, int iFieldIndex, const char *pszSubfield, int iSubfieldIndex, const char *pszValue, int nValueLength=-1) |
Set a string subfield in record. More... | |
int | SetFloatSubfield (const char *pszField, int iFieldIndex, const char *pszSubfield, int iSubfieldIndex, double dfNewValue) |
Set a float subfield in record. More... | |
int | GetDataSize () |
Fetch size of records raw data (GetData()) in bytes. More... | |
const char * | GetData () |
Fetch the raw data for this record. More... | |
ossimDDFModule * | GetModule () |
Fetch the DDFModule with which this record is associated. More... | |
int | ResizeField (ossimDDFField *poField, int nNewDataSize) |
Alter field data size within record. More... | |
int | DeleteField (ossimDDFField *poField) |
Delete a field instance from a record. More... | |
ossimDDFField * | AddField (ossimDDFFieldDefn *) |
Add a new field to record. More... | |
int | CreateDefaultFieldInstance (ossimDDFField *poField, int iIndexWithinField) |
Initialize default instance. More... | |
int | SetFieldRaw (ossimDDFField *poField, int iIndexWithinField, const char *pachRawData, int nRawDataSize) |
Set the raw contents of a field instance. More... | |
int | UpdateFieldRaw (ossimDDFField *poField, int iIndexWithinField, int nStartOffset, int nOldSize, const char *pachRawData, int nRawDataSize) |
int | Write () |
Write record out to module. More... | |
int | Read () |
void | Clear () |
int | ResetDirectory () |
Private Member Functions | |
int | ReadHeader () |
Private Attributes | |
ossimDDFModule * | poModule |
int | nReuseHeader |
int | nFieldOffset |
int | _sizeFieldTag |
int | _sizeFieldPos |
int | _sizeFieldLength |
int | nDataSize |
char * | pachData |
int | nFieldCount |
ossimDDFField * | paoFields |
int | bIsClone |
Contains instance data from one data record (DR).
The data is contained as a list of DDFField instances partitioning the raw data into fields.
Definition at line 385 of file ossimIso8211.h.
ossimDDFRecord::ossimDDFRecord | ( | ossimDDFModule * | poModuleIn | ) |
Definition at line 45 of file ossimDdfrecord.cpp.
References _sizeFieldLength, _sizeFieldPos, _sizeFieldTag, bIsClone, nDataSize, nFieldCount, nFieldOffset, nReuseHeader, pachData, paoFields, and poModule.
Referenced by Clone().
ossimDDFRecord::~ossimDDFRecord | ( | ) |
Definition at line 71 of file ossimDdfrecord.cpp.
References bIsClone, Clear(), poModule, and ossimDDFModule::RemoveCloneRecord().
ossimDDFField * ossimDDFRecord::AddField | ( | ossimDDFFieldDefn * | poDefn | ) |
Add a new field to record.
Add a new zero sized field to the record. The new field is always added at the end of the record.
NOTE: This method doesn't currently update the header information for the record to include the field information for this field, so the resulting record image isn't suitable for writing to disk. However, everything else about the record state should be updated properly to reflect the new field.
poDefn | the definition of the field to be added. |
Definition at line 1151 of file ossimDdfrecord.cpp.
References CreateDefaultFieldInstance(), GetData(), GetDataSize(), ossimDDFField::Initialize(), nFieldCount, and paoFields.
void ossimDDFRecord::Clear | ( | ) |
Definition at line 230 of file ossimDdfrecord.cpp.
References nDataSize, nFieldCount, nReuseHeader, pachData, and paoFields.
Referenced by ReadHeader(), ossimDDFModule::Rewind(), and ~ossimDDFRecord().
ossimDDFRecord * ossimDDFRecord::Clone | ( | ) |
Make a copy of a record.
This method is used to make a copy of a record that will become (mostly) the properly of application. However, it is automatically destroyed if the DDFModule it was created relative to is destroyed, as it's field and subfield definitions relate to that DDFModule. However, it does persist even when the record returned by DDFModule::ReadRecord() is invalidated, such as when reading a new record. This allows an application to cache whole DDFRecords.
Definition at line 847 of file ossimDdfrecord.cpp.
References ossimDDFModule::AddCloneRecord(), bIsClone, ossimDDFField::GetData(), ossimDDFField::GetDataSize(), ossimDDFField::Initialize(), nDataSize, nFieldCount, nFieldOffset, nReuseHeader, ossimDDFRecord(), pachData, paoFields, and poModule.
Referenced by CloneOn().
ossimDDFRecord * ossimDDFRecord::CloneOn | ( | ossimDDFModule * | poTargetModule | ) |
Recreate a record referencing another module.
Works similarly to the DDFRecord::Clone() method, but creates the new record with reference to a different DDFModule. All DDFFieldDefn references are transcribed onto the new module based on field names. If any fields don't have a similarly named field on the target module the operation will fail. No validation of field types and properties is done, but this operation is intended only to be used between modules with matching definitions of all affected fields.
The new record will be managed as a clone by the target module in a manner similar to regular clones.
poTargetModule | the module on which the record copy should be created. |
Definition at line 903 of file ossimDdfrecord.cpp.
References ossimDDFModule::AddCloneRecord(), Clone(), ossimDDFModule::FindFieldDefn(), ossimDDFField::GetData(), ossimDDFField::GetDataSize(), ossimDDFField::GetFieldDefn(), ossimDDFFieldDefn::GetName(), ossimDDFField::Initialize(), nFieldCount, paoFields, poModule, and ossimDDFModule::RemoveCloneRecord().
int ossimDDFRecord::CreateDefaultFieldInstance | ( | ossimDDFField * | poField, |
int | iIndexWithinField | ||
) |
Initialize default instance.
This method is normally only used internally by the AddField() method to initialize the new field instance with default subfield values. It installs default data for one instance of the field in the record using the DDFFieldDefn::GetDefaultValue() method and DDFRecord::SetFieldRaw().
poField | the field within the record to be assign a default instance. |
iIndexWithinField | the instance to set (may not have been tested with values other than 0). |
Definition at line 1500 of file ossimDdfrecord.cpp.
References ossimDDFFieldDefn::GetDefaultValue(), ossimDDFField::GetFieldDefn(), and SetFieldRaw().
Referenced by AddField(), SetFloatSubfield(), SetIntSubfield(), and SetStringSubfield().
int ossimDDFRecord::DeleteField | ( | ossimDDFField * | poTarget | ) |
Delete a field instance from a record.
Remove a field from this record, cleaning up the data
portion and repacking the fields list. We don't try to
reallocate the data area of the record to be smaller.
NOTE: This method doesn't actually remove the header
information for this field from the record tag list yet.
This should be added if the resulting record is even to be
written back to disk!
poTarget | the field instance on this record to delete. |
Definition at line 972 of file ossimDdfrecord.cpp.
References nFieldCount, paoFields, and ResizeField().
void ossimDDFRecord::Dump | ( | FILE * | fp | ) |
Write out record contents to debugging file.
A variety of information about this record, and all it's fields and subfields is written to the given debugging file handle. Note that field definition information (ala DDFFieldDefn) isn't written.
fp | The standard io file handle to write to. ie. stderr |
Definition at line 94 of file ossimDdfrecord.cpp.
References _sizeFieldLength, _sizeFieldPos, _sizeFieldTag, ossimDDFField::Dump(), nDataSize, nFieldCount, nReuseHeader, and paoFields.
ossimDDFField * ossimDDFRecord::FindField | ( | const char * | pszName, |
int | iFieldIndex = 0 |
||
) |
Find the named field within this record.
pszName | The name of the field to fetch. The comparison is case insensitive. |
iFieldIndex | The instance of this field to fetch. Use zero (the default) for the first instance. |
Definition at line 587 of file ossimDdfrecord.cpp.
References ossimDDFField::GetFieldDefn(), ossimDDFFieldDefn::GetName(), nFieldCount, and paoFields.
Referenced by GetFloatSubfield(), GetIntSubfield(), GetStringSubfield(), ossimAdrgHeader::parse(), SetFloatSubfield(), SetIntSubfield(), and SetStringSubfield().
|
inline |
Fetch the raw data for this record.
The returned pointer is effectively to the data for the first field of the record, and is of size GetDataSize().
Definition at line 427 of file ossimIso8211.h.
References pachData.
Referenced by AddField(), and ResizeField().
|
inline |
Fetch size of records raw data (GetData()) in bytes.
Definition at line 420 of file ossimIso8211.h.
References nDataSize.
Referenced by AddField(), and ResizeField().
ossimDDFField * ossimDDFRecord::GetField | ( | int | i | ) |
Fetch field object based on index.
i | The index of the field to fetch. Between 0 and GetFieldCount()-1. |
Definition at line 617 of file ossimDdfrecord.cpp.
References nFieldCount, and paoFields.
Referenced by ResetDirectory().
|
inline |
Get the number of DDFFields on this record.
Definition at line 397 of file ossimIso8211.h.
References nFieldCount.
double ossimDDFRecord::GetFloatSubfield | ( | const char * | pszField, |
int | iFieldIndex, | ||
const char * | pszSubfield, | ||
int | iSubfieldIndex, | ||
int * | pnSuccess = NULL |
||
) |
Fetch value of a subfield as a float (double).
This is a convenience function for fetching a subfield of a field within this record.
pszField | The name of the field containing the subfield. |
iFieldIndex | The instance of this field within the record. Use zero for the first instance of this field. |
pszSubfield | The name of the subfield within the selected field. |
iSubfieldIndex | The instance of this subfield within the record. Use zero for the first instance. |
pnSuccess | Pointer to an int which will be set to true if the fetch succeeds, or false if it fails. Use NULL if you don't want to check success. |
Definition at line 712 of file ossimDdfrecord.cpp.
References ossimDDFSubfieldDefn::ExtractFloatData(), FindField(), ossimDDFFieldDefn::FindSubfieldDefn(), ossimDDFField::GetFieldDefn(), ossimDDFField::GetSubfieldData(), and pachData.
int ossimDDFRecord::GetIntSubfield | ( | const char * | pszField, |
int | iFieldIndex, | ||
const char * | pszSubfield, | ||
int | iSubfieldIndex, | ||
int * | pnSuccess = NULL |
||
) |
Fetch value of a subfield as an integer.
This is a convenience function for fetching a subfield of a field within this record.
pszField | The name of the field containing the subfield. |
iFieldIndex | The instance of this field within the record. Use zero for the first instance of this field. |
pszSubfield | The name of the subfield within the selected field. |
iSubfieldIndex | The instance of this subfield within the record. Use zero for the first instance. |
pnSuccess | Pointer to an int which will be set to true if the fetch succeeds, or false if it fails. Use NULL if you don't want to check success. |
Definition at line 646 of file ossimDdfrecord.cpp.
References ossimDDFSubfieldDefn::ExtractIntData(), FindField(), ossimDDFFieldDefn::FindSubfieldDefn(), ossimDDFField::GetFieldDefn(), ossimDDFField::GetSubfieldData(), and pachData.
|
inline |
Fetch the DDFModule with which this record is associated.
Definition at line 433 of file ossimIso8211.h.
References poModule.
const char * ossimDDFRecord::GetStringSubfield | ( | const char * | pszField, |
int | iFieldIndex, | ||
const char * | pszSubfield, | ||
int | iSubfieldIndex, | ||
int * | pnSuccess = NULL |
||
) |
Fetch value of a subfield as a string.
This is a convenience function for fetching a subfield of a field within this record.
pszField | The name of the field containing the subfield. |
iFieldIndex | The instance of this field within the record. Use zero for the first instance of this field. |
pszSubfield | The name of the subfield within the selected field. |
iSubfieldIndex | The instance of this subfield within the record. Use zero for the first instance. |
pnSuccess | Pointer to an int which will be set to true if the fetch succeeds, or false if it fails. Use NULL if you don't want to check success. |
Definition at line 781 of file ossimDdfrecord.cpp.
References ossimDDFSubfieldDefn::ExtractStringData(), FindField(), ossimDDFFieldDefn::FindSubfieldDefn(), ossimDDFField::GetFieldDefn(), ossimDDFField::GetSubfieldData(), and pachData.
int ossimDDFRecord::Read | ( | ) |
Definition at line 122 of file ossimDdfrecord.cpp.
References ossimDDFModule::GetFP(), nDataSize, nFieldOffset, nReuseHeader, ossimNotify(), ossimNotifyLevel_WARN, pachData, poModule, and ReadHeader().
Referenced by ossimDDFModule::ReadRecord().
|
private |
Definition at line 255 of file ossimDdfrecord.cpp.
References Clear().
Referenced by Read().
int ossimDDFRecord::ResetDirectory | ( | ) |
Definition at line 1404 of file ossimDdfrecord.cpp.
References _sizeFieldLength, _sizeFieldPos, _sizeFieldTag, ossimDDFField::GetData(), ossimDDFField::GetDataSize(), GetField(), ossimDDFField::GetFieldDefn(), ossimDDFFieldDefn::GetName(), ossimDDFField::Initialize(), nDataSize, nFieldCount, nFieldOffset, OSSIM_DDF_FIELD_TERMINATOR, and pachData.
Referenced by Write().
int ossimDDFRecord::ResizeField | ( | ossimDDFField * | poField, |
int | nNewDataSize | ||
) |
Alter field data size within record.
This method will rearrange a DDFRecord altering the amount of space reserved for one of the existing fields. All following fields will be shifted accordingly. This includes updating the DDFField infos, and actually moving stuff within the data array after reallocating to the desired size.
poField | the field to alter. |
nNewDataSize | the number of data bytes to be reserved for the field. |
Definition at line 1029 of file ossimDdfrecord.cpp.
References GetData(), ossimDDFField::GetData(), GetDataSize(), ossimDDFField::GetDataSize(), ossimDDFField::GetFieldDefn(), ossimDDFField::Initialize(), nDataSize, nFieldCount, ossimCPLRealloc(), pachData, and paoFields.
Referenced by DeleteField(), SetFieldRaw(), and UpdateFieldRaw().
int ossimDDFRecord::SetFieldRaw | ( | ossimDDFField * | poField, |
int | iIndexWithinField, | ||
const char * | pachRawData, | ||
int | nRawDataSize | ||
) |
Set the raw contents of a field instance.
poField | the field to set data within. |
iIndexWithinField | The instance of this field to replace. Must be a value between 0 and GetRepeatCount(). If GetRepeatCount() is used, a new instance of the field is appeneded. |
pachRawData | the raw data to replace this field instance with. |
nRawDataSize | the number of bytes pointed to by pachRawData. |
Definition at line 1211 of file ossimDdfrecord.cpp.
References ossimDDFField::GetData(), ossimDDFField::GetDataSize(), ossimDDFField::GetFieldDefn(), ossimDDFField::GetInstanceData(), ossimDDFField::GetRepeatCount(), ossimDDFFieldDefn::IsRepeating(), nFieldCount, OSSIM_DDF_FIELD_TERMINATOR, paoFields, and ResizeField().
Referenced by CreateDefaultFieldInstance().
int ossimDDFRecord::SetFloatSubfield | ( | const char * | pszField, |
int | iFieldIndex, | ||
const char * | pszSubfield, | ||
int | iSubfieldIndex, | ||
double | dfNewValue | ||
) |
Set a float subfield in record.
The value of a given subfield is replaced with a new float value formatted appropriately.
pszField | the field name to operate on. |
iFieldIndex | the field index to operate on (zero based). |
pszSubfield | the subfield name to operate on. |
iSubfieldIndex | the subfield index to operate on (zero based). |
dfNewValue | the new value to place in the subfield. |
Definition at line 1763 of file ossimDdfrecord.cpp.
References CreateDefaultFieldInstance(), FindField(), ossimDDFFieldDefn::FindSubfieldDefn(), ossimDDFSubfieldDefn::FormatFloatValue(), ossimDDFSubfieldDefn::GetDataLength(), ossimDDFField::GetFieldDefn(), ossimDDFField::GetInstanceData(), ossimDDFField::GetSubfieldData(), OSSIM_DDF_FIELD_TERMINATOR, and UpdateFieldRaw().
int ossimDDFRecord::SetIntSubfield | ( | const char * | pszField, |
int | iFieldIndex, | ||
const char * | pszSubfield, | ||
int | iSubfieldIndex, | ||
int | nNewValue | ||
) |
Set an integer subfield in record.
The value of a given subfield is replaced with a new integer value formatted appropriately.
pszField | the field name to operate on. |
iFieldIndex | the field index to operate on (zero based). |
pszSubfield | the subfield name to operate on. |
iSubfieldIndex | the subfield index to operate on (zero based). |
nNewValue | the new value to place in the subfield. |
Definition at line 1652 of file ossimDdfrecord.cpp.
References CreateDefaultFieldInstance(), FindField(), ossimDDFFieldDefn::FindSubfieldDefn(), ossimDDFSubfieldDefn::FormatIntValue(), ossimDDFSubfieldDefn::GetDataLength(), ossimDDFField::GetFieldDefn(), ossimDDFField::GetInstanceData(), ossimDDFField::GetSubfieldData(), OSSIM_DDF_FIELD_TERMINATOR, and UpdateFieldRaw().
int ossimDDFRecord::SetStringSubfield | ( | const char * | pszField, |
int | iFieldIndex, | ||
const char * | pszSubfield, | ||
int | iSubfieldIndex, | ||
const char * | pszValue, | ||
int | nValueLength = -1 |
||
) |
Set a string subfield in record.
The value of a given subfield is replaced with a new string value formatted appropriately.
pszField | the field name to operate on. |
iFieldIndex | the field index to operate on (zero based). |
pszSubfield | the subfield name to operate on. |
iSubfieldIndex | the subfield index to operate on (zero based). |
pszValue | the new string to place in the subfield. This may be arbitrary binary bytes if nValueLength is specified. |
nValueLength | the number of valid bytes in pszValue, may be -1 to internally fetch with strlen(). |
Definition at line 1540 of file ossimDdfrecord.cpp.
References CreateDefaultFieldInstance(), FindField(), ossimDDFFieldDefn::FindSubfieldDefn(), ossimDDFSubfieldDefn::FormatStringValue(), ossimDDFSubfieldDefn::GetDataLength(), ossimDDFField::GetFieldDefn(), ossimDDFField::GetInstanceData(), ossimDDFField::GetSubfieldData(), OSSIM_DDF_FIELD_TERMINATOR, and UpdateFieldRaw().
int ossimDDFRecord::UpdateFieldRaw | ( | ossimDDFField * | poField, |
int | iIndexWithinField, | ||
int | nStartOffset, | ||
int | nOldSize, | ||
const char * | pachRawData, | ||
int | nRawDataSize | ||
) |
Definition at line 1317 of file ossimDdfrecord.cpp.
References ossimDDFField::GetData(), ossimDDFField::GetDataSize(), ossimDDFField::GetInstanceData(), ossimDDFField::GetRepeatCount(), nFieldCount, paoFields, and ResizeField().
Referenced by SetFloatSubfield(), SetIntSubfield(), and SetStringSubfield().
int ossimDDFRecord::Write | ( | ) |
Write record out to module.
This method writes the current record to the module to which it is attached. Normally this would be at the end of the file, and only used for modules newly created with DDFModule::Create(). Rewriting existing records is not supported at this time. Calling Write() multiple times on a DDFRecord will result it multiple copies being written at the end of the module.
Definition at line 181 of file ossimDdfrecord.cpp.
References ResetDirectory().
|
private |
Definition at line 466 of file ossimIso8211.h.
Referenced by Dump(), ossimDDFRecord(), and ResetDirectory().
|
private |
Definition at line 465 of file ossimIso8211.h.
Referenced by Dump(), ossimDDFRecord(), and ResetDirectory().
|
private |
Definition at line 464 of file ossimIso8211.h.
Referenced by Dump(), ossimDDFRecord(), and ResetDirectory().
|
private |
Definition at line 474 of file ossimIso8211.h.
Referenced by Clone(), ossimDDFRecord(), and ~ossimDDFRecord().
|
private |
Definition at line 468 of file ossimIso8211.h.
Referenced by Clear(), Clone(), Dump(), GetDataSize(), ossimDDFRecord(), Read(), ResetDirectory(), and ResizeField().
|
private |
Definition at line 471 of file ossimIso8211.h.
Referenced by AddField(), Clear(), Clone(), CloneOn(), DeleteField(), Dump(), FindField(), GetField(), GetFieldCount(), ossimDDFRecord(), ResetDirectory(), ResizeField(), SetFieldRaw(), and UpdateFieldRaw().
|
private |
Definition at line 462 of file ossimIso8211.h.
Referenced by Clone(), ossimDDFRecord(), Read(), and ResetDirectory().
|
private |
Definition at line 460 of file ossimIso8211.h.
Referenced by Clear(), Clone(), Dump(), ossimDDFRecord(), and Read().
|
private |
Definition at line 469 of file ossimIso8211.h.
Referenced by Clear(), Clone(), GetData(), GetFloatSubfield(), GetIntSubfield(), GetStringSubfield(), ossimDDFRecord(), Read(), ResetDirectory(), and ResizeField().
|
private |
Definition at line 472 of file ossimIso8211.h.
Referenced by AddField(), Clear(), Clone(), CloneOn(), DeleteField(), Dump(), FindField(), GetField(), ossimDDFRecord(), ResizeField(), SetFieldRaw(), and UpdateFieldRaw().
|
private |
Definition at line 458 of file ossimIso8211.h.
Referenced by Clone(), CloneOn(), GetModule(), ossimDDFRecord(), Read(), and ~ossimDDFRecord().