Bullet Collision Detection & Physics Library
bDNA.h
Go to the documentation of this file.
1/*
2bParse
3Copyright (c) 2006-2009 Charlie C & Erwin Coumans http://gamekit.googlecode.com
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef __BDNA_H__
17#define __BDNA_H__
18
19#include "bCommon.h"
20
21namespace bParse
22{
24{
25 char *m_name;
27 int m_dim0;
28 int m_dim1;
29};
30
31class bDNA
32{
33public:
34 bDNA();
35 ~bDNA();
36
37 void init(char *data, int len, bool swap = false);
38
39 int getArraySize(char *str);
40 int getArraySizeNew(short name)
41 {
42 const bNameInfo &nameInfo = m_Names[name];
43 return nameInfo.m_dim0 * nameInfo.m_dim1;
44 }
45 int getElementSize(short type, short name)
46 {
47 const bNameInfo &nameInfo = m_Names[name];
48 int size = nameInfo.m_isPointer ? mPtrLen * nameInfo.m_dim0 * nameInfo.m_dim1 : mTlens[type] * nameInfo.m_dim0 * nameInfo.m_dim1;
49 return size;
50 }
51
52 int getNumNames() const
53 {
54 return m_Names.size();
55 }
56
57 char *getName(int ind);
58 char *getType(int ind);
59 short *getStruct(int ind);
60 short getLength(int ind);
61 int getReverseType(short type);
62 int getReverseType(const char *type);
63
64 int getNumStructs();
65
66 //
67 bool lessThan(bDNA *other);
68
69 void initCmpFlags(bDNA *memDNA);
70 bool flagNotEqual(int dna_nr);
71 bool flagEqual(int dna_nr);
72 bool flagNone(int dna_nr);
73
74 int getPointerSize();
75
77
78private:
80 {
84 };
85
86 void initRecurseCmpFlags(int i);
87
89
96
98};
99} // namespace bParse
100
101#endif //__BDNA_H__
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
int getArraySizeNew(short name)
Definition: bDNA.h:40
btAlignedObjectArray< int > mCMPFlags
Definition: bDNA.h:88
btAlignedObjectArray< short * > mStructs
Definition: bDNA.h:92
int getPointerSize()
Definition: bDNA.cpp:125
bool flagNone(int dna_nr)
Definition: bDNA.cpp:118
short getLength(int ind)
Definition: bDNA.cpp:69
int mPtrLen
Definition: bDNA.h:97
void initCmpFlags(bDNA *memDNA)
Definition: bDNA.cpp:164
FileDNAFlags
Definition: bDNA.h:80
@ FDF_STRUCT_EQU
Definition: bDNA.h:83
@ FDF_NONE
Definition: bDNA.h:81
@ FDF_STRUCT_NEQU
Definition: bDNA.h:82
void init(char *data, int len, bool swap=false)
Definition: bDNA.cpp:345
void initRecurseCmpFlags(int i)
Definition: bDNA.cpp:131
bool flagEqual(int dna_nr)
Definition: bDNA.cpp:110
int getNumStructs()
Definition: bDNA.cpp:97
btHashMap< btHashInt, int > mStructReverse
Definition: bDNA.h:94
bool flagNotEqual(int dna_nr)
Definition: bDNA.cpp:103
btAlignedObjectArray< bNameInfo > m_Names
Definition: bDNA.h:90
char * getName(int ind)
Definition: bDNA.cpp:48
int getNumNames() const
Definition: bDNA.h:52
btAlignedObjectArray< char * > mTypes
Definition: bDNA.h:91
void dumpTypeDefinitions()
Definition: bDNA.cpp:524
bool lessThan(bDNA *other)
Definition: bDNA.cpp:42
int getReverseType(short type)
Definition: bDNA.cpp:76
btAlignedObjectArray< short > mTlens
Definition: bDNA.h:93
short * getStruct(int ind)
Definition: bDNA.cpp:62
int getArraySize(char *str)
Definition: bDNA.cpp:503
int getElementSize(short type, short name)
Definition: bDNA.h:45
btHashMap< btHashString, int > mTypeLookup
Definition: bDNA.h:95
char * getType(int ind)
Definition: bDNA.cpp:55
char * m_name
Definition: bDNA.h:25
bool m_isPointer
Definition: bDNA.h:26