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

#include <ossimAuxFileHandler.h>

Public Member Functions

 ossimAuxEntry (ossimAuxInfo *auxInfoIn, ossim_uint32 nPos, ossimAuxEntry *parentIn, ossimAuxEntry *prevIn)
 
virtual ~ossimAuxEntry ()
 
ossim_uint32 getFilePos ()
 
const char * getName ()
 
void setName (const char *nodeName)
 
const char * getType ()
 
char * getData ()
 
ossim_uint32 getDataPos ()
 
ossim_uint32 getDataSize ()
 
ossimAuxEntrygetChild ()
 
ossimAuxEntrygetNext ()
 
ossimAuxEntrygetNamedChild (const char *name)
 
ossim_int16 getIntField (const char *auxFieldPath)
 
const char * getStringField (const char *auxFieldPath)
 

Private Member Functions

void loadData ()
 
int getFieldValue (const char *auxFieldPath, char chReqType, void *reqReturn)
 

Private Attributes

ossim_uint32 nFilePos
 
ossimAuxInfom_auxInfo
 
ossimAuxEntrym_Parent
 
ossimAuxEntrym_Prev
 
ossimAuxEntrym_Next
 
ossimAuxEntrym_Child
 
ossim_uint32 nNextPos
 
ossim_uint32 nChildPos
 
char entryNodeName [64]
 
char entryType [32]
 
ossimAuxTypem_Type
 
ossim_uint32 nDataPos
 
ossim_uint32 nDataSize
 
char * entryData
 

Detailed Description

Definition at line 69 of file ossimAuxFileHandler.h.

Constructor & Destructor Documentation

◆ ossimAuxEntry()

ossimAuxEntry::ossimAuxEntry ( ossimAuxInfo auxInfoIn,
ossim_uint32  nPos,
ossimAuxEntry parentIn,
ossimAuxEntry prevIn 
)

Definition at line 283 of file ossimAuxFileHandler.cpp.

286 {
287  m_auxInfo = auxInfoIn;
288 
289  nFilePos = nPos;
290 
291  m_Parent = parentIn;
292  m_Prev = prevIn;
293 
294  m_Next = NULL;
295  m_Child = NULL;
296  entryData = NULL;
297 
298  nDataPos = nDataSize = 0;
299  nNextPos = nChildPos = 0;
300 
301  entryNodeName[0] = entryType[0] = '\0';
302 
303  ossim_int32 anEntryNums[6];
304 
305  if( fseek( m_auxInfo->fp, nFilePos, SEEK_SET ) == -1
306  || fread( anEntryNums, sizeof(ossim_uint32), 6, m_auxInfo->fp ) < 1 )
307  {
308  return;
309  }
310 
311  nNextPos = anEntryNums[0];
312  nChildPos = anEntryNums[3];
313  nDataPos = anEntryNums[4];
314  nDataSize = anEntryNums[5];
315 
316  if( fread( entryNodeName, 1, 64, m_auxInfo->fp ) < 1
317  || fread( entryType, 1, 32, m_auxInfo->fp ) < 1 )
318  {
319  return;
320  }
321 }
ossim_uint32 nDataPos
ossim_uint32 nChildPos
ossim_uint32 nDataSize
ossimAuxEntry * m_Child
unsigned int ossim_uint32
ossimAuxEntry * m_Parent
ossimAuxInfo * m_auxInfo
ossim_uint32 nFilePos
ossimAuxEntry * m_Next
ossimAuxEntry * m_Prev
int ossim_int32
ossim_uint32 nNextPos

◆ ~ossimAuxEntry()

ossimAuxEntry::~ossimAuxEntry ( )
virtual

Definition at line 322 of file ossimAuxFileHandler.cpp.

323 {
324  if( entryData != NULL )
325  {
326  delete entryData;
327  entryData = 0;
328  }
329 
330  if( m_Next != NULL )
331  {
332  delete m_Next;
333  m_Next = 0;
334  }
335 
336  if( m_Child != NULL )
337  {
338  delete m_Child;
339  m_Child = 0;
340  }
341 }
ossimAuxEntry * m_Child
ossimAuxEntry * m_Next

Member Function Documentation

◆ getChild()

ossimAuxEntry * ossimAuxEntry::getChild ( )

Definition at line 349 of file ossimAuxFileHandler.cpp.

350 {
351  if( m_Child == NULL && nChildPos != 0 )
352  {
353  m_Child = new ossimAuxEntry( m_auxInfo, nChildPos, this, NULL );
354  }
355 
356  return( m_Child );
357 }
ossim_uint32 nChildPos
ossimAuxEntry * m_Child
ossimAuxInfo * m_auxInfo
ossimAuxEntry(ossimAuxInfo *auxInfoIn, ossim_uint32 nPos, ossimAuxEntry *parentIn, ossimAuxEntry *prevIn)

◆ getData()

