17 Commits

Author SHA1 Message Date
fec68299c1 remove install duplicate 2020-08-19 16:22:01 +03:00
ccd6a9888f tree changes 2020-08-19 00:47:05 +03:00
c582d8ff46 PIStringList new constructor 2020-08-18 22:58:30 +03:00
9834ac177b debian version fix, "Maj.Min.Rev-Build-suffix" instead of "Maj.Min.Rev-suffix-Build" 2020-08-15 21:24:57 +03:00
31f0d88157 version 2.2.1
std::initializer_list supports for vector and dequeue
2020-08-14 18:00:28 +03:00
e76a07a3f3 binlog fixes 2020-08-13 18:03:25 +03:00
31a347250f version 2.2.0
remove deprecated members
PIVariantTypes::File add "is_save" flag
PIBinaryLog clear
2020-08-13 12:59:29 +03:00
294831df17 binlog user header 2020-08-12 20:01:24 +03:00
e77d3a86a9 opencl MacOS fix 2020-08-11 21:18:51 +03:00
66010c83eb export headers workaround 2020-08-11 20:59:12 +03:00
57a9ccb854 version 2.0.0_prealpha
PIFile::put() and get()
2020-08-11 20:09:34 +03:00
3ba6a7b0e8 rename PIBlockingDequeue -> PIBlockingQueue 2020-08-11 19:05:47 +03:00
8c3349d84a fix PIThreadPoolExecutor and PIBlockingDequeue 2020-08-11 17:26:44 +03:00
dac318c624 <T>_MAKE_VERSION macro add in "set_version()" CMake generated header 2020-08-06 17:25:16 +03:00
e08f805525 small fixes 2020-08-06 15:17:15 +03:00
26742a1fc3 PIFile::readAll patch 2020-08-06 15:01:31 +03:00
70a7363f76 some features
in main.cpp fastest Variant implementation
2020-08-05 00:53:27 +03:00
244 changed files with 588 additions and 294 deletions

View File

