Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

mmn_arc.h

Go to the documentation of this file.
00001 #ifndef mmn_arc_h_
00002 #define mmn_arc_h_
00003 //:
00004 // \file
00005 // \brief Representation of topological arc joining two vertices
00006 // \author Tim Cootes
00007 
00008 
00009 #include <vsl/vsl_binary_io.h>
00010 #include <vcl_iostream.h>
00011 
00012 //: Representation of topological arc joining two vertices
00013 class mmn_arc
00014 {
00015 public:
00016   unsigned v1,v2;
00017 
00018   mmn_arc() :v1(999999),v2(999999) {};
00019   mmn_arc(unsigned i1, unsigned i2) : v1(i1),v2(i2) {};
00020 
00021   //: Return smallest node index
00022   unsigned min_v() const { return (v1<v2?v1:v2); }
00023   //: Return largest node index
00024   unsigned max_v() const { return (v1<v2?v2:v1); }
00025 };
00026 
00027 inline bool operator==(const mmn_arc& t1, const mmn_arc& t2)
00028 {
00029   if ((t1.v1==t2.v1) && (t1.v2==t2.v2)) return true;
00030   if ((t1.v1==t2.v2) && (t1.v2==t2.v1)) return true;
00031   return false;
00032 }
00033 
00034 inline bool operator!=(const mmn_arc& t1, const mmn_arc& t2)
00035 { return !(t1==t2); }
00036 
00037 inline vcl_ostream& operator<<(vcl_ostream& os, const mmn_arc& t)
00038 {
00039   return os<<"{"<<t.v1<<","<<t.v2<<"}";
00040 }
00041 
00042 inline void vsl_b_write(vsl_b_ostream& bfs, const mmn_arc& t)
00043 {
00044   vsl_b_write(bfs,t.v1);
00045   vsl_b_write(bfs,t.v2);
00046 }
00047 
00048 inline void vsl_b_read(vsl_b_istream& bfs, mmn_arc& t)
00049 {
00050   vsl_b_read(bfs,t.v1);
00051   vsl_b_read(bfs,t.v2);
00052 }
00053 
00054 #endif // mmn_arc_h_
00055 

Generated on Thu Jan 10 14:44:52 2008 for contrib/mul/mmn by  doxygen 1.4.4