Sending a list of item from client to server

Options
KevinB
KevinB
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

  • Kaiserludi
    Options
    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]
  • KevinB
    Options
    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
  • Kaiserludi
    Options
    Sorry, it should work this way:
    [code2=cpp]param.put(static_cast<nByte>(1), ValueObject<Hashtable*>(table, 2));[/code2]
  • KevinB
    Options
    ah. Thanks. see it in ValueObject.h