@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0017 NEW) # need include() with .cmake cmake_policy(SET CMP0017 NEW) # need include() with .cmake
project(pip) project(pip)
set(_PIP_MAJOR 1) set(_PIP_MAJOR 2)
set(_PIP_MINOR 99) set(_PIP_MINOR 2)
set(_PIP_REVISION 3) set(_PIP_REVISION 2)
set(_PIP_SUFFIX _prebeta) set(_PIP_SUFFIX _alpha)
set(_PIP_COMPANY SHS) set(_PIP_COMPANY SHS)
set(_PIP_DOMAIN org.SHS) set(_PIP_DOMAIN org.SHS)
@@ -66,10 +66,10 @@ macro(pip_module NAME LIBS LABEL INCLUDES MSG)
set(HS) set(HS)
set(PHS) set(PHS)
set(CRES) set(CRES)
file(GLOB_RECURSE CPPS "lib/${NAME}/*.cpp") file(GLOB_RECURSE CPPS "libs/${NAME}/*.cpp")
file(GLOB_RECURSE HS "lib/${NAME}/*.h") file(GLOB_RECURSE HS "libs/${NAME}/*.h")
file(GLOB_RECURSE PHS "lib/${NAME}/*_p.h") file(GLOB_RECURSE PHS "libs/${NAME}/*_p.h")
file(GLOB_RECURSE RES "lib/${NAME}/*conf.h") file(GLOB_RECURSE RES "libs/${NAME}/*conf.h")
list(REMOVE_ITEM HS "${PHS}") list(REMOVE_ITEM HS "${PHS}")
list(APPEND HDRS ${HS}) list(APPEND HDRS ${HS})
list(APPEND PHDRS ${PHS}) list(APPEND PHDRS ${PHS})
@@ -112,8 +112,6 @@ macro(pip_module NAME LIBS LABEL INCLUDES MSG)
if (NOT "${INCLUDES}" STREQUAL "") if (NOT "${INCLUDES}" STREQUAL "")
target_include_directories(${_target} PRIVATE ${INCLUDES}) target_include_directories(${_target} PRIVATE ${INCLUDES})
endif() endif()
generate_export_header(${_target})
list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/${_target}_export.h")
list(APPEND PIP_EXPORTS "${DEF_NAME}_EXPORT") list(APPEND PIP_EXPORTS "${DEF_NAME}_EXPORT")
target_link_libraries(${_target} ${LINK_LIBS}) target_link_libraries(${_target} ${LINK_LIBS})
list(APPEND PIP_MODULES ${_target}) list(APPEND PIP_MODULES ${_target})
@@ -210,8 +208,8 @@ get_filename_component(C_COMPILER "${CMAKE_C_COMPILER}" NAME)
# Main lib # Main lib
file(GLOB PIP_FOLDERS LIST_DIRECTORIES TRUE "${CMAKE_CURRENT_SOURCE_DIR}/lib/main/*") file(GLOB PIP_FOLDERS LIST_DIRECTORIES TRUE "${CMAKE_CURRENT_SOURCE_DIR}/libs/main/*")
list(APPEND PIP_FOLDERS "${CMAKE_CURRENT_SOURCE_DIR}/lib/main") list(APPEND PIP_FOLDERS "${CMAKE_CURRENT_SOURCE_DIR}/libs/main")
set(PIP_MAIN_FOLDERS) set(PIP_MAIN_FOLDERS)
foreach(F ${PIP_FOLDERS}) foreach(F ${PIP_FOLDERS})
if (IS_DIRECTORY "${F}") if (IS_DIRECTORY "${F}")
@@ -384,6 +382,15 @@ set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
pip_module(main "${LIBS_MAIN}" "PIP main library" "" "") pip_module(main "${LIBS_MAIN}" "PIP main library" "" "")
generate_export_header(pip)
list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/pip_export.h")
foreach(_m ${PIP_SRC_MODULES})
set_target_properties(pip PROPERTIES DEFINE_SYMBOL pip_${_m}_EXPORTS)
generate_export_header(pip BASE_NAME "pip_${_m}")
list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/pip_${_m}_export.h")
endforeach()
set_target_properties(pip PROPERTIES DEFINE_SYMBOL pip_EXPORTS)
if (NOT CROSSTOOLS) if (NOT CROSSTOOLS)
if (NOT PIP_FREERTOS) if (NOT PIP_FREERTOS)
@@ -462,7 +469,11 @@ if (NOT CROSSTOOLS)
if(${CMAKE_VERSION} VERSION_LESS "3.7.0") if(${CMAKE_VERSION} VERSION_LESS "3.7.0")
target_link_libraries(_opencl_lib OpenCL) target_link_libraries(_opencl_lib OpenCL)
endif() endif()
pip_module(opencl "${_opencl_lib}" "PIP OpenCL support" "" " (${OpenCL_VERSION_STRING})") set(_opencl_inc "${OpenCL_INCLUDE_DIRS}")
if(APPLE)
set(_opencl_inc "${OpenCL_INCLUDE_DIRS}/Headers")
endif()
pip_module(opencl "${_opencl_lib}" "PIP OpenCL support" "${_opencl_inc}" " (${OpenCL_VERSION_STRING})")
endif() endif()
@@ -479,8 +490,8 @@ if (NOT CROSSTOOLS)
endif() endif()
find_package(Lua QUIET) find_package(Lua QUIET)
if (LUA_FOUND) if (LUA_FOUND)
pip_module(lua "LUA" "PIP Lua support" "${LUA_INCLUDE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/3rd" " (${LUA_VERSION_STRING})") pip_module(lua "LUA" "PIP Lua support" "${LUA_INCLUDE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libs/lua/3rd" " (${LUA_VERSION_STRING})")
list(APPEND HDR_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/3rd/LuaBridge") list(APPEND HDR_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/libs/lua/3rd/LuaBridge")
endif() endif()
@@ -524,7 +535,6 @@ if(LIB)
if(WIN32) if(WIN32)
if(MINGW) if(MINGW)
if (NOT CROSSTOOLS) if (NOT CROSSTOOLS)
install(FILES ${HDRS} DESTINATION ${MINGW_INCLUDE}/pip)
install(FILES ${HDRS} DESTINATION ${MINGW_INCLUDE}/pip) install(FILES ${HDRS} DESTINATION ${MINGW_INCLUDE}/pip)
if(HDR_DIRS) if(HDR_DIRS)
install(DIRECTORY ${HDR_DIRS} DESTINATION ${MINGW_INCLUDE}/pip) install(DIRECTORY ${HDR_DIRS} DESTINATION ${MINGW_INCLUDE}/pip)
@@ -612,7 +622,7 @@ if ((NOT PIP_FREERTOS) AND (NOT CROSSTOOLS))
set(DOXY_QHP_SECT_FILTER_ATTRS "\"PIP ${PIP_VERSION}\"") set(DOXY_QHP_SECT_FILTER_ATTRS "\"PIP ${PIP_VERSION}\"")
set(DOXY_EXAMPLE_PATH "\"${CMAKE_CURRENT_SOURCE_DIR}/doc/examples\"") set(DOXY_EXAMPLE_PATH "\"${CMAKE_CURRENT_SOURCE_DIR}/doc/examples\"")
set(DOXY_IMAGE_PATH "\"${CMAKE_CURRENT_SOURCE_DIR}/doc/images\"") set(DOXY_IMAGE_PATH "\"${CMAKE_CURRENT_SOURCE_DIR}/doc/images\"")
set(DOXY_EXCLUDE "\"${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/3rd\"") set(DOXY_EXCLUDE "\"${CMAKE_CURRENT_SOURCE_DIR}/libs/lua/3rd\"")
if(DOXYGEN_DOT_EXECUTABLE) if(DOXYGEN_DOT_EXECUTABLE)
string(REPLACE "\\" "" _DOT_PATH "${DOXYGEN_DOT_PATH}") string(REPLACE "\\" "" _DOT_PATH "${DOXYGEN_DOT_PATH}")
set(DOXY_DOT_PATH "\"${_DOT_PATH}\"") set(DOXY_DOT_PATH "\"${_DOT_PATH}\"")
@@ -623,7 +633,7 @@ if ((NOT PIP_FREERTOS) AND (NOT CROSSTOOLS))
foreach(F ${PIP_MAIN_FOLDERS}) foreach(F ${PIP_MAIN_FOLDERS})
list(APPEND DOXY_INPUT "\"${F}\"") list(APPEND DOXY_INPUT "\"${F}\"")
endforeach(F) endforeach(F)
string(REPLACE ";" " " DOXY_INPUT "\"${CMAKE_CURRENT_SOURCE_DIR}/lib\"") string(REPLACE ";" " " DOXY_INPUT "\"${CMAKE_CURRENT_SOURCE_DIR}/libs\"")
string(REPLACE ";" " " DOXY_INCLUDE_PATH "${DOXY_INPUT}") string(REPLACE ";" " " DOXY_INCLUDE_PATH "${DOXY_INPUT}")
string(REPLACE ";" " " DOXY_DEFINES "${PIP_EXPORTS};DOXYGEN;PIOBJECT;PIOBJECT_SUBCLASS") string(REPLACE ";" " " DOXY_DEFINES "${PIP_EXPORTS};DOXYGEN;PIOBJECT;PIOBJECT_SUBCLASS")
add_documentation(doc doc/Doxyfile.in) add_documentation(doc doc/Doxyfile.in)
@@ -632,6 +642,23 @@ if ((NOT PIP_FREERTOS) AND (NOT CROSSTOOLS))
endif() endif()
set(_max_len 0)
foreach(_m ${PIP_SRC_MODULES})
string(LENGTH "${_m}" _clen)
if (_clen GREATER _max_len)
set(_max_len ${_clen})
endif()
endforeach()
macro(expand_to_length _out _str _len)
set(${_out} "${_str}")
while(TRUE)
string(LENGTH "${${_out}}" _clen)
if (_clen GREATER_EQUAL ${_len})
break()
endif()
string(APPEND ${_out} " ")
endwhile()
endmacro()
list(REMOVE_ITEM LIBS_STATUS ${PIP_MODULES}) list(REMOVE_ITEM LIBS_STATUS ${PIP_MODULES})
message("----------PIP----------") message("----------PIP----------")
@@ -657,7 +684,8 @@ endif()
message("") message("")
message(" Modules:") message(" Modules:")
foreach(_m ${PIP_SRC_MODULES}) foreach(_m ${PIP_SRC_MODULES})
message(" ${_m}: ${PIP_MSG_${_m}}") expand_to_length(_m_e "${_m}" ${_max_len})
message(" ${_m_e}: ${PIP_MSG_${_m}}")
endforeach() endforeach()
message("") message("")
if (PIP_TESTS_LIST) if (PIP_TESTS_LIST)

