incubator-etch-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Veith <Martin.Ve...@bmw-carit.de>
Subject RE: array element access in c-binding
Date Wed, 17 Aug 2011 16:37:12 GMT
Hi Scott,

Please look at the examples below:

Transferring Bytes: (the byte array showed below is converted to a native array):
if(is_etch_nativearray(data)) {
	etch_nativearray* na = (etch_nativearray*) data;
	if(na != NULL && na->content_obj_type == ETCHTYPEB_BYTE) {
		data_buffer = static_cast<unsigned char*>(na->values);
		data_length = static_cast<Int32>(na->bytecount);
	}
}

Other data types e.g.  Int32 (all data types except byte are encapsulated into an EtchObject):
if(is_etch_arrayvalue(data)) {
	Int32  length = arrayvalue_count(data);
	for(Int32 k = 0; k < length; k++) {
		etch_int32* content = NULL;
		content = (etch_int32*)arrayvalue_get(data, k);
	}
}

If you have further questions you can also send your code to us and we can have a look at
it.

Cheers,
Michael & Martin

-----Original Message-----
From: scott comer [mailto:wert1y@mac.com] 
Sent: Mittwoch, 17. August 2011 17:32
To: etch-dev@incubator.apache.org; etch-user@incubator.apache.org
Subject: array element access in c-binding

thomas is bringing up the perf example from the etch examples with the 
c-binding, and has the following trouble.

for the method, sum, which takes an int[], it isn't clear how to fetch 
the elements out of the array. in general, a quick pointer to working 
with arrays would be helpful.

thomas is working on a pilot project for us, here at spawn labs, to 
bring up the c-binding in an image compare service which will be part of 
our mostly java service cloud for game play. the c-binding is important 
to us for other projects as well, including core communications for our 
video appliance and dynamic firewall control.

any help or examples would be appreciated.

thanks,
scott out


Mime
View raw message