OpenDDS的IDL定义时用到的数据类型和部分方法

(一)基本类型

short

2 bytes

long

4 bytes

long long

8 bytes

unsigned short

2 bytes

unsigned long

4 bytes

扫描二维码关注公众号,回复: 3047591 查看本文章

unsigned long long

8 bytes

float

4 bytes

double

8 bytes

long double

16 bytes

char

1 byte

boolean

1 byte

octet binary data

1 byte

enum Enumerated type

4 bytes

string

bounded and unbounded

constant constant type

always a number

(二)结构类型

struct

Structure type

union

Union type

array

Single or multi dimensional

sequence

bounded and unbounded

(三)sequence变长序列的主要方法

   

方法

CORBA::ULong maximum()

CORBA::Boolean release()

CORBA::ULong length()

 返回数据有效长度

void length(CORBA::ULong length)

 为缓冲区分配内存大小

value_type const * get_buffer()

 获取缓冲区指针

value_type * get_buffer(CORBA::Boolean orphan = false)

 

   

举例:

typedef sequence<octet> OctetSeq;
OctetSeq myArray;

myArray.length(100);//分配缓冲区

memcpy(&myArray[0], "test OctetSeq", 20);//缓冲区赋值,也可以为其他二进制字节流

猜你喜欢

转载自blog.csdn.net/pony12/article/details/79454904