Files
pip/libs/main/introspection/piintrospection_containers.h
2022-02-11 12:00:34 +03:00

80 lines
2.9 KiB
C++

/*
PIP - Platform Independent Primitives
Introspection module - interface for containers
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_H
#define PIINTROSPECTION_CONTAINERS_H
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
#include "piintrospection_base.h"
class PIIntrospectionContainers;
#define PIINTROSPECTION_CONTAINERS (PIIntrospectionContainersInterface::instance())//(PIIntrospectionContainersInterface::instance())
#ifdef CC_GCC
# include <typeinfo>
# define _PIIS_TYPENAME_(t) typeid(t).name()
#else
# define _PIIS_TYPENAME_(t) ""
#endif
# define PIINTROSPECTION_CONTAINER_NEW(t, isz) PIINTROSPECTION_CONTAINERS->containerNew (_PIIS_TYPENAME_(t), isz);
# define PIINTROSPECTION_CONTAINER_DELETE(t) PIINTROSPECTION_CONTAINERS->containerDelete(_PIIS_TYPENAME_(t));
# define PIINTROSPECTION_CONTAINER_ALLOC(t, cnt) PIINTROSPECTION_CONTAINERS->containerAlloc (_PIIS_TYPENAME_(t), cnt);
# define PIINTROSPECTION_CONTAINER_FREE(t, cnt) PIINTROSPECTION_CONTAINERS->containerFree (_PIIS_TYPENAME_(t), cnt);
# define PIINTROSPECTION_CONTAINER_USED(t, cnt) PIINTROSPECTION_CONTAINERS->containerUsed (_PIIS_TYPENAME_(t), cnt);
# define PIINTROSPECTION_CONTAINER_UNUSED(t, cnt) PIINTROSPECTION_CONTAINERS->containerUnused(_PIIS_TYPENAME_(t), cnt);
class PIP_EXPORT PIIntrospectionContainersInterface {
friend class PIIntrospection;
friend class PIIntrospectionServer;
public:
__PIINTROSPECTION_SINGLETON_H__(Containers)
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);
PIIntrospectionContainers * p;
private:
PIIntrospectionContainersInterface();
~PIIntrospectionContainersInterface();
};
#else
# define PIINTROSPECTION_CONTAINER_NEW(t, isz)
# define PIINTROSPECTION_CONTAINER_DELETE(t)
# define PIINTROSPECTION_CONTAINER_ALLOC(t, cnt)
# define PIINTROSPECTION_CONTAINER_FREE(t, cnt)
# define PIINTROSPECTION_CONTAINER_USED(t, cnt)
# define PIINTROSPECTION_CONTAINER_UNUSED(t, cnt)
#endif
#endif // PIINTROSPECTION_CONTAINERS_H