halcon学习之tuple比较运算

//执行两个tuple数组之间的相互比较

void testComparison()
{
HTuple tuple1;
tuple1[0] = 1;
tuple1[1] = 1;
tuple1[2] = 2;

HTuple tuple2;
tuple2[0] = 1;
tuple2[1] = 2;
tuple2[2] = 1;

HTuple result = tuple1.TupleEqual(tuple2);//数组大小相同,同一位置对应数据相同,就是相等。数组相等返回1,不相等返回0.
cout << (Hlong)result<<endl;

result = tuple1.TupleEqualElem(tuple2);//如果数组中含有相同的出现元素,就是相等。比如[1,1,2]与[1,2,2]是相等的。相等返回1,不相等返回0.
cout << (Hlong)result << endl;

result = tuple1.TupleGreater(tuple2);//如果数组中,tuple1的长度大于tuple2,返回1,否则返回0;如果长度相等,数组中元素进行逐个比较,如果首先出现对应位置的元素tuple1大于tuple2,则返回1,否则返回0;
cout << (Hlong)result << endl;

result = tuple1.TupleGreaterElem(tuple2);//如果数组中,tuple1的长度大于tuple2,返回1,否则返回0;如果长度相等,数组中元素进行逐个比较,如果存在所有对应位置的元素tuple1大于tuple2,则返回1,否则返回0;
cout << (Hlong)result << endl;

result = tuple1.TupleGreaterEqual(tuple2);//如果数组中,满足TupleEqual和TupleGreater其中之一,就返回1.否则返回0
cout << (Hlong)result << endl;

result = tuple1.TupleGreaterEqualElem(tuple2);//如果数组中,满足TupleEqualElem和TupleGreaterElem其中之一,就返回1.否则返回0
cout << (Hlong)result << endl;

result = tuple1.TupleLess(tuple2);//如果数组中,tuple1的长度小于tuple2,返回1,否则返回0;如果长度相等,数组中元素进行逐个比较,如果首先出现对应位置的元素tuple1小于tuple2,则返回1,否则返回0;
cout << (Hlong)result << endl;

result = tuple1.TupleLessElem(tuple2);//如果数组中,tuple1的长度小于tuple2,返回1,否则返回0;如果长度相等,数组中元素进行逐个比较,如果存在所有对应位置的元素tuple1小于tuple2,则返回1,否则返回0;
cout << (Hlong)result << endl;

result = tuple1.TupleLessEqual(tuple2);//如果数组中,满足TupleEqual和TupleLess其中之一,就返回1.否则返回0
cout << (Hlong)result << endl;

result = tuple1.TupleLessEqualElem(tuple2);//如果数组中,满足TupleEqual和TupleLessElem其中之一,就返回1.否则返回0
cout << (Hlong)result << endl;

result = tuple1.TupleNotEqual(tuple2);//与TupleNotEqual条件相反.
cout << (Hlong)result << endl;

result = tuple1.TupleNotEqualElem(tuple2);//与TupleNotEqualElem条件相反
cout << (Hlong)result << endl;

}

你可能感兴趣的:(比较,Tuple,halcon)