OpenDDS IDL Sequence type

648 views Asked by At

I am trying to publish video frames using the following IDL:

typedef sequence<octet> Pixels;
module message {
   @topic
   struct Image {
      int width;
      int height;
      int bytesPerPixel;
      Pixels  data;
};

I would also like to send 2 image data sequences (say, raw and filtered). Instead of declaring "Pixels data2", can sequence container by declared as arrays? The typedef sequence<octet> Pixels[2] gives errors.

1

There are 1 answers

2
Fred Hornsey On BEST ANSWER

Okay, so I gave this IDL to opendds_idl:

typedef sequence<octet> Pixels[2];
module message {
  @topic
  struct Image {
    unsigned short width;
    unsigned short height;
    unsigned short bytesPerPixel;
    Pixels data;
  };
};

and it accepted it:

opendds_idl --syntax-only test.idl                                                    
processing test.idl

However I decided to try to build a library with it in case the generated code was wrong, which seems to be true.

testTypeSupportImpl.cpp: In function ‘bool OpenDDS::DCPS::gen_skip_over(OpenDDS::DCPS::Serializer&, Pixels_forany*)’:
testTypeSupportImpl.cpp:83:41: error: ‘sequence’ does not name a type; did you mean ‘servent’?
     if (!gen_skip_over(ser, static_cast<sequence*>(0))) return false;

With other errors following. It seems we don't support trying to typedef an array and sequence at the same time. Replacing the typedef with two works:

typedef sequence<octet> PixelSeq;
typedef PixelSeq Pixels[2];