29.04.2014 - Version 0.4.0_prealpha. PICodeParser, namespace PICodeInfo, new tool "pip_cmg" in dir "code_model_generator". New feature in PIIODevice - "createFromFullPath", all parameters of all I/O devices now works with PIObjects`s properties.

This commit is contained in:
peri4
2014-04-29 11:50:13 +04:00
parent 77abb0bbea
commit 2e5e75c4c4
98 changed files with 2545 additions and 768 deletions

View File

@@ -31,7 +31,7 @@
class PIBinaryLog: public PIIODevice
{
PIOBJECT(PIBinaryLog)
PIIODEVICE(PIBinaryLog)
public:
PIBinaryLog();
~PIBinaryLog() {closeDevice();}
@@ -44,32 +44,38 @@ public:
//! Current \a PlayMode
PlayMode playMode() const {return playmode;}
PlayMode playMode() const {return (PlayMode)(property("playMode").toInt());}
//! Current directory where billogs wiil be saved
const PIString & logDir() const {return logdir;}
PIString logDir() const {return property("logDir").toString();}
//! Returns current file prefix
const PIString & filePrefix() const {return fileprefix;}
PIString filePrefix() const {return property("filePrefix").toString();}
//! Current LogDir, returns directory where billogs wiil be saved
int dafaultID() const {return default_id;}
int defaultID() const {return property("defaultID").toInt();}
//! Returns current play speed
float speed() const {return playspeed;}
float playSpeed() const {return property("playSpeed").toFloat();}
//! Returns if rapid start enabled
bool rapidStart() const {return property("rapidStart").toBool();}
//! Set \a PlayMode
void setPlayMode(PlayMode mode) {playmode = mode;}
void setPlayMode(PlayMode mode) {setProperty("playMode", (int)mode);}
//! Set path to directory where binlogs will be saved
void setLogDir(const PIString & path) {logdir = path;}
void setLogDir(const PIString & path) {setProperty("logDir", path);}
//! Set file prefix, used to
void setFilePrefix(const PIString & prefix) {fileprefix = prefix;}
void setFilePrefix(const PIString & prefix) {setProperty("filePrefix", prefix);}
//! Set defaultID, used in \a write function
void setDefaultID(int id) {default_id = id;}
void setDefaultID(int id) {setProperty("defaultID", id);}
//! If enabled BinLog \a ThreadedRead starts without delay for first record, e.g. first record will be readed immediately
void setRapidStart(bool enabled) {setProperty("rapidStart", enabled);}
// /** \brief Set play speed multiplyer, used only in \a PlayMode = \a PlayRealTime default value 1x.
// * If "speedX" > 0 than it use as speed increase by X times, else as speed decrease by X times.
@@ -77,8 +83,8 @@ public:
// bool setRealSpeedX(int speedX) {if (speedX == 0 || isRunning()) return false; real_speedX = speedX; return true;}
// //! Returns current play speed multiplyer
// float realSpeedX() const {return real_speedX;}
//! Set play speed, used only in \a PlayMode = \a PlayVariableSpeed, default value 1.0
void setSpeed(float speed) {playspeed = speed;}
//! Set play speed, used only if \a playMode = \a PlayVariableSpeed, default value 1.0
void setPlaySpeed(float speed) {setProperty("playSpeed", speed);}
//! Write one record to BinLog file, with ID = id, id must be greather than 0
@@ -89,7 +95,7 @@ public:
//! Read one record from BinLog file, with ID = id, if id = 0 than any id will be readed
PIByteArray readBinLog(int id = 0);
int readBinLog(int id, void *read_to, int max_size);
int readBinLog(int id, void * read_to, int max_size);
//! Return true, if position at the end of BinLog file
bool isEnd() {if (!opened_) return true; return file.isEnd();}
@@ -103,14 +109,11 @@ public:
int read(void *read_to, int max_size);
//! Write one record to BinLog file, with ID = "defaultID"
int write(const void * data, int size) {return writeBinLog(default_id, data, size);}
int write(const void * data, int size) {return writeBinLog(defaultID(), data, size);}
//! Array of ID, that BinLog can read from binlog file, when use \a read function, or in \a ThreadedRead
PIVector<int> filterID;
//! If "RapidStart" enabled, than BinLog \a ThreadedRead starts without delay for first record, e.g. first record will be readed immediately
void setRapidStart(bool enabled = false) {rapid_start = enabled;}
//! Go to begin of BinLog file
void restart();
@@ -139,6 +142,8 @@ public:
EVENT(fileError)
protected:
PIString fullPathPrefix() const {return "binlog";}
void configureFromFullPath(const PIString & full_path);
bool openDevice();
bool closeDevice();
bool threadedRead(uchar *readed, int size);
@@ -156,16 +161,12 @@ private:
BinLogRecord readRecord();
PIFile file;
PIString logdir, fileprefix;
BinLogRecord lastrecord;
PISystemTime startlogtime;
//BinLogRecord nextrecord;
PlayMode playmode;
double play_time; //milliseconds
float playspeed;
int default_id;
//int real_speedX; // in X
bool is_started, rapid_start, is_thread_ok;
bool is_started, is_thread_ok;
uchar binlog_sig[PIBINARYLOG_SIGNATURE_SIZE];
};