Public Member Functions | Private Attributes

cmtk::FileHeader Class Reference
[cmtkIO Library]

Access to fields in a binary file header. More...

#include <cmtkFileHeader.h>

List of all members.

Public Member Functions

 FileHeader (void *const header, const bool isBigEndian=true)
 Constructor.
template<class T >
GetField (const size_t offset)
 Retrieve field of arbitrary type from header.
template<class T >
void StoreField (const size_t offset, T value)
 Store field of arbitrary type to header.
void StoreFieldString (const size_t offset, const char *value, const size_t maxlen=0)
 Store null-terminated string to header.
bool CompareFieldStringN (const size_t offset, const char *value, const size_t len) const
 Compare n-character string.
template<class T >
void GetArray (T *const target, const size_t offset, const size_t length=1)
 Retrieve array of arbitrary type from header.

Private Attributes

char * Header
 Pointer to the binary header.
bool IsBigEndian
 Flag for endianness.

Detailed Description

Access to fields in a binary file header.

Definition at line 49 of file cmtkFileHeader.h.


Constructor & Destructor Documentation

cmtk::FileHeader::FileHeader ( void *const   header,
const bool  isBigEndian = true 
) [inline]

Constructor.

Definition at line 53 of file cmtkFileHeader.h.


Member Function Documentation

bool cmtk::FileHeader::CompareFieldStringN ( const size_t  offset,
const char *  value,
const size_t  len 
) const [inline]

Compare n-character string.

Returns:
The comparison result code as returned by memcmp(), i.e., the result is 0 if the given string matches the respective portion of the header.

Definition at line 96 of file cmtkFileHeader.h.

Referenced by cmtk::VolumeFromFile::ReadAnalyzeHdr().

template<class T >
void cmtk::FileHeader::GetArray ( T *const   target,
const size_t  offset,
const size_t  length = 1 
) [inline]

Retrieve array of arbitrary type from header.

Definition at line 103 of file cmtkFileHeader.h.

References cmtk::Memory::ByteSwap().

Referenced by cmtk::ScalarImageIO::ReadAnalyze(), cmtk::VolumeFromFile::ReadAnalyzeHdr(), and cmtk::VolumeFromFile::ReadNifti().

template<class T >
T cmtk::FileHeader::GetField ( const size_t  offset ) [inline]

Retrieve field of arbitrary type from header.

Definition at line 60 of file cmtkFileHeader.h.

References cmtk::Memory::ByteSwap().

Referenced by cmtk::ScalarImageIO::ReadAnalyze(), cmtk::VolumeFromFile::ReadAnalyzeHdr(), and cmtk::VolumeFromFile::ReadNifti().

template<class T >
void cmtk::FileHeader::StoreField ( const size_t  offset,
value 
) [inline]

Store field of arbitrary type to header.

Definition at line 73 of file cmtkFileHeader.h.

References cmtk::Memory::ByteSwap().

Referenced by cmtk::ScalarImageIO::WriteAnalyze(), and cmtk::VolumeFromFile::WriteAnalyzeHdr().

void cmtk::FileHeader::StoreFieldString ( const size_t  offset,
const char *  value,
const size_t  maxlen = 0 
) [inline]

Store null-terminated string to header.

Definition at line 84 of file cmtkFileHeader.h.

Referenced by cmtk::VolumeFromFile::WriteAnalyzeHdr().


Member Data Documentation

char* cmtk::FileHeader::Header [private]

Pointer to the binary header.

Definition at line 123 of file cmtkFileHeader.h.

Flag for endianness.

Definition at line 126 of file cmtkFileHeader.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines