Sending a list of item from client to server

KevinBKevinB
edited November 2012 in Native
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

Comments

  • Hi.
    KevinB wrote:
    param.put(static_cast<nByte>(1), ValueObject<Hashtable*>(table)); <- won't compile
    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]
  • 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

    K
  • Sorry, it should work this way:
    [code2=cpp]param.put(static_cast<nByte>(1), ValueObject<Hashtable*>(table, 2));[/code2]
  • ah. Thanks. see it in ValueObject.h
Sign In or Register to comment.