HIK2014/humanik/hikdump.h File Reference

#include "humanik.h"
#include "hikproperty.h"
#include <stdio.h>
#include <stddef.h>
#include <string.h>

Classes

class  Header
 
class  Field< type, count >
 
class  Field2D< type, count1, count2 >
 
class  HIKCharacterStream
 
class  HIKCharacterStateStream
 
class  HIKEffectorSetStateStream
 
class  HIKPropertySetStream
 
class  HIKDataDescriptionStream
 

Macros

#define _CRT_SECURE_NO_WARNINGS
 
#define HEADERLENGTH   16
 

Functions

HIKCharacterHIKLoadCharacter (const char *pFileName, const char *pValidationString, HIKMalloc pMalloc)
 Load file pFileName, and create an HIKCharacter object from its contents. More...
 
bool HIKSaveCharacter (const char *pFileName, HIKCharacter *pCharacter, HIKMalloc pMalloc, HIKFree pFree, float pUnitScale=1.0f)
 Save HIKCharacter pCharacter to file pFileName. More...
 
HIKCharacterStateHIKLoadCharacterState (const char *pFileName, HIKCharacter *pCharacter, HIKMalloc pMalloc)
 Load file pFileName, and create an HIKCharacterState object from its contents. More...
 
bool HIKSaveCharacterState (const char *pFileName, HIKCharacter *pCharacter, HIKCharacterState *pState, int pTransformMode, float pUnitScale=1.0f)
 Save HIKCharacterState pState to file pFileName. More...
 
HIKEffectorSetStateHIKLoadEffectorState (const char *pFileName, HIKMalloc pMalloc)
 Load file pFileName, and create an HIKEffectorSetState object from its contents. More...
 
bool HIKSaveEffectorState (const char *pFileName, HIKEffectorSetState *pState, float pUnitScale=1.0f)
 Save HIKEffectorSetState pState to file pFileName. More...
 
HIKPropertySetStateHIKLoadPropertySetState (const char *pFileName, HIKMalloc pMalloc)
 Load file pFileName, and create an HIKPropertySetState object from its contents. More...
 
bool HIKSavePropertySetState (const char *pFileName, HIKPropertySetState *pState, float pUnitScale=1.0f)
 Save HIKPropertySetState pState to file pFileName. More...
 
void * HIKLoadDataBlock (const char *pFileName, HIKDataDescription &pDataDesc, HIKMalloc pMalloc)
 Load file pFileName, and create a data set from its contents according to the data description provided in the pDataDesc argument. More...
 
void * HIKDefaultAlignedMalloc (size_t pSize, size_t pAlignment, HIKMalloc pMalloc)
 Allocates a data block aligned to the pAlignment pointer boundary. More...
 
void HIKDefaultAlignedFree (void *pAligned, HIKFree pFree)
 Frees a data block allocated using HIKDefaultAlignedMalloc(). More...
 
void HIKSaveDataBlock (const char *pFileName, const HIKDataDescription &pDataDesc, const void *pDataBlock)
 Save the data set located in memory at pDataBlock to file pFileName. More...
 
template<typename type >
bool Write (const char *pFileName, const type &pStream)
 
template<typename type >
bool WriteBlock (const char *pFileName, const size_t &pElementSize, const size_t &pElementCount, type &pStream)
 
template<typename type >
bool Read (const char *pFileName, type &pStream)
 
template<typename type >
bool ReadBlock (const char *pFileName, const size_t pOffset, const size_t &pElementSize, const size_t &pElementCount, type &pStream)
 
void SwapBytes4 (char *ToSwap)
 
bool HIKGetCharacterDefinitionFromDump (const char *pFileName, HIKCharacterDefinition &pDef)
 

Variables

const char HIKCHARACTER_HEADER [] = "HIKCHARACTER000\0"
 
const char HIKCHARACTERSTATE_HEADER [] = "HIKSTATE0000000\0"
 
const char HIKCHARACTEREFFECTOR_HEADER [] = "HIKEFFECTOR0000\0"
 
const char HIKCHARACTERPROPERTY_HEADER [] = "HIKPROPERTY0000\0"
 
const char HIKCHARACTERDATABLOCK_HEADER [] = "HIKDATABLOCK000\0"
 
