OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Public Attributes | List of all members
ossimAuxType Class Reference

#include <ossimAuxFileHandler.h>

Public Member Functions

 ossimAuxType ()
 
 ~ossimAuxType ()
 
const char * initialize (const char *typeInput)
 
void completeDefn (ossimAuxDictionary *auxDict)
 
int getInstBytes (char *entryData, int nDataSize)
 
int extractInstValue (const char *auxField, char *entryData, ossim_uint32 nDataOffset, int nDataSize, char chReqType, void *reqReturn)
 

Public Attributes

int nBytes
 
int nFields
 
ossimAuxField ** m_auxFields
 
char * auxTypeName
 

Detailed Description

Definition at line 154 of file ossimAuxFileHandler.h.

Constructor & Destructor Documentation

◆ ossimAuxType()

ossimAuxType::ossimAuxType ( )

Definition at line 820 of file ossimAuxFileHandler.cpp.

821 {
822  nBytes = 0;
823  nFields = 0;
824  m_auxFields = NULL;
825  auxTypeName = NULL;
826 }
ossimAuxField ** m_auxFields

◆ ~ossimAuxType()

ossimAuxType::~ossimAuxType ( )

Definition at line 828 of file ossimAuxFileHandler.cpp.

829 {
830  for(int i = 0; i < nFields; i++ )
831  {
832  delete m_auxFields[i];
833  m_auxFields[i] = 0;
834  }
835 
836  if (auxTypeName != NULL)
837  {
838  delete[] auxTypeName;
839  auxTypeName = 0;
840  }
841 }
ossimAuxField ** m_auxFields

Member Function Documentation

◆ completeDefn()

void ossimAuxType::completeDefn ( ossimAuxDictionary auxDict)

Definition at line 891 of file ossimAuxFileHandler.cpp.

Referenced by ossimAuxField::completeDefn().

892 {
893  int i;
894 
895  if( nBytes != 0 )
896  return;
897 
898  for( i = 0; i < nFields; i++ )
899  {
900  m_auxFields[i]->completeDefn( auxDict );
901  if( m_auxFields[i]->nBytes < 0 || nBytes == -1 )
902  {
903  nBytes = -1;
904  }
905  else
906  {
907  nBytes += m_auxFields[i]->nBytes;
908  }
909  }
910 }
void completeDefn(ossimAuxDictionary *auxDict)
ossimAuxField ** m_auxFields

◆ extractInstValue()

int ossimAuxType::extractInstValue ( const char *  auxField,
char *  entryData,
ossim_uint32  nDataOffset,
int  nDataSize,
char  chReqType,
void *  reqReturn 
)

Definition at line 912 of file ossimAuxFileHandler.cpp.

916 {
917  int nArrayIndex = 0, nNameLen, iField, nByteOffset;
918  const char *remainder;
919 
920  const char *firstArray = strchr(auxFieldPath,'[');
921  const char *firstDot = strchr(auxFieldPath,'.');
922 
923  if( firstArray != NULL
924  && (firstDot == NULL
925  || firstDot > firstArray) )
926  {
927  const char *theEnd = firstArray;
928 
929  nArrayIndex = atoi(theEnd+1);
930  nNameLen = theEnd - auxFieldPath;
931 
932  remainder = strchr(auxFieldPath,'.');
933  if( remainder != NULL )
934  {
935  remainder++;
936  }
937  }
938  else if( firstDot != NULL )
939  {
940  const char *theEnd = firstDot;
941 
942  nNameLen = theEnd - auxFieldPath;
943 
944  remainder = theEnd + 1;
945  }
946  else
947  {
948  nNameLen = (int)strlen(auxFieldPath);
949  remainder = NULL;
950  }
951 
952  //Find this field within this type, if possible.
953  nByteOffset = 0;
954  for( iField = 0; iField < nFields && nByteOffset < nDataSize; iField++ )
955  {
956  std::string tmpFieldPath = const_cast<char*>(auxFieldPath);
957  tmpFieldPath = tmpFieldPath.substr(0, nNameLen);
958  std::string tmpFieldName = const_cast<char*>(m_auxFields[iField]->fieldName);
959  tmpFieldName = tmpFieldName.substr(0, nNameLen);
960  if( strcmp(tmpFieldPath.c_str(),tmpFieldName.c_str()) == 0
961  && m_auxFields[iField]->fieldName[nNameLen] == '\0' )
962  {
963  break;
964  }
965 
966  nByteOffset +=
967  m_auxFields[iField]->getInstBytes( entryData + nByteOffset,
968  nDataSize - nByteOffset );
969  }
970 
971  if( iField == nFields || nByteOffset >= nDataSize )
972  {
973  return false;
974  }
975 
976  //Extract this field value, and return.
977  return( m_auxFields[iField]->
978  extractInstValue( remainder, nArrayIndex,
979  entryData + nByteOffset,
980  nDataOffset + nByteOffset,
981  nDataSize - nByteOffset,
982  chReqType, reqReturn ) );
983 }
ossimAuxField ** m_auxFields
int extractInstValue(const char *auxField, char *entryData, ossim_uint32 nDataOffset, int nDataSize, char chReqType, void *reqReturn)
int getInstBytes(char *entryData, int nDataSize)

