#ifndef LIBR2C2_CATALOGUE_H_
#define LIBR2C2_CATALOGUE_H_
-#include <map>
-#include <msp/datafile/objectloader.h>
-#include "articlenumber.h"
+#include <msp/datafile/collection.h>
+#include <msp/datafile/collectionsource.h>
+#include <msp/fs/path.h>
#include "layout.h"
-#include "profile.h"
namespace R2C2 {
class ObjectType;
-class Catalogue
+class Catalogue: public Msp::DataFile::Collection
{
public:
- class Loader: public Msp::DataFile::ObjectLoader<Catalogue>
+ class Loader: public Msp::DataFile::Collection::Loader
{
+ private:
+ Catalogue &cat;
+
public:
Loader(Catalogue &);
private:
- void ballast_profile();
- void gauge(float);
void layout();
- void rail_profile();
void scale(float, float);
- void signal(ArticleNumber);
- void terrain(ArticleNumber);
- void track(ArticleNumber);
- void vehicle(ArticleNumber);
};
- typedef std::map<ArticleNumber, ObjectType *> ObjectMap;
-
- sigc::signal<void, const ObjectType &> signal_object_added;
+ sigc::signal<void, Msp::DataFile::CollectionSource &> signal_source_added;
private:
float scale;
- float gauge;
- Profile rail_profile;
- Profile ballast_profile;
- std::string track_technique;
- ObjectMap objects;
Layout layout;
+ std::list<Msp::DataFile::CollectionSource *> sources;
public:
Catalogue();
- ~Catalogue();
- 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 std::string &get_track_technique() const { return track_technique; }
-
- void add(ObjectType &);
- const ObjectType &get(const ArticleNumber &) const;
- const ObjectMap &get_all() const { return objects; }
-
- template<typename T>
- const T &get(const ArticleNumber &an) const
- { return dynamic_cast<const T &>(get(an)); }
+ void add_source(const Msp::FS::Path &);
+ const std::list<Msp::DataFile::CollectionSource *> &get_sources() const { return sources; }
+ float get_scale() const { return scale; }
Layout &get_layout() { return layout; }
};