]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/tracktype.h
Major architecture rework
[r2c2.git] / source / libmarklin / tracktype.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBMARKLIN_TRACKTYPE_H_
9 #define LIBMARKLIN_TRACKTYPE_H_
10
11 #include <msp/datafile/loader.h>
12 #include "endpoint.h"
13 #include "trackpart.h"
14
15 namespace Marklin {
16
17 class TrackType
18 {
19 public:
20         class Loader: public Msp::DataFile::BasicLoader<TrackType>
21         {
22         public:
23                 Loader(TrackType &);
24         private:
25                 virtual void finish();
26                 void part();
27                 void position(float, float, float);
28         };
29
30 private:
31         unsigned art_nr;
32         std::string description;
33         std::vector<TrackPart> parts;
34         std::vector<Endpoint> endpoints;
35
36 public:
37         TrackType(unsigned);
38
39         unsigned get_article_number() const { return art_nr; }
40         const std::string &get_description() const { return description; }
41         float get_total_length() const;
42         float get_path_length(int) const;
43         unsigned get_paths() const;
44         unsigned get_n_paths() const;
45         bool is_turnout() const;
46         bool is_double_address() const;
47         const std::vector<TrackPart> &get_parts() const { return parts; }
48         const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
49
50 private:
51         void collect_endpoints();
52 };
53
54 } // namespace Marklin
55
56 #endif