From 0c7ce272e67137a4137b2d684fa6b1daaca79862 Mon Sep 17 00:00:00 2001 From: andrey Date: Wed, 4 Aug 2021 14:31:36 +0300 Subject: [PATCH] fix some warnings, add some doc --- libs/main/cloud/picloudclient.h | 2 +- libs/main/cloud/picloudserver.h | 2 +- libs/main/containers/pivector2d.h | 2 +- libs/main/core/pibytearray.h | 27 ++++++++++++++++++++++----- libs/main/core/pistring.h | 14 +++++++------- libs/main/core/pistringlist.h | 8 ++++---- libs/main/core/pitime.h | 8 ++++---- libs/main/io_devices/pibinarylog.h | 2 +- libs/main/system/piplugin.cpp | 2 +- libs/main/thread/piblockingqueue.h | 1 + libs/opencl/piopencl.cpp | 1 + 11 files changed, 44 insertions(+), 25 deletions(-) diff --git a/libs/main/cloud/picloudclient.h b/libs/main/cloud/picloudclient.h index b9b8550b..08993b86 100644 --- a/libs/main/cloud/picloudclient.h +++ b/libs/main/cloud/picloudclient.h @@ -31,7 +31,7 @@ class PIP_CLOUD_EXPORT PICloudClient: public PIIODevice, public PICloudBase { PIIODEVICE(PICloudClient) public: - //! + //! PICloudClient explicit PICloudClient(const PIString & path = PIString(), PIIODevice::DeviceMode mode = PIIODevice::ReadWrite); virtual ~PICloudClient(); diff --git a/libs/main/cloud/picloudserver.h b/libs/main/cloud/picloudserver.h index 9702d60e..80e521d0 100644 --- a/libs/main/cloud/picloudserver.h +++ b/libs/main/cloud/picloudserver.h @@ -31,7 +31,7 @@ class PIP_CLOUD_EXPORT PICloudServer: public PIIODevice, public PICloudBase { PIIODEVICE(PICloudServer) public: - //! + //! PICloudServer explicit PICloudServer(const PIString & path = PIString(), PIIODevice::DeviceMode mode = PIIODevice::ReadWrite); virtual ~PICloudServer(); diff --git a/libs/main/containers/pivector2d.h b/libs/main/containers/pivector2d.h index 748f522b..9f8a7957 100644 --- a/libs/main/containers/pivector2d.h +++ b/libs/main/containers/pivector2d.h @@ -1,4 +1,4 @@ -/*! \file pivecto2d.h +/*! \file pivector2d.h * \brief 2D wrapper around PIVector * * This file declares PIVector diff --git a/libs/main/core/pibytearray.h b/libs/main/core/pibytearray.h index 6a48ade5..5aadc8e9 100644 --- a/libs/main/core/pibytearray.h +++ b/libs/main/core/pibytearray.h @@ -37,7 +37,12 @@ class PIString; class PIByteArray; - +/*! \brief The PIByteArray class provides an array of bytes + * \details PIByteArray used to store raw bytes. + * It can be constructed from any data and size. + * You can use PIByteArray as binary stream + * to serialize/deserialize any objects and data. + */ class PIP_EXPORT PIByteArray: public PIDeque { public: @@ -87,14 +92,15 @@ public: //! Return converted to Base 64 data PIByteArray toBase64() const; - //! Return converted from Base 64 data - PIByteArray & compressRLE(uchar threshold = 192); PIByteArray & decompressRLE(uchar threshold = 192); PIByteArray compressedRLE(uchar threshold = 192) {PIByteArray ba(*this); ba.compressRLE(threshold); return ba;} PIByteArray decompressedRLE(uchar threshold = 192) {PIByteArray ba(*this); ba.decompressRLE(threshold); return ba;} PIString toString(int base = 16) const; + + //! Returns a hex encoded copy of the byte array. + //! The hex encoding uses the numbers 0-9 and the letters a-f. PIString toHex() const; //! Add to the end data "data" with size "size" @@ -106,10 +112,18 @@ public: //! Add to the end "t" PIByteArray & append(uchar t) {push_back(t); return *this;} - //! Returns plain 8-bit checksum + //! Returns 8-bit checksum + //! sum all bytes, add 1, inverse + //! Pseudocode: + //! sum += at(i); + //! return ~(sum + 1) uchar checksumPlain8() const; - //! Returns plain 32-bit checksum + //! Returns 32-bit checksum + //! sum all bytes multiplyed by index+1, add 1, inverse + //! Pseudocode: + //! sum += at(i) * (i + 1); + //! return ~(sum + 1) uint checksumPlain32() const; //! Returns hash @@ -122,7 +136,10 @@ public: PIByteArray & operator =(PIByteArray && o) {swap(o); return *this;} static PIByteArray fromUserInput(PIString str); + static PIByteArray fromHex(PIString str); + + //! Return converted from Base 64 data static PIByteArray fromBase64(const PIByteArray & base64); static PIByteArray fromBase64(const PIString & base64); diff --git a/libs/main/core/pistring.h b/libs/main/core/pistring.h index 455ad87d..5571d2b5 100644 --- a/libs/main/core/pistring.h +++ b/libs/main/core/pistring.h @@ -754,30 +754,30 @@ private: }; -//! \relatesalso PIString \relatesalso PICout \brief Output operator to PICout +//! \relatesalso PICout \brief Output operator to PICout PIP_EXPORT PICout operator <<(PICout s, const PIString & v); -//! \relatesalso PIString \relatesalso PIByteArray \brief Output operator to PIByteArray +//! \relatesalso PIByteArray \brief Output operator to PIByteArray inline PIByteArray & operator <<(PIByteArray & s, const PIString & v) {s << *(PIDeque*)&v; return s;} -//! \relatesalso PIString \relatesalso PIByteArray \brief Input operator from PIByteArray +//! \relatesalso PIByteArray \brief Input operator from PIByteArray inline PIByteArray & operator >>(PIByteArray & s, PIString & v) {v.clear(); s >> *(PIDeque*)&v; return s;} -//! \relatesalso PIString \brief Return concatenated string +//! \brief Return concatenated string inline PIString operator +(const PIString & str, const PIString & f) {PIString s(str); s += f; return s;} -//! \relatesalso PIString \brief Return concatenated string +//! \brief Return concatenated string inline PIString operator +(const PIString & f, const char * str) {PIString s(f); s += str; return s;} -//! \relatesalso PIString \brief Return concatenated string +//! \brief Return concatenated string inline PIString operator +(const char * str, const PIString & f) {return PIString(str) + f;} //! \relatesalso PIString \brief Return concatenated string inline PIString operator +(const char c, const PIString & f) {return PIChar(c) + f;} -//! \relatesalso PIString \brief Return concatenated string +//! \brief Return concatenated string inline PIString operator +(const PIString & f, const char c) {return f + PIChar(c);} diff --git a/libs/main/core/pistringlist.h b/libs/main/core/pistringlist.h index 9220aacf..0c63f2e8 100644 --- a/libs/main/core/pistringlist.h +++ b/libs/main/core/pistringlist.h @@ -76,7 +76,7 @@ public: PIStringList & removeDuplicates(); //! \brief Trim all strings - //! \details Example: \snippet pistring.cpp PIStringList::trim + //! \details Example: \snippet pistring.cpp PIString::trim PIStringList & trim() {for (uint i = 0; i < size(); ++i) (*this)[i].trim(); return *this;} //! Return sum of lengths of all strings @@ -97,13 +97,13 @@ public: }; -//! \relatesalso PIStringList \relatesalso PIByteArray \brief Output operator to PIByteArray +//! \relatesalso PIByteArray \brief Output operator to PIByteArray inline PIByteArray & operator <<(PIByteArray & s, const PIStringList & v) {s << int(v.size_s()); for (int i = 0; i < v.size_s(); ++i) s << v[i]; return s;} -//! \relatesalso PIStringList \relatesalso PIByteArray \brief Input operator from PIByteArray +//! relatesalso PIByteArray \brief Input operator from PIByteArray inline PIByteArray & operator >>(PIByteArray & s, PIStringList & v) {int sz; s >> sz; v.resize(sz); for (int i = 0; i < sz; ++i) s >> v[i]; return s;} -//! \relatesalso PIStringList \relatesalso PICout \brief Output operator to PICout +//! \relatesalso PICout \brief Output operator to PICout inline PICout operator <<(PICout s, const PIStringList & v) {s.space(); s.setControl(0, true); s << "{"; for (uint i = 0; i < v.size(); ++i) {s << "\"" << v[i] << "\""; if (i < v.size() - 1) s << ", ";} s << "}"; s.restoreControl(); return s;} #endif // PISTRINGLIST_H diff --git a/libs/main/core/pitime.h b/libs/main/core/pitime.h index 9c9a959d..1f8d97ad 100644 --- a/libs/main/core/pitime.h +++ b/libs/main/core/pitime.h @@ -167,7 +167,7 @@ private: }; -//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout +//! \relatesalso PICout \brief Output operator to PICout inline PICout operator <<(PICout s, const PISystemTime & v) {s.space(); s.setControl(0, true); s << "(" << v.seconds << " s, " << v.nanoseconds << " ns)"; s.restoreControl(); return s;} @@ -191,7 +191,7 @@ inline bool operator !=(const PITime & t0, const PITime & t1) {return !(t0 == t1 inline bool operator <=(const PITime & t0, const PITime & t1) {return !(t0 > t1);} inline bool operator >=(const PITime & t0, const PITime & t1) {return !(t0 < t1);} -//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout +//! \relatesalso PICout \brief Output operator to PICout PIP_EXPORT PICout operator <<(PICout s, const PITime & v); @@ -213,7 +213,7 @@ inline bool operator !=(const PIDate & t0, const PIDate & t1) {return !(t0 == t1 inline bool operator <=(const PIDate & t0, const PIDate & t1) {return !(t0 > t1);} inline bool operator >=(const PIDate & t0, const PIDate & t1) {return !(t0 < t1);} -//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout +//! \relatesalso PICout \brief Output operator to PICout PIP_EXPORT PICout operator <<(PICout s, const PIDate & v); @@ -258,7 +258,7 @@ inline bool operator >=(const PIDateTime & t0, const PIDateTime & t1) {return !( inline PIByteArray & operator <<(PIByteArray & s, const PIDateTime & v) {s << v.year << v.month << v.day << v.hours << v.minutes << v.seconds << v.milliseconds; return s;} inline PIByteArray & operator >>(PIByteArray & s, PIDateTime & v) {s >> v.year >> v.month >> v.day >> v.hours >> v.minutes >> v.seconds >> v.milliseconds; return s;} -//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout +//! \relatesalso PICout \brief Output operator to PICout PIP_EXPORT PICout operator <<(PICout s, const PIDateTime & v); diff --git a/libs/main/io_devices/pibinarylog.h b/libs/main/io_devices/pibinarylog.h index dc73e675..d7c4c21f 100644 --- a/libs/main/io_devices/pibinarylog.h +++ b/libs/main/io_devices/pibinarylog.h @@ -324,7 +324,7 @@ private: PIByteArray user_header; }; -//! \relatesalso PICout \relatesalso PIBinaryLog::BinLogInfo \brief Output operator to PICout +//! \relatesalso PICout \brief Output operator PIBinaryLog::BinLogInfo to PICout inline PICout operator <<(PICout s, const PIBinaryLog::BinLogInfo & bi) { s.space(); s.setControl(0, true); diff --git a/libs/main/system/piplugin.cpp b/libs/main/system/piplugin.cpp index 52d00d54..b9aa61ef 100644 --- a/libs/main/system/piplugin.cpp +++ b/libs/main/system/piplugin.cpp @@ -45,7 +45,7 @@ * Application should use class \a PIPluginLoader to load * plugin. Main function is \a load(PIString name). * "name" is base name of library, %PIPluginLoader - * try to use sevaral names, , lib and + * try to use sevaral names, \, lib\ and * "dll", "so" and "dylib" extensions, depends on system. * For example: * \code diff --git a/libs/main/thread/piblockingqueue.h b/libs/main/thread/piblockingqueue.h index 6021e4d9..c630ea21 100644 --- a/libs/main/thread/piblockingqueue.h +++ b/libs/main/thread/piblockingqueue.h @@ -87,6 +87,7 @@ public: * exceeding the queue's capacity, returning true upon success and false if this queue is full. * * @param v the element to add + * @param timeoutMs the timeout waiting for inserting if que is full, if timeout = 0, then returns immediately * @return true if the element was added to this queue, else false */ bool offer(const T & v, int timeoutMs = 0) { diff --git a/libs/opencl/piopencl.cpp b/libs/opencl/piopencl.cpp index a3dc52c0..1558d749 100644 --- a/libs/opencl/piopencl.cpp +++ b/libs/opencl/piopencl.cpp @@ -2,6 +2,7 @@ #include "piresources.h" #define CL_USE_DEPRECATED_OPENCL_1_2_APIS #define CL_USE_DEPRECATED_OPENCL_2_0_APIS +#define CL_TARGET_OPENCL_VERSION 120 #ifdef MAC_OS # include "cl.h" #else