]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/driver.cpp
3b6d64995f56a04c24e52472800e9d6ec8fe24ba
[r2c2.git] / source / libr2c2 / driver.cpp
1 #include "centralstation.h"
2 #include "driver.h"
3 #include "dummy.h"
4 #include "intellibox.h"
5
6 using namespace std;
7
8 namespace R2C2 {
9
10 Driver *Driver::create(const string &str)
11 {
12         string::size_type colon = str.find(':');
13         string type = str.substr(0, colon);
14         string params;
15
16         if(colon!=string::npos)
17                 params = str.substr(colon+1);
18
19         if(type=="ib" || type=="intellibox")
20                 return new Intellibox(params);
21         else if(type=="cs" || type=="centralstation")
22                 return new CentralStation(params);
23         else if(type=="dummy")
24                 return new Dummy(params);
25
26         throw invalid_argument("Driver::create");
27 }
28
29 } // namespace R2C2