OSGNRRDImageFileType.cpp File Reference

#include <stdlib.h>
#include <stdio.h>
#include "OSGConfig.h"
#include <vector>
#include <string>
#include <iostream>
#include <OSGLog.h>
#include "OSGNRRDImageFileType.h"

Go to the source code of this file.

Namespaces

namespace  osg

Classes

struct  HeadStr

Defines

#define INT_MAX   numeric_limits<int>::max()

Enumerations

enum  HeadElem {
  INVALID_HE, MIME_HE, TYPE_HE, DIMENSION_HE,
  SIZES_HE, ENDIAN_HE, ENCODING_HE, UNSIGNED_HE,
  SIGNED_HE, LITTLE_HE, BIG_HE, RAW_HE,
  ASCII_HE, CHAR_HE, SHORT_HE
}

Functions

HeadElem mapElem (const std::string &str)
unsigned stringTokenizer (const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")

Variables

static const Char8 * suffixArray []
static HeadStr headStrVec []


Define Documentation

#define INT_MAX   numeric_limits<int>::max()

Definition at line 59 of file OSGNRRDImageFileType.cpp.


Enumeration Type Documentation

enum HeadElem

Enumerator:
INVALID_HE 
MIME_HE 
TYPE_HE 
DIMENSION_HE 
SIZES_HE 
ENDIAN_HE 
ENCODING_HE 
UNSIGNED_HE 
SIGNED_HE 
LITTLE_HE 
BIG_HE 
RAW_HE 
ASCII_HE 
CHAR_HE 
SHORT_HE 

Definition at line 98 of file OSGNRRDImageFileType.cpp.

00098               {
00099   INVALID_HE,
00100   MIME_HE,
00101   TYPE_HE,
00102   DIMENSION_HE,
00103   SIZES_HE,
00104   ENDIAN_HE,
00105   ENCODING_HE,
00106 
00107   UNSIGNED_HE,
00108   SIGNED_HE,
00109 
00110   LITTLE_HE,
00111   BIG_HE,
00112   
00113   RAW_HE,
00114   ASCII_HE,
00115 
00116   CHAR_HE,  
00117   SHORT_HE,
00118 };


Function Documentation

HeadElem mapElem ( const std::string &  str  )  [inline]

Definition at line 142 of file OSGNRRDImageFileType.cpp.

References HeadStr::headElem, and INVALID_HE.

Referenced by osg::NRRDImageFileType::read().

00143 {
00144   unsigned i = 0;
00145 
00146   for ( i = 0; headStrVec[i].headElem != INVALID_HE; ++i )
00147     if (headStrVec[i].str == str)
00148       break;
00149 
00150   return headStrVec[i].headElem;
00151 }

unsigned stringTokenizer ( const std::string &  str,
std::vector< std::string > &  tokens,
const std::string &  delimiters = " " 
) [inline]

Definition at line 153 of file OSGNRRDImageFileType.cpp.

Referenced by osg::NRRDImageFileType::read().

00156 {
00157     // Skip delimiters at beginning.
00158     std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
00159     // Find first "non-delimiter".
00160     std::string::size_type pos     = str.find_first_of(delimiters, lastPos);
00161 
00162     while (std::string::npos != pos || std::string::npos != lastPos)
00163     {
00164         // Found a token, add it to the vector.
00165         tokens.push_back(str.substr(lastPos, pos - lastPos));
00166         // Skip delimiters.  Note the "not_of"
00167         lastPos = str.find_first_not_of(delimiters, pos);
00168         // Find next "non-delimiter"
00169         pos = str.find_first_of(delimiters, lastPos);
00170     }
00171 
00172     return tokens.size();
00173 }


Variable Documentation

const Char8* suffixArray[] [static]

Initial value:

{
    "nrrd"
}

Definition at line 83 of file OSGNRRDImageFileType.cpp.

HeadStr headStrVec[] [static]

Initial value:

 {
  { "NRRD0001",   MIME_HE },
  { "type",       TYPE_HE },
  { "dimension",  DIMENSION_HE },
  { "sizes",      SIZES_HE },
  { "endian",     ENDIAN_HE },
  { "encoding",   ENCODING_HE },

  { "unsigned",   UNSIGNED_HE },
  { "signed",     SIGNED_HE },

  { "char",       CHAR_HE },
  { "short",      SHORT_HE },

  { "",           INVALID_HE }
}

Definition at line 125 of file OSGNRRDImageFileType.cpp.


Generated on Mon Mar 17 11:10:12 2008 for OpenSG by  doxygen 1.5.5