edge.h

00001 //==========================================================================
00002 //
00003 //   edge.h
00004 //
00005 //==========================================================================
00006 // $Id: edge.h,v 1.15 2001/04/17 14:35:25 raitner Exp $
00007 
00008 #ifndef GTL_EDGE_H
00009 #define GTL_EDGE_H
00010 
00011 #include <GTL/GTL.h>
00012 
00013 #include <list>
00014 
00015 __GTL_BEGIN_NAMESPACE
00016  
00017 //--------------------------------------------------------------------------
00018 //   For MSVC 5.0 edge.h has to be included before node.h and
00019 //   {node,edge}_data.h. So we only declare needed classnames here
00020 //--------------------------------------------------------------------------
00021 
00022 class node;
00023 class edge_data;
00024 
00025 //--------------------------------------------------------------------------
00026 //   edge
00027 //--------------------------------------------------------------------------
00028 
00032 class GTL_EXTERN edge
00033 {
00034 public:
00051     edge();
00052 
00058     node source() const;
00059 
00065     node target() const;
00066 
00070     void reverse ();
00071 
00077     void change_source (node n);
00078 
00084     void change_target (node n);
00085 
00092     const node& opposite(node n) const;
00093 
00097     list<node> sources() const;
00098 
00102     list<node> targets() const;
00103 
00107     int id() const;
00108 
00109     
00117     bool is_hidden () const;
00118 
00119 
00120     //================================================== Implementation
00121     
00122 private:
00123     edge_data *data;
00124     
00125     void remove_from(int where) const; // 0 = sources, 1 == targets
00126 
00127     friend class graph;
00128     friend class node;
00129     
00130     GTL_EXTERN friend bool operator==(edge, edge);
00131     GTL_EXTERN friend bool operator!=(edge, edge);
00132     GTL_EXTERN friend bool operator<(edge, edge);
00133     GTL_EXTERN friend ostream& operator<< (ostream& os, const edge& e);
00134 };
00135 
00136 __GTL_END_NAMESPACE
00137 
00138 #endif // GTL_EDGE_H
00139 
00140 //--------------------------------------------------------------------------
00141 //   end of file
00142 //--------------------------------------------------------------------------