PandaRoot
BinaryStoreHelper.h File Reference
#include <assert.h>
#include "PndFTSCADef.h"
#include <cstdio>

Go to the source code of this file.

Functions

template<typename T >
static void BinaryStoreWrite (const T *mem, int count, FILE *f)
 
template<typename T >
static void BinaryStoreWrite (const T &mem, FILE *f)
 
static void BinaryStoreWrite (const void *offsetPtr, const void *mem, FILE *f)
 
template<typename T >
static void BinaryStoreRead (T *mem, int count, FILE *f)
 
template<typename T >
static void BinaryStoreRead (T &mem, FILE *f)
 
template<typename T >
static void BinaryStoreRead (T *&offsetPtr, char *mem, FILE *f)
 

Function Documentation

◆ BinaryStoreRead() [1/3]

template<typename T >
static void BinaryStoreRead ( T *  mem,
int  count,
FILE *  f 
)
inlinestatic

Definition at line 69 of file BinaryStoreHelper.h.

70 {
71  const int read = std::fread(mem, sizeof(T), count, f);
72  assert(read == count);
73  UNUSED_PARAM1(read);
74 }
float f
Definition: P4_F32vec4.h:32

◆ BinaryStoreRead() [2/3]

template<typename T >
static void BinaryStoreRead ( T &  mem,
FILE *  f 
)
inlinestatic

Definition at line 77 of file BinaryStoreHelper.h.

78 {
79  const size_t read = std::fread(&mem, sizeof(T), 1, f);
80  assert(read == 1);
81  UNUSED_PARAM1(read);
82 }
float f
Definition: P4_F32vec4.h:32

◆ BinaryStoreRead() [3/3]

template<typename T >
static void BinaryStoreRead ( T *&  offsetPtr,
char *  mem,
FILE *  f 
)
inlinestatic

Definition at line 85 of file BinaryStoreHelper.h.

86 {
87  int offset;
88  const size_t read = std::fread(&offset, sizeof(int), 1, f);
89  assert(read == 1);
90  UNUSED_PARAM1(read);
91  offsetPtr = reinterpret_cast<T *>(mem + offset);
92 }
float f
Definition: P4_F32vec4.h:32

◆ BinaryStoreWrite() [1/3]

template<typename T >
static void BinaryStoreWrite ( const T *  mem,
int  count,
FILE *  f 
)
inlinestatic

Definition at line 43 of file BinaryStoreHelper.h.

44 {
45  const int written = std::fwrite(mem, sizeof(T), count, f);
46  assert(written == count);
47  UNUSED_PARAM1(written);
48 }
float f
Definition: P4_F32vec4.h:32

◆ BinaryStoreWrite() [2/3]

template<typename T >
static void BinaryStoreWrite ( const T &  mem,
FILE *  f 
)
inlinestatic

Definition at line 51 of file BinaryStoreHelper.h.

52 {
53  const size_t written = std::fwrite(&mem, sizeof(T), 1, f);
54  assert(written == 1);
55  UNUSED_PARAM1(written);
56 }
float f
Definition: P4_F32vec4.h:32

◆ BinaryStoreWrite() [3/3]

static void BinaryStoreWrite ( const void *  offsetPtr,
const void *  mem,
FILE *  f 
)
inlinestatic

Definition at line 58 of file BinaryStoreHelper.h.

59 {
60  const int offset = static_cast<const char *>(offsetPtr) - static_cast<const char *>(mem);
61  const size_t written = std::fwrite(&offset, sizeof(int), 1, f);
62  assert(written == 1);
63  UNUSED_PARAM1(written);
64 }
float f
Definition: P4_F32vec4.h:32