const int MagicNumber = 0xabcdef12
 

Macro Definition Documentation

#define _CRT_SECURE_NO_WARNINGS

Definition at line 43 of file hikdump.h.

#define HEADERLENGTH   16

Definition at line 192 of file hikdump.h.

Function Documentation

bool HIKGetCharacterDefinitionFromDump ( const char *  pFileName,
HIKCharacterDefinition pDef 
)
inline

Definition at line 336 of file hikdump.h.

337 {
338  // First let retrieve data
339  // We need characterization flag, Default stance pose and Parent offset
340  HIKCharacterStream lStream;
341 
342  lStream.Init();
343 
344  // Load all the data
345  if(Read(pFileName, lStream))
346  {
347  memcpy(pDef.mUsedNodes, lStream.mNodeFlag.mField, sizeof(int)*lStream.mNodeFlag.eCount);
348  return true;
349  }
350  return false;
351 }
Field< int, LastNodeId > mNodeFlag
Definition: hikdump.h:277
bool Read(const char *pFileName, type &pStream)
FieldType mField[eCount]
Definition: hikdump.h:243
bool Read ( const char *  pFileName,
type pStream 
)
+ Examples:

Definition at line 139 of file hikdump_std.inl.

140 {
141  // Read all the data
142  bool bResult = false;
143  FILE* lFile = fopen(pFileName, "rb");
144  if(lFile != NULL)
145  {
146  bResult = pStream.Read(lFile);
147  fclose(lFile);
148  }
149 
150  return bResult;
151 }
#define NULL
Definition: kaydara.h:179
char char int FILE
Definition: fileobject.h:45
bool ReadBlock ( const char *  pFileName,
const size_t  pOffset,
const size_t pElementSize,
const size_t pElementCount,
type pStream 
)

Definition at line 153 of file hikdump_std.inl.

154 {
155  // Read all the data
156  bool bResult = false;
157  FILE* lFile = fopen(pFileName, "rb");
158  if(lFile != NULL)
159  {
160  fseek(lFile, pOffset, 0);
161  bResult = fread(pStream, pElementSize, pElementCount, lFile) > 0 ;
162  fclose(lFile);
163  }
164 
165  return bResult;
166 }
#define NULL
Definition: kaydara.h:179
char char int FILE
Definition: fileobject.h:45
void SwapBytes4 ( char *  ToSwap)
inline

Definition at line 224 of file hikdump.h.

225 {
226  char temp;
227 
228  temp = ToSwap[0];
229  ToSwap[0] = ToSwap[3];
230  ToSwap[3] = temp;
231  temp = ToSwap[1];
232  ToSwap[1] = ToSwap[2];
233  ToSwap[2] = temp;
234 }
bool Write ( const char *  pFileName,
const type pStream 
)
bool WriteBlock ( const char *  pFileName,
const size_t pElementSize,
const size_t pElementCount,
type pStream 
)

Definition at line 126 of file hikdump_std.inl.

127 {
128  // Save all the collected data
129  FILE* lFile = fopen(pFileName, "ab+");
130  if(lFile != NULL)
131  {
132  fwrite(pStream, pElementSize, pElementCount, lFile);
133  fclose(lFile);
134  return true;
135  }
136  return false;
137 }
#define NULL
Definition: kaydara.h:179
char char int FILE
Definition: fileobject.h:45

Variable Documentation

const char HIKCHARACTER_HEADER[] = "HIKCHARACTER000\0"

Definition at line 194 of file hikdump.h.

const char HIKCHARACTERDATABLOCK_HEADER[] = "HIKDATABLOCK000\0"

Definition at line 198 of file hikdump.h.

const char HIKCHARACTEREFFECTOR_HEADER[] = "HIKEFFECTOR0000\0"

Definition at line 196 of file hikdump.h.

const char HIKCHARACTERPROPERTY_HEADER[] = "HIKPROPERTY0000\0"

Definition at line 197 of file hikdump.h.

const char HIKCHARACTERSTATE_HEADER[] = "HIKSTATE0000000\0"

Definition at line 195 of file hikdump.h.

const int MagicNumber = 0xabcdef12

Definition at line 199 of file hikdump.h.

Go to the source code of this file.