char* ossimAuxEntry::getData ( )
inline

Definition at line 108 of file ossimAuxFileHandler.h.

References entryData, and loadData().

108 { loadData(); return entryData; }

◆ getDataPos()

ossim_uint32 ossimAuxEntry::getDataPos ( )
inline

Definition at line 109 of file ossimAuxFileHandler.h.

References nDataPos.

109 { return nDataPos; }
ossim_uint32 nDataPos

◆ getDataSize()

ossim_uint32 ossimAuxEntry::getDataSize ( )
inline

Definition at line 110 of file ossimAuxFileHandler.h.

References nDataSize.

110 { return nDataSize; }
ossim_uint32 nDataSize

◆ getFieldValue()

int ossimAuxEntry::getFieldValue ( const char *  auxFieldPath,
char  chReqType,
void *  reqReturn 
)
private

Definition at line 449 of file ossimAuxFileHandler.cpp.

451 {
452  ossimAuxEntry *entry = this;
453 
454  if( strchr(auxFieldPath,':') != NULL )
455  {
456  entry = getNamedChild( auxFieldPath );
457  if( entry == NULL )
458  return false;
459 
460  auxFieldPath = strchr(auxFieldPath,':') + 1;
461  }
462 
463  loadData();
464 
465  if( entryData == NULL )
466  {
467  return false;
468  }
469 
470  if( m_Type == NULL )
471  {
472  return false;
473  }
474 
475  return (m_Type->extractInstValue( auxFieldPath,
477  chReqType, reqReturn ));
478 }
ossimAuxType * m_Type
ossim_uint32 nDataPos
ossim_uint32 nDataSize
int extractInstValue(const char *auxField, char *entryData, ossim_uint32 nDataOffset, int nDataSize, char chReqType, void *reqReturn)
ossimAuxEntry * getNamedChild(const char *name)

◆ getFilePos()

ossim_uint32 ossimAuxEntry::getFilePos ( )
inline

Definition at line 101 of file ossimAuxFileHandler.h.

References nFilePos.

101 { return nFilePos; }
ossim_uint32 nFilePos

◆ getIntField()

ossim_int16 ossimAuxEntry::getIntField ( const char *  auxFieldPath)

Definition at line 480 of file ossimAuxFileHandler.cpp.

481 {
482  ossim_int16 nIntValue;
483 
484  if( !getFieldValue( auxFieldPath, 'i', &nIntValue ) )
485  {
486  return 0;
487  }
488  else
489  {
490  return nIntValue;
491  }
492 }
short ossim_int16
int getFieldValue(const char *auxFieldPath, char chReqType, void *reqReturn)

◆ getName()

const char* ossimAuxEntry::getName ( )
inline

Definition at line 103 of file ossimAuxFileHandler.h.

References entryNodeName.

Referenced by getNamedChild().

103 { return entryNodeName; }

◆ getNamedChild()

ossimAuxEntry * ossimAuxEntry::getNamedChild ( const char *  name)

Definition at line 412 of file ossimAuxFileHandler.cpp.

References getName(), getNamedChild(), and getNext().

Referenced by getNamedChild().

413 {
414  int nNameLen;
415  ossimAuxEntry *entry;
416 
417  for( nNameLen = 0;
418  name[nNameLen] != '.'
419  && name[nNameLen] != '\0'
420  && name[nNameLen] != ':';
421  nNameLen++ ) {}
422 
423 
424  for( entry = getChild(); entry != NULL; entry = entry->getNext() )
425  {
426  std::string tmpEntryName = const_cast<char*>(entry->getName());
427  tmpEntryName = tmpEntryName.substr(0, nNameLen);
428  std::string tmpName = const_cast<char*>(name);
429  tmpName = tmpName.substr(0, nNameLen);
430  if( strcmp(tmpEntryName.c_str(),tmpName.c_str()) == 0
431  && (int) strlen(entry->getName()) == nNameLen )
432  {
433  if( name[nNameLen] == '.' )
434  {
435  ossimAuxEntry *result;
436 
437  result = entry->getNamedChild( name+nNameLen+1 );
438  if( result != NULL )
439  return result;
440  }
441  else
442  return entry;
443  }
444  }
445 
446  return NULL;
447 }
ossimAuxEntry * getNext()
ossimAuxEntry * getChild()
const char * getName()
ossimAuxEntry * getNamedChild(const char *name)

◆ getNext()

ossimAuxEntry * ossimAuxEntry::getNext ( )

Definition at line 359 of file ossimAuxFileHandler.cpp.

References m_Prev, and nFilePos.

Referenced by getNamedChild().

