new class PIVariantSimple

PIObject::CONNECTU_QUEUED moved to PIVariantSimple
static_assert on undeclared operators PIByteArray << and >> with complex types
This commit is contained in:
2020-10-01 21:50:41 +03:00
parent 2ca8db70f3
commit 298765b7d8
7 changed files with 321 additions and 159 deletions

View File

@@ -444,26 +444,16 @@ inline PIByteArray & operator >>(PIByteArray & s, PIMap<Key, T> & v) {
template<typename T, typename std::enable_if<!std::is_trivially_copyable<T>::value, int>::type = 0>
inline PIByteArray & operator <<(PIByteArray & s, const T & ) {piCout << "[PIByteArray] Warning: using undeclared operator <<!"; return s;}
template<typename T, typename std::enable_if<!std::is_trivially_copyable<T>::value, int>::type = 0>
inline PIByteArray & operator >>(PIByteArray & s, T & ) {piCout << "[PIByteArray] Warning: using undeclared operator >>!"; return s;}
inline PIByteArray & operator <<(PIByteArray & s, const T & ) {
static_assert(std::is_trivially_copyable<T>::value, "[PIByteArray] Error: using undeclared operator << for complex type!");
return s;
}
/*
__PIBYTEARRAY_SIMPLE_TYPE__(bool)
__PIBYTEARRAY_SIMPLE_TYPE__(char)
__PIBYTEARRAY_SIMPLE_TYPE__(short)
__PIBYTEARRAY_SIMPLE_TYPE__(ushort)
__PIBYTEARRAY_SIMPLE_TYPE__(int)
__PIBYTEARRAY_SIMPLE_TYPE__(uint)
__PIBYTEARRAY_SIMPLE_TYPE__(long)
__PIBYTEARRAY_SIMPLE_TYPE__(ulong)
__PIBYTEARRAY_SIMPLE_TYPE__(llong)
__PIBYTEARRAY_SIMPLE_TYPE__(ullong)
__PIBYTEARRAY_SIMPLE_TYPE__(float)
__PIBYTEARRAY_SIMPLE_TYPE__(double)
__PIBYTEARRAY_SIMPLE_TYPE__(ldouble)
__PIBYTEARRAY_SIMPLE_TYPE__(PIChar)
*/
template<typename T, typename std::enable_if<!std::is_trivially_copyable<T>::value, int>::type = 0>
inline PIByteArray & operator >>(PIByteArray & s, T & ) {
static_assert(std::is_trivially_copyable<T>::value, "[PIByteArray] Error: using undeclared operator >> for complex type!");
return s;
}
template<> inline uint piHash(const PIByteArray & ba) {return ba.hash();}
template<> inline void piSwap(PIByteArray & f, PIByteArray & s) {f.swap(s);}