Photon C++ Client API  5.0.7.3
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
CustomType< T, typeCode > Class Template Reference
Inheritance diagram for CustomType< T, typeCode >:
Inheritance graph
[legend]
Collaboration diagram for CustomType< T, typeCode >:
Collaboration graph
[legend]

Public Member Functions

virtual nByte getTypeCode (void) const
 
- Public Member Functions inherited from CustomTypeBase
virtual bool compare (const CustomTypeBase &other) const =0
 
virtual void duplicate (CustomTypeBase *pRetVal) const =0
 
virtual void deserialize (const nByte *pData, short length)=0
 
virtual short serialize (nByte *pRetVal) const =0
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const=0
 
JString toString (bool withTypes=false) const
 
- Public Member Functions inherited from Base
virtual ~Base (void)=0
 
- Public Member Functions inherited from LoggingBase< Base >
virtual ~LoggingBase (void)=0
 
- Public Member Functions inherited from ToString
virtual ~ToString (void)
 
virtual JString typeToString (void) const
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const =0
 
JString toString (bool withTypes=false) const
 

Static Public Member Functions

static void registerType (void)
 
static void unregisterType (void)
 
- Static Public Member Functions inherited from LoggingBase< Base >
static void setListener (const BaseListener *pBaseListener)
 
static int getDebugOutputLevel (void)
 
static bool setDebugOutputLevel (int debugLevel)
 
static const LogFormatOptionsgetLogFormatOptions (void)
 
static void setLogFormatOptions (const LogFormatOptions &options)
 

Static Public Attributes

static const nByte TypeCode
 

Detailed Description

template<typename T, nByte typeCode>
class ExitGames::Common::CustomType< T, typeCode >

The CustomType class provides you with an interface, to add support for additional data-types.

We only support a certain subset of Datatypes out of the box. If you need support for further datatypes, then you can easily add this support yourself by subclassing this class template and providing suitable implementations for the pure virtual functions, which are inherited from CustomTypeBase, in your subclass. You should only subclass every typecode once. typeCode 0 should be considered as reserved. So your first custom type would inherit from CustomType<1>, the second one from CustomType<2> and so on. Subclassing the same typecode multiple times will lead into undefined behavior as the typecode will determine the class as instance of which serialized data should be interpreted.

Remarks
When you are subclassing a specialization of CustomType, then you will also have to subclass the according specialization of CustomTypeFactory (the one for the same typecode).
See also
CustomTypeBase, CustomTypeFactory

Member Function Documentation

◆ registerType()

void registerType ( void  )
static

This static function registers the custom type and has to be called once on each concrete subclass, before any instance of that concrete subclass gets created.

See also
unregisterType()

◆ unregisterType()

void unregisterType ( void  )
static

This static function unregisters a custom type and has to be called once for each concrete subclass after the last instance of that subclass has been deallocated.

See also
registerType()

Member Data Documentation

◆ TypeCode

TypeCode
static

Check this public constant to find out the typecode of a custom type at runtime. This should normally not be of any interest.