Photon C++ Client API
Classes | Public Member Functions | List of all members
Object Class Reference
Inheritance diagram for Object:
Inheritance graph
Collaboration diagram for Object:
Collaboration graph

Public Member Functions

 Object (void)
virtual ~Object (void)
 Object (const Object &toCopy)
virtual Objectoperator= (const Object &toCopy)
bool operator== (const Object &toCompare) const
bool operator!= (const Object &toCompare) const
nByte getType (void) const
nByte getCustomType (void) const
const short * getSizes (void) const
unsigned int getDimensions (void) const
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

Container class designed to hold all types of objects that are supported by the library.

Object is the common base for the template classes KeyObject and ValueObject, that provide a more convenient interface for handling Objects.

We do recommend to use KeyObject and ValueObject instead whenever possible, as they provide a more type-safe and more convenient interface for dealing with Objects. However in situations where an array or a container class holding multiple Objects of different types is absolutely needed, using the Object interface can be the only option.
See also
KeyObject, ValueObject

Constructor & Destructor Documentation

§ Object() [1/2]

Object ( void  )

Constructor: Creates an empty Object. You have to set the content with operator= before you can use the object.

§ ~Object()

~Object ( void  )


§ Object() [2/2]

Object ( const Object toCopy)

Copy-Constructor: Creates an Object containing a deep copy of the argument passed.

toCopyThe object to copy.

Member Function Documentation

§ operator=()

Object & operator= ( const Object toCopy)

operator= : Makes a deep copy of its right operand into its left operand. This overwrites old data in the left operand.

Reimplemented in ValueObject< Etype >, and KeyObject< Etype >.

§ operator==()

bool operator== ( const Object toCompare) const


true, if both operands are equal, false otherwise.

Two instances are considered equal, if all of the following is true:

  • their types as returned by getType() match
  • their payloads' dimension-counts as returned by getDimensions() match
  • their custom types as returned by getCustomType() match
  • their payload sizes as returned by getSizes() match on every dimension
  • every element in every dimension of an instance's payload equals the according element in the other instance's payload (non-array payloads are handled as the first element in a 1D arrays with an element count of 1)

§ operator!=()

bool operator!= ( const Object toCompare) const


false, if operator==() would return true, true otherwise.

§ getType()

nByte getType ( void  ) const

Returns the type of the object.

The return value should be one of the constants representing the serialize-able data types supported by Neutron/Photon. Please refer to EG_Object for a complete list.

the type of the object.

§ getCustomType()

nByte getCustomType ( void  ) const

Returns the type of the object.

This will return the custom type, if getType() returns EG_CUSTOM. If getType() returns something else than EG_CUSTOM, then the custom type is not in use for that object instance and this will return 0.

the custom type of a object.

§ getSizes()

const short * getSizes ( void  ) const

Returns an array holding the amounts of elements of the instance's payload for each dimension of the payload. The amount of elements in the returned array of sizes will equal the return value of getDimensions(), but it will always be at least 1, even when getDimensions() returns 0. So, if the payload of the instance is not an array, then this function will return an array with 1 element, if the payload is a 1D array, then it will return an array with 1 element, for a 2D array payload it will return an array with 2 elements, for a 3D array payload an array with 3 elements and so on.

the sizes of all dimensions of the array contained in the Object.

§ getDimensions()

unsigned int getDimensions ( void  ) const

Returns the amount of dimensions for objects holding multi-dimensional array data, 1 for single-dimensional arrays and 0 for non-array data.

the amount of dimensions for the data.

§ toString()

JString & toString ( JString retStr,
bool  withTypes = false 
) const
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.
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
a JString representation of the instance and its contents for debugging purposes.

Implements ToString.