◆ getInstBytes()

int ossimAuxType::getInstBytes ( char *  entryData,
int  nDataSize 
)

Definition at line 985 of file ossimAuxFileHandler.cpp.

References ossimAuxField::getInstBytes().

986 {
987  if( nBytes >= 0 )
988  {
989  return( nBytes );
990  }
991  else
992  {
993  int nTotal = 0;
994  int iField;
995 
996  for( iField = 0; iField < nFields && nTotal < nDataSize; iField++ )
997  {
998  ossimAuxField *poField = m_auxFields[iField];
999 
1000  int nInstBytes = poField->getInstBytes( entryData,
1001  nDataSize - nTotal );
1002 
1003  entryData += nInstBytes;
1004  nTotal += nInstBytes;
1005  }
1006 
1007  return( nTotal );
1008  }
1009 }
ossimAuxField ** m_auxFields
int getInstBytes(char *entryData, int nDataSize)

◆ initialize()

const char * ossimAuxType::initialize ( const char *  typeInput)

Definition at line 843 of file ossimAuxFileHandler.cpp.

References ossimAuxField::initialize().

Referenced by ossimAuxDictionary::ossimAuxDictionary().

844 {
845  int i;
846  if( *typeInput != '{' )
847  {
848  while( *typeInput != '{' && *typeInput != '\0' )
849  typeInput++;
850 
851  if( *typeInput == '\0' )
852  return NULL;
853  }
854 
855  typeInput++;
856 
857  while( typeInput != NULL && *typeInput != '}' )
858  {
859  ossimAuxField *newField = new ossimAuxField();
860 
861  typeInput = newField->initialize( typeInput );
862  if( typeInput != NULL )
863  {
864  m_auxFields = (ossimAuxField **)realloc(m_auxFields, sizeof(void*) * (nFields+1) );
865  m_auxFields[nFields++] = newField;
866  }
867  else
868  {
869  delete newField;
870  }
871  }
872 
873  if( typeInput == NULL )
874  {
875  return NULL;
876  }
877 
878  typeInput++; /* skip `}' */
879 
880  for( i = 0; typeInput[i] != '\0' && typeInput[i] != ','; i++ ) {}
881 
882  auxTypeName = (char *) malloc(i+1);
883  strncpy( auxTypeName, typeInput, i );
884  auxTypeName[i] = '\0';
885 
886  typeInput += i+1;
887 
888  return( typeInput );
889 }
ossimAuxField ** m_auxFields
const char * initialize(const char *fieldInput)

Member Data Documentation

◆ auxTypeName

char* ossimAuxType::auxTypeName

Definition at line 162 of file ossimAuxFileHandler.h.

◆ m_auxFields

ossimAuxField** ossimAuxType::m_auxFields

Definition at line 160 of file ossimAuxFileHandler.h.

◆ nBytes

int ossimAuxType::nBytes

Definition at line 157 of file ossimAuxFileHandler.h.

◆ nFields

int ossimAuxType::nFields

Definition at line 158 of file ossimAuxFileHandler.h.


The documentation for this class was generated from the following files: