Codemesh Runtime v3 C++ API Reference  3.9.205
Static Public Member Functions | List of all members
xmog_peer Class Reference

A utility class that provides access to the Java interface com.codemesh.peer.PeerType. More...

#include <xmog_peer.h>

Inheritance diagram for xmog_peer:
Inheritance graph
[legend]

Static Public Member Functions

static int create (xmog_base *peer, const char *classNameUtf, xmog_localenv *env=NULL, xmog_flags=xmog_base::LOCAL)
 Creates a new instance of a Java type that is supposedly implementing the com.codemesh.peer.PeerType interface. More...
 
static int set_typeInfo (xmog_base *peer, const char *typeInfoUtf, xmog_localenv *env=NULL)
 Sets the typeinfo for the C++ instance that is storing data into this instance. More...
 
static int set_typeInfo (xmog_base *peer, const wchar_t *typeInfo, xmog_localenv *env=NULL)
 Sets the typeinfo for the C++ instance that is storing data into this instance. More...
 
static int set_typeInfo (xmog_base *peer, xmog_base *typeInfo, xmog_localenv *env=NULL)
 Sets the typeinfo for the C++ instance that is storing data into this instance. More...
 
static int get_typeInfo (xmog_base *peer, char *result, jint size, jint &required, xmog_localenv *env=NULL)
 Gets the typeinfo from the peer instance. More...
 
static int set_binaryData (xmog_base *peer, jbyte *pBytes, size_t len, xmog_localenv *env=NULL)
 Sets binary data into the instance. More...
 
static int get_binaryData (xmog_base *peer, jbyte **ppBytes, size_t *len, xmog_localenv *env=NULL)
 Retrieves binary data from the instance. More...
 
static int set_byte (xmog_base *peer, const char *fieldNameUtf, jbyte b, xmog_localenv *env=NULL)
 Sets a byte field into the instance. More...
 
static int get_byte (xmog_base *peer, const char *fieldNameUtf, jbyte *b, xmog_localenv *env=NULL)
 Reads a byte field from the instance. More...
 
static int set_bool (xmog_base *peer, const char *fieldNameUtf, bool b, xmog_localenv *env=NULL)
 Sets a bool field into the instance. More...
 
static int get_bool (xmog_base *peer, const char *fieldNameUtf, bool *b, xmog_localenv *env=NULL)
 Reads a bool field from the instance. More...
 
static int set_boolean (xmog_base *peer, const char *fieldNameUtf, jboolean b, xmog_localenv *env=NULL)
 Sets a boolean field into the instance. More...
 
static int get_boolean (xmog_base *peer, const char *fieldNameUtf, jboolean *b, xmog_localenv *env=NULL)
 Reads a jboolean field from the instance. More...
 
static int set_char (xmog_base *peer, const char *fieldNameUtf, jchar c, xmog_localenv *env=NULL)
 Sets a char field into the instance. More...
 
static int get_char (xmog_base *peer, const char *fieldNameUtf, jchar *ch, xmog_localenv *env=NULL)
 Reads a char field from the instance. More...
 
static int set_double (xmog_base *peer, const char *fieldNameUtf, jdouble d, xmog_localenv *env=NULL)
 Sets a double field into the instance. More...
 
static int get_double (xmog_base *peer, const char *fieldNameUtf, jdouble *d, xmog_localenv *env=NULL)
 Reads a double field from the instance. More...
 
static int set_float (xmog_base *peer, const char *fieldNameUtf, jfloat f, xmog_localenv *env=NULL)
 Sets a float field into the instance. More...
 
static int get_float (xmog_base *peer, const char *fieldNameUtf, jfloat *f, xmog_localenv *env=NULL)
 Reads a float field from the instance. More...
 
static int set_int (xmog_base *peer, const char *fieldNameUtf, jint i, xmog_localenv *env=NULL)
 Sets a int field into the instance. More...
 
static int get_int (xmog_base *peer, const char *fieldNameUtf, jint *i, xmog_localenv *env=NULL)
 Reads an int field from the instance. More...
 
static int set_long (xmog_base *peer, const char *fieldNameUtf, jlong l, xmog_localenv *env=NULL)
 Sets a long field into the instance. More...
 
static int get_long (xmog_base *peer, const char *fieldNameUtf, jlong *l, xmog_localenv *env=NULL)
 Reads a long field from the instance. More...
 
static int set_short (xmog_base *peer, const char *fieldNameUtf, jshort s, xmog_localenv *env=NULL)
 Sets a short field into the instance. More...
 
static int get_short (xmog_base *peer, const char *fieldNameUtf, jshort *s, xmog_localenv *env=NULL)
 Reads a short field from the instance. More...
 
static int set_Object (xmog_base *peer, const char *fieldNameUtf, jobject o, xmog_localenv *env=NULL)
 Sets an Object field into the instance. More...
 
static int get_Object (xmog_base *peer, const char *fieldNameUtf, jobject *o, xmog_localenv *env=NULL)
 Reads an Object field from the instance. More...
 
static int set_Object (xmog_base *peer, const char *fieldNameUtf, const char *str, xmog_localenv *env=NULL)
 Sets a String field into the instance. More...
 
static int get_String (xmog_base *peer, const char *fieldNameUtf, const char **str, size_t *len, xmog_localenv *env=NULL)
 Reads a String field from the instance. More...
 
static int get_StringUtf8 (xmog_base *peer, const char *fieldNameUtf, const char **strUtf8, size_t *len, xmog_localenv *env=NULL)
 Reads a String field from the instance. More...
 
static int set_Object (xmog_base *peer, const char *fieldNameUtf, const wchar_t *str, xmog_localenv *env=NULL)
 Sets a String field into the instance. More...
 
static char * to_string (xmog_base *peer, xmog_localenv *env=NULL)
 Returns a string containing the instance's state in text representation. More...
 
static xmog_java_classget_class ()
 Returns a pointer to the xmog_java_class that represents the com.codemesh.peer.PeerType interface. More...
 
static xmog_java_classget_class (const char *classNameUtf, xmog_localenv *env=NULL)
 Returns a pointer to the class of the given name. More...
 
static int register_unmarshaller (const char *javaClassNameUtf, const char *cppClassIdentifier, XMOG_PEER_UNMARSHAL_METHOD pUnmarshal)
 Registers a peer unmarshaller for the tuple of <Java peer classname, C++ class identifier>. More...
 

Detailed Description

A utility class that provides access to the Java interface com.codemesh.peer.PeerType.

This type is useful to access arbitrary custom peer types if they implement the com.codemesh.peer.PeerType interface.

Member Function Documentation

◆ create()

static int xmog_peer::create ( xmog_base peer,
const char *  classNameUtf,
xmog_localenv env = NULL,
xmog_flags  = xmog_base::LOCAL 
)
static

Creates a new instance of a Java type that is supposedly implementing the com.codemesh.peer.PeerType interface.

Parameters
peerthe instance into which the peer instance is created.
classNameUtfthe classname in UTF-8 format.
envthe local call environment. May be NULL.

◆ get_binaryData()

static int xmog_peer::get_binaryData ( xmog_base peer,
jbyte **  ppBytes,
size_t *  len,
xmog_localenv env = NULL 
)
static

Retrieves binary data from the instance.

Parameters
peerthe peer instance.
ppBytesa pointer to the buffer that holds the retrieved bytes.
lenpointer the variable that holds the number of bytes.
envthe local call environment. May be NULL.

◆ get_bool()

static int xmog_peer::get_bool ( xmog_base peer,
const char *  fieldNameUtf,
bool *  b,
xmog_localenv env = NULL 
)
static

Reads a bool field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
ba pointer to the field value
envthe local call environment. May be NULL.

◆ get_boolean()

static int xmog_peer::get_boolean ( xmog_base peer,
const char *  fieldNameUtf,
jboolean *  b,
xmog_localenv env = NULL 
)
static

Reads a jboolean field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
ba pointer to the field value
envthe local call environment. May be NULL.

◆ get_byte()

static int xmog_peer::get_byte ( xmog_base peer,
const char *  fieldNameUtf,
jbyte *  b,
xmog_localenv env = NULL 
)
static

Reads a byte field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
ba pointer to the field value
envthe local call environment. May be NULL.

◆ get_char()

static int xmog_peer::get_char ( xmog_base peer,
const char *  fieldNameUtf,
jchar *  ch,
xmog_localenv env = NULL 
)
static

Reads a char field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
cha pointer to the field value
envthe local call environment. May be NULL.

◆ get_class() [1/2]

static xmog_java_class* xmog_peer::get_class ( )
static

Returns a pointer to the xmog_java_class that represents the com.codemesh.peer.PeerType interface.

The owner should not delete the returned instance; it is owned by the xmog_peer type.

◆ get_class() [2/2]

static xmog_java_class* xmog_peer::get_class ( const char *  classNameUtf,
xmog_localenv env = NULL 
)
static

