0

我正在尝试使用以下 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]给出错误。

4

1 回答 1

1

好的,所以我把这个 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 sequence<octet> PixelSeq;
typedef PixelSeq Pixels[2];
于 2020-10-06T23:58:41.017 回答