View File

@@ -14,7 +14,9 @@ Create variable <target>_VERSION with full version name
If OUTPUT then generate header <file> with If OUTPUT then generate header <file> with
version macros - <target>_VERSION_<NAME> version macros - <target>_VERSION_<NAME>
Also create macro <target>_VERSION_NAME with full string version Also create macro <target>_VERSION_NAME with full string version and
macro <target>_MAKE_VERSION(major, minor, revision) that returns
byte-packed integer version.
Attention: macro <target>_VERSION is byte-packed integer version! Attention: macro <target>_VERSION is byte-packed integer version!
@@ -165,7 +167,7 @@ set(_dt_delim "::")
macro(set_version _T) macro(set_version _T)
set(_VERSION_ 1) # macro version set(_VERSION_ 2) # macro version
set(_name) set(_name)
set(_is_name 1) set(_is_name 1)
set(_is_out 0) set(_is_out 0)
@@ -239,7 +241,8 @@ macro(set_version _T)
#define ${_TN}_VERSION_BUILD ${${_T}_VERSION_BUILD} #define ${_TN}_VERSION_BUILD ${${_T}_VERSION_BUILD}
#define ${_TN}_VERSION_SUFFIX \"${${_T}_VERSION_SUFFIX}\" #define ${_TN}_VERSION_SUFFIX \"${${_T}_VERSION_SUFFIX}\"
#define ${_TN}_VERSION_NAME \"${${_T}_VERSION}\" #define ${_TN}_VERSION_NAME \"${${_T}_VERSION}\"
#define ${_TN}_VERSION ((${_TN}_VERSION_MAJOR << 16) | (${_TN}_VERSION_MINOR << 8) | ${_TN}_VERSION_REVISION) #define ${_TN}_MAKE_VERSION(major, minor, revision) ((major << 16) | (minor << 8) | revision)
#define ${_TN}_VERSION ${_TN}_MAKE_VERSION(${_TN}_VERSION_MAJOR, ${_TN}_VERSION_MINOR, ${_TN}_VERSION_REVISION)
// Tools // Tools
@@ -656,7 +659,8 @@ macro(deploy_target _T)
set(_TARGET_OS "linux") set(_TARGET_OS "linux")
endif() endif()
string(REPLACE "_" "-" _DEBNAME "${_T}") string(REPLACE "_" "-" _DEBNAME "${_T}")
string(REPLACE "_" "-" _DEBVERSION "${${_T}_VERSION}${_build}+${_TARGET_OS}") set(_DEBVERSION "${${_T}_VERSION_MAJOR}.${${_T}_VERSION_MINOR}.${${_T}_VERSION_REVISION}${_build}${${_T}_VERSION_FULLSUFFIX}+${_TARGET_OS}")
string(REPLACE "_" "-" _DEBVERSION "${_DEBVERSION}")
string(TOLOWER "${_DEBNAME}" _DEBNAME) string(TOLOWER "${_DEBNAME}" _DEBNAME)
set(_DEB_ARCH) set(_DEB_ARCH)
if("_${MY_ARCH}" STREQUAL "_arm64") if("_${MY_ARCH}" STREQUAL "_arm64")

