22 #include <odinseq/seqclass.h>
23 #include <odinseq/seqplatform.h>
25 class SeqDriverBase :
public virtual SeqClass {
29 virtual ~SeqDriverBase() {}
44 typedef D* (*create_driver_callback)();
52 if(current_driver)
delete current_driver;
56 SeqClass::operator = (di);
57 if(current_driver)
delete current_driver;
59 if(di.current_driver) current_driver=di.current_driver->clone_driver();
63 D& operator * () {
return *get_driver();}
64 D* operator -> () {
return get_driver();}
70 bool prep() {
return bool(get_driver());}
73 odinPlatform current_pf=SeqPlatformProxy::get_current_platform();
74 if(!current_driver) allocate_driver();
76 odinPlatform driver_platform=current_driver->get_driverplatform();
77 if(driver_platform!=current_pf) {
78 delete current_driver;
83 STD_cerr <<
"ERROR: " <<
get_label() <<
": Driver missing for platform " << SeqPlatformProxy::get_platform_str(current_pf) << STD_endl;
85 if(current_driver->get_driverplatform()!=current_pf) {
86 STD_string drvplat(SeqPlatformProxy::get_possible_platforms()[current_driver->get_driverplatform()]);
87 STD_cerr <<
"ERROR: " <<
get_label() <<
": Driver has wrong platform signature " << drvplat <<
", but expected " << SeqPlatformProxy::get_platform_str(current_pf) << STD_endl;
89 return current_driver;
92 void allocate_driver() {
93 current_driver=pfinterface->create_driver(current_driver);
94 if(current_driver) current_driver->set_label(
get_label());
Labeled & set_label(const STD_string &label)
const STD_string & get_label() const