git-svn-id: svn://db.shs.com.ru/pip@803 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user