]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/tracktype.h
ba1b95ff6aee5148d5335f47648e9c2e5de84b00
[r2c2.git] / source / libmarklin / tracktype.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_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_route_length(int) const;
43         unsigned get_n_routes() const;
44         const std::vector<TrackPart> &get_parts() const { return parts; }
45         const std::vector<Endpoint>  &get_endpoints() const { return endpoints; }
46
47 private:
48         void  collect_endpoints();
49 };
50
51 } // namespace Marklin
52
53 #endif