ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/primitives/StuntDouble.hpp
Revision: 1709
Committed: Thu Nov 4 16:22:03 2004 UTC (19 years, 8 months ago) by gezelter
File size: 2177 byte(s)
Log Message:
isLinear and linearAxis are virtual in StuntDouble,
but are implemented by DirectionalAtom and RigidBody
In StuntDouble, they should return false and "-1" but
there should be logic to figure them out in the other
two classes

File Contents

# User Rev Content
1 gezelter 1490 #ifndef __STUNTDOUBLE_HPP__
2     #define __STUNTDOUBLE_HPP__
3    
4     #include <map>
5 tim 1492 #include "utils/GenericData.hpp"
6 gezelter 1490
7     #define OT_ATOM 0
8     #define OT_DATOM 1
9     #define OT_RIGIDBODY 2
10    
11     using namespace std;
12 tim 1625 using namespace oopse;
13    
14 gezelter 1490 class BaseVisitor;
15    
16     class StuntDouble {
17     public:
18     virtual ~StuntDouble();
19    
20     int getObjType();
21    
22     bool isAtom(){
23     return objType == OT_ATOM || objType == OT_DATOM;
24     }
25    
26     bool isDirectionalAtom(){
27     return objType == OT_DATOM;
28     }
29    
30     bool isRigidBody(){
31     return objType == OT_RIGIDBODY;
32     }
33    
34     bool isDirectional(){
35     return isDirectionalAtom() || isRigidBody();
36     }
37    
38     virtual double getMass(void);
39    
40     virtual void getPos(double pos[3]);
41     virtual void setPos(double pos[3]);
42    
43     virtual void getVel(double vel[3]);
44     virtual void setVel(double vel[3]);
45    
46     virtual void getFrc(double frc[3]);
47     virtual void addFrc(double frc[3]);
48    
49     virtual void getA(double A[3][3]);
50     virtual void setA(double A[3][3]);
51    
52     virtual void getJ(double j[3]);
53     virtual void setJ(double j[3]);
54    
55     virtual void getQ( double q[4] ); // get the quanternions
56     virtual void setQ( double q[4] );
57    
58     virtual void setType(char* type) = 0;
59     virtual char* getType() = 0;
60    
61     virtual void getTrq(double trq[3]);
62     virtual void addTrq(double trq[3]);
63    
64     virtual void getI(double I[3][3]);
65     virtual void lab2Body(double vec[3]);
66    
67     virtual void getGrad(double grad[6]);
68     virtual void setEuler(double phi, double theta, double psi);
69     virtual void getEulerAngles(double eulers[3]);
70    
71 gezelter 1709 virtual bool isLinear() { return false;}
72     virtual int linearAxis() { return -1; }
73 gezelter 1490
74     virtual double getZangle();
75     virtual void setZangle(double zAngle);
76     virtual void addZangle(double zAngle);
77    
78     virtual void accept(BaseVisitor* v) = 0;
79    
80     void addProperty(GenericData* data);
81     void removeProperty(const string& propName);
82     GenericData* getProperty(const string& propName);
83    
84     protected:
85     StuntDouble(){}
86    
87     //prevent default copy constructor copy information from properties which will cause problem
88     StuntDouble(const StuntDouble& sd){
89     objType = sd.objType;
90     }
91    
92     int objType;
93    
94     map<string, GenericData*> properties;
95     };
96    
97     #endif

Properties

Name Value
svn:executable *