Bullet Collision Detection & Physics Library: bParse::bFile Class Reference

Bullet Collision Detection & Physics Library

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
bParse::bFile Class Referenceabstract

`#include <bFile.h>`

Inheritance diagram for bParse::bFile:
[legend]
Collaboration diagram for bParse::bFile:
[legend]

## Public Member Functions
| bFile (const char *filename, const char headerString[7])
| bFile (char *memoryBuffer, int len, const char headerString[7])
virtual | ~bFile ()
bDNA * | getFileDNA ()
virtual void | addDataBlock (char *dataBlock)=0
int | getFlags () const
void | setFileDNAisMemoryDNA ()
bPtrMap & | getLibPointers ()
void * | findLibPointer (void *ptr)
bool | ok ()
virtual void | parse (int verboseMode)=0
virtual int | write (const char *fileName, bool fixupPointers=false)=0
virtual void | writeChunks (FILE *fp, bool fixupPointers)
virtual void | writeDNA (FILE *fp)=0
void | updateOldPointers ()
void | resolvePointers (int verboseMode)
| Resolve pointers replaces the original pointers in structures, and linked lists by the new in-memory structures.
void | dumpChunks (bDNA *dna)
virtual void | setFileDNA (int verboseMode, char *buffer, int len)
int | getVersion () const
void | preSwap ()
void | writeFile (const char *fileName)

## Protected Member Functions
int | getNextBlock (bChunkInd *dataChunk, const char *dataPtr, const int flags)
void | safeSwapPtr (char *dst, const char *src)
virtual void | parseHeader ()
virtual void | parseData ()=0
void | resolvePointersMismatch ()
void | resolvePointersChunk (const bChunkInd &dataChunk, int verboseMode)
| this loop only works fine if the Blender DNA structure of the file matches the headerfiles
int | resolvePointersStructRecursive (char *strcPtr, int old_dna, int verboseMode, int recursion)
void | parseStruct (char *strcPtr, char *dtPtr, int old_dna, int new_dna, bool fixupPointers)
void | getMatchingFileDNA (short *old, const char *lookupName, const char *lookupType, char *strcData, char *data, bool fixupPointers)
char * | getFileElement (short *firstStruct, char *lookupName, char *lookupType, char *data, short **foundPos)
void | swap (char *head, class bChunkInd &ch, bool ignoreEndianFlag)
void | swapData (char *data, short type, int arraySize, bool ignoreEndianFlag)
void | swapStruct (int dna_nr, char *data, bool ignoreEndianFlag)
void | swapLen (char *dataPtr)
void | swapDNA (char *ptr)
char * | readStruct (char *head, class bChunkInd &chunk)
char * | getAsString (int code)
virtual void | parseInternal (int verboseMode, char *memDna, int memDnaLength)

## Protected Attributes
char | m_headerString [7]
bool | mOwnsBuffer
char * | mFileBuffer
int | mFileLen
int | mVersion
bPtrMap | mLibPointers
int | mDataStart
bDNA * | mFileDNA
bDNA * | mMemoryDNA
btAlignedObjectArray< char * > | m_pointerFixupArray
btAlignedObjectArray< char * > | m_pointerPtrFixupArray
btAlignedObjectArray< bChunkInd > | m_chunks
btHashMap< btHashPtr, bChunkInd > | m_chunkPtrPtrMap
bPtrMap | mDataPointers
int | mFlags

## Detailed Description

Definition at line 48 of file bFile.h.

## Constructor & Destructor Documentation

## ◆ bFile() [1/2]

bFile::bFile | ( | const char * | filename,
|  | const char | headerString[7] )

Definition at line 55 of file bFile.cpp.

## ◆ bFile() [2/2]

bFile::bFile | ( | char * | memoryBuffer,
|  | int | len,
|  | const char | headerString[7] )

Definition at line 90 of file bFile.cpp.

## ◆ ~bFile()

bFile::~bFile | ( |  | ) |
| virtual

Definition at line 111 of file bFile.cpp.

## Member Function Documentation

## ◆ addDataBlock()

virtual void bParse::bFile::addDataBlock | ( | char * | dataBlock | ) |
| pure virtual

Implemented in bParse::btBulletFile.

## ◆ dumpChunks()

void bFile::dumpChunks | ( | bParse::bDNA * | dna | ) |

Definition at line 1458 of file bFile.cpp.

## ◆ findLibPointer()

