ITK  5.2.0
Insight Toolkit
Public Types | Public Member Functions | Static Public Member Functions | List of all members

#include <itkByteSwapper.h>

+ Inheritance diagram for itk::ByteSwapper< T >:
+ Collaboration diagram for itk::ByteSwapper< T >:

Public Types

using BufferSizeType = SizeValueType
 
using ConstPointer = SmartPointer< const Self >
 
using OStreamType = std::ostream
 
using Pointer = SmartPointer< Self >
 
using Self = ByteSwapper
 
using Superclass = Object
 
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = Object
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 

Public Member Functions

virtual const char * GetNameOfClass () const
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
unsigned long AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const
 
LightObject::Pointer CreateAnother () const override
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
const MetaDataDictionaryGetMetaDataDictionary () const
 
virtual ModifiedTimeType GetMTime () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetReferenceCount (int) override
 
void UnRegister () const noexcept override
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- Public Member Functions inherited from itk::LightObject
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
 itkCloneMacro (Self)
 
void Print (std::ostream &os, Indent indent=0) const
 

Static Public Member Functions

static void SwapFromSystemToBigEndian (T *p)
 
static void SwapRangeFromSystemToBigEndian (T *p, BufferSizeType num)
 
static bool SystemIsBE ()
 
static bool SystemIsBigEndian ()
 
static bool SystemIsLE ()
 
static bool SystemIsLittleEndian ()
 
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool flag)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 
static void SwapWriteRangeFromSystemToBigEndian (T *p, int num, OStreamType *fp)
 
static void SwapFromSystemToLittleEndian (T *p)
 
static void SwapRangeFromSystemToLittleEndian (T *p, BufferSizeType num)
 
static void SwapWriteRangeFromSystemToLittleEndian (T *p, int num, OStreamType *fp)
 
 ByteSwapper ()=default
 
 ~ByteSwapper () override=default
 
static void Swap2 (void *p)
 
static void Swap2Range (void *p, BufferSizeType num)
 
static void SwapWrite2Range (void *p, BufferSizeType num, OStreamType *fp)
 
static void Swap4 (void *p)
 
static void Swap4Range (void *p, BufferSizeType num)
 
static void SwapWrite4Range (void *p, BufferSizeType num, OStreamType *fp)
 
static void Swap8 (void *p)
 
static void Swap8Range (void *p, BufferSizeType num)
 
static void SwapWrite8Range (void *p, BufferSizeType num, OStreamType *fp)
 

Additional Inherited Members

- Protected Member Functions inherited from itk::Object
 Object ()
 
 ~Object () override
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &time)
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 
- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount
 

Detailed Description

template<typename T>
class itk::ByteSwapper< T >

Perform machine dependent byte swapping.

ByteSwapper is used by I/O classes to perform machine dependent byte swapping. Byte swapping is often used when reading or writing binary files. Files can either be Big Endian (BE) or Little Endian (LE).

Definition at line 50 of file itkByteSwapper.h.

Member Typedef Documentation

◆ BufferSizeType

template<typename T >
using itk::ByteSwapper< T >::BufferSizeType = SizeValueType

Type for representing large buffers, including those in 64bits architectures

Definition at line 95 of file itkByteSwapper.h.

◆ ConstPointer

template<typename T >
using itk::ByteSwapper< T >::ConstPointer = SmartPointer<const Self>

Definition at line 59 of file itkByteSwapper.h.

◆ OStreamType

template<typename T >
using itk::ByteSwapper< T >::OStreamType = std::ostream

Work around MSVC bug (including ByteSwapper.h in a templated class).

Definition at line 62 of file itkByteSwapper.h.

◆ Pointer

template<typename T >
using itk::ByteSwapper< T >::Pointer = SmartPointer<Self>

Definition at line 58 of file itkByteSwapper.h.

◆ Self

template<typename T >
using itk::ByteSwapper< T >::Self = ByteSwapper

Standard class type aliases.

Definition at line 56 of file itkByteSwapper.h.

◆ Superclass

template<typename T >
using itk::ByteSwapper< T >::Superclass = Object

Definition at line 57 of file itkByteSwapper.h.

Constructor & Destructor Documentation

◆ ByteSwapper()

template<typename T >
itk::ByteSwapper< T >::ByteSwapper ( )
protecteddefault

Generic swap method handles type T. The data is swapped and written (in binary) to the ostream given. A total of num values of type T are written and swapped. 2, 4 and 8 byte swapping can be handled. Single byte types are not swapped; others raise an exception. The method is used to swap to and from Big Endian.

◆ ~ByteSwapper()

template<typename T >
itk::ByteSwapper< T >::~ByteSwapper ( )
overrideprotecteddefault

Generic swap method handles type T. The data is swapped and written (in binary) to the ostream given. A total of num values of type T are written and swapped. 2, 4 and 8 byte swapping can be handled. Single byte types are not swapped; others raise an exception. The method is used to swap to and from Big Endian.

Member Function Documentation

◆ GetNameOfClass()

template<typename T >
virtual const char* itk::ByteSwapper< T >::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::Object.

◆ Swap2()

template<typename T >
static void itk::ByteSwapper< T >::Swap2 ( void *  p)
staticprotected

Swap 2 bytes.

◆ Swap2Range()

template<typename T >
static void itk::ByteSwapper< T >::Swap2Range ( void *  p,
BufferSizeType  num 
)
staticprotected

Swap a range of two-byte words. Num is the number of two-byte words to swap.

◆ Swap4()

template<typename T >
static void itk::ByteSwapper< T >::Swap4 ( void *  p)
staticprotected

Swap four bytes.

◆ Swap4Range()

template<typename T >
static void itk::ByteSwapper< T >::Swap4Range ( void *  p,
BufferSizeType  num 
)
staticprotected

