halcon基础数据类型详解

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

halcon基础数据类型详解

#if defined(__CHAR_UNSIGNED__) || defined(__sgi)

#define INT1 signed char /* integer, signed 1 Byte */

#define INT1_MIN SCHAR_MIN

#define INT1_MAX SCHAR_MAX

#else

#define INT1 char /* integer, signed 1 Byte */

#define INT1_MIN CHAR_MIN

#define INT1_MAX CHAR_MAX

#endif

#define UINT1 unsigned char /* integer, unsigned 1 Byte */

#define UINT1_MIN 0

#define UINT1_MAX UCHAR_MAX

#define LONG_FORMAT _INT64_FORMAT

typedef INT4_8 Hlong;

typedef UINT4_8 Hulong;

看粗体部分,可以看到Hlong型在32位的机器上其实就是long型代表4个字节32位,在64位机器上有另一种定义

再来看看halcon中最重要的数据类型HTuple,在C++里面,halcon将HTuple类型封

装了类,其始祖类HRootObject,这个类相当于MFC里面的CObject,halcon从HRootObject

派生了HBaseArray,当然这两个类是虚基类,有一些方法需要我HTuple自己实现,当然也

有一些方法可以直接用的。这两个类在HCPPUtil里,可以看看。

HTuple类就是从HBaseArray派生,元组基类,相当于数组,具有如下的构造函数:

HTuple(int l);

HTuple(float f);

HTuple(double d);

HTuple(constchar *s);

HTuple(const HCtrlVal&c);

HTuple(const HTuple&in):HBaseArray() {CopyTuple(in);}

HTuple(Hlong length, const HTuple&value);

HTuple(const HTuple&length, const HTuple&value);

HTuple(SpecialTuple d);

HTuple对各种操作符进行了重载:

operator HCtrlVal(void) const;

HTuple operator () (Hlong min, Hlong max) const;

HTuple operator () (const HTuple&min, const HTuple&max) const; HCtrlVal&operator [] (Hlong index);

HCtrlVal operator [] (Hlong index) const;

HCtrlVal&operator [] (const HTuple&index);

HCtrlVal operator [] (const HTuple&index) const;

HTuple&operator ++ (void); // nurfuer double und Hlong

HBool operator ! (void) const;

HTuple operator~ (void) const;

HTuple operator<< (const HTuple&val) const;

HTuple operator<< (Hlongval) const;

HTuple operator>> (const HTuple&val) const;

HTuple operator>> (Hlongval) const;

HTuple operator+ (const HTuple&val) const;

HTuple operator+ (double val) const;

HTuple operator+ (int val) const;

在讲解halcon是如何维护这样一个HTuple中各种数据之前,先来看看这样一个类:

class LIntExportHCtrlVal {

friend class HTuple;

public:

HCtrlVal(void) {val.type = UndefVal; val.par.l = 0;}

#if !defined(_TMS320C6X)

HCtrlVal(Hlong l) {val.type = LongVal; val.par.l = l;}

#endif

HCtrlVal(int l) {val.type = LongVal; val.par.l = l;} HCtrlVal(double d) {val.type = DoubleVal; val.par.f = d;} HCtrlVal(constchar *s);

HCtrlVal(const HCtrlVal&v) {CopyCtrlVal(v);}

~HCtrlVal(void) {ClearCtrlVal();} HCtrlVal&operator = (const HCtrlVal&v);

// Type conversion

int ValType() const {return val.type;} operatorint(void) const {return I();}

#if !defined(_TMS320C6X)

operator Hlong(void) const {return L();}

#endif

operatordouble(void) const {return D();} operatorconstchar*(void) const {return S();} operatorconst Hcpar&(void)const {return HCPAR();}

// Access contents

double D() const;

HlongL() const;

int I() const;

constchar * S() const;

const Hcpar& HCPAR()const;

// Arithmetics

HCtrlVal operator + (const HCtrlVal&val) const;

HTuple operator + (const HTuple&val) const;

HCtrlVal operator - (const HCtrlVal&val) const;

HTuple operator - (const HTuple&val) const;

HCtrlVal operator * (const HCtrlVal&val) const;

HTuple operator * (const HTuple&val) const;

HCtrlVal operator / (const HCtrlVal&val) const;

HTuple operator / (const HTuple&val) const;

HCtrlVal operator % (const HCtrlVal&val) const;

HTuple operator % (const HTuple&val) const;

HBool operator != (const HCtrlVal&val) const;

HBool operator != (const HTuple&val) const;

HBool operator == (const HCtrlVal&val) const;

HBool operator == (const HTuple&val) const;

HBool operator>= (const HCtrlVal&val) const;

HBool operator>= (const HTuple&val) const;

HBool operator<= (const HCtrlVal&val) const;

HBool operator<= (const HTuple&val) const;

HBool operator> (const HCtrlVal&val) const;

HBool operator> (const HTuple&val) const;

HBool operator< (const HCtrlVal&val) const;

HBool operator< (const HTuple&val) const;

constchar *ClassName(void) const { return"HCtrlVal"; }

相关文档
最新文档