void * bFile::findLibPointer | ( | void * | ptr | ) |

Definition at line 1440 of file bFile.cpp.

## ◆ getAsString()

char * bParse::bFile::getAsString | ( | int | code | ) |
| protected

## ◆ getFileDNA()

bDNA * bParse::bFile::getFileDNA | ( |  | ) |
| inline

Definition at line 115 of file bFile.h.

## ◆ getFileElement()

char * bFile::getFileElement | ( | short * | firstStruct,
|  | char * | lookupName,
|  | char * | lookupType,
|  | char * | data,
|  | short ** | foundPos )
| protected

Definition at line 1024 of file bFile.cpp.

## ◆ getFlags()

int bParse::bFile::getFlags | ( |  | ) | const
| inline

Definition at line 122 of file bFile.h.

## ◆ getLibPointers()

bPtrMap & bParse::bFile::getLibPointers | ( |  | ) |
| inline

Definition at line 132 of file bFile.h.

## ◆ getMatchingFileDNA()

void bFile::getMatchingFileDNA | ( | short * | old,
|  | const char * | lookupName,
|  | const char * | lookupType,
|  | char * | strcData,
|  | char * | data,
|  | bool | fixupPointers )
| protected

Definition at line 941 of file bFile.cpp.

## ◆ getNextBlock()

int bFile::getNextBlock | ( | bChunkInd * | dataChunk,
|  | const char * | dataPtr,
|  | const int | flags )
| protected

Definition at line 1559 of file bFile.cpp.

## ◆ getVersion()

int bParse::bFile::getVersion | ( |  | ) | const
| inline

Definition at line 156 of file bFile.h.

## ◆ ok()

bool bFile::ok | ( |  | ) |

Definition at line 178 of file bFile.cpp.

## ◆ parse()

virtual void bParse::bFile::parse | ( | int | verboseMode | ) |
| pure virtual

Implemented in bParse::btBulletFile.

## ◆ parseData()

virtual void bParse::bFile::parseData | ( |  | ) |
| protectedpure virtual

Implemented in bParse::btBulletFile.

## ◆ parseHeader()

void bFile::parseHeader | ( |  | ) |
| protectedvirtual

Definition at line 124 of file bFile.cpp.

## ◆ parseInternal()

void bFile::parseInternal | ( | int | verboseMode,
|  | char * | memDna,
|  | int | memDnaLength )
| protectedvirtual

mFileDNA->init will convert part of DNA file endianness to current CPU endianness if necessary

Definition at line 195 of file bFile.cpp.

## ◆ parseStruct()

void bFile::parseStruct | ( | char * | strcPtr,
|  | char * | dtPtr,
|  | int | old_dna,
|  | int | new_dna,
|  | bool | fixupPointers )
| protected

Definition at line 734 of file bFile.cpp.

## ◆ preSwap()

void bFile::preSwap | ( |  | ) |

Definition at line 545 of file bFile.cpp.

## ◆ readStruct()

char * bFile::readStruct | ( | char * | head,
|  | class bChunkInd & | chunk )
| protected

don't try to convert Link block data, just memcpy it. Other data can be converted.

Definition at line 619 of file bFile.cpp.

## ◆ resolvePointers()

void bFile::resolvePointers | ( | int | verboseMode | ) |

Resolve pointers replaces the original pointers in structures, and linked lists by the new in-memory structures.

Definition at line 1391 of file bFile.cpp.

## ◆ resolvePointersChunk()

void bFile::resolvePointersChunk | ( | const bChunkInd & | dataChunk,
|  | int | verboseMode )
| protected

this loop only works fine if the Blender DNA structure of the file matches the headerfiles

Definition at line 1166 of file bFile.cpp.

## ◆ resolvePointersMismatch()

void bFile::resolvePointersMismatch | ( |  | ) |
| protected

Definition at line 1100 of file bFile.cpp.

## ◆ resolvePointersStructRecursive()

int bFile::resolvePointersStructRecursive | ( | char * | strcPtr,
|  | int | old_dna,
|  | int | verboseMode,
|  | int | recursion )
| protected

Definition at line 1182 of file bFile.cpp.

## ◆ safeSwapPtr()

void bFile::safeSwapPtr | ( | char * | dst,
|  | const char * | src )
| protected

Definition at line 885 of file bFile.cpp.

## ◆ setFileDNA()

void bFile::setFileDNA | ( | int | verboseMode,
|  | char * | buffer,
|  | int | len )
| virtual