Returns a pointer to the class of the given name.

The owner is responsible for deleting the returned instance.

Parameters
classNameUtfthe name of the peer type we wish to use.
envthe local call environment. May be NULL.

◆ get_double()

static int xmog_peer::get_double ( xmog_base peer,
const char *  fieldNameUtf,
jdouble *  d,
xmog_localenv env = NULL 
)
static

Reads a double field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
da pointer to the field value
envthe local call environment. May be NULL.

◆ get_float()

static int xmog_peer::get_float ( xmog_base peer,
const char *  fieldNameUtf,
jfloat *  f,
xmog_localenv env = NULL 
)
static

Reads a float field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
fa pointer to the field value
envthe local call environment. May be NULL.

◆ get_int()

static int xmog_peer::get_int ( xmog_base peer,
const char *  fieldNameUtf,
jint *  i,
xmog_localenv env = NULL 
)
static

Reads an int field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
ia pointer to the field value
envthe local call environment. May be NULL.

◆ get_long()

static int xmog_peer::get_long ( xmog_base peer,
const char *  fieldNameUtf,
jlong *  l,
xmog_localenv env = NULL 
)
static

Reads a long field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
la pointer to the field value
envthe local call environment. May be NULL.

◆ get_Object()

static int xmog_peer::get_Object ( xmog_base peer,
const char *  fieldNameUtf,
jobject *  o,
xmog_localenv env = NULL 
)
static

Reads an Object field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
oa pointer to the field value
envthe local call environment. May be NULL.

◆ get_short()

static int xmog_peer::get_short ( xmog_base peer,
const char *  fieldNameUtf,
jshort *  s,
xmog_localenv env = NULL 
)
static

Reads a short field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
sa pointer to the field value
envthe local call environment. May be NULL.

◆ get_String()

static int xmog_peer::get_String ( xmog_base peer,
const char *  fieldNameUtf,
const char **  str,
size_t *  len,
xmog_localenv env = NULL 
)
static

Reads a String field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
stra pointer to variable that will receive the string in the current default encoding.
lena pointer to the variable that will receive the bytecount.
envthe local call environment. May be NULL.

◆ get_StringUtf8()

static int xmog_peer::get_StringUtf8 ( xmog_base peer,
const char *  fieldNameUtf,
const char **  strUtf8,
size_t *  len,
xmog_localenv env = NULL 
)
static

Reads a String field from the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
strUtf8a pointer to variable that will receive the UTF-8 string.
lena pointer to the variable that will receive the UTF-8 bytecount.
envthe local call environment. May be NULL.

◆ get_typeInfo()

static int xmog_peer::get_typeInfo ( xmog_base peer,
char *  result,
jint  size,
jint &  required,
xmog_localenv env = NULL 
)
static

Gets the typeinfo from the peer instance.

Parameters
peerthe peer instance.
resulta pointer to the buffer that will hold the result.
sizethe buffer size.
requiredthe number of bytes required to hold the result.
envthe local call environment. May be NULL.

◆ register_unmarshaller()

static int xmog_peer::register_unmarshaller ( const char *  javaClassNameUtf,
const char *  cppClassIdentifier,
XMOG_PEER_UNMARSHAL_METHOD  pUnmarshal 
)
static

Registers a peer unmarshaller for the tuple of <Java peer classname, C++ class identifier>.

One unmarshaller may be used for more than one C++ class, so the runtime will parse the cppClassIdentifier as a comma separated list of identifiers, allowing the registration of more than one C++ type for one Java peer type.

Parameters
javaClassNameUtfthe name of the Java peer type.
cppClassIdentifierthe (comma-separated list of) C++ type identifiers handled by this unamrshaller.
pUnmarshalthe function performing the unmarshalling for us.
Returns
0 on success, -1 on failure.

◆ set_binaryData()

static int xmog_peer::set_binaryData ( xmog_base peer,
jbyte *  pBytes,
size_t  len,
xmog_localenv env = NULL 
)
static

Sets binary data into the instance.

Parameters
peerthe peer instance.
pBytesa pointer to the beginning of the native data.
lenthe number of bytes to store.
envthe local call environment. May be NULL.

◆ set_bool()

static int xmog_peer::set_bool ( xmog_base peer,
const char *  fieldNameUtf,
bool  b,
xmog_localenv env = NULL 
)
static

Sets a bool field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
bthe field value
envthe local call environment. May be NULL.

◆ set_boolean()