View File

@@ -49,6 +49,9 @@ PIVector<char> vec(4u, 'p');
piForeachC (char i, vec) piForeachC (char i, vec)
cout << i << ", "; cout << i << ", ";
// p, p, p, p, // p, p, p, p,
piCout << PIVector<int>({1, 2, 3});
// 1, 2, 3
//! [PIVector::PIVector] //! [PIVector::PIVector]
//! [PIVector::at_c] //! [PIVector::at_c]
PIVector<int> vec; PIVector<int> vec;

View File

@@ -30,11 +30,11 @@ PICloudClient::~PICloudClient() {
bool PICloudClient::openDevice() { bool PICloudClient::openDevice() {
return false;
} }
bool PICloudClient::closeDevice() { bool PICloudClient::closeDevice() {
return false;
} }

View File

@@ -32,6 +32,10 @@
* \brief Contructs vector with size "size" filled elements "value" * \brief Contructs vector with size "size" filled elements "value"
* \details Example: \snippet picontainers.cpp PIVector::PIVector * \details Example: \snippet picontainers.cpp PIVector::PIVector
* \fn PIVector::PIVector(std::initializer_list list);
* \brief Contructs vector from C++11 initializer list
* \details Example: \snippet picontainers.cpp PIVector::PIVector
* \fn const T & PIVector::at(size_t index) const; * \fn const T & PIVector::at(size_t index) const;
* \brief Read-only access to element by index "index" * \brief Read-only access to element by index "index"
* \details Example: \snippet picontainers.cpp PIVector::at_c * \details Example: \snippet picontainers.cpp PIVector::at_c
@@ -371,4 +375,7 @@
* \fn bool PIMapIterator::next() * \fn bool PIMapIterator::next()
* \brief Jump to next entry and return if new position is valid. * \brief Jump to next entry and return if new position is valid.
* \fn void PIMapIterator::reset()
* \brief Reset iterator to initial position.
* */ * */

View File

@@ -42,6 +42,7 @@
#else #else
# include <malloc.h> # include <malloc.h>
#endif #endif
#include <initializer_list>
#include <string.h> #include <string.h>
#include <new> #include <new>
#ifndef PIP_MEMALIGN_BYTES #ifndef PIP_MEMALIGN_BYTES

View File

@@ -39,6 +39,11 @@ public:
alloc(other.pid_size, true); alloc(other.pid_size, true);
newT(pid_data + pid_start, other.pid_data + other.pid_start, pid_size); newT(pid_data + pid_start, other.pid_data + other.pid_start, pid_size);
} }
inline PIDeque(std::initializer_list<T> init_list): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T))
alloc(init_list.size(), true);
newT(pid_data, init_list.begin(), init_list.size());
}
inline PIDeque(const T * data, size_t size): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) { inline PIDeque(const T * data, size_t size): pid_data(0), pid_size(0), pid_rsize(0), pid_start(0) {
PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T)) PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T))
alloc(size, true); alloc(size, true);
@@ -49,6 +54,7 @@ public:
resize(pid_size, f); resize(pid_size, f);
} }
inline PIDeque(PIDeque<T> && other): pid_data(other.pid_data), pid_size(other.pid_size), pid_rsize(other.pid_rsize), pid_start(other.pid_start) { inline PIDeque(PIDeque<T> && other): pid_data(other.pid_data), pid_size(other.pid_size), pid_rsize(other.pid_rsize), pid_start(other.pid_start) {
PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T))
other._reset(); other._reset();
} }
inline virtual ~PIDeque() { inline virtual ~PIDeque() {

View File

@@ -364,6 +364,13 @@ public:
} }
return false; return false;
} }
inline void reset() {
if (rev) {
pos = m.size_s();
} else {
pos = -1;
}
}
private: private:
const MapType & m; const MapType & m;
ssize_t pos; ssize_t pos;

