]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/layout.h
f603d39f2f0b8ad3e4262e9b583254c4e13dc6eb
[r2c2.git] / source / libmarklin / layout.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2009 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBMARKLIN_LAYOUT_H_
9 #define LIBMARKLIN_LAYOUT_H_
10
11 #include <sigc++/sigc++.h>
12 #include <msp/datafile/loader.h>
13 #include "route.h"
14 #include "track.h"
15
16 namespace Marklin {
17
18 class Catalogue;
19
20 class Layout
21 {
22 public:
23         class Loader: public Msp::DataFile::BasicLoader<Layout>
24         {
25         public:
26                 Loader(Layout &);
27         private:
28                 virtual void finish();
29                 void track(unsigned);
30         };
31
32 private:
33         const Catalogue &catalogue;
34         std::string base;
35         std::set<Track *> tracks;
36         //RouteSeq    routes;
37
38 public:
39         sigc::signal<void, Track &> signal_track_added;
40         sigc::signal<void, Track &> signal_track_removed;
41
42         Layout(const Catalogue &);
43         ~Layout();
44
45         const Catalogue &get_catalogue() const { return catalogue; }
46         const std::string &get_base() const { return base; }
47         const std::set<Track *> &get_tracks() const { return tracks; }
48         void  add_track(Track &);
49         void  remove_track(Track &);
50         void  check_links();
51         void  save(const std::string &);
52 };
53
54 } // namespace Marklin
55
56 #endif
57