Graph: Generic attributed relational graphs


gfactory.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef GRAPH_GRAPH_GFACTORY_H
35 #define GRAPH_GRAPH_GFACTORY_H
36 
37 
38 //=============================================================================
39 // H E A D E R F I L E S
40 //=============================================================================
41 
44 #include <map>
45 #include <string>
46 
47 
48 //=============================================================================
49 // F O R W A R D D E C L A R A T I O N S
50 //=============================================================================
51 
52 class Vertex;
53 class UEdge;
54 class DEdge;
55 namespace carto
56 {
57  class GenericObject;
58 }
59 
60 
61 //=============================================================================
62 // C L A S S D E C L A R A T I O N
63 //=============================================================================
64 
72 {
73 
74 public:
75  GraphFactory();
76  virtual ~GraphFactory();
77 
78  typedef carto::GenericObject* (*Generator)( const std::string & );
79  static void registerGenerator( const std::string & syntax,
80  Generator f );
81  static void unregisterGenerator( const std::string & syntax );
82 
83 protected:
84 
85  //---------------------------------------------------------------------
87  //---------------------------------------------------------------------
89 
92  virtual Vertex* makeVertex(const std::string& s);
93 
96  virtual UEdge* makeUEdge(const std::string& s);
97 
100  virtual DEdge* makeDEdge(const std::string& s);
101 
103 
104 private:
105 
106  //---------------------------------------------------------------------
108  //---------------------------------------------------------------------
110 
112  friend class Graph;
113 
115 
116  //---------------------------------------------------------------------
118  //---------------------------------------------------------------------
120 
123  GraphFactory& operator=(const GraphFactory&);
124 
126 
127  static std::map<std::string, Generator> & _generators();
128 
129 };
130 
131 
132 #endif
virtual Vertex * makeVertex(const std::string &s)
Create a Vertex.
static void unregisterGenerator(const std::string &syntax)
The base class for graphs.
Definition: graph.h:71
virtual UEdge * makeUEdge(const std::string &s)
Create an unitialized UEdge - without vertices.
Directed edges.
Definition: dedge.h:55
Default abstract factory for graphs.
Definition: gfactory.h:71
virtual DEdge * makeDEdge(const std::string &s)
Create an unitialized DEdge - without vertices.
virtual ~GraphFactory()
carto::GenericObject *(* Generator)(const std::string &)
Definition: gfactory.h:78
static void registerGenerator(const std::string &syntax, Generator f)
Vertices are created and managed by Graphs.
Definition: vertex.h:63
Undirected edges.
Definition: uedge.h:55