Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SbDataType Class Reference

Class encoding a data type. More...

#include <Inventor/SbDataType.h>

Public Types

enum  DataType {
  UNSIGNED_BYTE = 0 ,
  UNSIGNED_SHORT = 1 ,
  UNSIGNED_INT32 = 2 ,
  SIGNED_BYTE = 4 ,
  SIGNED_SHORT = 5 ,
  SIGNED_INT32 = 6 ,
  FLOAT = 10 ,
  DOUBLE = 11 ,
  UNKNOWN = 0xFFFF
}
 Supported Data type. More...
 

Public Member Functions

 SbDataType (DataType type)
 Copy constructor.
 
 SbDataType (const SbString &type)
 Constructor from a string.
 
 SbDataType ()
 Default constructor.
 
 operator unsigned int () const
 
DataType getType () const
 Returns the type as an enum.
 
unsigned int getSize () const
 Returns size in bytes of the type.
 
SbBool isSigned () const
 Returns true if the type is signed.
 
SbBool isInteger () const
 Returns true if the type is an integer type.
 
unsigned int getNumBits () const
 Returns the numer of bits in the type.
 
SbString getString () const
 Returns the type as a string, e.g.
 
double getMin () const
 Returns the minimum value of the type.
 
double getMax () const
 Returns the maximum value of the type.
 
template<>
SbDataType getTemplateType (const unsigned char &)
 
template<>
SbDataType getTemplateType (const unsigned short &)
 
template<>
SbDataType getTemplateType (const uint32_t &)
 
template<>
SbDataType getTemplateType (const signed char &)
 
template<>
SbDataType getTemplateType (const signed short &)
 
template<>
SbDataType getTemplateType (const int &)
 
template<>
SbDataType getTemplateType (const float &)
 
template<>
SbDataType getTemplateType (const double &)
 

Friends

std::ostream & operator<< (std::ostream &os, const SbDataType type)
 ostream operator for SbDataType
 

Detailed Description

Class encoding a data type.

This is a basic Open Inventor type that is used for representing a data type, for example unsigned int32, and some information about that type, for example is it signed or not. It is used by classes handling user buffers such as SoMemoryObject, SoSFArray2D, SoSFArray3D, SoSFImage and also SoDataSet.

SEE ALSO

SoMemoryObject, SoSFArray2D, SoSFArray3D

Definition at line 57 of file SbDataType.h.

Member Enumeration Documentation

◆ DataType

Supported Data type.

Enumerator
UNSIGNED_BYTE 

unsigned byte

UNSIGNED_SHORT 

unsigned short

UNSIGNED_INT32 

unsigned int (32bits)

SIGNED_BYTE 

signed byte

SIGNED_SHORT 

signed short

SIGNED_INT32 

signed int (32bits)

FLOAT 

float

DOUBLE 

Double.

UNKNOWN 

unknown data type

Definition at line 63 of file SbDataType.h.

Constructor & Destructor Documentation

◆ SbDataType() [1/3]

SbDataType::SbDataType ( DataType  type)
inlineexplicit

Copy constructor.

Definition at line 88 of file SbDataType.h.

◆ SbDataType() [2/3]

SbDataType::SbDataType ( const SbString type)

Constructor from a string.

Valid strings are the enum names.

◆ SbDataType() [3/3]

SbDataType::SbDataType ( )
inline

Default constructor.

The initial value is UNSIGNED_BYTE.

Definition at line 99 of file SbDataType.h.

Member Function Documentation

◆ getMax()

double SbDataType::getMax ( ) const

Returns the maximum value of the type.

◆ getMin()

double SbDataType::getMin ( ) const

Returns the minimum value of the type.


For floating point type, returns the minimum positive normalized value.

◆ getNumBits()

unsigned int SbDataType::getNumBits ( ) const
inline

Returns the numer of bits in the type.

Definition at line 267 of file SbDataType.h.

◆ getSize()

unsigned int SbDataType::getSize ( ) const
inline

Returns size in bytes of the type.

Definition at line 260 of file SbDataType.h.

◆ getString()

SbString SbDataType::getString ( ) const

Returns the type as a string, e.g.

"FLOAT". See also getType().

◆ getTemplateType() [1/8]

template<>
SbDataType SbDataType::getTemplateType ( const double &  )
inline

Definition at line 396 of file SbDataType.h.

◆ getTemplateType() [2/8]

template<>
SbDataType SbDataType::getTemplateType ( const float &  )
inline

Definition at line 388 of file SbDataType.h.

◆ getTemplateType() [3/8]

template<>
SbDataType SbDataType::getTemplateType ( const int &  )
inline

Definition at line 380 of file SbDataType.h.

◆ getTemplateType() [4/8]

template<>
SbDataType SbDataType::getTemplateType ( const signed char &  )
inline

Definition at line 364 of file SbDataType.h.

◆ getTemplateType() [5/8]

template<>
SbDataType SbDataType::getTemplateType ( const signed short &  )
inline

Definition at line 372 of file SbDataType.h.

◆ getTemplateType() [6/8]

template<>
SbDataType SbDataType::getTemplateType ( const uint32_t &  )
inline

Definition at line 356 of file SbDataType.h.

◆ getTemplateType() [7/8]

template<>
SbDataType SbDataType::getTemplateType ( const unsigned char &  )
inline

Definition at line 340 of file SbDataType.h.

◆ getTemplateType() [8/8]

template<>
SbDataType SbDataType::getTemplateType ( const unsigned short &  )
inline

Definition at line 348 of file SbDataType.h.

◆ getType()

SbDataType::DataType SbDataType::getType ( ) const
inline

Returns the type as an enum.

See also getString().

Definition at line 239 of file SbDataType.h.

◆ isInteger()

SbBool SbDataType::isInteger ( ) const
inline

Returns true if the type is an integer type.

Definition at line 274 of file SbDataType.h.

◆ isSigned()

SbBool SbDataType::isSigned ( ) const
inline

Returns true if the type is signed.

Definition at line 252 of file SbDataType.h.

◆ operator unsigned int()

SbDataType::operator unsigned int ( ) const
inline

Definition at line 245 of file SbDataType.h.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const SbDataType  type 
)
friend

ostream operator for SbDataType

Definition at line 412 of file SbDataType.h.


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