template<nByte typeCode>
class ExitGames::Common::CustomTypeFactory< typeCode >
This is the factory interface class template for the CustomType interface class template and offers an interface to create, copy and delete instances of CustomType subclasses, without the caller needing to know the names of the subclasses.
For every specialization of the CustomType template, that you subclass, you have to subclass the according specialization (meaning the one for the same typecode) of this class. Please refer to class SampleCustomTypeFactory in demo_typeSupport for an example implementation.
- Remarks
- You normally won't have to call functions from this class yourself, but the library does this for you.
- See also
- CustomType, CustomTypeBase
§ ~CustomTypeFactory()
§ copyFactory()
copyFactory |
( |
void |
| ) |
const |
|
pure virtual |
This function shall return a pointer to a freshly allocated copy of the instance, on which it has been called.
- Returns
- a pointer to a copy of the instance
§ destroyFactory()
This function shall deallocate the instance, on which it has been called on.
§ create()
create |
( |
short |
amount | ) |
const |
|
pure virtual |
This function shall allocate an array of the class, for which the template parameter specialization has been registered.
- Parameters
-
amount | the amount of elements to allocate |
- Returns
- a pointer to the created array of CustomTypes
§ copy()
copy |
( |
const CustomType< typeCode > * |
pToCopy, |
|
|
short |
amount |
|
) |
| const |
|
pure virtual |
This function shall return a pointer to a freshly allocated copy of the passed array.
- Parameters
-
pToCopy | a pointer to the original array, which should be copied |
amount | the amount of elements of the array, pointed to by pToCopy |
- Returns
- the created copy of the array
§ destroy()
destroy |
( |
const CustomType< typeCode > * |
pToDestroy | ) |
const |
|
pure virtual |
This function shall deallocate the array, to which the passed pointer points.
- Parameters
-
pToDestroy | a pointer to an array, which has previously been allocated with create() or copy() |
§ sizeOf()
- Returns
- the size of a single �nstance as determined by calling the sizeof()-operator, for the class, which is fabricated by this specialization of the factory
§ toString()
- Remarks
- The cost of this function depends a lot on implementation details of the implementing subclasses, but for container classes this function can become quite expensive, if the instance contains huge amounts of data, as its cost for many container class implementations increases disproportionately high to the size of the payload.
- Parameters
-
retStr | reference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string |
withTypes | set to true, to include type information in the generated string |
- Returns
- a JString representation of the instance and its contents for debugging purposes.
Implements ToString.