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
20#include "bCommon.h"
21
22namespace bParse {
23
24 struct bNameInfo
25 {
26 char* m_name;
28 int m_dim0;
29 int m_dim1;
30 };
31
32 class bDNA
33 {
34 public:
35 bDNA();
36 ~bDNA();
37
38 void init(char *data, int len, bool swap=false);
39
40 int getArraySize(char* str);
41 int getArraySizeNew(short name)
42 {
43 const bNameInfo& nameInfo = m_Names[name];
44 return nameInfo.m_dim0*nameInfo.m_dim1;
45 }
46 int getElementSize(short type, short name)
47 {
48 const bNameInfo& nameInfo = m_Names[name];
49 int size = nameInfo.m_isPointer ? mPtrLen*nameInfo.m_dim0*nameInfo.m_dim1 : mTlens[type]*nameInfo.m_dim0*nameInfo.m_dim1;
50 return size;
51 }
52
53 int getNumNames() const
54 {
55 return m_Names.size();
56 }
57
58 char *getName(int ind);
59 char *getType(int ind);
60 short *getStruct(int ind);
61 short getLength(int ind);
62 int getReverseType(short type);
63 int getReverseType(const char *type);
64
65
66 int getNumStructs();
67
68 //
69 bool lessThan(bDNA* other);
70
71 void initCmpFlags(bDNA *memDNA);
72 bool flagNotEqual(int dna_nr);
73 bool flagEqual(int dna_nr);
74 bool flagNone(int dna_nr);
75
76
77 int getPointerSize();
78
80
81
82 private:
89
90 void initRecurseCmpFlags(int i);
91
93
100
102
103
104
105
106 };
107}
108
109
110#endif//__BDNA_H__
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
int getArraySizeNew(short name)
Definition bDNA.h:41
btAlignedObjectArray< int > mCMPFlags
Definition bDNA.h:92
int getPointerSize()
Definition bDNA.cpp:133
bool flagNone(int dna_nr)
Definition bDNA.cpp:126
short getLength(int ind)
Definition bDNA.cpp:74
int mPtrLen
Definition bDNA.h:101
btAlignedObjectArray< short * > mStructs
Definition bDNA.h:96
void initCmpFlags(bDNA *memDNA)
Definition bDNA.cpp:172
@ FDF_STRUCT_EQU
Definition bDNA.h:87
@ FDF_NONE
Definition bDNA.h:85
@ FDF_STRUCT_NEQU
Definition bDNA.h:86
void init(char *data, int len, bool swap=false)
Definition bDNA.cpp:349
void initRecurseCmpFlags(int i)
Definition bDNA.cpp:139
bool flagEqual(int dna_nr)
Definition bDNA.cpp:118
int getNumStructs()
Definition bDNA.cpp:105
btHashMap< btHashInt, int > mStructReverse
Definition bDNA.h:98
bool flagNotEqual(int dna_nr)
Definition bDNA.cpp:111
btAlignedObjectArray< bNameInfo > m_Names
Definition bDNA.h:94
char * getName(int ind)
Definition bDNA.cpp:50
int getNumNames() const
Definition bDNA.h:53
void dumpTypeDefinitions()
Definition bDNA.cpp:531
bool lessThan(bDNA *other)
Definition bDNA.cpp:44
int getReverseType(short type)
Definition bDNA.cpp:82
btAlignedObjectArray< short > mTlens
Definition bDNA.h:97
short * getStruct(int ind)
Definition bDNA.cpp:66
btAlignedObjectArray< char * > mTypes
Definition bDNA.h:95
int getArraySize(char *str)
Definition bDNA.cpp:508
btHashMap< btHashString, int > mTypeLookup
Definition bDNA.h:99
int getElementSize(short type, short name)
Definition bDNA.h:46
char * getType(int ind)
Definition bDNA.cpp:58
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
The btHashMap template class implements a generic and lightweight hashmap.
Definition btHashMap.h:226
char * m_name
Definition bDNA.h:26
bool m_isPointer
Definition bDNA.h:27