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

@@ -6,7 +6,7 @@
/*
PIP - Platform Independent Primitives
Object, base class of some PIP classes, provide EVENT -> EVENT_HANDLER mechanism
Copyright (C) 2013 Ivan Pelipenko peri4ko@gmail.com
Copyright (C) 2014 Ivan Pelipenko peri4ko@gmail.com
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
@@ -227,26 +227,26 @@ class PIP_EXPORT PIObject
public:
//! Contructs PIObject with name "name"
PIObject(const PIString & name = PIString()) {piMonitor.objects++; setName(name); objects << this; debug_ = true;}
PIObject(const PIString & name = PIString());
virtual ~PIObject() {piMonitor.objects--; objects.removeAll(this);}
//! Returns object name
const PIString & name() const {return name_;}
PIString name() const {return property("name").toString();}
//! Returns object class name
virtual const char * className() const {return "PIObject";}
//! Return if debug of this object is active
bool debug() const {return debug_;}
bool debug() const {return property("debug").toBool();}
//! Set object name
void setName(const PIString & name) {name_ = name;}
void setName(const PIString & name) {setProperty("name", name);}
//! Set object debug active
void setDebug(bool debug) {debug_ = debug;}
void setDebug(bool debug) {setProperty("debug", debug);}
//! Returns properties of the object
const PIMap<PIString, PIVariant> & properties() const {return properties_;}
@@ -255,13 +255,13 @@ public:
int propertiesCount() const {return properties_.size_s();}
//! Returns property with name "name"
PIVariant property(const PIString & name) {if (!properties_.contains(name)) return PIVariant(); return properties_.value(name);}
PIVariant property(const PIString & name) const {if (!properties_.contains(name)) return PIVariant(); return properties_.value(name);}
//! Set property with name "name" to "value". If there is no such property in object it will be added
void setProperty(const PIString & name, const PIVariant & value) {properties_[name] = value;}
//! Returns if property with name "name" exists
bool isPropertyExists(const PIString & name) {return properties_.contains(name);}
bool isPropertyExists(const PIString & name) const {return properties_.contains(name);}
/*
PIStringList events();
@@ -475,10 +475,17 @@ public:
}
raiseEvent<T0, T1, T2, T3>(name,dest , v0, v1, v2, v3);
}
//! Returns PIObject* with name "name" or 0, if there is no objects found
static PIObject * findByName(const PIString & name) {
piForeach (PIObject * i, PIObject::objects) {
if (i->name() != name) continue;
return i;
}
return 0;
};
protected:
PIString name_;
bool debug_;
private:
struct Connection {
@@ -493,13 +500,6 @@ private:
PIMap<PIString, PIVariant> properties_;
static PIVector<PIObject * > objects;
static PIObject * findByName(const PIString & name) {
piForeach (PIObject * i, PIObject::objects) {
if (i->name_ != name) continue;
return i;
}
return 0;
};
};