Oracle Coherence for C++ API
Release 3.6.0.0

E15728-01

Class Class Reference

#include <coherence/lang/Class.hpp>

Inherits Object.

Inherited by TypedBarrenClass, and TypedClass.

List of all members.


Detailed Description

A Class represents a managed object implementation.

Not all managed classes may have a corresponding Class representation. Classes are referred to via their demangled RTTI name, for example coherence::lang::Object.

Classes can be loaded by name via a ClassLoader.

See also:
ClassLoader
Author:
mf 2008.04.03

Public Types

typedef spec::Handle  Handle
  Class Handle definition.
typedef spec::View  View
  Class View definition.
typedef spec::Holder  Holder
  Class Holder definition.

Public Member Functions

String::View  getName () const
  Return the name of the class.
virtual Object::Handle  newInstance (ObjectArray::View vaParam=NULL) const =0
  Create a new instance of the corresponding type.
virtual const
std::type_info & 
getTypeInfo () const =0
  Return the typeinfo for the corresponding type.
virtual size32_t  getSize () const =0
  Return the shallow size for an instance of the class represented by this Class.
virtual bool  equals (Object::View that) const
  Return true iff the specified Object is "equal" to this Object.

This method implements an equivalence relation on Objects:

  • It is reflexive: for any non-null handle h, h->equals(h) must return true.
  • It is symmetric: for any non-null handles h1 and h2, h1->equals(h2) should return true if and only if h2->equals(h1) returns true.
  • It is transitive: for any non-null handles h1, h2, and h3, if h1->equals(h2) returns true and h2->equals(h3) returns true, then h1->equals(h3) should return true.
  • It is consistent: for any non-null handles h1 and h2, multiple invocations of h1->equals(h2) consistently return true or consistently return false, provided no information used in comparisons on the objects is modified.
  • If the supplied handle is NULL then false must be returned.

The default implementation is a reference equality comparison.

Parameters:
v  the Object::View to compare against, may be NULL
Returns:
true iff the given handle references an Object that is "equal" to this Object
See also:
equals(Object::View v1, Object::View v2)

virtual size32_t  hashCode () const
  Return a hash code value for the Object.

This method is supported for the benefit of hash-based containers.

The general contract of hashCode is:

  • Whenever it is invoked on the same Object more than once during an execution of an application, the hashCode method must consistently return the same value, provided no information used in equals comparisons on the object is modified. This value need not remain consistent from one execution of an application to another execution of the same application.
  • If two Objects are equal according to the equals method, then calling the hashCode method on each of the two Objects must produce the same value.
  • It is not required that if two Objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct results. However, the programmer should be aware that producing distinct results for unequal objects may improve the performance of hash-based containers.

The default implementation is identity based.

Returns:
a hash code value for this Object


Static Public Member Functions

static String::View  getClassName (Object::View v)
  Return the class name of the supplied Object.
static String::View  getTypeName (const std::type_info &info)
  Return the type name of the supplied Object.

Protected Member Functions

  Class (const std::type_info &info)
  Construct a class based on a C++ type_info.

Constructor & Destructor Documentation

Class ( const std::type_info &  info  )  [protected]

Construct a class based on a C++ type_info.

Parameters:
info  the type_info for the class represented by this Class.

Member Function Documentation

String::View getName (  )  const

Return the name of the class.

Returns:
the class name

virtual Object::Handle newInstance ( ObjectArray::View  vaParam = NULL  )  const [pure virtual]

Create a new instance of the corresponding type.

Parameters:
vaParam  the object's initialization parameters
Returns:
a new instance of the corresponding type

Implemented in TypedBarrenClass, and TypedClass.

virtual const std::type_info& getTypeInfo (  )  const [pure virtual]

Return the typeinfo for the corresponding type.

Returns:
the typeinfo for the corresponding type

Implemented in TypedBarrenClass, and TypedClass.

virtual size32_t getSize (  )  const [pure virtual]

Return the shallow size for an instance of the class represented by this Class.

Returns:
the shallow size of an instance of the represented class.

Implemented in TypedBarrenClass, and TypedClass.

static String::View getClassName ( Object::View  v  )  [static]

Return the class name of the supplied Object.

Parameters:
v  the object instance for which to obtain the class name
Returns:
the class name of the supplied Object

static String::View getTypeName ( const std::type_info &  info  )  [static]

Return the type name of the supplied Object.

Parameters:
info  the type id for which to obtain the type name
Returns:
the type name of the supplied type

The documentation for this class was generated from the following file:
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.