【问题标题】:OpenDDS IDL Sequence typeOpenDDS IDL 序列类型
【发布时间】:2020-10-06 21:21:13
【问题描述】:

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

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

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

【问题讨论】:

  • int 不是有效的 IDL 类型。整数类型是short(16 位)、long(32 位)、long long(64 位)以及这三个版本的unsigned
  • 在将ints 转换为unsigned shorts 并添加缺少的大括号后,IDL 编译器将接受 IDL。您遇到了什么样的错误?

标签: image sequence idl opendds


【解决方案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];

【讨论】:

猜你喜欢
  • 2021-04-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-15
  • 1970-01-01
  • 2016-09-18
  • 2012-07-25
相关资源
最近更新 更多