Swap a range of four-byte words. Num is the number of four-byte words to swap.

◆ Swap8()

template<typename T >
static void itk::ByteSwapper< T >::Swap8 ( void *  p)
staticprotected

Swap 8 bytes.

◆ Swap8Range()

template<typename T >
static void itk::ByteSwapper< T >::Swap8Range ( void *  p,
BufferSizeType  num 
)
staticprotected

Swap a range of 8-byte words. Num is the number of four-byte words to swap.

◆ SwapFromSystemToBigEndian()

template<typename T >
static void itk::ByteSwapper< T >::SwapFromSystemToBigEndian ( T *  p)
static

Generic swap method handles type T. The swapping is done in-place. 2, 4 and 8 byte swapping can be handled. Single byte types are not swapped; others raise an exception. The method is used to swap to and from Big Endian.

Referenced by itk::DCMTKFileReader::GetElementDSorOB().

◆ SwapFromSystemToLittleEndian()

template<typename T >
static void itk::ByteSwapper< T >::SwapFromSystemToLittleEndian ( T *  p)
static

Generic swap method handles type T. The swapping is done in-place. 2, 4 and 8 byte swapping can be handled. Single byte types are not swapped; others raise an exception. The method is used to swap to and from Little Endian.

Referenced by itk::DCMTKFileReader::GetElementDSorOB().

◆ SwapRangeFromSystemToBigEndian()

template<typename T >
static void itk::ByteSwapper< T >::SwapRangeFromSystemToBigEndian ( T *  p,
BufferSizeType  num 
)
static

Generic swap method handles type T. The swapping is done in-place. 2, 4 and 8 byte swapping can be handled. Single byte types are not swapped; others raise an exception. The method is used to swap to and from Big Endian.

Referenced by itk::MeshIOBase::ReadBufferAsBinary(), itk::VTKPolyDataMeshIO::ReadCellDataBufferAsBINARY(), itk::VTKPolyDataMeshIO::ReadPointDataBufferAsBINARY(), itk::VTKPolyDataMeshIO::ReadPointsBufferAsBINARY(), and itk::MeshIOBase::WriteBufferAsBinary().

◆ SwapRangeFromSystemToLittleEndian()

template<typename T >
static void itk::ByteSwapper< T >::SwapRangeFromSystemToLittleEndian ( T *  p,
BufferSizeType  num 
)
static

Generic swap method handles type T. The swapping is done in-place. 2, 4 and 8 byte swapping can be handled. Single byte types are not swapped; others raise an exception. The method is used to swap to and from Little Endian.

Referenced by itk::MeshIOBase::ReadBufferAsBinary(), and itk::MeshIOBase::WriteBufferAsBinary().

◆ SwapWrite2Range()

template<typename T >
static void itk::ByteSwapper< T >::SwapWrite2Range ( void *  p,
BufferSizeType  num,
OStreamType fp 
)
staticprotected

Swap and write a range of two-byte words. Num is the number of two-byte words to swap and write.

◆ SwapWrite4Range()

template<typename T >
static void itk::ByteSwapper< T >::SwapWrite4Range ( void *  p,
BufferSizeType  num,
OStreamType fp 
)
staticprotected

Swap and write a range of four-byte words. Num is the number of four-byte words to swap and write.

◆ SwapWrite8Range()

template<typename T >
static void itk::ByteSwapper< T >::SwapWrite8Range ( void *  p,
BufferSizeType  num,
OStreamType fp 
)
staticprotected

Swap and write a range of 8-byte words. Num is the number of four-byte words to swap and write.

◆ SwapWriteRangeFromSystemToBigEndian()

template<typename T >
static void itk::ByteSwapper< T >::SwapWriteRangeFromSystemToBigEndian ( T *  p,
int  num,
OStreamType fp 
)
static

Generic swap method handles type T. The data is swapped and written (in binary) to the ostream given. A total of num values of type T are written and swapped. 2, 4 and 8 byte swapping can be handled. Single byte types are not swapped; others raise an exception. The method is used to swap to and from Big Endian.

Referenced by itk::VTKPolyDataMeshIO::WriteCellDataBufferAsBINARY(), itk::FreeSurferBinaryMeshIO::WriteCells(), itk::VTKPolyDataMeshIO::WriteCellsBufferAsBINARY(), itk::FreeSurferBinaryMeshIO::WritePointData(), itk::VTKPolyDataMeshIO::WritePointDataBufferAsBINARY(), itk::FreeSurferBinaryMeshIO::WritePoints(), and itk::VTKPolyDataMeshIO::WritePointsBufferAsBINARY().

◆ SwapWriteRangeFromSystemToLittleEndian()

template<typename T >
static void itk::ByteSwapper< T >::SwapWriteRangeFromSystemToLittleEndian ( T *  p,
int  num,
OStreamType fp 
)
static

Generic swap method handles type T. The data is swapped and written (in binary) to the ostream given. A total of num values of type T are written and swapped. 2, 4 and 8 byte swapping can be handled. Single byte types are not swapped; others raise an exception. The method is used to swap to and from Little Endian.

◆ SystemIsBE()

template<typename T >
static bool itk::ByteSwapper< T >::SystemIsBE ( )
inlinestatic

Definition at line 72 of file itkByteSwapper.h.

◆ SystemIsBigEndian()

template<typename T >
static bool itk::ByteSwapper< T >::SystemIsBigEndian ( )
static

Query the machine Endian-ness.

◆ SystemIsLE()

template<typename T >
static bool itk::ByteSwapper< T >::SystemIsLE ( )
inlinestatic

Definition at line 80 of file itkByteSwapper.h.

◆ SystemIsLittleEndian()

template<typename T >
static bool itk::ByteSwapper< T >::SystemIsLittleEndian ( )
static

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