Bullet Collision Detection & Physics Library
bDNA.h
Go to the documentation of this file.
1 /*
2 bParse
3 Copyright (c) 2006-2009 Charlie C & Erwin Coumans http://gamekit.googlecode.com
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 1. 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. 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 
22 namespace 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 
79  void dumpTypeDefinitions();
80 
81 
82  private:
84  {
88  };
89 
90  void initRecurseCmpFlags(int i);
91 
93 
100 
101  int mPtrLen;
102 
103 
104 
105 
106  };
107 }
108 
109 
110 #endif//__BDNA_H__
bParse::bDNA::getType
char * getType(int ind)
Definition: bDNA.cpp:58
bParse::bDNA::getName
char * getName(int ind)
Definition: bDNA.cpp:50
bParse::bDNA::lessThan
bool lessThan(bDNA *other)
Definition: bDNA.cpp:44
bParse::bDNA::getArraySizeNew
int getArraySizeNew(short name)
Definition: bDNA.h:41
bParse::bDNA::getLength
short getLength(int ind)
Definition: bDNA.cpp:74
bParse::bDNA::initRecurseCmpFlags
void initRecurseCmpFlags(int i)
Definition: bDNA.cpp:139
bParse::bDNA::mTypes
btAlignedObjectArray< char * > mTypes
Definition: bDNA.h:95
bParse::bDNA::flagNone
bool flagNone(int dna_nr)
Definition: bDNA.cpp:126
bParse::bDNA::initCmpFlags
void initCmpFlags(bDNA *memDNA)
Definition: bDNA.cpp:172
bParse::bDNA::getNumStructs
int getNumStructs()
Definition: bDNA.cpp:105
bParse::bDNA::FDF_NONE
@ FDF_NONE
Definition: bDNA.h:85
bParse::bDNA::mStructs
btAlignedObjectArray< short * > mStructs
Definition: bDNA.h:96
bCommon.h
bParse::bNameInfo::m_dim1
int m_dim1
Definition: bDNA.h:29
bParse::bDNA::mTlens
btAlignedObjectArray< short > mTlens
Definition: bDNA.h:97
bParse::bDNA::getReverseType
int getReverseType(short type)
Definition: bDNA.cpp:82
bParse::bDNA::dumpTypeDefinitions
void dumpTypeDefinitions()
Definition: bDNA.cpp:531
bParse::bDNA::mPtrLen
int mPtrLen
Definition: bDNA.h:101
bParse::bDNA::FDF_STRUCT_EQU
@ FDF_STRUCT_EQU
Definition: bDNA.h:87
bParse::bNameInfo::m_name
char * m_name
Definition: bDNA.h:26
bParse::bDNA
Definition: bDNA.h:32
bParse::bDNA::mStructReverse
btHashMap< btHashInt, int > mStructReverse
Definition: bDNA.h:98
bParse::bDNA::m_Names
btAlignedObjectArray< bNameInfo > m_Names
Definition: bDNA.h:94
btHashMap< btHashInt, int >
bParse::bDNA::FileDNAFlags
FileDNAFlags
Definition: bDNA.h:83
bParse::bNameInfo::m_isPointer
bool m_isPointer
Definition: bDNA.h:27
bParse::bDNA::getPointerSize
int getPointerSize()
Definition: bDNA.cpp:133
bParse::bDNA::flagEqual
bool flagEqual(int dna_nr)
Definition: bDNA.cpp:118
bParse::bNameInfo::m_dim0
int m_dim0
Definition: bDNA.h:28
btAlignedObjectArray< int >
bParse::bNameInfo
Definition: bDNA.h:24
bParse::bDNA::getNumNames
int getNumNames() const
Definition: bDNA.h:53
bParse::bDNA::~bDNA
~bDNA()
Definition: bDNA.cpp:38
bParse::bDNA::getArraySize
int getArraySize(char *str)
Definition: bDNA.cpp:508
bParse::bDNA::flagNotEqual
bool flagNotEqual(int dna_nr)
Definition: bDNA.cpp:111
bParse::bDNA::init
void init(char *data, int len, bool swap=false)
Definition: bDNA.cpp:349
bParse::bDNA::getStruct
short * getStruct(int ind)
Definition: bDNA.cpp:66
bParse
Definition: btBulletWorldImporter.h:29
bParse::bDNA::FDF_STRUCT_NEQU
@ FDF_STRUCT_NEQU
Definition: bDNA.h:86
bParse::bDNA::bDNA
bDNA()
Definition: bDNA.cpp:31
bParse::bDNA::getElementSize
int getElementSize(short type, short name)
Definition: bDNA.h:46
size
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
bParse::bDNA::mTypeLookup
btHashMap< btHashString, int > mTypeLookup
Definition: bDNA.h:99
bParse::bDNA::mCMPFlags
btAlignedObjectArray< int > mCMPFlags
Definition: bDNA.h:92