Changeset 961:289d80c33f04 in lemon-0.x for src/lemon/concept/graph.h
- Timestamp:
- 11/04/04 23:04:51 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1344
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/concept/graph.h
r959 r961 766 766 767 767 768 /// \bug The nodes and edges are not allowed to inherit from the769 /// same baseclass.770 771 class BaseGraphItem {772 public:773 BaseGraphItem() {}774 BaseGraphItem(Invalid) {}775 776 // We explicitely list these:777 BaseGraphItem(BaseGraphItem const&) {}778 BaseGraphItem& operator=(BaseGraphItem const&) { return *this; }779 780 bool operator==(BaseGraphItem) const { return false; }781 bool operator!=(BaseGraphItem) const { return false; }782 783 // Technical requirement. Do we really need this?784 bool operator<(BaseGraphItem) const { return false; }785 };786 787 788 768 /// A minimal GraphBase concept 789 769 … … 795 775 GraphBase() {} 796 776 797 798 /// \bug Nodes and Edges are comparable each other 799 800 class Node : public BaseGraphItem {}; 801 class Edge : public BaseGraphItem {}; 777 /// \bug Should we demand that Node and Edge be subclasses of the 778 /// Graph class??? 779 780 typedef GraphItem<'n'> Node; 781 typedef GraphItem<'e'> Edge; 782 783 // class Node : public BaseGraphItem<'n'> {}; 784 // class Edge : public BaseGraphItem<'e'> {}; 802 785 803 786 // Graph operation … … 841 824 842 825 843 /**************** Concept checking classes ****************/ 844 845 template<typename BGI> 846 struct BaseGraphItemConcept { 847 void constraints() { 848 BGI i1; 849 BGI i2 = i1; 850 BGI i3 = INVALID; 851 852 i1 = i3; 853 if( i1 == i3 ) { 854 if ( i2 != i3 && i3 < i2 ) 855 return; 856 } 857 } 858 }; 859 860 826 827 /**************** The full-featured graph concepts ****************/ 828 861 829 862 830 class StaticGraph 863 : virtual public BaseGraphComponent, public IterableGraphComponent, public MappableGraphComponent { 831 : virtual public BaseGraphComponent, 832 public IterableGraphComponent, public MappableGraphComponent { 864 833 public: 865 834 typedef BaseGraphComponent::Node Node; … … 870 839 struct StaticGraphConcept { 871 840 void constraints() { 872 function_requires<BaseGraphComponentConcept<Graph> >();873 841 function_requires<IterableGraphComponentConcept<Graph> >(); 874 842 function_requires<MappableGraphComponentConcept<Graph> >(); 875 843 } 876 Graph& graph;877 844 }; 878 845 879 846 class ExtendableGraph 880 : virtual public BaseGraphComponent, public StaticGraph, public ExtendableGraphComponent, public ClearableGraphComponent { 847 : virtual public BaseGraphComponent, public StaticGraph, 848 public ExtendableGraphComponent, public ClearableGraphComponent { 881 849 public: 882 850 typedef BaseGraphComponent::Node Node; … … 891 859 function_requires<ClearableGraphComponentConcept<Graph> >(); 892 860 } 893 Graph& graph;894 861 }; 895 862 896 863 class ErasableGraph 897 : virtual public BaseGraphComponent, public ExtendableGraph, public ErasableGraphComponent { 864 : virtual public BaseGraphComponent, public ExtendableGraph, 865 public ErasableGraphComponent { 898 866 public: 899 867 typedef BaseGraphComponent::Node Node; … … 907 875 function_requires<ErasableGraphComponentConcept<Graph> >(); 908 876 } 909 Graph& graph;910 877 }; 911 878
Note: See TracChangeset
for help on using the changeset viewer.