Codemesh Runtime v3 C++ API Reference
3.9.205
|
The wrapper class for the builtin Java com.codemesh.peer.Value type. More...
#include <xmog_peer_value.h>
Public Types | |
enum | { XMOG_VOID = 0, XMOG_BOOLEAN = 2, XMOG_BYTE = 4, XMOG_CHAR = 8, XMOG_DOUBLE = 16, XMOG_FLOAT = 32, XMOG_INT = 64, XMOG_LONG = 128, XMOG_SHORT = 256, XMOG_OBJECT = 512, XMOG_EXCEPTION = 1 } |
The values that indicate the type of object that is encapsulated by an xmog_peer_value instance. More... | |
Public Types inherited from xmog_base | |
enum | flags { STAND_ALONE = 1, ARRAY_ELEMENT = 2, DYNAMIC = 4, DELEGATE = 8, LOCAL = 16, WEAK_GLOBAL = 32, GLOBAL = 64, REMOTE = 128, CACHING = 256, CACHE_INVALID = 512, CACHE_DIRTY = 1024, CACHE_LAZY_WRITE = 2048, OWNS_DELEGATE = 4096, STRING_DIRTY = 8192, STRING_PTR = 16384, STRING_WPTR = 32768, INDIRECT = 65536, NONVIRT = 131072, SUPPRESS_LOGGING = 262144, CATEGORY = 15, TYPE = 240, CACHE = 3840 } |
The possible flag values. More... | |
Public Member Functions | |
xmog_peer_value () | |
The default constructor. | |
xmog_peer_value (const xmog_peer_value &_rhs) | |
The copy constructor. More... | |
xmog_peer_value (jobject _ref, xmog_flags flags) | |
The constructor from an already existing Java reference. More... | |
xmog_peer_value (xmog_java_array *_array, jint index) | |
The constructor for a pere value that is an element of an array. More... | |
xmog_peer_value (bool z, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) | |
Creates a peer value instance representing a bool value. More... | |
xmog_peer_value (jboolean z, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) | |
Creates a peer value instance representing a jboolean value. More... | |
xmog_peer_value (jbyte b, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) | |
Creates a peer value instance representing a jbyte value. More... | |
xmog_peer_value (jchar ch, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) | |
Creates a peer value instance representing a jchar value. More... | |
xmog_peer_value (jdouble d, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) | |
Creates a peer value instance representing a jdouble value. More... | |
xmog_peer_value (jfloat f, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) | |
Creates a peer value instance representing a jfloat value. More... | |
xmog_peer_value (jint i, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) | |
Creates a peer value instance representing a jint value. More... | |
xmog_peer_value (jlong j, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) | |
Creates a peer value instance representing a jlong value. More... | |
xmog_peer_value (jshort s, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) | |
Creates a peer value instance representing a jshort value. More... | |
xmog_peer_value (const xmog_base &l, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) | |
Creates a peer value instance representing an object. More... | |
xmog_peer_value (const xmog_base &exc, bool bIsExc, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) | |
Creates a peer value instance representing an exception (a Throwable). More... | |
xmog_peer_value | operator= (const xmog_peer_value &_rhs) |
Duplicates the reference held by the argumnent into the receiver. More... | |
void | setz (bool z, xmog_localenv *env, xmog_flags flags) |
A utility method to set the peer value to a bool value. More... | |
void | setz (jboolean z, xmog_localenv *env, xmog_flags flags) |
A utility method to set the peer value to a jboolean value. More... | |
void | setb (jbyte b, xmog_localenv *env, xmog_flags flags) |
A utility method to set the peer value to a byte value. More... | |
void | setc (jchar c, xmog_localenv *env, xmog_flags flags) |
A utility method to set the peer value to a char value. More... | |
void | setd (jdouble d, xmog_localenv *env, xmog_flags flags) |
A utility method to set the peer value to a double value. More... | |
void | setf (jfloat f, xmog_localenv *env, xmog_flags flags) |
A utility method to set the peer value to a float value. More... | |
void | seti (jint i, xmog_localenv *env, xmog_flags flags) |
A utility method to set the peer value to an int value. More... | |
void | setj (jlong j, xmog_localenv *env, xmog_flags flags) |
A utility method to set the peer value to a long value. More... | |
void | sets (jshort s, xmog_localenv *env, xmog_flags flags) |
A utility method to set the peer value to a short value. More... | |
void | setl (const xmog_base &l, xmog_localenv *env, xmog_flags flags) |
A utility method to set the peer value to an reference type value. More... | |
void | sete (const xmog_base &e, xmog_localenv *env, xmog_flags flags) |
A utility method to set the peer value to an exception value. More... | |
void | printToString (FILE *file, xmog_localenv *env) |
A utility method for debugging. More... | |
Public Member Functions inherited from xmog_java_ref | |
xmog_java_ref () | |
The default constructor. | |
xmog_java_ref (const xmog_null &) | |
The from null constructor. More... | |
xmog_java_ref (xmog_java_array *_arr, jint _index) | |
The array element constructor. More... | |
xmog_java_ref (xmog_java_class *_clazz, xmog_java_dynamic *_dynamic, xmog_flags _flags) | |
The constructor that allows the dynamic resolution of class-related information. More... | |
XMOG_EXPLICIT | xmog_java_ref (xmog_base *_delegate, bool _owns_delegate=true) |
The constructor that allows the creation of an instance to handle all requests by delegating to another instance. More... | |
xmog_java_ref (xmog_java_ref *_ref, xmog_java_dynamic *_dynamic, xmog_flags _flags) | |
The constructor that allows the dynamic resolution of instance-related information. More... | |
xmog_java_ref (jobject _local, xmog_flags _flags) | |
The constructor that sets an existing JNI reference into a wrapper instance. More... | |
~xmog_java_ref () | |
Deletes the reference we hold to the wrapped Java instance. | |
bool | operator== (const xmog_null &) const |
Compares the instance for equality with null . | |
bool | operator== (const xmog_java_ref &) const |
Compares the instance for equality with another instance. More... | |
bool | operator!= (const xmog_null &) const |
Compares the instance for inequality with null . | |
bool | operator!= (const xmog_java_ref &) const |
Compares the instance for inequality with another instance. More... | |
bool | operator! () const |
Returns true if the instance refers to null , false otherwise. | |
jboolean | xmog_equals (const xmog_java_ref &_rhs, xmog_localenv *env=NULL) |
Returns true if both instances are null or satisfy the equality test. More... | |
jint | xmog_hashCode (xmog_localenv *env=NULL) |
Returns the Java instance's hashCode. More... | |
jobject | xmog_toString (xmog_localenv *env=NULL) |
Returns the Java instance's toString() valus as a global reference. More... | |
virtual jobject | get_jobject_ (xmog_localenv *env=NULL) const |
Returns this instance's object reference. More... | |
virtual void | xmog_monitor_enter (xmog_localenv *env=NULL) const |
Attempts to enter into a lock on the object. | |
virtual void | xmog_monitor_exit (xmog_localenv *env=NULL) const |
Leaves a lock in the object. | |
Public Member Functions inherited from xmog_base | |
xmog_base () | |
The default contructor. More... | |
xmog_base (xmog_java_array *_ref, jint _index) | |
The constructor for Java array elements. More... | |
xmog_base (xmog_java_ref *_ref, xmog_java_dynamic *_dynamic, xmog_flags _flags) | |
The constructor for indirect and user-defined types. More... | |
xmog_base (xmog_java_class *_clazz, xmog_java_dynamic *_dynamic, xmog_flags _flags) | |
The constructor for indirect and user-defined types. More... | |
XMOG_EXPLICIT | xmog_base (xmog_base *_delegate, bool _owns_delegate=true) |
The constructor for delegating objects. More... | |
xmog_base (jobject _local, xmog_flags _flags) | |
The constructor for direct types. More... | |
virtual | ~xmog_base () |
The virtual destructor. | |
virtual void | copy_jobject_ (xmog_base *_rhs, xmog_localenv *env=NULL) |
Sets this instance's object reference to a duplicate of the given object's reference. More... | |
virtual jobject | get_owning_jobject_ (xmog_localenv *env=NULL) |
Returns this instance's owner. More... | |
virtual jobject | get_released_local_jobject_ (xmog_localenv *env=NULL) const |
Returns this instance's object reference as a local reference and removes it from this instance's ownership. More... | |
virtual bool | is_null_ (xmog_localenv *env=NULL) const |
Tests the instance for null . | |
virtual bool | is_same_ (const xmog_base &_rhs, xmog_localenv *env=NULL) const |
Tests whether this instance references the same instance as the other instance. | |
virtual jobject | duplicate_jobject_ (xmog_localenv *env=NULL) const |
Returns a duplicate of this instance's object reference. More... | |
virtual void | set_jobject_ (xmog_base *_rhs, xmog_localenv *env=NULL) |
Sets this instance's object reference to the given object's reference. More... | |
virtual void | transfer_jobject_ (xmog_base *_rhs, xmog_localenv *env=NULL) |
Sets this instance's object reference to the given object's reference and removes ownership from the other object. More... | |
virtual xmog_base * | xmog_to_ (xmog_flags flags, xmog_localenv *env=NULL) |
Converts a reference from one reference type to another. More... | |
virtual xmog_base * | xmog_fill_with_standalone_for_ (xmog_base *_rhs, xmog_localenv *env=NULL) |
Populates the object with a stand-alone reference based on another object. More... | |
virtual xmog_java_class * | xmog_get_java_peer (xmog_localenv *env=NULL) |
Returns NULL if the type does not have a Java peer type, a pointer to the type's xmog_java_class otherwise. More... | |
virtual int | xmog_create_java_peer (xmog_java_class *clazz, xmog_localenv *env=NULL, xmog_flags flags=xmog_base::GLOBAL) |
Creates a Java peer instance for this type. More... | |
virtual int | xmog_to_java_peer (xmog_localenv *env=NULL) |
Sets the native instance's state into the Java peer instance. More... | |
virtual void | xmog_lazy_write (xmog_localenv *env=NULL) |
Performs a lazy write operation on the instance. More... | |
virtual void | xmog_invalidate (xmog_localenv *env=NULL) |
Invalidates any cached values in the instance. More... | |
void | release_standalone (xmog_localenv *env=NULL) |
Releases the internally maintained object if the instance is a stand-alone (direct) instance and not an indirect instance. More... | |
void | release_delegate () |
Releases the internally maintained delegate. | |
Static Public Member Functions | |
static void | startHeapMonitor (jlong collector, jint highWaterMark, jlong interval) |
Starts a heap monitor for .NET runtime environments. More... | |
static void | stopHeapMonitor () |
Stops the heap monitor for .NET runtime environments. | |
static int | register_native (xmog_java_class *clazz=NULL, xmog_localenv *env=NULL) |
A framework method that registers the native method(s) of the corresponding Java class. More... | |
static int | register_native (jclass clazz, xmog_localenv *env) |
A framework method that registers the native method(s) of the corresponding Java class. More... | |
static xmog_java_class * | get_java_class (xmog_localenv *env=NULL) |
Returns the class instance representing the peer.Value type. More... | |
static jobject | get_stack_trace (xmog_localenv *env, jlong exc, jint size) |
A method returning the stacktrace string upto a certain length. More... | |
static jobject | get_ifc_names (xmog_localenv *env, jlong inst) |
A method returning an array of classnames, representing the interfaces implemented by the given object. More... | |
static void * | get_callback (const xmog_base &obj, xmog_localenv *env=NULL) |
A method returning a pointer to a callback instance or NULL if the instance is not representing a callback. More... | |
Public Attributes | |
xmog_jboolean | z |
A field that allows access to the instance's bool value. | |
xmog_byte | b |
A field that allows access to the instance's jbyte value. | |
xmog_char | c |
A field that allows access to the instance's jchar value. | |
xmog_double | d |
A field that allows access to the instance's jdouble value. | |
xmog_float | f |
A field that allows access to the instance's jfloat value. | |
xmog_int | i |
A field that allows access to the instance's jint value. | |
xmog_long | j |
A field that allows access to the instance's jlong value. | |
xmog_short | s |
A field that allows access to the instance's jshort value. | |
xmog_java_ref | l |
A field that allows access to the instance's reference (jobject ) value. | |
xmog_int | type |
A field that allows access to the instance's type. | |
Public Attributes inherited from xmog_base | |
XMOG_JOBJECT_HOLDER | owner_ |
The owner or identity of the object. More... | |
union { | |
xmog_java_dynamic * dynamic_ | |
A pointer to an object that can access indirectly specified information. | |
jint index_ | |
The index of an array element. | |
}; | |
Data or object that provides assistance in accessing indirectly specified elements. More... | |
xmog_flags | flags_ |
The flags governing the type and other housekeeping information. | |
The wrapper class for the builtin Java com.codemesh.peer.Value type.
This class helps us pass values polymorphically between C++ and Java. Think of it as a more powerful wrapper around JNI's jvalue
type. This type adds housekeeping that allows us to pass information about the type of contained data, something that is not necessary in jvalue
because it is only used in situations where the caller knows what data to expect.
anonymous enum |
The values that indicate the type of object that is encapsulated by an xmog_peer_value instance.
This value is kept in the type field.
xmog_peer_value::xmog_peer_value | ( | const xmog_peer_value & | _rhs | ) |
The copy constructor.
_rhs | the instance from which the newly created instance is initialized. |
xmog_peer_value::xmog_peer_value | ( | jobject | _ref, |
xmog_flags | flags | ||
) |
The constructor from an already existing Java reference.
_ref | the Java object handle. |
flags | the housekeeping flags. |
xmog_peer_value::xmog_peer_value | ( | xmog_java_array * | _array, |
jint | index | ||
) |
The constructor for a pere value that is an element of an array.
_array | pointr to the owning array. |
index | index into the array. |
xmog_peer_value::xmog_peer_value | ( | bool | z, |
xmog_localenv * | env = NULL , |
||
xmog_flags | flags = xmog_base::GLOBAL |
||
) |
Creates a peer value instance representing a bool
value.
z | the instance's value. |
env | the optional local environment. Default value is NULL . |
flags | the optional housekeeping flags. Default value is xmog_base::GLOBAL . |
xmog_peer_value::xmog_peer_value | ( | jboolean | z, |
xmog_localenv * | env = NULL , |
||
xmog_flags | flags = xmog_base::GLOBAL |
||
) |
Creates a peer value instance representing a jboolean
value.
z | the instance's value. |
env | the optional local environment. Default value is NULL . |
flags | the optional housekeeping flags. Default value is xmog_base::GLOBAL . |
xmog_peer_value::xmog_peer_value | ( | jbyte | b, |
xmog_localenv * | env = NULL , |
||
xmog_flags | flags = xmog_base::GLOBAL |
||
) |
Creates a peer value instance representing a jbyte
value.
b | the instance's value. |
env | the optional local environment. Default value is NULL . |
flags | the optional housekeeping flags. Default value is xmog_base::GLOBAL . |
xmog_peer_value::xmog_peer_value | ( | jchar | ch, |
xmog_localenv * | env = NULL , |
||
xmog_flags | flags = xmog_base::GLOBAL |
||
) |
Creates a peer value instance representing a jchar
value.
ch | the instance's value. |
env | the optional local environment. Default value is NULL . |
flags | the optional housekeeping flags. Default value is xmog_base::GLOBAL . |
xmog_peer_value::xmog_peer_value | ( | jdouble | d, |
xmog_localenv * | env = NULL , |
||
xmog_flags | flags = xmog_base::GLOBAL |
||
) |
Creates a peer value instance representing a jdouble
value.
d | the instance's value. |
env | the optional local environment. Default value is NULL . |
flags | the optional housekeeping flags. Default value is xmog_base::GLOBAL . |
xmog_peer_value::xmog_peer_value | ( | jfloat | f, |
xmog_localenv * | env = NULL , |
||
xmog_flags | flags = xmog_base::GLOBAL |
||
) |
Creates a peer value instance representing a jfloat
value.
f | the instance's value. |
env | the optional local environment. Default value is NULL . |
flags | the optional housekeeping flags. Default value is xmog_base::GLOBAL . |
xmog_peer_value::xmog_peer_value | ( | jint | i, |
xmog_localenv * | env = NULL , |
||
xmog_flags | flags = xmog_base::GLOBAL |
||
) |
Creates a peer value instance representing a jint
value.
i | the instance's value. |
env | the optional local environment. Default value is NULL . |
flags | the optional housekeeping flags. Default value is xmog_base::GLOBAL . |
xmog_peer_value::xmog_peer_value | ( | jlong | j, |
xmog_localenv * | env = NULL , |
||
xmog_flags | flags = xmog_base::GLOBAL |
||
) |
Creates a peer value instance representing a jlong
value.
j | the instance's value. |
env | the optional local environment. Default value is NULL . |
flags | the optional housekeeping flags. Default value is xmog_base::GLOBAL . |
xmog_peer_value::xmog_peer_value | ( | jshort | s, |
xmog_localenv * | env = NULL , |
||
xmog_flags | flags = xmog_base::GLOBAL |
||
) |
Creates a peer value instance representing a jshort
value.
s | the instance's value. |
env | the optional local environment. Default value is NULL . |
flags | the optional housekeeping flags. Default value is xmog_base::GLOBAL . |
xmog_peer_value::xmog_peer_value | ( | const xmog_base & | l, |
xmog_localenv * | env = NULL , |
||
xmog_flags | flags = xmog_base::GLOBAL |
||
) |
Creates a peer value instance representing an object.
l | the instance's value. |
env | the optional local environment. Default value is NULL . |
flags | the optional housekeeping flags. Default value is xmog_base::GLOBAL . |
xmog_peer_value::xmog_peer_value | ( | const xmog_base & | exc, |
bool | bIsExc, | ||
xmog_localenv * | env = NULL , |
||
xmog_flags | flags = xmog_base::GLOBAL |
||
) |
Creates a peer value instance representing an exception (a Throwable).
exc | the instance's value. |
bIsExc | always true to distinguish this constructor from the object constructor. |
env | the optional local environment. Default value is NULL . |
flags | the optional housekeeping flags. Default value is xmog_base::GLOBAL . |
|
static |
A method returning a pointer to a callback instance or NULL if the instance is not representing a callback.
This method is a framework support method that is useful when you have stored a callback object in a Java data structure and retrieve it as an Object. At this point you have lost the original C++ object that really handles the callback. This method allows you to retrieve at least the pointer, if not the type. You will have to cast the retrieved pointer to the correct type.
If the Java object represented by the given proxy instance does not represent a callback object the return value is NULL
.
obj | the Java object from which we wish to extract the C++ callback pointer. |
env | the local call environment. |
|
static |
A method returning an array of classnames, representing the interfaces implemented by the given object.
This method is only used internally by by .NET bindings.
|
static |
Returns the class instance representing the peer.Value type.
env | an optional local call environment. |
|
static |
A method returning the stacktrace string upto a certain length.
This method is only used internally by by .NET bindings.
xmog_peer_value xmog_peer_value::operator= | ( | const xmog_peer_value & | _rhs | ) |
Duplicates the reference held by the argumnent into the receiver.
_rhs | the source operand. |
void xmog_peer_value::printToString | ( | FILE * | file, |
xmog_localenv * | env | ||
) |
A utility method for debugging.
file | the file to which to print the instance. |
env | the local call environment. |
|
static |
A framework method that registers the native method(s) of the corresponding Java class.
clazz | a JNI handle representing the Value type in a classloader. |
env | an optional local call environment. |
|
static |
A framework method that registers the native method(s) of the corresponding Java class.
clazz | the wrapper instance that wraps around the Java class representing the Value type. |
env | an optional local call environment. |
void xmog_peer_value::setb | ( | jbyte | b, |
xmog_localenv * | env, | ||
xmog_flags | flags | ||
) |
A utility method to set the peer value to a byte
value.
This method also sets the type
field to XMOG_BYTE.
b | the new value of the instance. |
env | an optional local environment. May be NULL . |
flags | an optional housekeeping field. |
void xmog_peer_value::setc | ( | jchar | c, |
xmog_localenv * | env, | ||
xmog_flags | flags | ||
) |
A utility method to set the peer value to a char
value.
This method also sets the type
field to XMOG_CHAR.
c | the new value of the instance. |
env | an optional local environment. May be NULL . |
flags | an optional housekeeping field. |
void xmog_peer_value::setd | ( | jdouble | d, |
xmog_localenv * | env, | ||
xmog_flags | flags | ||
) |
A utility method to set the peer value to a double
value.
This method also sets the type
field to XMOG_DOUBLE.
d | the new value of the instance. |
env | an optional local environment. May be NULL . |
flags | an optional housekeeping field. |
void xmog_peer_value::sete | ( | const xmog_base & | e, |
xmog_localenv * | env, | ||
xmog_flags | flags | ||
) |
A utility method to set the peer value to an exception value.
This method also sets the type
field to XMOG_EXCEPTION. Its only difference to the setl() method is that it reports a different type. This allows us to use instances of this type to be used as return values that can distinguish between an Exception as a regular return value and an exception that was thrown.
e | the new value of the instance. |
env | an optional local environment. May be NULL . |
flags | an optional housekeeping field. |
void xmog_peer_value::setf | ( | jfloat | f, |
xmog_localenv * | env, | ||
xmog_flags | flags | ||
) |
A utility method to set the peer value to a float
value.
This method also sets the type
field to XMOG_FLOAT.
f | the new value of the instance. |
env | an optional local environment. May be NULL . |
flags | an optional housekeeping field. |
void xmog_peer_value::seti | ( | jint | i, |
xmog_localenv * | env, | ||
xmog_flags | flags | ||
) |
A utility method to set the peer value to an int
value.
This method also sets the type
field to XMOG_INT.
i | the new value of the instance. |
env | an optional local environment. May be NULL . |
flags | an optional housekeeping field. |
void xmog_peer_value::setj | ( | jlong | j, |
xmog_localenv * | env, | ||
xmog_flags | flags | ||
) |
A utility method to set the peer value to a long
value.
This method also sets the type
field to XMOG_LONG.
j | the new value of the instance. |
env | an optional local environment. May be NULL . |
flags | an optional housekeeping field. |
void xmog_peer_value::setl | ( | const xmog_base & | l, |
xmog_localenv * | env, | ||
xmog_flags | flags | ||
) |
A utility method to set the peer value to an reference type value.
This method also sets the type
field to XMOG_OBJECT.
l | the new value of the instance. |
env | an optional local environment. May be NULL . |
flags | an optional housekeeping field. |
void xmog_peer_value::sets | ( | jshort | s, |
xmog_localenv * | env, | ||
xmog_flags | flags | ||
) |
A utility method to set the peer value to a short
value.
This method also sets the type
field to XMOG_SHORT.
s | the new value of the instance. |
env | an optional local environment. May be NULL . |
flags | an optional housekeeping field. |
void xmog_peer_value::setz | ( | bool | z, |
xmog_localenv * | env, | ||
xmog_flags | flags | ||
) |
A utility method to set the peer value to a bool
value.
This method also sets the type
field to XMOG_BOOLEAN.
z | the new value of the instance. |
env | an optional local environment. May be NULL . |
flags | an optional housekeeping field. |
void xmog_peer_value::setz | ( | jboolean | z, |
xmog_localenv * | env, | ||
xmog_flags | flags | ||
) |
A utility method to set the peer value to a jboolean
value.
This method also sets the type
field to XMOG_BOOLEAN.
z | the new value of the instance. |
env | an optional local environment. May be NULL . |
flags | an optional housekeeping field. |
|
static |
Starts a heap monitor for .NET runtime environments.
collector | a delegate to call. |
highWaterMark | the percentage of heap utilization at which the callback is invoked. |
interval | the sleep interval for hte monitor thread. |