Revision: 1.1 - (view) (download) (as text)
1 : | ktanaka | 1.1 | #ifndef _ASSUMPTION_H |
2 : | #define _ASSUMPTION_H | ||
3 : | |||
4 : | enum PtypeMask{ | ||
5 : | TenMask=1<<0, | ||
6 : | YokoMask=1<<1, | ||
7 : | TateMask=1<<2, | ||
8 : | }; | ||
9 : | enum JointType{ | ||
10 : | Start, | ||
11 : | JointStart, | ||
12 : | Mid, | ||
13 : | End, | ||
14 : | JointEnd, | ||
15 : | }; | ||
16 : | |||
17 : | class SimpleAssumption{ | ||
18 : | friend ostream& operator<<(ostream &os,const SimpleAssumption &sa); | ||
19 : | protected: | ||
20 : | PtypeMask pmask; | ||
21 : | JointType jtype; | ||
22 : | int x, y; | ||
23 : | int angle; | ||
24 : | public: | ||
25 : | SimpleAssumption(PtypeMask pm, JointType jt,int xx,int yy, int a) | ||
26 : | :pmask(pm), jtype(jt), x(xx), y(yy), angle(a){} | ||
27 : | }; | ||
28 : | class AndAssumption{ | ||
29 : | friend ostream& operator<<(ostream &os,const AndAssumption &aa); | ||
30 : | protected: | ||
31 : | vector<SimpleAssumption> saList; | ||
32 : | public: | ||
33 : | AndAssumption& add(const SimpleAssumption &sa){ | ||
34 : | saList.push_back(sa); | ||
35 : | return *this; | ||
36 : | } | ||
37 : | }; | ||
38 : | class Assumption{ | ||
39 : | friend ostream& operator<<(ostream &os,const Assumption &as); | ||
40 : | private: | ||
41 : | vector<AndAssumption> aaList; | ||
42 : | public: | ||
43 : | Assumption& add(const AndAssumption &sa){ | ||
44 : | aaList.push_back(sa); | ||
45 : | return *this; | ||
46 : | } | ||
47 : | }; | ||
48 : | ostream& operator<<(ostream &os,const SimpleAssumption &sa){ | ||
49 : | os << "SimpleAssumption(pmask=" << (int)(sa.pmask) << ",jtype=" << (int)(sa.jtype) | ||
50 : | << ",x=" << sa.x << ",y=" << sa.y << ",angle=" << sa.angle << ")"; | ||
51 : | return os; | ||
52 : | } | ||
53 : | ostream& operator<<(ostream &os,const AndAssumption &aa){ | ||
54 : | vector<SimpleAssumption>::const_iterator it; | ||
55 : | os << "AndAssumption("; | ||
56 : | for(it=aa.saList.begin(); it!=aa.saList.end(); it++){ | ||
57 : | os << *it << ' '; | ||
58 : | } | ||
59 : | os << ")"; | ||
60 : | return os; | ||
61 : | } | ||
62 : | ostream& operator<<(ostream &os,const Assumption &a){ | ||
63 : | vector<AndAssumption>::const_iterator it; | ||
64 : | os << "Assumption("; | ||
65 : | for(it=a.aaList.begin(); it!=a.aaList.end(); it++){ | ||
66 : | os << *it << ' '; | ||
67 : | } | ||
68 : | os << ")"; | ||
69 : | return os; | ||
70 : | } | ||
71 : | |||
72 : | #endif /* _ASSUMPTION_H */ |
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |