Leviathan  0.8.0.0
Leviathan game engine
Leviathan::DataBlockConversionResolver< DBlockTDT, T > Struct Template Reference

#include <DataBlock.h>

Static Public Member Functions

static T DoConversionNonPtr (const DataBlock< DBlockTDT > *block)
 
static T * DoConversionPtr (DataBlock< DBlockTDT > *block)
 
static bool IsConversionAllowedNonPtr (const DataBlock< DBlockTDT > *block)
 
static bool IsConversionAllowedPtr (const DataBlock< DBlockTDT > *block)
 

Detailed Description

template<class DBlockTDT, class T>
struct Leviathan::DataBlockConversionResolver< DBlockTDT, T >

Definition at line 74 of file DataBlock.h.

Member Function Documentation

◆ DoConversionNonPtr()

template<class DBlockTDT , class T >
static T Leviathan::DataBlockConversionResolver< DBlockTDT, T >::DoConversionNonPtr ( const DataBlock< DBlockTDT > *  block)
inlinestatic

Definition at line 76 of file DataBlock.h.

76  {
77  // direct conversion check //
78  //if(DataBlockNameResolver<T>::TVal == block->Type){
79  // // just return //
80  // return *block->Value;
81  //}
82  return DataBlockConverter<DataBlock<DBlockTDT>, T>::DoConvert(block);
83  }

◆ DoConversionPtr()

template<class DBlockTDT , class T >
static T* Leviathan::DataBlockConversionResolver< DBlockTDT, T >::DoConversionPtr ( DataBlock< DBlockTDT > *  block)
inlinestatic

Definition at line 85 of file DataBlock.h.

85  {
86  // direct conversion check //
87  if(DataBlockNameResolver<T>::TVal == block->Type){
88  // just return //
89  // Already type checked so force the pointer type //
90  return reinterpret_cast<T*>(block->Value);
91  }
92  // cannot return converted value //
93 //#pragma message ("cannot return pointer from converted type")
94  LEVIATHAN_ASSERT(0, "return pointer of converted value not possible");
95  return NULL;
96  }
static const short TVal
Definition: DataBlock.h:43

◆ IsConversionAllowedNonPtr()

template<class DBlockTDT , class T >
static bool Leviathan::DataBlockConversionResolver< DBlockTDT, T >::IsConversionAllowedNonPtr ( const DataBlock< DBlockTDT > *  block)
inlinestatic

Definition at line 98 of file DataBlock.h.

98  {
99  // check types //
100  if(DataBlockNameResolver<T>::TVal == block->Type){
101  // same type, is allowed always //
102  return true;
103  }
104  // use templates to see if there is a template that allows this //
105  return DataBlockConverter<DataBlock<DBlockTDT>, T>::AllowedConversion;
106  }
static const short TVal
Definition: DataBlock.h:43

◆ IsConversionAllowedPtr()

template<class DBlockTDT , class T >
static bool Leviathan::DataBlockConversionResolver< DBlockTDT, T >::IsConversionAllowedPtr ( const DataBlock< DBlockTDT > *  block)
inlinestatic

Definition at line 107 of file DataBlock.h.

107  {
108  // check types //
109  if(DataBlockNameResolver<T>::TVal == block->Type){
110  // same type, is allowed always //
111  return true;
112  }
113  // different types, cannot be returned as pointer //
114  return false;
115  }
static const short TVal
Definition: DataBlock.h:43

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