Files
pip/src_main/introspection/piintrospection_containers_p.h

70 lines
1.9 KiB
C++

/*
PIP - Platform Independent Primitives
Introspection module - implementation of containers
Copyright (C) 2020 Ivan Pelipenko peri4ko@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIINTROSPECTION_CONTAINERS_P_H
#define PIINTROSPECTION_CONTAINERS_P_H
#include "pimutex.h"
#include <map>
#include <string>
#include "picrc.h"
class PIP_EXPORT PIIntrospectionContainers {
public:
PIIntrospectionContainers();
struct TypeInfo;
void containerNew (const char * tn, uint isz);
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);
PIVector<TypeInfo> getInfo() const;
#pragma pack(push, 1)
struct _Type {
_Type();
uint id;
uint count;
uint item_size;
ullong allocated;
ullong used;
};
#pragma pack(pop)
struct TypeInfo: _Type {
PIString name;
};
std::map<uint, _Type> data;
std::map<uint, std::string> typenames;
mutable PIMutex mutex;
};
PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::TypeInfo & v);
PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::TypeInfo & v);
#endif // PIINTROSPECTION_CONTAINERS_P_H