Sending a list of item from client to server
Options
Hi,
I am using the latest cpp photon client library. I would like to send a list of Hashtable to server via custom operation, but I couldn't find examples in the demos.
currently, I am doing this:
Hashtable *table = new Hashtable[2];
Photon::OperationRequestParameters param;
param.put(static_cast<nByte>(1), ValueObject<Hashtable*>(table)); <- won't compile
photonlib.opCustom(OperationRequest(operationCode, param), true);
I have no problem sending int or Hashtable, but when I couldn't find way to send int* or Hashtable*
Thanks in advance.
K
I am using the latest cpp photon client library. I would like to send a list of Hashtable to server via custom operation, but I couldn't find examples in the demos.
currently, I am doing this:
Hashtable *table = new Hashtable[2];
Photon::OperationRequestParameters param;
param.put(static_cast<nByte>(1), ValueObject<Hashtable*>(table)); <- won't compile
photonlib.opCustom(OperationRequest(operationCode, param), true);
I have no problem sending int or Hashtable, but when I couldn't find way to send int* or Hashtable*
Thanks in advance.
K
0
Comments
-
Hi.KevinB wrote:param.put(static_cast<nByte>(1), ValueObject<Hashtable*>(table)); <- won't compile
[code2=cpp]param.put(static_cast<nByte>(1), table, 2/*element count of the array*/);[/code2]0 -
Kaiserludi wrote:Just pass it like non-array data, but additionally pass the element count of the array:
[code2=cpp]param.put(static_cast<nByte>(1), table, 2/*element count of the array*/);[/code2]
I tried this, but in order for it to compile. I have to change it to [code2=cpp]param.put(static_cast<nByte>(1), ValueObject<Hashtable*>table, 2/*element count of the array*/);[/code2]
unfortunately this won't link, it complains undefined template in ValueObject.h
K0 -
Sorry, it should work this way:
[code2=cpp]param.put(static_cast<nByte>(1), ValueObject<Hashtable*>(table, 2));[/code2]0 -
ah. Thanks. see it in ValueObject.h0