OpenDDS IDL序列类型

问题描述

我正在尝试使用以下IDL发布视频帧:

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

我还想发送2个图像数据序列(例如,原始和过滤的)。代替声明“ Pixels data2”,可以将序列容器声明为数组吗? typedef sequence<octet> Pixels[2]给出了错误

解决方法

好的,所以我将此IDL交给了opendds_idl

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

它接受了:

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

但是我决定尝试用它来构建一个库,以防生成的代码错误,这似乎是正确的。

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;

以下还有其他错误。似乎我们不支持尝试同时对数组和序列进行typedef。用两种方法替换typedef:

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