Photon C++ Client API  5.0.7.3
Namespaces | Macros | Functions
Allocate.h File Reference

Namespaces

 ExitGames
 
 ExitGames::Common
 
 ExitGames::Common::MemoryManagement
 

Macros

#define EG_SIZE_T
 

Functions

void * EG_MALLOC (size_t size)
 
void EG_FREE (void *p)
 
void * EG_REALLOC (void *p, size_t size)
 
void * EG_CALLOC (size_t num, size_t size)
 

HighLevelMemoryManagement

The template functions in this section are an alternative for the C++ dynamic memory management operators new, new[], delete and delete[].

They are implemented in terms of enhancing the Low Level Memory Management macros and for this reason offer similar advantages over new and co like those macros offer over malloc and co.

However same as new and co they also construct and destruct the objects that they allocate and deallocate.

#define ALLOCATE(type, p, ...)
 
#define ALLOCATE_ARRAY(type, p, count, ...)
 
#define REALLOCATE_ARRAY(type, p, count, ...)
 
#define DEALLOCATE(type, p)
 
#define DEALLOCATE_ARRAY(type, p)
 
void setMaxAllocSize (size_t maxAllocSize)
 
void setMaxSizeForAllocatorUsage (size_t maxSizeForAllocatorUsage)
 
void setAllocator (ExitGames::Common::MemoryManagement::AllocatorInterface &allocator)
 
void setAllocatorToDefault (void)
 
template<typename Ftype >
EG_PRAGMA_VISIBILITY_PUSH_HIDDEN Ftype * allocate (void)
 
template<typename Ftype >
Ftype * allocateArray (size_t count)
 
template<typename Ftype >
Ftype * reallocateArray (Ftype *p, size_t count)
 
template<typename Ftype >
void deallocate (const Ftype *p)
 
template<typename Ftype >
void deallocateArray (const Ftype *p)
 

Macro Definition Documentation

◆ ALLOCATE

#define ALLOCATE (   type,
  p,
  ... 
)

This is the macro version of the allocate() template function.

Normally the template version should be preferred, but using the macro instead can be necessary, if you want to pass more than 5 parameters to the constructor or if you want to call a private or protected constructor to which your class has (friend-/subclass-)access.

Parameters
typethe data type of the instance to create
pa pointer, in which the macro will store the address of the freshly created instance
...optional arguments to pass to the constructor

◆ ALLOCATE_ARRAY

#define ALLOCATE_ARRAY (   type,
  p,
  count,
  ... 
)

This is the macro version of the allocateArray() template function.

Normally the template version should be preferred, but using the macro instead can be necessary, if you want to pass more than 5 parameters to the constructor or if you want to call a private or protected constructor to which your class has (friend-/subclass-)access.

Parameters
typethe data type of the instance to create
pa pointer, in which the macro will store the address of the freshly created instance
countthe number of the elements to create
...optional arguments to pass to the constructor

◆ REALLOCATE_ARRAY

#define REALLOCATE_ARRAY (   type,
  p,
  count,
  ... 
)

This is the macro version of the reallocateArray() template function.

Normally the template version should be preferred, but using the macro instead can be necessary, if you want to pass more than 5 parameters to the constructor or if you want to call a private or protected constructor or destructor to which your class has (friend-/subclass-)access.

Note
This macro does not support primitive types, but only classes and structs. Use the reallocateArray() template function instead of this macro for reallocating arrays of primitve types.
Parameters
typethe data type of the instance to create
pa pointer, in which the macro will store the address of the freshly created instance
countthe number of the elements to create
...optional arguments to pass to the constructor

◆ DEALLOCATE

#define DEALLOCATE (   type,
 
)

This is the macro version of the deallocate() template function.

Normally the template version should be preferred, but using the macro instead can make sense for consistency reasons when the macro version has been used for allocation or it might be necessary if you want to call a private or protected destructor to which your class has (friend-/subclass-)access.

Note
This macro does not support primitive types, but only classes and structs. Use the deallocate() template function instead of this macro for deallocating primitve types.
Parameters
typethe data type of the instance, to which p points
pa pointer to the instance to destroy

◆ DEALLOCATE_ARRAY

#define DEALLOCATE_ARRAY (   type,
 
)

This is the macro version of the deallocateArray() template function.

Normally the template version should be preferred, but using the macro instead can make sense for consistency reasons when the macro version has been used for allocation or it might be necessary if you want to call a private or protected destructor to which your class has (friend-/subclass-)access.

Note
This macro does not support primitive types, but only classes and structs. Use the deallocateArray() template function instead of this macro for deallocating arrays of primitve types.
Parameters
typethe data type of the instance, to which p points
pa pointer to the instance to destroy