360 {
361  if( m_Next == NULL && nNextPos != 0 )
362  {
363  // Check if we have a loop on the next node in this sibling chain.
364  ossimAuxEntry *past;
365 
366  for( past = this;
367  past != NULL && past->nFilePos != nNextPos;
368  past = past->m_Prev ) {}
369 
370  if( past != NULL )
371  {
372  nNextPos = 0;
373  return NULL;
374  }
375 
377  }
378 
379  return( m_Next );
380 }
ossimAuxEntry * m_Parent
ossimAuxInfo * m_auxInfo
ossim_uint32 nFilePos
ossimAuxEntry * m_Next
ossimAuxEntry * m_Prev
ossimAuxEntry(ossimAuxInfo *auxInfoIn, ossim_uint32 nPos, ossimAuxEntry *parentIn, ossimAuxEntry *prevIn)
ossim_uint32 nNextPos

◆ getStringField()

const char * ossimAuxEntry::getStringField ( const char *  auxFieldPath)

Definition at line 494 of file ossimAuxFileHandler.cpp.

495 {
496  char *result = NULL;
497 
498  if( !getFieldValue( auxFieldPath, 's', &result ) )
499  {
500  return NULL;
501  }
502  else
503  {
504  return result;
505  }
506 }
int getFieldValue(const char *auxFieldPath, char chReqType, void *reqReturn)

◆ getType()

const char* ossimAuxEntry::getType ( )
inline

Definition at line 106 of file ossimAuxFileHandler.h.

References entryType.

106 { return entryType; }

◆ loadData()

void ossimAuxEntry::loadData ( )
private

Definition at line 382 of file ossimAuxFileHandler.cpp.

Referenced by getData().

383 {
384  if( entryData != NULL || nDataSize == 0 )
385  {
386  return;
387  }
388 
389  entryData = (char*) malloc(nDataSize);
390  if (entryData == NULL)
391  {
392  return;
393  }
394 
395  if(fseek(m_auxInfo->fp, nDataPos, SEEK_SET ) < 0 )
396  {
397  return;
398  }
399 
400  if( fread( entryData, 1, nDataSize, m_auxInfo->fp ) < 1 )
401  {
402  return;
403  }
404 
406  if(m_Type == NULL)
407  {
408  return;
409  }
410 }
ossimAuxType * m_Type
ossim_uint32 nDataPos
ossimAuxDictionary * m_Dictionary
ossim_uint32 nDataSize
ossimAuxType * findType(const char *name)
ossimAuxInfo * m_auxInfo

◆ setName()

void ossimAuxEntry::setName ( const char *  nodeName)

Definition at line 343 of file ossimAuxFileHandler.cpp.

344 {
345  memset( entryNodeName, '\0', 64 );
346  strncpy( entryNodeName, nodeName, 64 );
347 }

Member Data Documentation

◆ entryData

char* ossimAuxEntry::entryData
private

Definition at line 88 of file ossimAuxFileHandler.h.

Referenced by getData().

◆ entryNodeName

char ossimAuxEntry::entryNodeName[64]
private

Definition at line 82 of file ossimAuxFileHandler.h.

Referenced by getName().

◆ entryType

char ossimAuxEntry::entryType[32]
private

Definition at line 83 of file ossimAuxFileHandler.h.

Referenced by getType().

◆ m_auxInfo

ossimAuxInfo* ossimAuxEntry::m_auxInfo
private

Definition at line 73 of file ossimAuxFileHandler.h.

◆ m_Child

ossimAuxEntry* ossimAuxEntry::m_Child
private

Definition at line 77 of file ossimAuxFileHandler.h.

◆ m_Next

ossimAuxEntry* ossimAuxEntry::m_Next
private

Definition at line 76 of file ossimAuxFileHandler.h.

◆ m_Parent

ossimAuxEntry* ossimAuxEntry::m_Parent
private

Definition at line 74 of file ossimAuxFileHandler.h.

◆ m_Prev

ossimAuxEntry* ossimAuxEntry::m_Prev
private

Definition at line 75 of file ossimAuxFileHandler.h.

Referenced by getNext().

◆ m_Type

ossimAuxType* ossimAuxEntry::m_Type
private

Definition at line 85 of file ossimAuxFileHandler.h.

◆ nChildPos

ossim_uint32 ossimAuxEntry::nChildPos
private

Definition at line 80 of file ossimAuxFileHandler.h.

◆ nDataPos

ossim_uint32 ossimAuxEntry::nDataPos
private

Definition at line 86 of file ossimAuxFileHandler.h.

Referenced by getDataPos().

◆ nDataSize

ossim_uint32 ossimAuxEntry::nDataSize
private

Definition at line 87 of file ossimAuxFileHandler.h.

Referenced by getDataSize().

◆ nFilePos

ossim_uint32 ossimAuxEntry::nFilePos
private

Definition at line 71 of file ossimAuxFileHandler.h.

Referenced by getFilePos(), and getNext().

◆ nNextPos

ossim_uint32 ossimAuxEntry::nNextPos
private

Definition at line 79 of file ossimAuxFileHandler.h.


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