vcsl_graph.h
Go to the documentation of this file.
1 // This is core/vcsl/vcsl_graph.h
2 #ifndef vcsl_graph_h_
3 #define vcsl_graph_h_
4 //:
5 // \file
6 // \brief Spatial coordinate system transformation graph
7 // \author Francois BERTEL
8 //
9 // \verbatim
10 // Modifications
11 // 2000/08/01 Francois BERTEL Creation.
12 // 2001/04/10 Ian Scott (Manchester) Converted perceps header to doxygen
13 // 2002/01/28 Peter Vanroose - std::vector member vertices_ changed to non-ptr
14 // 2004/09/10 Peter Vanroose - Added explicit copy constructor (ref_count !)
15 // 2004/09/17 Peter Vanroose - made count() non-virtual - it just returns a member and should not be overloaded
16 // \endverbatim
17 
18 #include <vector>
19 #include <vbl/vbl_ref_count.h>
20 #include <vcsl/vcsl_graph_sptr.h>
21 #include <vcsl/vcsl_spatial_sptr.h>
22 #ifdef _MSC_VER
23 # include <vcl_msvc_warnings.h>
24 #endif
25 
26 //: Spatial coordinate system transformation graph
27 // Graph where nodes are spatial coordinate systems and arrows are
28 // transformations. Only the nodes are in the graph class. The transformations
29 // are in the spatial coordinates systems
31  :public vbl_ref_count
32 {
33  public:
34  //***************************************************************************
35  // Constructors/Destructor
36  //***************************************************************************
37 
38  // Default constructor
39  vcsl_graph() = default;
40 
41  // Copy constructor
43 
44  // Destructor
45  ~vcsl_graph() override = default;
46 
47  //***************************************************************************
48  // Measurement
49  //***************************************************************************
50 
51  //: Number of coordinate systems
52  unsigned int count() const { return (unsigned int)(vertices_.size()); }
53 
54  //***************************************************************************
55  // Status report
56  //***************************************************************************
57 
58  //: Has `this' `cs' as node ?
59  bool has(const vcsl_spatial_sptr &cs) const;
60 
61  //: Is `index' valid in the list of the spatial coordinate systems ?
62  bool valid_index(unsigned int index) const { return index < count(); }
63 
64  //***************************************************************************
65  // Access
66  //***************************************************************************
67 
68  //: Spatial coordinate system number `index'
69  // REQUIRE: valid_index(index)
70  vcsl_spatial_sptr item(unsigned int index) const;
71 
72  //: Add `cs' in `this'
73  // REQUIRE: !has(cs)
74  void put(const vcsl_spatial_sptr &cs);
75 
76  //: Remove `cs' from `this'
77  // REQUIRE: has(cs)
78  void remove(const vcsl_spatial_sptr &cs);
79 
80  //***************************************************************************
81  // Basic operations
82  //***************************************************************************
83 
84  //: Set the flag `reached' to false for each spatial coordinate system.
85  // Used by the search path algorithm
86  void init_vertices() const;
87 
88  protected:
89 
90  //: Vertices of the graph: all the spatial coordinate systems
91  std::vector<vcsl_spatial_sptr> vertices_;
92 };
93 
94 #endif // vcsl_graph_h_
Spatial coordinate system transformation graph.
Definition: vcsl_graph.h:30
std::vector< vcsl_spatial_sptr > vertices_
Vertices of the graph: all the spatial coordinate systems.
Definition: vcsl_graph.h:91
~vcsl_graph() override=default
void put(const vcsl_spatial_sptr &cs)
Add ‘cs’ in ‘this’.
Definition: vcsl_graph.cxx:41
unsigned int count() const
Number of coordinate systems.
Definition: vcsl_graph.h:52
void remove(const vcsl_spatial_sptr &cs)
Remove ‘cs’ from ‘this’.
Definition: vcsl_graph.cxx:53
void init_vertices() const
Set the flag ‘reached’ to false for each spatial coordinate system.
Definition: vcsl_graph.cxx:67
vcsl_graph(vcsl_graph const &x)
Definition: vcsl_graph.h:42
bool valid_index(unsigned int index) const
Is ‘index’ valid in the list of the spatial coordinate systems ?.
Definition: vcsl_graph.h:62
bool has(const vcsl_spatial_sptr &cs) const
Has ‘this’ ‘cs’ as node ?.
Definition: vcsl_graph.cxx:12
vcsl_graph()=default
vcsl_spatial_sptr item(unsigned int index) const
Spatial coordinate system number ‘index’.
Definition: vcsl_graph.cxx:29