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

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 int * getSizes (void) const
 
unsigned int getDimensions (void) const
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const
 
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
 
JString toString (bool withTypes=false) const
 

Additional Inherited Members

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

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.

Remarks
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  )
virtual

Destructor.

◆ Object() [2/2]

Object ( const Object toCopy)

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

Parameters
toCopyThe object to copy.

Member Function Documentation

◆ operator=()

Object & operator= ( const Object toCopy)
virtual

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

operator==.

Returns
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 array with an element count of 1)

◆ operator!=()

bool operator!= ( const Object toCompare) const

operator!=.

Returns
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 namespace TypeCode for a complete list.

Returns
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 TypeCode::CUSTOM. If getType() returns something else than TypeCode::CUSTOM, then the custom type is not in use for that object instance and this will return 0.

Returns
the custom type of a object.

◆ getSizes()

const int * 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.

Returns
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.

Returns
the amount of dimensions for the data.

◆ toString() [1/3]

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.

◆ toString() [2/3]

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
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.

◆ toString() [3/3]

JString toString

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.
See also
JString