]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/block.h
Major architecture rework
[r2c2.git] / source / libmarklin / block.h
index b72215ae03d1608092fd0c41943fdea7b7abeb54..abcd87cd9b02221edba66d33955eca56abe8c7ad 100644 (file)
@@ -1,12 +1,12 @@
 /* $Id$
 
 This file is part of the MSP Märklin suite
-Copyright © 2006-2009  Mikkosoft Productions, Mikko Rasa
+Copyright © 2006-2010  Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */
 
-#ifndef MARKLIN_3D_BLOCK_H_
-#define MARKLIN_3D_BLOCK_H_
+#ifndef LIBMARKLIN_BLOCK_H_
+#define LIBMARKLIN_BLOCK_H_
 
 #include <list>
 #include <set>
@@ -14,8 +14,8 @@ Distributed under the GPL
 
 namespace Marklin {
 
+class Layout;
 class Train;
-class TrafficManager;
 
 class Block
 {
@@ -31,16 +31,17 @@ public:
        };
 
 private:
-       TrafficManager &trfc_mgr;
+       Layout &layout;
        unsigned id;
        unsigned sensor_id;
        unsigned turnout_id;
        std::set<Track *> tracks;
        std::vector<Endpoint> endpoints;
-       const Train *train;
+       Train *train;
 
 public:
-       Block(TrafficManager &, Track &);
+       Block(Layout &, Track &);
+       ~Block();
 
        unsigned get_id() const { return id; }
        unsigned get_sensor_id() const { return sensor_id; }
@@ -50,12 +51,14 @@ public:
        int get_endpoint_by_link(const Block &) const;
        unsigned traverse(unsigned, float * =0) const;
        void check_link(Block &);
+       void break_link(Block &);
        Block *get_link(unsigned) const;
-       bool reserve(const Train *);
-       const Train *get_train() const { return train; }
+       bool reserve(Train *);
+       Train *get_train() const { return train; }
        void print_debug();
 private:
        void find_paths(Track &, unsigned, unsigned, std::set<Track *> &);
+       void determine_id();
 };
 
 } // namespace Marklin