mFileDNA->init will convert part of DNA file endianness to current CPU endianness if necessary

Definition at line 183 of file bFile.cpp.

## ◆ setFileDNAisMemoryDNA()

void bParse::bFile::setFileDNAisMemoryDNA | ( |  | ) |
| inline

Definition at line 127 of file bFile.h.

## ◆ swap()

void bFile::swap | ( | char * | head,
|  | class bChunkInd & | ch,
|  | bool | ignoreEndianFlag )
| protected

Definition at line 308 of file bFile.cpp.

## ◆ swapData()

void bFile::swapData | ( | char * | data,
|  | short | type,
|  | int | arraySize,
|  | bool | ignoreEndianFlag )
| protected

Definition at line 854 of file bFile.cpp.

## ◆ swapDNA()

void bFile::swapDNA | ( | char * | ptr | ) |
| protected

Definition at line 382 of file bFile.cpp.

## ◆ swapLen()

void bFile::swapLen | ( | char * | dataPtr | ) |
| protected

Definition at line 334 of file bFile.cpp.

## ◆ swapStruct()

void bFile::swapStruct | ( | int | dna_nr,
|  | char * | data,
|  | bool | ignoreEndianFlag )
| protected

Definition at line 1052 of file bFile.cpp.

## ◆ updateOldPointers()

void bFile::updateOldPointers | ( |  | ) |

Definition at line 1448 of file bFile.cpp.

## ◆ write()

virtual int bParse::bFile::write | ( | const char * | fileName,
|  | bool | fixupPointers = false )
| pure virtual

Implemented in bParse::btBulletFile.

## ◆ writeChunks()

void bFile::writeChunks | ( | FILE * | fp,
|  | bool | fixupPointers )
| virtual

don't try to convert Link block data, just memcpy it. Other data can be converted.

Definition at line 1499 of file bFile.cpp.

## ◆ writeDNA()

virtual void bParse::bFile::writeDNA | ( | FILE * | fp | ) |
| pure virtual

Implemented in bParse::btBulletFile.

## ◆ writeFile()

void bFile::writeFile | ( | const char * | fileName | ) |

Definition at line 538 of file bFile.cpp.

## Member Data Documentation

## ◆ m_chunkPtrPtrMap

btHashMap<btHashPtr, bChunkInd> bParse::bFile::m_chunkPtrPtrMap
| protected

Definition at line 68 of file bFile.h.

## ◆ m_chunks

btAlignedObjectArray<bChunkInd> bParse::bFile::m_chunks
| protected

Definition at line 67 of file bFile.h.

## ◆ m_headerString

char bParse::bFile::m_headerString[7]
| protected

Definition at line 51 of file bFile.h.

## ◆ m_pointerFixupArray

btAlignedObjectArray<char*> bParse::bFile::m_pointerFixupArray
| protected

Definition at line 64 of file bFile.h.

## ◆ m_pointerPtrFixupArray

btAlignedObjectArray<char*> bParse::bFile::m_pointerPtrFixupArray
| protected

Definition at line 65 of file bFile.h.

## ◆ mDataPointers

bPtrMap bParse::bFile::mDataPointers
| protected

Definition at line 72 of file bFile.h.

## ◆ mDataStart

int bParse::bFile::mDataStart
| protected

Definition at line 60 of file bFile.h.

## ◆ mFileBuffer

char* bParse::bFile::mFileBuffer
| protected

Definition at line 54 of file bFile.h.

## ◆ mFileDNA

bDNA* bParse::bFile::mFileDNA
| protected

Definition at line 61 of file bFile.h.

## ◆ mFileLen

int bParse::bFile::mFileLen
| protected

Definition at line 55 of file bFile.h.

## ◆ mFlags

int bParse::bFile::mFlags
| protected

Definition at line 74 of file bFile.h.

## ◆ mLibPointers

bPtrMap bParse::bFile::mLibPointers
| protected

Definition at line 58 of file bFile.h.

## ◆ mMemoryDNA

bDNA* bParse::bFile::mMemoryDNA
| protected

Definition at line 62 of file bFile.h.

## ◆ mOwnsBuffer

bool bParse::bFile::mOwnsBuffer
| protected

Definition at line 53 of file bFile.h.

## ◆ mVersion

int bParse::bFile::mVersion
| protected

Definition at line 56 of file bFile.h.

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

- bFile.h
- bFile.cpp