| Polaris: DirectedEdge.h Source File | ||
|
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members
DirectedEdge.hGo to the documentation of this file.00001 #ifndef _DIRECTEDEDGE_H 00002 #define _DIRECTEDEDGE_H 00003 /// 00004 #ifdef POLARIS_GNU_PRAGMAS 00005 #pragma interface 00006 #endif 00007 /// 00008 /// \class DirectedEdge 00009 /// \brief 00010 /// DirectedEdge is a class for holding the tail and head of the 00011 /// directed edge from a directed acyclic graph (DAG). This class 00012 /// can be used with the TopSorter class to produce the topological 00013 /// sort of the DAG. 00014 /// 00015 /// 00016 /// 00017 #include "ClassNames.h" 00018 #include "Listable.h" 00019 #include "StringElem.h" 00020 /// 00021 class DirectedEdge : public Listable { 00022 00023 protected: 00024 00025 StringElem _source; ///< Tail of the directed arc, e.g. "A" from "A"->"B" 00026 00027 StringElem _target; ///< Head of the directed arc, e.g. "B" from "A"->"B" 00028 00029 public: 00030 00031 DirectedEdge & operator = (const DirectedEdge & de); 00032 ///< Copies one directed edge into another 00033 00034 DirectedEdge( const StringElem & source, const StringElem & target ); 00035 ///< This method creates a DirectedEdge from the two strings (source, target) 00036 00037 DirectedEdge( const StringElem & source, const char * target ); 00038 ///< This method creates a DirectedEdge from the two strings (source, target) 00039 00040 DirectedEdge( const char * source, const StringElem & target ); 00041 ///< This method creates a DirectedEdge from the two strings (source, target) 00042 00043 DirectedEdge( const char * source, const char * target ); 00044 ///< This method creates a DirectedEdge from the two strings (source, target) 00045 00046 DirectedEdge(const DirectedEdge & other); 00047 ///< This method copies the entire state (including current element) 00048 ///< of the DirectedEdge. 00049 00050 ~DirectedEdge() { 00051 #ifdef CLASS_INSTANCE_REGISTRY 00052 unregister_instance(DIRECTED_EDGE, this); 00053 #endif 00054 }; 00055 00056 virtual Listable *listable_clone() const { 00057 return (Listable *) clone(); 00058 } 00059 00060 virtual DirectedEdge *clone() const { 00061 return new DirectedEdge( *this ); 00062 } 00063 00064 ///< This one is to satisfy Listable 00065 virtual void print(ostream & o) const { 00066 o << "(" << this->source() << ", " << this->target() << ")"; 00067 } 00068 00069 friend ostream & operator << (ostream & o, const DirectedEdge & de) { 00070 de.print(o); 00071 return o; 00072 } 00073 00074 StringElem & source() const; 00075 ///< Return the tail of the directed edge, e.g. "A" from "A"->"B" 00076 00077 StringElem & target() const; 00078 ///< Return the head of the directed edge, e.g. "B" from "A"->"B" 00079 00080 }; 00081 00082 #endif |
||
|