ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/ConstraintAlgorithm.hpp
Revision: 1232
Committed: Thu Jun 3 21:51:55 2004 UTC (20 years, 1 month ago) by tim
File size: 1860 byte(s)
Log Message:
new implementation of constraint

File Contents

# Content
1 #ifndef _CONSTRAINTALGORITHM_H_
2 #define _CONSTRAINTALGORITHM_H_
3
4 #include <iostream>
5 #include <map>
6 #include "CallbackFunctor.hpp"
7 #include "TypeInfo.hpp"
8 #include "ConstraintIterator.hpp"
9 using namespace std;
10
11 class ConstraintManager;
12 class ConstraintPair;
13 class JointConstraintPair;
14 class DistanceConstraintPair;
15 class SimInfo;
16
17 enum ConsAlgoStatus{consFail, consSuccess, consAlready, consPairHandlerFail, consElemHandlerFail};
18
19 ////////////////////////////////////////////////////////////////////////////////
20 //Declaration of ConstraintAlgorithm
21 ////////////////////////////////////////////////////////////////////////////////
22 //base class of constraint algorithm
23 //Actuallly we encount a triple dispatch problem here, something like
24 //ConstrainPair(ConsPairType*, ConsElementType1*, ConsElementType2*)
25 //To solve this problem, we apply visitor pattern and standard double dispatch technique
26 class ConstraintAlgorithm{
27
28 public:
29 ~ConstraintAlgorithm();
30 virtual void doConstrain();
31
32 //using RTTI (Run Time Type Information) to dispatch
33 int doConstrainPair(ConstraintPair* consPair);
34 void registerCallback(const TypeInfo& ti, CallbackFunctor* functor);
35 void unRegister(TypeInfo& ti);
36
37 protected:
38 ConstraintAlgorithm(SimInfo* rhs);
39
40 SimInfo* info;
41 ConstraintPairIterator* cpIter;
42 ConstraintElementIterator* ceIter;
43
44 map<TypeInfo, CallbackFunctor*> callbackMap;
45 };
46
47 ////////////////////////////////////////////////////////////////////////////////
48 //Declaration of ConsAlgoFramework
49 ////////////////////////////////////////////////////////////////////////////////
50 class ConsAlgoFramework{
51 public:
52 ~ConsAlgoFramework();
53
54 void doPreConstraint();
55
56 protected:
57 ConsAlgoFramework(SimInfo* rhs);
58
59 private:
60 ConstraintElementIterator* ceIter;
61
62 };
63
64 #endif //endif _CONSTRAINTALGORITHM_H_

Properties

Name Value
svn:executable *