Photon C++ Client API: CustomTypeFactory< typeCode > Class Template Reference

Photon C++ Client API

Photon C++ Client API  4.1.12.2
CustomTypeFactory< typeCode > Class Template Referenceabstract
Inheritance diagram for CustomTypeFactory< typeCode >:
Collaboration diagram for CustomTypeFactory< typeCode >:

Public Member Functions

virtual ~CustomTypeFactory (void)
 
virtual CustomTypeFactory< typeCode > * copyFactory (void) const =0
 
virtual void destroyFactory (void)=0
 
virtual CustomType< typeCode > * create (short amount) const =0
 
virtual CustomType< typeCode > * copy (const CustomType< typeCode > *pToCopy, short amount) const =0
 
virtual void destroy (const CustomType< typeCode > *pToDestroy) const =0
 
virtual unsigned int sizeOf (void) const =0
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const
 
- Public Member Functions inherited from Base
virtual ~Base (void)
 
- Public Member Functions inherited from ToString
virtual ~ToString (void)
 
virtual JString typeToString (void) const
 
JString toString (bool withTypes=false) const
 

Additional Inherited Members

- Static Public Member Functions inherited from Base
static void setListener (const BaseListener *baseListener)
 
static int getDebugOutputLevel (void)
 
static bool setDebugOutputLevel (int debugLevel)
 
static const LogFormatOptionsgetLogFormatOptions (void)
 
static void setLogFormatOptions (const LogFormatOptions &options)
 

Detailed Description

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

Constructor & Destructor Documentation

§ ~CustomTypeFactory()

~CustomTypeFactory ( void  )
virtual

Destructor.

Member Function Documentation

§ 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()

destroyFactory ( void  )
pure virtual

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
amountthe 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
pToCopya pointer to the original array, which should be copied
amountthe 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
pToDestroya pointer to an array, which has previously been allocated with create() or copy()

§ sizeOf()

sizeOf ( void  ) const
pure virtual
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()

JString & toString ( JString retStr,
bool  withTypes = false 
) const
virtual
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
retStrreference 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
withTypesset 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.