Halcon mutual assignment of HTuple data and data of VC

// HTuple→VC 数据类型转换
HTuple hTuple = 1234;
int i = hTuple[0].I();                  // i=1234
long l = hTuple[0].L();                 // l=1234
long lNumber = hTuple.Num();            // lNumber=1,数据个数
double d = hTuple[0].D();               // d=1234.0000
    
hTuple = "1234";
CString strBuffer = hTuple[0].S();      // strBuffer="1234"
    
    
// VC→HTuple 数据类型转换
int ii = 1234;
double dd = 1234.1234;
CString strTemp = "Halcon";
    
HTuple hTuple2;
hTuple2[0] = ii;                        // hTuple2[0].I()=1234
hTuple2[1] = dd;                        // hTuple2[1].D()=1234.1234
hTuple2[2] = strTemp.GetBuffer();       // hTuple2[2].S()="Halcon"
    
i = hTuple2[0].I();                     // i=1234
d = hTuple2[1].D();                     // d=1234.1234
strBuffer = hTuple2[2].S();             // strBuffer="Halcon"
lNumber = hTuple2.Num();                // lNumber=3,数据个数

HTuple type data extracting  
read data from the type HTuple

// HTuple there is an element

AA = 120 HTuple;
Double dd = AA [0] II.D (); // dd = 120.000
int = AA II [0] the .I (); // II = 120
Long LL = AA [0] .L () ; // LL = 120
Hlong HH = AA [0] .L (); // 120 HH =
Long aa.Num NUM = (); // NUM =. 1;
AA = "120"; // string of HTuple , if the assignment is not a string, can not be called S () function
const char * CC;
CC = AA [0] .S (); // CC [0] = '. 1', CC [. 1] = '2', cc [2] = '0'

// aa time when the multi-element array

AA [. 1] = 230;
NUM = aa.Num (); // NUM = 2;
II = AA [. 1] the .I (); // II // = 230 other methods of acquiring data similar to the above
--- ------------------ 
author: big fishing child 
source: CSDN 
original: https: //blog.csdn.net/shenhuan1104/article/details/75331484 
copyright: This article is bloggers original article, reproduced, please attach Bowen link!

Guess you like

Origin blog.csdn.net/qingzhuyuxian/article/details/93195589