/usr/include/odinseq/seqdriver.h is in libodin-dev 1.8.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | /***************************************************************************
seqdriver.h - description
-------------------
begin : Sat Apr 3 2004
copyright : (C) 2000-2014 by Thies H. Jochimsen
email : thies@jochimsen.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SEQDRIVER_H
#define SEQDRIVER_H
#include <odinseq/seqclass.h>
#include <odinseq/seqplatform.h>
class SeqDriverBase : public virtual SeqClass {
public:
SeqDriverBase() {}
virtual ~SeqDriverBase() {}
virtual odinPlatform get_driverplatform() const = 0;
};
/////////////////////////////////////////////////////////////////
/**
* @ingroup odinseq_internals
* The interface class for all driver (platform specific) classes
*/
template<class D>
class SeqDriverInterface : public SeqClass {
public:
typedef D* (*create_driver_callback)();
SeqDriverInterface(const STD_string& driverlabel="unnamedSeqDriverInterface")
: current_driver(0) {
set_label(driverlabel);
}
virtual ~SeqDriverInterface(){
if(current_driver) delete current_driver;
}
SeqDriverInterface& operator = (const SeqDriverInterface& di) {
SeqClass::operator = (di);
if(current_driver) delete current_driver;
current_driver=0;
if(di.current_driver) current_driver=di.current_driver->clone_driver();
return *this;
}
D& operator * () {return *get_driver();}
D* operator -> () {return get_driver();}
private:
// overwriting virtual functions from SeqClass
bool prep() {return bool(get_driver());} // make sure correct driver is loaded
D* get_driver() {
odinPlatform current_pf=SeqPlatformProxy::get_current_platform();
if(!current_driver) allocate_driver();
else {
odinPlatform driver_platform=current_driver->get_driverplatform();
if(driver_platform!=current_pf) {
delete current_driver;
allocate_driver();
}
}
if(!current_driver) {
STD_cerr << "ERROR: " << get_label() << ": Driver missing for platform " << SeqPlatformProxy::get_platform_str(current_pf) << STD_endl;
}
if(current_driver->get_driverplatform()!=current_pf) {
STD_string drvplat(SeqPlatformProxy::get_possible_platforms()[current_driver->get_driverplatform()]);
STD_cerr << "ERROR: " << get_label() << ": Driver has wrong platform signature " << drvplat << ", but expected " << SeqPlatformProxy::get_platform_str(current_pf) << STD_endl;
}
return current_driver;
}
void allocate_driver() {
current_driver=pfinterface->create_driver(current_driver);
if(current_driver) current_driver->set_label(get_label());
}
SeqPlatformProxy pfinterface;
D* current_driver;
};
#endif
|