ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/IntegrableObjects.hpp
Revision: 1101
Committed: Tue Apr 13 15:09:24 2004 UTC (20 years, 2 months ago) by gezelter
File size: 1370 byte(s)
Log Message:
Forgot to add IntegrableObjects

File Contents

# User Rev Content
1 gezelter 1101 #ifndef __INTEGRABLEOBJECTS_HPP__
2     #define __INTEGRABLEOBJECTS_HPP__
3    
4     #include <set>
5     #include <utility>
6     #include "StuntDouble.hpp"
7    
8     using namespace std;
9    
10     struct sd_equals
11     {
12     bool operator()==(const StuntDouble* sd1, const StuntDouble* sd2) const
13     {
14     if (sd1->isAtom()) {
15     if (sd2->isAtom())
16     return ((Atom *)sd1->getIndex() == (Atom *)sd2->getIndex());
17     else
18     return 0;
19     } else {
20     if (sd2->isRigidBody())
21     return ((RigidBody *)sd1->getIndex() == (RigidBody *)sd2->getIndex());
22     else
23     return 0;
24     }
25     };
26    
27     struct sd_lt
28     {
29     bool operator()(const StuntDouble* sd1, const StuntDouble* sd2) const
30     {
31     if (sd1->isAtom()) {
32     if (sd2->isAtom())
33     return ((Atom *)sd1->getIndex() < (Atom *)sd2->getIndex()) ;
34     else
35     return 0;
36     } else {
37     if (sd2->isRigidBody())
38     return ((RigidBody *)sd1->getIndex() < (RigidBody *)sd2->getIndex()) ;
39     else
40     return 1;
41     }
42    
43     }
44     };
45    
46     class IntegrableObjects{
47    
48     public:
49    
50     ~IntegrableObjects();
51    
52     void addStuntDouble(StuntDouble sd);
53     int hasStuntDouble(StuntDouble sd);
54     int getSize( void );
55     static IntegrableObjects* Instance();
56    
57     protected:
58    
59     set<StuntDouble, sd_lt> integrableObjectSet;
60     IntegrableObjects();
61    
62     private:
63     static IntegrableObjects* _instance;
64    
65     };
66    
67     #endif // __INTEGRABLEOBJECTS_HPP__