[Paraview] Send an array from client to server

Biddiscombe, John A. biddisco at cscs.ch
Sun Sep 20 04:43:43 EDT 2015


Just following up so that when I’ve forgotten how to do it ...

This works

#define VTK_WRAPPING_CXX
#include "vtkClientServerStream.h"

...


//  void SetSelectedGIds(int n, const int *Ids);
  void SetSelectedGIds(int N, int Ids[]);
//BTX
  void SetSelectedGIds(int N, vtkClientServerStreamDataArg<int> &temp0);
//ETX

And in the cxx, use the vtkClientServerStreamDataArg operator () to get
the T* pointer.

Then in the client GUI

vtkClientServerStream::Array array =
  {
    vtkClientServerStream::int32_array,
    static_cast<vtkTypeUInt32>(numValues),
    
static_cast<vtkTypeUInt32>(sizeof(vtkClientServerStream::int32_value)*numVa
lues),
    (int*)(data)
  };


  vtkClientServerStream stream;
  stream << vtkClientServerStream::Invoke
    << VTKOBJECT(proxy)
    << "SetSelectedGIds"
    << numValues
    << array;
  stream << vtkClientServerStream::End;

This correctly inserts the array and the type,size,data vars so that the
server reads them as expected.

I’m not happy about the fact that we have to spoof the wrapper generators,
but at least I don’t need to modify the ClientServerStreamArg<>
implementation.



JB



More information about the ParaView mailing list