]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/tracktype.h
Add Id tags and copyright notices to files
[r2c2.git] / source / libmarklin / tracktype.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2008 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::Loader
21         {
22         private:
23                 TrackType &ttype;
24
25         public:
26                 Loader(TrackType &);
27                 TrackType &get_object() { return ttype; }
28         private:
29                 virtual void finish();
30
31                 void part();
32                 void position(float, float, float);
33         };
34
35 private:
36         unsigned     art_nr;
37         std::string  description;
38         std::vector<TrackPart> parts;
39         std::vector<Endpoint> endpoints;
40
41 public:
42         TrackType(unsigned);
43
44         unsigned get_article_number() const { return art_nr; }
45         const std::string &get_description() const { return description; }
46         float get_total_length() const;
47         float get_route_length(int) const;
48         unsigned get_n_routes() const;
49         const std::vector<TrackPart> &get_parts() const { return parts; }
50         const std::vector<Endpoint>  &get_endpoints() const { return endpoints; }
51
52 private:
53         void  collect_endpoints();
54 };
55
56 } // namespace Marklin
57
58 #endif