+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
#ifndef LIBMARKLIN_CATALOGUE_H_
#define LIBMARKLIN_CATALOGUE_H_
#include <map>
#include <msp/datafile/loader.h>
+#include "layout.h"
+#include "profile.h"
namespace Marklin {
-class LocoType;
class TrackType;
+class VehicleType;
class Catalogue
{
public:
- class Loader: public Msp::DataFile::Loader
+ class Loader: public Msp::DataFile::BasicLoader<Catalogue>
{
public:
Loader(Catalogue &);
private:
- Catalogue &cat;
-
- void locomotive(unsigned);
+ void ballast_profile();
+ void gauge(float);
+ void layout();
+ void rail_profile();
+ void scale(float, float);
void track(unsigned);
+ void vehicle(unsigned);
};
+ sigc::signal<void, const TrackType &> signal_track_added;
+ sigc::signal<void, const VehicleType &> signal_vehicle_added;
+
private:
+ float scale;
+ float gauge;
+ Profile rail_profile;
+ Profile ballast_profile;
+ Profile path_profile;
std::map<unsigned, TrackType *> tracks;
- std::map<unsigned, LocoType *> locos;
+ std::map<unsigned, VehicleType *> vehicles;
+ Layout layout;
public:
+ Catalogue();
~Catalogue();
- TrackType &get_track(unsigned) const;
+ float get_scale() const { return scale; }
+ float get_gauge() const { return gauge; }
+ float get_rail_elevation() const;
+ 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; }
+
+ void add_track(TrackType &);
+ const TrackType &get_track(unsigned) const;
const std::map<unsigned, TrackType *> &get_tracks() const { return tracks; }
- LocoType &get_locomotive(unsigned) const;
- const std::map<unsigned, LocoType *> &get_locomotives() const { return locos; }
- void load(const std::string &);
+
+ void add_vehicle(VehicleType &);
+ const VehicleType &get_vehicle(unsigned) const;
+ const std::map<unsigned, VehicleType *> &get_vehicles() const { return vehicles; }
+
+ Layout &get_layout() { return layout; }
};
} // namespace Marklin