[wadalabfont-kit] / jis2prim / Assumption.h  

Annotation of /jis2prim/Assumption.h

Parent Directory | Revision Log

Revision: 1.2 - (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 : ktanaka 1.2 HidariMask=1<<3,
9 :     TatehaneMask=1<<4,
10 :     TatehidariMask=1<<5,
11 : ktanaka 1.1 };
12 :     enum JointType{
13 :     Start,
14 :     JointStart,
15 :     Mid,
16 :     End,
17 :     JointEnd,
18 :     };
19 :    
20 :     class SimpleAssumption{
21 :     friend ostream& operator<<(ostream &os,const SimpleAssumption &sa);
22 :     protected:
23 :     PtypeMask pmask;
24 :     JointType jtype;
25 : ktanaka 1.2 double x, y;
26 : ktanaka 1.1 int angle;
27 : ktanaka 1.2 int hint;
28 : ktanaka 1.1 public:
29 : ktanaka 1.2 SimpleAssumption(PtypeMask pm, JointType jt,double xx,double yy, int a,int h)
30 :     :pmask(pm), jtype(jt), x(xx), y(yy), angle(a), hint(h){}
31 : ktanaka 1.1 };
32 :     class AndAssumption{
33 :     friend ostream& operator<<(ostream &os,const AndAssumption &aa);
34 :     protected:
35 :     vector<SimpleAssumption> saList;
36 :     public:
37 :     AndAssumption& add(const SimpleAssumption &sa){
38 :     saList.push_back(sa);
39 :     return *this;
40 :     }
41 :     };
42 :     class Assumption{
43 :     friend ostream& operator<<(ostream &os,const Assumption &as);
44 :     private:
45 :     vector<AndAssumption> aaList;
46 :     public:
47 :     Assumption& add(const AndAssumption &sa){
48 :     aaList.push_back(sa);
49 :     return *this;
50 :     }
51 : ktanaka 1.2 Assumption& add(const SimpleAssumption &sa){
52 :     aaList.push_back(AndAssumption().add(sa));
53 :     return *this;
54 :     }
55 : ktanaka 1.1 };
56 :     ostream& operator<<(ostream &os,const SimpleAssumption &sa){
57 :     os << "SimpleAssumption(pmask=" << (int)(sa.pmask) << ",jtype=" << (int)(sa.jtype)
58 : ktanaka 1.2 << ",x=" << sa.x << ",y=" << sa.y << ",angle=" << sa.angle
59 :     << ",hint=" << sa.hint << ")";
60 : ktanaka 1.1 return os;
61 :     }
62 :     ostream& operator<<(ostream &os,const AndAssumption &aa){
63 :     vector<SimpleAssumption>::const_iterator it;
64 : ktanaka 1.2 if(aa.saList.size()==1){
65 :     return os << *(aa.saList.begin());
66 :     }
67 : ktanaka 1.1 os << "AndAssumption(";
68 :     for(it=aa.saList.begin(); it!=aa.saList.end(); it++){
69 :     os << *it << ' ';
70 :     }
71 :     os << ")";
72 :     return os;
73 :     }
74 :     ostream& operator<<(ostream &os,const Assumption &a){
75 :     vector<AndAssumption>::const_iterator it;
76 : ktanaka 1.2 if(a.aaList.size()==1){
77 :     return os << *(a.aaList.begin());
78 :     }
79 : ktanaka 1.1 os << "Assumption(";
80 :     for(it=a.aaList.begin(); it!=a.aaList.end(); it++){
81 :     os << *it << ' ';
82 :     }
83 :     os << ")";
84 :     return os;
85 :     }
86 :    
87 :     #endif /* _ASSUMPTION_H */

ktanaka

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help