]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/catalogue.h
Add basic support for signals
[r2c2.git] / source / libr2c2 / catalogue.h
index c8b006ab42820b8b7b786e3ca494292fed7874a3..d1829afae8b47a3510188523bffbb423ffaf38b5 100644 (file)
@@ -1,28 +1,22 @@
-/* $Id$
-
-This file is part of R²C²
-Copyright © 2006-2010  Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #ifndef LIBR2C2_CATALOGUE_H_
 #define LIBR2C2_CATALOGUE_H_
 
 #include <map>
-#include <msp/datafile/loader.h>
+#include <msp/datafile/objectloader.h>
 #include "articlenumber.h"
 #include "layout.h"
 #include "profile.h"
 
 namespace R2C2 {
 
+class SignalType;
 class TrackType;
 class VehicleType;
 
 class Catalogue
 {
 public:
-       class Loader: public Msp::DataFile::BasicLoader<Catalogue>
+       class Loader: public Msp::DataFile::ObjectLoader<Catalogue>
        {
        public:
                Loader(Catalogue &);
@@ -32,6 +26,7 @@ public:
                void layout();
                void rail_profile();
                void scale(float, float);
+               void signal(ArticleNumber);
                void track(unsigned);
                void track(ArticleNumber);
                void vehicle(unsigned);
@@ -40,9 +35,11 @@ public:
 
        typedef std::map<ArticleNumber, TrackType *> TrackMap;
        typedef std::map<ArticleNumber, VehicleType *> VehicleMap;
+       typedef std::map<ArticleNumber, SignalType *> SignalMap;
 
        sigc::signal<void, const TrackType &> signal_track_added;
        sigc::signal<void, const VehicleType &> signal_vehicle_added;
+       sigc::signal<void, const SignalType &> signal_signal_added;
 
 private:
        float scale;
@@ -50,8 +47,10 @@ private:
        Profile rail_profile;
        Profile ballast_profile;
        Profile path_profile;
+       std::string track_technique;
        TrackMap tracks;
        VehicleMap vehicles;
+       SignalMap signals;
        Layout layout;
 
 public:
@@ -64,6 +63,7 @@ public:
        const Profile &get_rail_profile() const { return rail_profile; }
        const Profile &get_ballast_profile() const { return ballast_profile; }
        const Profile &get_path_profile() const { return path_profile; }
+       const std::string &get_track_technique() const { return track_technique; }
 
        void add_track(TrackType &);
        const TrackType &get_track(const ArticleNumber &) const;
@@ -73,6 +73,10 @@ public:
        const VehicleType &get_vehicle(const ArticleNumber &) const;
        const VehicleMap &get_vehicles() const { return vehicles; }
 
+       void add_signal(SignalType &);
+       const SignalType &get_signal(const ArticleNumber &) const;
+       const SignalMap &get_signals() const { return signals; }
+
        Layout &get_layout() { return layout; }
 };