View File

@@ -44,11 +44,17 @@ public:
alloc(other.piv_size); alloc(other.piv_size);
newT(piv_data, other.piv_data, piv_size); newT(piv_data, other.piv_data, piv_size);
} }
inline PIVector(std::initializer_list<T> init_list): piv_data(0), piv_size(0), piv_rsize(0) {
PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T))
alloc(init_list.size());
newT(piv_data, init_list.begin(), init_list.size());
}
inline PIVector(size_t piv_size, const T & f = T()): piv_data(0), piv_size(0), piv_rsize(0) { inline PIVector(size_t piv_size, const T & f = T()): piv_data(0), piv_size(0), piv_rsize(0) {
PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T)) PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T))
resize(piv_size, f); resize(piv_size, f);
} }
inline PIVector(PIVector<T> && other): piv_data(other.piv_data), piv_size(other.piv_size), piv_rsize(other.piv_rsize) { inline PIVector(PIVector<T> && other): piv_data(other.piv_data), piv_size(other.piv_size), piv_rsize(other.piv_rsize) {
PIINTROSPECTION_CONTAINER_NEW(T, sizeof(T))
other._reset(); other._reset();
} }
inline virtual ~PIVector() { inline virtual ~PIVector() {

View File

@@ -454,20 +454,7 @@ template<> inline float piLetobe(const float & v) {
return a.f; return a.f;
} }
DEPRECATED inline ushort letobe_s(const ushort & v) {return (v << 8) | (v >> 8);} /// \brief Generic hash function, implements murmur3/32 algorithm
DEPRECATED inline uint letobe_i(const uint & v) {return (v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | ((v << 24) & 0xFF000000);}
#ifdef DOXYGEN
/// \deprecated \brief Use \a piLetobe() instead of this function
ushort letobe_s(ushort v) {return (v << 8) | (v >> 8);}
/// \deprecated \brief Use \a piLetobe() instead of this function
uint letobe_i(uint v) {return (v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | ((v << 24) & 0xFF000000);}
#endif
/// \brief Generic hash function, impements murmur3/32 algorithm
inline uint piHashData(const uchar * data, uint len, uint seed = 0) { inline uint piHashData(const uchar * data, uint len, uint seed = 0) {
if (!data || len <= 0) return 0u; if (!data || len <= 0) return 0u;
uint h = seed; uint h = seed;

View File

@@ -396,8 +396,8 @@ PIByteArray & operator >>(PIByteArray & s, PIByteArray & v) {
} }
v.resize(sz); v.resize(sz);
if (sz > 0) { if (sz > 0) {
memcpy(v.data(), s.data(), v.size()); memcpy(v.data(), s.data(), sz);
s.remove(0, v.size()); s.remove(0, sz);
} }
return s; return s;
} }

View File

@@ -38,6 +38,16 @@ void PIPropertyStorage::addProperty(const PIPropertyStorage::Property & p) {
} }
void PIPropertyStorage::addProperty(PIPropertyStorage::Property && p) {
for (uint i = 0; i < props.size(); ++i)
if (props[i].name == p.name) {
props[i] = std::move(p);
return;
}
props << std::move(p);
}
void PIPropertyStorage::removeProperty(const PIString & _name) { void PIPropertyStorage::removeProperty(const PIString & _name) {
for (uint i = 0; i < props.size(); ++i) for (uint i = 0; i < props.size(); ++i)
if (props[i].name == _name) { if (props[i].name == _name) {

Some files were not shown because too many files have changed in this diff Show More