git-svn-id: svn://db.shs.com.ru/pip@803 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2019-06-22 14:55:23 +00:00
parent 71128017dd
commit fb44b01c0f
24 changed files with 433 additions and 142 deletions

View File

@@ -9,14 +9,26 @@ public:
}
};
PIKbdListener kbd;
PIKbdListener kbd(0, 0, false);
#include <typeinfo>
#define PIIS_TYPENAME(t) typeid(t).name()
template<typename T> class Name
{
public:
static const char * name() {return PIIS_TYPENAME(T);}
};
int main(int argc, char * argv[]) {
//piCout << Name<PIDiagnostics::State>::name();
return 0;
PICLI cli(argc, argv);
cli.setDebug(false);
cli.addArgument("send");
//PISystemInfo::machineID();
kbd.enableExitCapture();
kbd.start();
if (cli.hasArgument("send")) {
/*piCout << "send mode";

View File

@@ -136,11 +136,6 @@ TileList::TileList(const PIString & n): PIScreenTile(n) {
}
TileList::~TileList() {
delete scroll;
}
void TileList::sizeHint(int & w, int & h) const {
w = h = 0;
piForeachC (Row & r, content)

View File

@@ -32,6 +32,7 @@ public:
typedef PIPair<PIString, PIScreenTypes::CellFormat> Row;
TileSimple(const PIString & n = PIString());
TileSimple(const Row & r);
virtual ~TileSimple() {}
PIVector<Row> content;
PIScreenTypes::Alignment alignment;
protected:
@@ -47,6 +48,7 @@ class PIP_EXPORT TileScrollBar: public PIScreenTile {
friend class TileList;
public:
TileScrollBar(const PIString & n = PIString());
virtual ~TileScrollBar() {}
void setMinimum(int v);
void setMaximum(int v);
void setValue(int v);
@@ -68,7 +70,7 @@ class PIP_EXPORT TileList: public PIScreenTile {
PIOBJECT_SUBCLASS(TileList, PIScreenTile)
public:
TileList(const PIString & n = PIString());
~TileList();
virtual ~TileList() {}
enum SelectionMode {
NoSelection,
SingleSelection,
@@ -100,6 +102,7 @@ class PIP_EXPORT TileButton: public PIScreenTile {
PIOBJECT_SUBCLASS(TileButton, PIScreenTile)
public:
TileButton(const PIString & n = PIString());
virtual ~TileButton() {}
enum EventType {
ButtonClicked
};
@@ -119,6 +122,7 @@ class PIP_EXPORT TileButtons: public PIScreenTile {
PIOBJECT_SUBCLASS(TileButtons, PIScreenTile)
public:
TileButtons(const PIString & n = PIString());
virtual ~TileButtons() {}
enum EventType {
ButtonSelected
};
@@ -131,7 +135,10 @@ protected:
void drawEvent(PIScreenDrawer * d);
bool keyEvent(PIKbdListener::KeyEvent key);
bool mouseEvent(PIKbdListener::MouseEvent me);
struct Rect {Rect(int _x0 = 0, int _y0 = 0, int _x1 = 0, int _y1 = 0): x0(_x0),y0(_y0),x1(_x1),y1(_y1) {}; int x0,y0,x1,y1;};
struct Rect {
Rect(int _x0 = 0, int _y0 = 0, int _x1 = 0, int _y1 = 0): x0(_x0),y0(_y0),x1(_x1),y1(_y1) {}
int x0,y0,x1,y1;
};
PIVector<Rect> btn_rects;
};
@@ -140,6 +147,7 @@ class PIP_EXPORT TileCheck: public PIScreenTile {
PIOBJECT_SUBCLASS(TileCheck, PIScreenTile)
public:
TileCheck(const PIString & n = PIString());
virtual ~TileCheck() {}
enum EventType {
Toggled
};
@@ -158,6 +166,7 @@ class PIP_EXPORT TileProgress: public PIScreenTile {
PIOBJECT_SUBCLASS(TileProgress, PIScreenTile)
public:
TileProgress(const PIString & n = PIString());
virtual ~TileProgress() {}
PIScreenTypes::CellFormat format;
PIString prefix;
PIString suffix;
@@ -173,6 +182,7 @@ class PIP_EXPORT TilePICout: public TileList {
PIOBJECT_SUBCLASS(TilePICout, PIScreenTile)
public:
TilePICout(const PIString & n = PIString());
virtual ~TilePICout() {}
PIScreenTypes::CellFormat format;
int max_lines;
protected:
@@ -185,6 +195,7 @@ class PIP_EXPORT TileInput: public PIScreenTile {
PIOBJECT_SUBCLASS(TileInput, PIScreenTile)
public:
TileInput(const PIString & n = PIString());
virtual ~TileInput() {}
/*enum EventType {
EditFinished
};*/

View File

@@ -36,38 +36,27 @@ class PIDeque {
public:
inline PIDeque(): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
PIINTROSPECTION_CONTAINER_NEW(T)
//printf("new vector 1 %p (%s) ... !{\n", this, typeid(T).name());
//printf("(s=%d, d=%p) }!\n", int(pid_size), pid_data);
}
inline PIDeque(const PIDeque<T> & other): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
PIINTROSPECTION_CONTAINER_NEW(T)
//printf("new vector 2 %p (%s) ... !{\n", this, typeid(T).name());
alloc(other.pid_size, true);
newT(pid_data + pid_start, other.pid_data + other.pid_start, pid_size);
//printf("(s=%d, d=%p) }!\n", int(pid_size), pid_data);
}
inline PIDeque(const T * data, size_t size): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
PIINTROSPECTION_CONTAINER_NEW(T)
//printf("new vector 2 %p (%s) ... !{\n", this, typeid(T).name());
alloc(size, true);
newT(pid_data + pid_start, data, pid_size);
//printf("(s=%d, d=%p) }!\n", int(pid_size), pid_data);
}
inline PIDeque(size_t pid_size, const T & f = T()): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
PIINTROSPECTION_CONTAINER_NEW(T)
//printf("new vector 3 %p (%s) ... !{\n", this, typeid(T).name());
resize(pid_size, f);
//printf("(s=%d, d=%p) }!\n", int(pid_size), pid_data);
}
inline ~PIDeque() {
inline virtual ~PIDeque() {
PIINTROSPECTION_CONTAINER_DELETE(T)
PIINTROSPECTION_CONTAINER_FREE(T, (pid_rsize)*sizeof(T))
//printf("delete deque %p (%s) (s=%d, rs=%d, st=%d, d=%p) ... ~{\n", this, typeid(T).name(), int(pid_size), int(pid_rsize), int(pid_start), pid_data);
deleteT(pid_data + pid_start, pid_size);
dealloc();
//deleteRaw(pid_tdata);
_reset();
//printf("}~\n");
}
inline PIDeque<T> & operator =(const PIDeque<T> & other) {
@@ -188,9 +177,8 @@ public:
inline PIDeque<T> & clear() {resize(0); return *this;}
inline PIDeque<T> & fill(const T & f = T()) {
//if (sizeof(T) == 1) memset(pid_data, f, pid_size);
deleteT(pid_data + pid_start, pid_size);
//zeroRaw(pid_data, pid_size);
PIINTROSPECTION_CONTAINER_USED(T, pid_size*sizeof(T))
for (size_t i = pid_start; i < pid_start + pid_size; ++i)
elementNew(pid_data + i, f);
return *this;
@@ -206,8 +194,6 @@ public:
if (new_size > pid_size) {
size_t os = pid_size;
alloc(new_size, true);
//if (sizeof(T) == 1) memset(&(pid_data[os]), f, ds);
//zeroRaw(&(pid_data[os]), new_size - os);
PIINTROSPECTION_CONTAINER_USED(T, (new_size-os)*sizeof(T))
for (size_t i = os + pid_start; i < new_size + pid_start; ++i) elementNew(pid_data + i, f);
}
@@ -229,7 +215,6 @@ public:
inline PIDeque<T> & insert(size_t index, const T & v = T()) {
bool dir = pid_rsize <= 2 ? true : (index >= pid_rsize / 2 ? true : false);
//piCout << "insert" << dir << index << pid_size << pid_rsize << pid_start << "!<";
if (dir) {
alloc(pid_size + 1, true);
if (index < pid_size - 1) {
@@ -238,11 +223,9 @@ public:
}
} else {
alloc(pid_size + 1, false, -1);
//piCout << "insert front" << pid_size << pid_rsize << pid_start << "!<";
if (index > 0)
memmove((void*)(&(pid_data[pid_start])), (const void*)(&(pid_data[pid_start + 1])), index * sizeof(T));
}
//piCout << "insert" << pid_start << index << (pid_start + ssize_t(index)) << pid_size << ">!";
PIINTROSPECTION_CONTAINER_USED(T, sizeof(T))
elementNew(pid_data + pid_start + index, v);
return *this;
@@ -250,22 +233,16 @@ public:
inline PIDeque<T> & insert(size_t index, const PIDeque<T> & other) {
if (other.isEmpty()) return *this;
bool dir = pid_rsize <= 2 ? true : (index >= pid_rsize / 2 ? true : false);
//piCout << this << "insert" << dir << index << pid_size << pid_rsize << pid_start << " <- " << other.size() << "!<";
if (dir) {
ssize_t os = pid_size - index;
alloc(pid_size + other.pid_size, true);
if (os > 0)
memmove((void*)(&(pid_data[index + pid_start + other.pid_size])), (const void*)(&(pid_data[index + pid_start])), os * sizeof(T));
} else {
//if (pid_start < other.pid_size) pid_start = 0;
//piCout << this << " insert offseted start ba" << pid_start << pid_size << pid_rsize;
alloc(pid_size + other.pid_size, false, -other.pid_size);
//piCout << this << " insert offseted start aa" << pid_start << pid_size << pid_rsize;
//piCout << this << " insert front" << pid_size << pid_rsize << pid_start << "!<";
if (index > 0)
memmove((void*)(&(pid_data[pid_start])), (const void*)(&(pid_data[pid_start + other.pid_size])), index * sizeof(T));
}
//piCout << this << "insert" << pid_start << index << (pid_start + ssize_t(index)) << pid_size << ">!";
newT(pid_data + pid_start + index, other.pid_data + other.pid_start, other.pid_size);
return *this;
}
@@ -279,7 +256,6 @@ public:
size_t os = pid_size - index - count;
deleteT(&(pid_data[index + pid_start]), count);
if (os <= index) {
//if (true) {
if (os > 0) memmove((void*)(&(pid_data[index + pid_start])), (const void*)(&(pid_data[index + pid_start + count])), os * sizeof(T));
} else {
if (index > 0) memmove((void*)(&(pid_data[pid_start + count])), (const void*)(&(pid_data[pid_start])), index * sizeof(T));
@@ -351,12 +327,9 @@ private:
if (pid_rsize + pid_rsize >= size_t(s) && pid_rsize < size_t(s))
return pid_rsize + pid_rsize;
ssize_t t = 0, s_ = s - 1;
//printf("asize .. %p rs=%d ns=%d s_=%d t=%d \n", this, pid_rsize, s, s_, t);
while (s_ >> t) {
++t;
//printf("asize ++ %p rs=%d ns=%d s_=%d t=%d \n", this, pid_rsize, s, s_, t);
}
//printf("asize ok %p rs=%d ns=%d s_=%d t=%d \n", this, pid_rsize, s, s_, t);
return (1 << t);
}
inline void newT(T * dst, const T * src, size_t s) {
@@ -365,11 +338,7 @@ private:
elementNew(dst + i, src[i]);
}
inline static T * newRaw(size_t s) {
//std::cout << std::dec << " ![("<<this<<")newRaw " << s << " elements ... <" << std::endl;
//uchar * ret = new uchar[s * sizeof(T)];
uchar * ret = (uchar*)(malloc(s * sizeof(T)));//new uchar[];
//zeroRaw((T*)ret, s);
//std::cout << std::hex << " > (new 0x" << (llong)ret << ") ok]!" << std::endl;
return (T*)ret;
}
/*void reallocRawTemp(size_t s) {
@@ -378,24 +347,17 @@ private:
}*/
inline void deleteT(T * d, size_t sz) {
PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T))
//std::cout << " ~[("<<this<<")deleteT " << std::dec << sz << " elements " << " start " << pid_start << std::hex << " 0x" << (llong)d << " ... <" << std::endl;
if ((uchar*)d != 0) {
for (size_t i = 0; i < sz; ++i)
elementDelete(d[i]);
//zeroRaw(d, sz);
}
//cout << " > ok]~" << endl;
}
inline static void deleteRaw(T *& d) {
//cout << " ~[("<<this<<")deleteRaw " << std::dec << pid_rsize << " elements " << std::hex << "0x" << (llong)d << " ... <\n" << endl;
if ((uchar*)d != 0) free((uchar*)d);
d = 0;
//cout << " > ok]~" << endl;
}
inline static void zeroRaw(T * d, size_t s) {
//cout << " ~[("<<this<<")zeroRaw " << std::dec << s << " elements " << std::hex << "0x" << (llong)d << " ... <\n" << endl;
if ((uchar*)d != 0) memset(d, 0, s*sizeof(T));
//cout << " > ok]~" << endl;
}
inline void elementNew(T * to, const T & from) {new(to)T(from);}
inline void elementDelete(T & from) {from.~T();}
@@ -418,11 +380,9 @@ private:
pid_start = ssize_t(pid_rsize) - pid_size - pid_size;
}
}*/
//printf("(%p) check move st=%d sz=%d rs=%d\n", this, pid_start, pid_size, pid_rsize);
if (pid_start < ssize_t(pid_size + pid_size) || pid_start > (ssize_t(pid_rsize) - ssize_t(pid_size) - ssize_t(pid_size))) {
ssize_t ns = (pid_rsize - pid_size) / 2;
if (pid_start != ns) {
//printf("(%p) move %d -> %d\n", this, pid_start, ns);
memmove((void*)(pid_data + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
pid_start = ns;
}
@@ -431,14 +391,12 @@ private:
} else {
ssize_t ns = (pid_rsize - pid_size) / 2;
if (pid_start != ns) {
//printf("(%p) move %d -> %d\n", this, pid_start, ns);
memmove((void*)(pid_data + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
pid_start = ns;
}
}
}
inline void alloc(size_t new_size, bool direction, ssize_t start_offset = 0) { // direction == true -> alloc forward
//if(new_size == 65536) printf("(%p) alloc too much size %d->%d", this, (int)pid_size, (int)new_size);
if (direction) {
if (pid_start + new_size <= pid_rsize) {
pid_size = new_size;
@@ -447,50 +405,35 @@ private:
}
pid_size = new_size;
size_t as = asize(pid_start + new_size);
//if(as > 1000) piCout << "too much deque size" << new_size << as;
if (as != pid_rsize) {
//printf("(%p) realloc %d -> %d (%p)\n", this, pid_rsize, as, pid_data);
PIINTROSPECTION_CONTAINER_ALLOC(T, (as-pid_rsize)*sizeof(T))
T * p_d = (T*)(realloc((void*)(pid_data), as*sizeof(T)));
//if(!p_d) printf("(%p) realloc (%d)%d -> %d (%p) %d\n", this, (int)pid_start, (int)pid_rsize, (int)as, pid_data, (int)new_size);
assert(p_d);
pid_data = p_d;
pid_rsize = as;
//printf("(%p) realloc done (%p)\n", this, pid_data);
}
} else {
size_t as;
//piCout << "INS ba" << *this;
if (pid_start + start_offset < 0)
as = asize(pid_rsize - start_offset);
else as = pid_rsize;
//if(as > 1000) piCout << "too much deque size" << new_size << as;
//printf("%X alloc %d %d\n", this, pid_rsize, start_offset);
//printf("%X alloc %d %d %d %d %d %d\n", this, new_size, pid_size, pid_rsize, as, pid_start, start_offset);
if (as > pid_rsize) {
//printf("%X alloc new size %d\n", this, as);
//cout << std::hex << " ![("<<this<<")realloc " << pid_data << " data ... <\n" << endl;
T * td = newRaw(as);
ssize_t ns = pid_start + as - pid_rsize;
//printf("%X pid_start ost=%d ors=%d nst=%d nrs=%d\n", this, pid_start, pid_rsize, ns, as);
PIINTROSPECTION_CONTAINER_ALLOC(T, (as-pid_rsize)*sizeof(T))
if (pid_rsize > 0 && pid_data != 0) {
//printf("%X copy from %p + %d to %p + %d %d el\n", this, pid_data, pid_start, td, ns, pid_size);
memcpy((void*)(td + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
deleteRaw(pid_data);
}
pid_data = td;
pid_rsize = as;
pid_start = ns;
//piCout << "INS aa" << *this;
}
pid_start += start_offset;
pid_size = new_size;
checkMove(direction);
}
//checkMove(direction);
//printf("%X alloc new start %d\n", this, pid_start);
}
T * pid_data;
@@ -504,8 +447,9 @@ private:
template<> inline void PIDeque<T>::elementNew(T * to, const T & from) {(*to) = from;} \
template<> inline void PIDeque<T>::elementDelete(T & from) {;} \
template<> inline PIDeque<T> & PIDeque<T>::_resizeRaw(size_t new_size) {if (new_size > pid_size) alloc(new_size, true); return *this;} \
template<> inline PIDeque<T> & PIDeque<T>::clear() {pid_size = 0; return *this;} \
template<> inline PIDeque<T> & PIDeque<T>::assign(size_t new_size, const T & f) {_resizeRaw(new_size); return fill(f);}
template<> inline PIDeque<T> & PIDeque<T>::clear() {PIINTROSPECTION_CONTAINER_UNUSED(T, pid_size*sizeof(T)); pid_size = 0; return *this;} \
template<> inline PIDeque<T> & PIDeque<T>::assign(size_t new_size, const T & f) {\
_resizeRaw(new_size); return fill(f);}
#else

View File

@@ -39,7 +39,7 @@ public:
PIList(const Type & v0, const Type & v1, const Type & v2) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2);}
PIList(const Type & v0, const Type & v1, const Type & v2, const Type & v3) {piMonitor.containers++; _stlc::push_back(v0); _stlc::push_back(v1); _stlc::push_back(v2); _stlc::push_back(v3);}
PIList(uint size, const Type & value = Type()) {piMonitor.containers++; _stlc::resize(size, value);}
~PIList() {piMonitor.containers--;}
virtual ~PIList() {piMonitor.containers--;}
Type & operator [](uint index) {return (*this)[index];}
Type & operator [](uint index) const {return (*this)[index];}
const Type * data(uint index = 0) const {return &(*this)[index];}

View File

@@ -76,7 +76,7 @@ class PIMap {
public:
PIMap() {;}
PIMap(const PIMap<Key, T> & other) {*this = other;}
~PIMap() {;}
virtual ~PIMap() {;}
PIMap<Key, T> & operator =(const PIMap<Key, T> & other) {
if (this == &other) return *this;

View File

@@ -31,6 +31,7 @@ template<typename T>
class PIP_EXPORT PIQueue: public PIDeque<T> {
public:
PIQueue() {;}
virtual ~PIQueue() {;}
PIDeque<T> & enqueue(const T & v) {PIDeque<T>::push_front(v); return *this;}
T dequeue() {return PIDeque<T>::take_back();}
T & head() {return PIDeque<T>::back();}

View File

@@ -41,7 +41,9 @@ public:
//! Contructs an empty set
PISet() {}
virtual ~PISet() {;}
//! Contructs set with one element "value"
PISet(const T & value) {_CSet::insert(value, 0);}

View File

@@ -31,6 +31,7 @@ template<typename T>
class PIP_EXPORT PIStack: public PIVector<T> {
public:
PIStack() {;}
virtual ~PIStack() {;}
PIVector<T> & push(const T & v) {PIVector<T>::push_back(v); return *this;}
T pop() {return PIVector<T>::take_back();}
T & top() {return PIVector<T>::back();}

View File

@@ -35,33 +35,28 @@ template <typename T>
class PIVector {
public:
inline PIVector(): piv_data(0), piv_size(0), piv_rsize(0) {
//printf("new vector 1 %p (%s) ... !{\n", this, typeid(T).name());
//printf("(s=%d, d=%p) }!\n", int(piv_size), piv_data);
PIINTROSPECTION_CONTAINER_NEW(T)
}
inline PIVector(const T * data, size_t size): piv_data(0), piv_size(0), piv_rsize(0) {
//printf("new vector 2 %p (%s) ... !{\n", this, typeid(T).name());
PIINTROSPECTION_CONTAINER_NEW(T)
alloc(size);
newT(piv_data, data, piv_size);
//printf("(s=%d, d=%p) }!\n", int(pid_size), pid_data);
}
inline PIVector(const PIVector<T> & other): piv_data(0), piv_size(0), piv_rsize(0) {
//printf("new vector 2 %p (%s) ... !{\n", this, typeid(T).name());
PIINTROSPECTION_CONTAINER_NEW(T)
alloc(other.piv_size);
newT(piv_data, other.piv_data, piv_size);
//printf("(s=%d, d=%p) }!\n", int(piv_size), piv_data);
}
inline PIVector(size_t piv_size, const T & f = T()): piv_data(0), piv_size(0), piv_rsize(0) {
//printf("new vector 3 %p (%s) ... !{\n", this, typeid(T).name());
PIINTROSPECTION_CONTAINER_NEW(T)
resize(piv_size, f);
//printf("(s=%d, d=%p) }!\n", int(piv_size), piv_data);
}
inline ~PIVector() {
//printf("delete vector %p (%s) (s=%d, d=%p) ... ~{\n", this, typeid(T).name(), int(piv_size), piv_data);
inline virtual ~PIVector() {
PIINTROSPECTION_CONTAINER_DELETE(T)
PIINTROSPECTION_CONTAINER_FREE(T, (piv_rsize)*sizeof(T))
deleteT(piv_data, piv_size);
dealloc();
//deleteRaw(piv_tdata);
_reset();
//printf("}~\n");
}
inline PIVector<T> & operator =(const PIVector<T> & other) {
@@ -182,9 +177,8 @@ public:
inline PIVector<T> & clear() {resize(0); return *this;}
inline PIVector<T> & fill(const T & f = T()) {
//if (sizeof(T) == 1) memset(piv_data, f, piv_size);
deleteT(piv_data, piv_size);
//zeroRaw(piv_data, piv_size);
PIINTROSPECTION_CONTAINER_USED(T, piv_size*sizeof(T))
for (size_t i = 0; i < piv_size; ++i)
elementNew(piv_data + i, f);
return *this;
@@ -201,8 +195,7 @@ public:
if (new_size > piv_size) {
size_t os = piv_size;
alloc(new_size);
//if (sizeof(T) == 1) memset(&(piv_data[os]), f, ds);
//zeroRaw(&(piv_data[os]), new_size - os);
PIINTROSPECTION_CONTAINER_USED(T, (new_size-os)*sizeof(T))
for (size_t i = os; i < new_size; ++i)
elementNew(piv_data + i, f);
}
@@ -231,7 +224,7 @@ public:
size_t os = piv_size - index - 1;
memmove((void*)(&(piv_data[index + 1])), (const void*)(&(piv_data[index])), os * sizeof(T));
}
//zeroRaw(&(piv_data[index]), 1);
PIINTROSPECTION_CONTAINER_USED(T, sizeof(T))
elementNew(piv_data + index, v);
return *this;
}
@@ -273,7 +266,7 @@ public:
inline PIVector<T> & removeOne(const T & v) {for (size_t i = 0; i < piv_size; ++i) if (piv_data[i] == v) {remove(i); return *this;} return *this;}
inline PIVector<T> & removeAll(const T & v) {for (ssize_t i = 0; i < ssize_t(piv_size); ++i) if (piv_data[i] == v) {remove(i); --i;} return *this;}
inline PIVector<T> & push_back(const T & v) {alloc(piv_size + 1); elementNew(piv_data + piv_size - 1, v); return *this;}
inline PIVector<T> & push_back(const T & v) {alloc(piv_size + 1); PIINTROSPECTION_CONTAINER_USED(T, sizeof(T)); elementNew(piv_data + piv_size - 1, v); return *this;}
inline PIVector<T> & append(const T & v) {return push_back(v);}
inline PIVector<T> & append(const PIVector<T> & other) {
size_t ps = piv_size;
@@ -312,15 +305,12 @@ private:
return (1 << t);
}
inline void newT(T * dst, const T * src, size_t s) {
PIINTROSPECTION_CONTAINER_USED(T, s*sizeof(T))
for (size_t i = 0; i < s; ++i)
elementNew(dst + i, src[i]);
}
inline T * newRaw(size_t s) {
//cout << std::dec << " ![("<<this<<")newRaw " << s << " elements ... <\n" << endl;
//uchar * ret = new uchar[s * sizeof(T)];
uchar * ret = (uchar*)(malloc(s * sizeof(T)));//new uchar[];
//zeroRaw((T*)ret, s);
//cout << std::hex << " > (new 0x" << (llong)ret << ") ok]!" << endl;
return (T*)ret;
}
/*void reallocRawTemp(size_t s) {
@@ -328,24 +318,18 @@ private:
else piv_tdata = (T*)(realloc(piv_tdata, s * sizeof(T)));
}*/
inline void deleteT(T * d, size_t sz) {
//cout << " ~[("<<this<<")deleteT " << std::dec << sz << " elements " << std::hex << "0x" << (llong)d << " ... <\n" << endl;
PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T))
if ((uchar*)d != 0) {
for (size_t i = 0; i < sz; ++i)
elementDelete(d[i]);
//zeroRaw(d, sz);
}
//cout << " > ok]~" << endl;
}
inline void deleteRaw(T *& d) {
//cout << " ~[("<<this<<")deleteRaw " << std::dec << piv_rsize << " elements " << std::hex << "0x" << (llong)d << " ... <\n" << endl;
if ((uchar*)d != 0) free((uchar*)d);
d = 0;
//cout << " > ok]~" << endl;
}
inline void zeroRaw(T * d, size_t s) {
//cout << " ~[("<<this<<")zeroRaw " << std::dec << s << " elements " << std::hex << "0x" << (llong)d << " ... <\n" << endl;
if ((uchar*)d != 0) memset(d, 0, s*sizeof(T));
//cout << " > ok]~" << endl;
}
inline void elementNew(T * to, const T & from) {new(to)T(from);}
inline void elementDelete(T & from) {from.~T();}
@@ -355,19 +339,15 @@ private:
piv_size = new_size;
return;
}
//int os = piv_size;
piv_size = new_size;
size_t as = asize(new_size);
if (as == piv_rsize) return;
//if(as > 1000) piCout << "too much vector size" << new_size << as;
PIINTROSPECTION_CONTAINER_ALLOC(T, (as-piv_rsize)*sizeof(T))
//cout << std::hex << " ![("<<this<<")realloc " << piv_data << " data ... <\n" << endl;
T * p_d = (T*)(realloc((void*)(piv_data), as*sizeof(T)));
assert(p_d);
piv_data = p_d;
//zeroRaw(&(piv_data[os]), as - os);
piv_rsize = as;
//cout << std::hex << " > (new 0x" << (llong)piv_data << ") ok]!" << endl;
/*piv_rsize = as;
T * pd = newRaw(piv_rsize);
if (os > 0 && piv_data != 0) {
@@ -434,13 +414,14 @@ __PIVECTOR_SIMPLE_FUNCTIONS__(float)
__PIVECTOR_SIMPLE_FUNCTIONS__(double)
__PIVECTOR_SIMPLE_FUNCTIONS__(ldouble)*/
#define __PIVECTOR_SIMPLE_TYPE__(T) \
template<> inline void PIVector<T>::newT(T * dst, const T * src, size_t s) {memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \
template<> inline void PIVector<T>::deleteT(T * d, size_t sz) {;} \
template<> inline void PIVector<T>::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(T, s*sizeof(T)); memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \
template<> inline void PIVector<T>::deleteT(T * d, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(T, sz*sizeof(T));} \
template<> inline void PIVector<T>::elementNew(T * to, const T & from) {(*to) = from;} \
template<> inline void PIVector<T>::elementDelete(T & from) {;} \
template<> inline PIVector<T> & PIVector<T>::_resizeRaw(size_t new_size) {alloc(new_size); return *this;} \
template<> inline PIVector<T> & PIVector<T>::clear() {piv_size = 0; return *this;} \
template<> inline PIVector<T> & PIVector<T>::assign(size_t new_size, const T & f) {_resizeRaw(new_size); return fill(f);}
template<> inline PIVector<T> & PIVector<T>::clear() {PIINTROSPECTION_CONTAINER_UNUSED(T, piv_size*sizeof(T)); piv_size = 0; return *this;} \
template<> inline PIVector<T> & PIVector<T>::assign(size_t new_size, const T & f) {\
_resizeRaw(new_size); return fill(f);}
#else

View File

@@ -209,9 +209,9 @@
#define PRIVATE_DEFINITION_END(c) \
}; \
c::__PrivateInitializer__::__PrivateInitializer__() {p = new c::__Private__();} \
c::__PrivateInitializer__::__PrivateInitializer__(const c::__PrivateInitializer__ & o) {/*if (p) delete p;*/ p = new c::__Private__();} \
c::__PrivateInitializer__::__PrivateInitializer__(const c::__PrivateInitializer__ & o) {/*if (p) delete p;*/ p = new c::__Private__(); *p = *(o.p);} \
c::__PrivateInitializer__::~__PrivateInitializer__() {delete p; p = 0;} \
c::__PrivateInitializer__ & c::__PrivateInitializer__::operator =(const c::__PrivateInitializer__ & o) {if (p) delete p; p = new c::__Private__(); return *this;}
c::__PrivateInitializer__ & c::__PrivateInitializer__::operator =(const c::__PrivateInitializer__ & o) {if (p) delete p; p = new c::__Private__(); *p = *(o.p); return *this;}
#define PRIVATE (__privateinitializer__.p)
#define PRIVATEWB __privateinitializer__.p

View File

@@ -34,15 +34,15 @@ __PICONTAINERS_SIMPLE_TYPE__(PIChar)
template<> \
inline PIByteArray & operator <<(PIByteArray & s, const PIVector<T> & v) {s << int(v.size_s()); int os = s.size_s(); s.enlarge(v.size_s()*sizeof(T)); memcpy(s.data(os), v.data(), v.size_s()*sizeof(T)); return s;} \
template<> \
inline PIByteArray & operator >>(PIByteArray & s, PIVector<T> & v) {assert(s.size_s() >= 4); int sz; s >> sz; v._resizeRaw(sz); if (sz > 0) memcpy(v.data(), s.data(), sz*sizeof(T)); s.remove(0, sz*sizeof(T)); return s;} \
inline PIByteArray & operator >>(PIByteArray & s, PIVector<T> & v) {assert(s.size_s() >= 4); int sz; s >> sz; v._resizeRaw(sz); PIINTROSPECTION_CONTAINER_USED(T, sz*sizeof(T)); if (sz > 0) memcpy(v.data(), s.data(), sz*sizeof(T)); s.remove(0, sz*sizeof(T)); return s;} \
template<> \
inline PIByteArray & operator <<(PIByteArray & s, const PIDeque<T> & v) {s << int(v.size_s()); int os = s.size_s(); s.enlarge(v.size_s()*sizeof(T)); memcpy(s.data(os), v.data(), v.size_s()*sizeof(T)); return s;} \
template<> \
inline PIByteArray & operator >>(PIByteArray & s, PIDeque<T> & v) {assert(s.size_s() >= 4); int sz; s >> sz; v._resizeRaw(sz); if (sz > 0) memcpy(v.data(), s.data(), sz*sizeof(T)); s.remove(0, sz*sizeof(T)); return s;} \
inline PIByteArray & operator >>(PIByteArray & s, PIDeque<T> & v) {assert(s.size_s() >= 4); int sz; s >> sz; v._resizeRaw(sz); PIINTROSPECTION_CONTAINER_USED(T, sz*sizeof(T)); if (sz > 0) memcpy(v.data(), s.data(), sz*sizeof(T)); s.remove(0, sz*sizeof(T)); return s;} \
template<> \
inline PIByteArray & operator <<(PIByteArray & s, const PIVector2D<T> & v) {s << int(v.rows()) << int(v.cols()); int os = s.size_s(); s.enlarge(v.size_s()*sizeof(T)); memcpy(s.data(os), v.data(), v.size_s()*sizeof(T)); return s;} \
template<> \
inline PIByteArray & operator >>(PIByteArray & s, PIVector2D<T> & v) {assert(s.size_s() >= 8); int r, c; s >> r >> c; v._resizeRaw(r, c); int sz = r*c; if (sz > 0) memcpy(v.data(), s.data(), sz*sizeof(T)); s.remove(0, sz*sizeof(T)); return s;}
inline PIByteArray & operator >>(PIByteArray & s, PIVector2D<T> & v) {assert(s.size_s() >= 8); int r, c; s >> r >> c; v._resizeRaw(r, c); int sz = r*c; PIINTROSPECTION_CONTAINER_USED(T, sz*sizeof(T)); if (sz > 0) memcpy(v.data(), s.data(), sz*sizeof(T)); s.remove(0, sz*sizeof(T)); return s;}
class PIString;

View File

@@ -462,12 +462,12 @@
typedef void (*Handler)(void * );
class PIP_EXPORT PIObject
{
class PIP_EXPORT PIObject {
friend class PIObjectManager;
friend void dumpApplication();
typedef PIObject __PIObject__;
typedef void __Parent__;
friend class PIIntrospection;
public:
//! Contructs PIObject with name "name"

View File

@@ -94,7 +94,7 @@ public:
// PIString(const double & value): PIDeque<PIChar>() {/*reserve(4); */piMonitor.strings++; piMonitor.containers--; *this = fromNumber(value);}
//~PIString() {piMonitor.strings--; piMonitor.containers++;}
~PIString() {piMonitor.strings--; piMonitor.containers++;}
PIString & operator =(const PIString & o) {if (this == &o) return *this; clear(); *this += o; return *this;}
@@ -775,6 +775,8 @@ public:
//! Contructs empty strings list
PIStringList() {;}
~PIStringList() {;}
//! Contructs strings list with one string "str"
PIStringList(const PIString & str) {push_back(str);}

View File

@@ -27,6 +27,7 @@ class PIMutex;
class PIThread;
class PITimer;
class PIPeer;
class PIIntrospection;
#define __PIINTROSPECTION_SINGLETON__(T) \
static PIIntrospection##T##Interface * instance() {static PIIntrospection##T##Interface ret; return &ret;} \

View File

@@ -56,6 +56,8 @@ class PIIntrospectionContainers;
#endif
class PIP_EXPORT PIIntrospectionContainersInterface {
friend class PIIntrospection;
friend class PIIntrospectionServer;
public:
__PIINTROSPECTION_SINGLETON__(Containers)

View File

@@ -18,6 +18,7 @@
*/
#include "piintrospection_containers_p.h"
#include <stdio.h>
PIIntrospectionContainers::Type::Type() {
@@ -29,14 +30,17 @@ PIIntrospectionContainers::Type::Type() {
PIIntrospectionContainers::PIIntrospectionContainers() {
crc = standardCRC_32();
}
void PIIntrospectionContainers::containerNew(const char * tn) {
PIMutexLocker _ml(mutex);
uint id = typeID(tn);
typenames[id] = PIStringAscii(tn);
PIMutexLocker _ml(mutex);
//printf("containerNew lock\n");
typenames[id] = tn;
data[id].count++;
//printf("containerNew unlock\n");
}
@@ -74,18 +78,26 @@ uint PIIntrospectionContainers::typeID(const char * tn) {
if (!tn) return 0u;
size_t l = strlen(tn);
if (l == 0) return 0u;
return crc.calculate(tn, l);
return crc.calculate(tn, int(l));
}
PIByteArray & operator <<(PIByteArray & s, const std::unordered_map<uint, std::string> & v) {
PIMap<uint, PIString> m;
for (typename std::unordered_map<uint, std::string>::const_iterator i = v.cbegin(); i != v.cend(); ++i) {
m[i->first] = PIStringAscii(i->second.c_str());
}
s << m;
return s;
}
PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::Type & v) {
s << v.count << v.items << v.bytes_allocated << v.bytes_used;
return s;
}
PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::Type & v) {
s >> v.count >> v.items >> v.bytes_allocated >> v.bytes_used;
return s;

View File

@@ -20,10 +20,9 @@
#ifndef PIINTROSPECTION_CONTAINERS_P_H
#define PIINTROSPECTION_CONTAINERS_P_H
#define PIP_FORCE_NO_PIINTROSPECTION
#include "pimutex.h"
#include "pimap.h"
#include <unordered_map>
#include <string>
#include "picrc.h"
@@ -48,15 +47,15 @@ public:
ullong bytes_used;
};
PIMap<uint, Type> data;
PIMap<uint, PIString> typenames;
std::unordered_map<uint, Type> data;
std::unordered_map<uint, std::string> typenames;
PIMutex mutex;
CRC_32 crc;
};
PIByteArray & operator <<(PIByteArray & s, const std::unordered_map<uint, std::string> & v);
PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::Type & v);
PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::Type & v);
#undef PIP_FORCE_NO_PIINTROSPECTION
#endif // PIINTROSPECTION_CONTAINERS_P_H

View File

@@ -18,11 +18,33 @@
*/
#include "piintrospection_server.h"
#include "piintrospection_server_p.h"
#include "pichunkstream.h"
PRIVATE_DEFINITION_START(PIIntrospectionServer)
PIIntrospection::ProcessInfo process_info;
PRIVATE_DEFINITION_END(PIIntrospectionServer)
PIIntrospectionServer::PIIntrospectionServer(): PIPeer(genName()) {
CONNECTU(&itimer, tickEvent, this, timerEvent)
itimer.start(100);
PRIVATE->process_info = PIIntrospection::getInfo();
CONNECTU(&itimer, tickEvent, this, timerEvent);
}
PIIntrospectionServer::~PIIntrospectionServer() {
itimer.stop(false);
if (!itimer.waitForFinish(1000)) {
PIINTROSPECTION_CONTAINERS->p->mutex.unlock();
}
PIPeer::stop();
}
void PIIntrospectionServer::start() {
itimer.start(1000);
PIPeer::start();
}
@@ -33,10 +55,13 @@ PIString PIIntrospectionServer::genName() {
void PIIntrospectionServer::timerEvent() {
PIChunkStream cs;
cs.add(1, PIIntrospection::packInfo())
.add(2, PIIntrospection::packContainers())
.add(3, PIIntrospection::packThreads())
.add(4, PIIntrospection::packObjects());
PIByteArray ba;
/* PIINTROSPECTION_THREADS->mutex.lock();
ba << appname << *(PIINTROSPECTION_CONTAINERS) << PIINTROSPECTION_THREADS->threads.values();
PIINTROSPECTION_THREADS->mutex.unlock();*/
//piCout << "send" << appname;
ba << PIIntrospection::sign;
ba.append(cs.data());
send("__introspection_client__", ba);
}

View File

@@ -21,21 +21,35 @@
#define PIINTROSPECTION_SERVER_H
#include "pipeer.h"
#include "pimutex.h"
class __PIIntrospectionServer__;
class PIIntrospectionServer;
#define PIINTROSPECTION_SERVER (PIIntrospectionServer::instance())
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
# define PIINTROSPECTION_START PIINTROSPECTION_SERVER->start();
#else
# define PIINTROSPECTION_START
#endif
class PIP_EXPORT PIIntrospectionServer: public PIPeer {
PIOBJECT_SUBCLASS(PIIntrospectionServer, PIPeer)
friend class __PIIntrospectionServer__;
PIIntrospectionServer();
public:
PIString appname;
static PIIntrospectionServer * instance() {static PIIntrospectionServer ret; return &ret;}
void start();
private:
PIIntrospectionServer();
~PIIntrospectionServer();
NO_COPY_CLASS(PIIntrospectionServer)
EVENT_HANDLER(void, timerEvent);
PIString genName();
PRIVATE_DECLARATION
PITimer itimer;
};
#endif // PIINTROSPECTION_SERVER_H

View File

@@ -0,0 +1,208 @@
/*
PIP - Platform Independent Primitives
Introspection module - Base server structs
Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru
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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "piintrospection_server_p.h"
#include "pichunkstream.h"
#include "piinit.h"
#include "pisysteminfo.h"
#include "piobject.h"
const uint PIIntrospection::sign = 0x0F1C2B3A;
PIIntrospection::ProcessInfo::ProcessInfo() {
processorsCount = 0;
}
PIIntrospection::ObjectInfo::ObjectInfo() {
queued_events = 0;
}
PIIntrospection::ProcessInfo PIIntrospection::getInfo() {
PIIntrospection::ProcessInfo ret;
PISystemInfo * si = PISystemInfo::instance();
ret.architecture = si->architecture;
ret.execCommand = si->execCommand;
ret.execDateTime = si->execDateTime;
ret.hostname = si->hostname;
ret.OS_name = si->OS_name;
ret.OS_version = si->OS_version;
ret.processorsCount = si->processorsCount;
ret.user = si->user;
ret.build_options = PIInit::buildOptions();
return ret;
}
PIVector<PIIntrospection::ObjectInfo> PIIntrospection::getObjects() {
PIVector<PIIntrospection::ObjectInfo> ret;
PIObject::mutexObjects().lock();
const PIVector<PIObject * > & ao(PIObject::objects());
ret.resize(ao.size());
for (int i = 0; i < ao.size_s(); ++i) {
ret[i].classname = PIStringAscii(ao[i]->className());
ret[i].name = ao[i]->name();
ret[i].properties = ao[i]->properties_;
ret[i].parents = ao[i]->scopeList();
ao[i]->mutex_queue.lock();
ret[i].queued_events = ao[i]->events_queue.size_s();
ao[i]->mutex_queue.unlock();
}
PIObject::mutexObjects().unlock();
return ret;
}
PIByteArray & operator <<(PIByteArray & s, const std::unordered_map<uint, PIIntrospectionContainers::Type> & v) {
PIMap<uint, PIIntrospectionContainers::Type> m;
for (typename std::unordered_map<uint, PIIntrospectionContainers::Type>::const_iterator i = v.cbegin(); i != v.cend(); ++i) {
m[i->first] = i->second;
}
s << m;
return s;
}
PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::ProcessInfo & v) {
PIChunkStream cs;
cs.add(1, v.architecture).add(2, v.execCommand).add(3, v.execDateTime).add(4, v.hostname).add(5, v.OS_name)
.add(6, v.OS_version).add(7, v.processorsCount).add(8, v.user).add(9, v.build_options);
b << cs.data();
return b;
}
PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ProcessInfo & v) {
PIByteArray csba; b >> csba;
PIChunkStream cs(csba);
while (!cs.atEnd()) {
switch (cs.read()) {
case 1: cs.get(v.architecture); break;
case 2: cs.get(v.execCommand); break;
case 3: cs.get(v.execDateTime); break;
case 4: cs.get(v.hostname); break;
case 5: cs.get(v.OS_name); break;
case 6: cs.get(v.OS_version); break;
case 7: cs.get(v.processorsCount); break;
case 8: cs.get(v.user); break;
case 9: cs.get(v.build_options); break;
default: break;
}
}
return b;
}
PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::ObjectInfo & v) {
PIChunkStream cs;
cs.add(1, v.classname).add(2, v.name).add(3, v.parents).add(4, v.properties).add(5, v.queued_events);
b << cs.data();
return b;
}
PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ObjectInfo & v) {
PIByteArray csba; b >> csba;
PIChunkStream cs(csba);
while (!cs.atEnd()) {
switch (cs.read()) {
case 1: cs.get(v.classname); break;
case 2: cs.get(v.name); break;
case 3: cs.get(v.parents); break;
case 4: cs.get(v.properties); break;
case 5: cs.get(v.queued_events); break;
default: break;
}
}
return b;
}
PIByteArray PIIntrospection::packInfo() {
PIByteArray ret;
ret << getInfo();
return ret;
}
void PIIntrospection::unpackInfo(PIByteArray & ba, PIIntrospection::ProcessInfo & info) {
ba >> info;
}
PIByteArray PIIntrospection::packContainers() {
PIByteArray ret;
PIIntrospectionContainers * p = PIINTROSPECTION_CONTAINERS->p;
p->mutex.lock();
std::unordered_map<uint, PIIntrospectionContainers::Type> data = p->data;
std::unordered_map<uint, std::string> typenames = p->typenames;
p->mutex.unlock();
ret << data << typenames;
return ret;
}
void PIIntrospection::unpackContainers(PIByteArray & ba, PIMap<uint, PIIntrospectionContainers::Type> & data, PIMap<uint, PIString> & typenames) {
data.clear();
typenames.clear();
ba >> data >> typenames;
}
PIByteArray PIIntrospection::packThreads() {
PIByteArray ret;
PIIntrospectionThreads * p = PIINTROSPECTION_THREADS->p;
p->mutex.lock();
ret << p->threads.values();
p->mutex.unlock();
return ret;
}
void PIIntrospection::unpackThreads(PIByteArray & ba, PIVector<PIIntrospectionThreads::ThreadInfo> & threads) {
threads.clear();
ba >> threads;
}
PIByteArray PIIntrospection::packObjects() {
PIByteArray ret;
ret << getObjects();
return ret;
}
void PIIntrospection::unpackObjects(PIByteArray & ba, PIVector<PIIntrospection::ObjectInfo> & objects) {
objects.clear();
ba >> objects;
}

View File

@@ -0,0 +1,79 @@
/*
PIP - Platform Independent Primitives
Introspection module - Base server structs
Copyright (C) 2019 Ivan Pelipenko peri4ko@yandex.ru
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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIINTROSPECTION_SERVER_P_H
#define PIINTROSPECTION_SERVER_P_H
#include "piintrospection_containers.h"
#include "piintrospection_containers_p.h"
#include "piintrospection_threads.h"
#include "piintrospection_threads_p.h"
#include "pitime.h"
class PIIntrospection {
public:
struct ProcessInfo {
ProcessInfo();
PIString execCommand, hostname, user, OS_name, OS_version, architecture;
PIDateTime execDateTime;
int processorsCount;
PIStringList build_options;
};
struct ObjectInfo {
ObjectInfo();
PIString classname, name;
PIStringList parents;
PIMap<PIString, PIVariant> properties;
int queued_events;
};
static const uint sign;
static ProcessInfo getInfo();
static PIVector<ObjectInfo> getObjects();
static PIByteArray packInfo();
static void unpackInfo(PIByteArray & ba, ProcessInfo & info);
static PIByteArray packContainers();
static void unpackContainers(PIByteArray & ba, PIMap<uint, PIIntrospectionContainers::Type> & data, PIMap<uint, PIString> & typenames);
static PIByteArray packThreads();
static void unpackThreads(PIByteArray & ba, PIVector<PIIntrospectionThreads::ThreadInfo> & threads);
static PIByteArray packObjects();
static void unpackObjects(PIByteArray & ba, PIVector<PIIntrospection::ObjectInfo> & objects);
};
PIByteArray & operator <<(PIByteArray & s, const std::unordered_map<uint, PIIntrospectionContainers::Type> & v);
PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::ProcessInfo & v);
PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ProcessInfo & v);
PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::ObjectInfo & v);
PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ObjectInfo & v);
#endif // PIINTROSPECTION_SERVER_P_H

View File

@@ -45,6 +45,7 @@ class PIIntrospectionThreads;
#endif
class PIP_EXPORT PIIntrospectionThreadsInterface {
friend class PIIntrospection;
public:
__PIINTROSPECTION_SINGLETON__(Threads)

View File

@@ -25,6 +25,7 @@
#include "file_manager.h"
#include "daemon.h"
#include "shared.h"
#include "piintrospection_server.h"
class _Init {
public:
@@ -337,6 +338,7 @@ void usage() {
int main(int argc, char * argv[]) {
PIINTROSPECTION_START
//piDebug = false;
PICLI cli(argc, argv);
cli.addArgument("help");
@@ -388,7 +390,6 @@ int main(int argc, char * argv[]) {
PIProcess::execIndependent(exe, args);
return 0;
}
/// PIINTROSPECTION_START
//cli.addArgument("");
screen = new PIScreen(false);
screen->setMouseEnabled(true);