static int xmog_peer::set_boolean ( xmog_base peer,
const char *  fieldNameUtf,
jboolean  b,
xmog_localenv env = NULL 
)
static

Sets a boolean field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
bthe field value
envthe local call environment. May be NULL.

◆ set_byte()

static int xmog_peer::set_byte ( xmog_base peer,
const char *  fieldNameUtf,
jbyte  b,
xmog_localenv env = NULL 
)
static

Sets a byte field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
bthe field value
envthe local call environment. May be NULL.

◆ set_char()

static int xmog_peer::set_char ( xmog_base peer,
const char *  fieldNameUtf,
jchar  c,
xmog_localenv env = NULL 
)
static

Sets a char field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
cthe field value
envthe local call environment. May be NULL.

◆ set_double()

static int xmog_peer::set_double ( xmog_base peer,
const char *  fieldNameUtf,
jdouble  d,
xmog_localenv env = NULL 
)
static

Sets a double field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
dthe field value
envthe local call environment. May be NULL.

◆ set_float()

static int xmog_peer::set_float ( xmog_base peer,
const char *  fieldNameUtf,
jfloat  f,
xmog_localenv env = NULL 
)
static

Sets a float field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
fthe field value
envthe local call environment. May be NULL.

◆ set_int()

static int xmog_peer::set_int ( xmog_base peer,
const char *  fieldNameUtf,
jint  i,
xmog_localenv env = NULL 
)
static

Sets a int field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
ithe field value
envthe local call environment. May be NULL.

◆ set_long()

static int xmog_peer::set_long ( xmog_base peer,
const char *  fieldNameUtf,
jlong  l,
xmog_localenv env = NULL 
)
static

Sets a long field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
lthe field value
envthe local call environment. May be NULL.

◆ set_Object() [1/3]

static int xmog_peer::set_Object ( xmog_base peer,
const char *  fieldNameUtf,
const char *  str,
xmog_localenv env = NULL 
)
static

Sets a String field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
strthe field value.
envthe local call environment. May be NULL.

◆ set_Object() [2/3]

static int xmog_peer::set_Object ( xmog_base peer,
const char *  fieldNameUtf,
const wchar_t *  str,
xmog_localenv env = NULL 
)
static

Sets a String field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
strthe field value.
envthe local call environment. May be NULL.

◆ set_Object() [3/3]

static int xmog_peer::set_Object ( xmog_base peer,
const char *  fieldNameUtf,
jobject  o,
xmog_localenv env = NULL 
)
static

Sets an Object field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
othe field value
envthe local call environment. May be NULL.

◆ set_short()

static int xmog_peer::set_short ( xmog_base peer,
const char *  fieldNameUtf,
jshort  s,
xmog_localenv env = NULL 
)
static

Sets a short field into the instance.

Parameters
peerthe peer instance.
fieldNameUtfthe fieldname to which this data belongs in the C++ instance.
sthe field value
envthe local call environment. May be NULL.

◆ set_typeInfo() [1/3]

static int xmog_peer::set_typeInfo ( xmog_base peer,
const char *  typeInfoUtf,
xmog_localenv env = NULL 
)
static

Sets the typeinfo for the C++ instance that is storing data into this instance.

Parameters
peerthe peer instance.
typeInfoUtfthe type identifier in UTF-8 format.
envthe local call environment. May be NULL.

◆ set_typeInfo() [2/3]

static int xmog_peer::set_typeInfo ( xmog_base peer,
const wchar_t *  typeInfo,
xmog_localenv env = NULL 
)
static

Sets the typeinfo for the C++ instance that is storing data into this instance.

Parameters
peerthe peer instance.
typeInfothe type identifier.
envthe local call environment. May be NULL.

◆ set_typeInfo() [3/3]

static int xmog_peer::set_typeInfo ( xmog_base peer,
xmog_base typeInfo,
xmog_localenv env = NULL 
)
static

Sets the typeinfo for the C++ instance that is storing data into this instance.

This is the best variant of the method in terms of performance because no temporary Java string needs to be created.

Parameters
peerthe peer instance.
typeInfothe type identifier.
envthe local call environment. May be NULL.

◆ to_string()

static char* xmog_peer::to_string ( xmog_base peer,
xmog_localenv env = NULL 
)
static

Returns a string containing the instance's state in text representation.

The returned string is dynamically allocated and needs to be freed by the caller.

Parameters
peerthe peer instance.
envthe local call environment. May be NULL.

The documentation for this class was generated from the following file:

Copyright (c) 1999-2020 by Codemesh, Inc., ALL RIGHTS RESERVED.