20.10.2013 - Modified PIObject - virtual debugName() for macro piCoutObj, improved timer measurements and timers on Windows

This commit is contained in:
peri4
2013-10-20 17:41:55 +04:00
parent 0f1b528ac6
commit ec5530053a
32 changed files with 2196 additions and 1331 deletions

View File

@@ -146,10 +146,10 @@ public:
//! Reimplement this function to read from your device
virtual int read(void * read_to, int max_size) {piCoutObj << "[PIIODevice] \"read\" not implemented!"; return -2;}
virtual int read(void * read_to, int max_size) {piCoutObj << "\"read\" is not implemented!"; return -2;}
//! Reimplement this function to write to your device
virtual int write(const void * data, int max_size) {piCoutObj << "[PIIODevice] \"write\" not implemented!"; return -2;}
virtual int write(const void * data, int max_size) {piCoutObj << "\"write\" is not implemented!"; return -2;}
//! Read from device maximum "max_size" bytes and return them as PIByteArray
@@ -164,6 +164,10 @@ public:
//! Add task to threaded write queue and return task ID
ullong writeThreaded(const PIByteArray & data);
//! Configure device from section "section" of file "config_file", if "parent_section" parent section also will be read
bool configure(const PIString & config_file, const PIString & section, bool parent_section = true);
EVENT_HANDLER(bool, open) {if (!init_) init(); opened_ = openDevice(); if (opened_) opened(); return opened_;}
@@ -230,6 +234,9 @@ protected:
//! Function executed before first \a openDevice() or from constructor
virtual bool init() {return true;}
//! Reimplement to configure device from entries "e_main" and "e_parent", cast arguments to \a PIConfig::Entry*
virtual bool configureDevice(const void * e_main, const void * e_parent = 0) {return true;}
//! Reimplement to open device, return value will be set to "opened_" variable
virtual bool openDevice() = 0; // use path_, type_, opened_, init_ variables
@@ -242,6 +249,7 @@ protected:
void terminate();
PIString path_;
DeviceMode mode_;
ReadRetFunc ret_func_;