00001 #ifndef mmn_dependancy_h_
00002 #define mmn_dependancy_h_
00003
00004
00005
00006
00007
00008
00009 #include <vsl/vsl_binary_io.h>
00010
00011
00012
00013
00014 class mmn_dependancy
00015 {
00016 public:
00017 unsigned v0,v1,v2;
00018 unsigned arc1, arc2, arc12;
00019 unsigned n_dep;
00020
00021
00022 mmn_dependancy() :v0(0), v1(0),v2(0),arc1(0),arc2(0),arc12(0),n_dep(0) {};
00023
00024
00025 mmn_dependancy(unsigned u0, unsigned u1, unsigned a1)
00026 : v0(u0), v1(u1), v2(9999), arc1(a1), arc2(9999), n_dep(1) {};
00027
00028
00029 mmn_dependancy(unsigned u0, unsigned u1, unsigned u2,
00030 unsigned a1, unsigned a2, unsigned a12)
00031 : v0(u0), v1(u1), v2(u2), arc1(a1), arc2(a2),arc12(a12), n_dep(2) {};
00032
00033 };
00034
00035 inline vcl_ostream& operator<<(vcl_ostream& os, const mmn_dependancy& t)
00036 {
00037 os<<"{";
00038 if (t.n_dep==1) os<<t.v0<<":"<<t.v1<<"}";
00039 if (t.n_dep==2) os<<t.v0<<":("<<t.v1<<","<<t.v2<<")}";
00040 return os;
00041 }
00042
00043 inline void vsl_b_write(vsl_b_ostream& bfs, const mmn_dependancy& t)
00044 {
00045 vsl_b_write(bfs,t.v0);
00046 vsl_b_write(bfs,t.v1);
00047 vsl_b_write(bfs,t.v2);
00048 vsl_b_write(bfs,t.arc1);
00049 vsl_b_write(bfs,t.arc2);
00050 vsl_b_write(bfs,t.arc12);
00051 vsl_b_write(bfs,t.n_dep);
00052 }
00053
00054 inline void vsl_b_read(vsl_b_istream& bfs, mmn_dependancy& t)
00055 {
00056 vsl_b_read(bfs,t.v0);
00057 vsl_b_read(bfs,t.v1);
00058 vsl_b_read(bfs,t.v2);
00059 vsl_b_read(bfs,t.arc1);
00060 vsl_b_read(bfs,t.arc2);
00061 vsl_b_read(bfs,t.arc12);
00062 vsl_b_read(bfs,t.n_dep);
00063 }
00064
00065 #endif // mmn_dependancy_h_
00066