#include "driver.h"
#include "layout.h"
#include "track.h"
+#include "trackattachment.h"
#include "tracktype.h"
using namespace std;
using namespace Msp;
+namespace {
+
+struct AttachmentCompare
+{
+ unsigned entry;
+
+ AttachmentCompare(unsigned e): entry(e) { }
+
+ bool operator()(const R2C2::TrackAttachment *a1, const R2C2::TrackAttachment *a2) const
+ { return a1->get_offset_from_endpoint(entry)<a2->get_offset_from_endpoint(entry); }
+};
+
+}
+
namespace R2C2 {
Track::Track(Layout &l, const TrackType &t):
sensor_id = i;
layout.create_blocks(*this);
- if(layout.has_driver() && sensor_id)
- layout.get_driver().add_sensor(sensor_id);
}
void Track::set_active_path(unsigned p)
attachments.erase(i);
}
+Track::AttachmentList Track::get_attachments_ordered(unsigned epi) const
+{
+ AttachmentList result = attachments;
+ result.sort(AttachmentCompare(epi));
+ return result;
+}
+
void Track::save(list<DataFile::Statement> &st) const
{
st.push_back((DataFile::Statement("position"), position.x, position.y, position.z));