+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2010 Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#include <msp/core/except.h>
+#include "driver.h"
+#include "dummy.h"
+#include "intellibox.h"
+
+using namespace std;
+
+namespace Marklin {
+
+Driver *Driver::create(const string &str)
+{
+ string::size_type colon = str.find(':');
+ string type = str.substr(0, colon);
+ string params;
+
+ if(colon!=string::npos)
+ params = str.substr(colon+1);
+
+ if(type=="ib" || type=="intellibox")
+ return new Intellibox(params);
+ else if(type=="dummy")
+ return new Dummy;
+
+ throw Msp::InvalidParameterValue("Unknown driver");
+}
+
+} // namespace Marklin