/*
PIP - Platform Independent Primitives
Introspection module - implementation of containers
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 .
*/
#ifndef PIINTROSPECTION_CONTAINERS_P_H
#define PIINTROSPECTION_CONTAINERS_P_H
#include "pimutex.h"
#include
#include
#include "picrc.h"
class PIP_EXPORT PIIntrospectionContainers {
public:
PIIntrospectionContainers();
void containerNew (const char * tn);
void containerDelete(const char * tn);
void containerAlloc (const char * tn, ullong cnt);
void containerFree (const char * tn, ullong cnt);
void containerUsed (const char * tn, ullong cnt);
void containerUnused(const char * tn, ullong cnt);
uint typeID(const char * tn);
struct Type {
Type();
uint count;
uint items;
ullong bytes_allocated;
ullong bytes_used;
};
std::unordered_map data;
std::unordered_map typenames;
PIMutex mutex;
CRC_32 crc;
};
PIByteArray & operator <<(PIByteArray & s, const std::unordered_map & v);
PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::Type & v);
PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::Type & v);
#endif // PIINTROSPECTION_CONTAINERS_P_H