halcon11用于C++的HTuple.h头文件,纯手添中文翻译!乐于分享,请勿在非同意下转载!
/*****************************************************************************
* HTuple.h --- 带中文翻译版
*****************************************************************************
*
* Project: HALCON/C++
* Description: Tuple data used for control parameters of HALCON operators
*
* (c) 2010-2011 by MVTec Software GmbH
* www.mvtec.com
*
*****************************************************************************
*
* $Revision: 1.4 $
* $Date: 2012/05/14 17:14:29 $
*
*****************************************************************************
*
* 翻译:DMM
* 时间:2017年11月1日
*
*****************************************************************************/
#ifndef HCPP_TUPLE_H
#define HCPP_TUPLE_H
#include <new>
namespace HalconCpp
{
enum HTupleType
{
// The empty tuple does not yet have a defined data type
//空元组还没有定义的数据类型
eTupleTypeEmpty = UNDEF_PAR,
// The tuple is a pure array of integers
//元组是一个纯整数数组
eTupleTypeLong = LONG_PAR,
// The tuple is a pure array of floating point values
//元组是浮点值的纯数组
eTupleTypeDouble = DOUBLE_PAR,
// The tuple is a pure array of strings
//元组是字符串的纯数组
eTupleTypeString = STRING_PAR,
// The tuple is an array of Hcpar. Each element can have a different type
//元组是Hcpar数组。每个元素都可以有不同的类型
eTupleTypeMixed = MIXED_PAR
};
}
#include "HTupleElement.h"
namespace HalconCpp
{
// Smart pointer to internal data representation
//智能指针到内部数据表示
template<class T> class HSmartPtr;
typedef HSmartPtr<HTupleData> HTupleDataPtr;
// Tuple data used for control parameters of HALCON operators
//用于控制HALCON运算符控制参数的元组数据
class LIntExport HTuple
{
friend class HalconAPI;
friend class HTupleElement;
public:
/***************************************************************************/
/* Constructors / Destructor */
/***************************************************************************/
// Empty tuple
//空元组
HTuple();
// Integer (machine pointer size)
HTuple(Hlong l);
// Integer array (machine pointer size)
HTuple(Hlong* l, Hlong num);
#if defined(HCPP_INT_OVERLOADS)
// Integer (possibly smaller size than pointer)
HTuple(INT i);
// Integer array (possibly smaller size than pointer)
HTuple(INT* i, Hlong num);
#endif
// Single precision floating point value
HTuple(float f);
// Single precision floating point array
HTuple(float* f, Hlong num);
// Double precision floating point value
HTuple(double d);
// Double precision floating point array
HTuple(double* d, Hlong num);
// String (C style)
HTuple(const char *s);
// String (object)
HTuple(const HString& s);
// Mixed
HTuple(Hcpar* p, Hlong num);
// Constant tuple
HTuple(const HTuple& length, const HTuple& value);
// Element of another tuple
HTuple(const HTupleElement& element);
// HTuple
HTuple(const HTuple& tuple);
// Destructor
virtual ~HTuple();
/***************************************************************************/
/* General members 一般成员函数 */
/***************************************************************************/
// Clear all data inside this tuple
//清除此元组内的所有数据
void Clear();
// The number of elements of this tuple
//这个元组的元素个数
Hlong Length() const;
// The data type of this tuple (pure data types or mixed tuple)
//此元组的数据类型(纯数据类型或混合元组)
HTupleType Type() const;
// Create a detached copy duplicating the underlying tuple data
//创建一个分离的副本复制底层的元组数据
HTuple Clone() const;
// Append data to existing tuple
//将数据追加到现有的元组
HTuple &Append(const HTuple& tuple);
// Returns a simple string representation of the tuple contents,
// mainly intended for debugging purposes
//返回元组内容的简单字符串表示形式,主要用于调试目的
HString ToString() const;
/***************************************************************************/
/* Data access 数据访问 */
/***************************************************************************/
// Direct array access will raise an exception if tuple type does not match!
// Modifications to array will affect data in tuples as well.
//如果tuple类型不匹配,直接数组访问将引发异常!对数组的修改也会影响元组中的数据
Hlong* LArr();
double* DArr();
char** SArr();
Hcpar* PArr();
// Safer but less efficient access is provided by copying the data.
// Mismatched elements will be initialized with default values. Caller
// is responsible for using HTuple::FreeArr() to free the array (do
// not use "delete []" directly as transferring memory ownership
// across DLL boundaries may cause problems with the C++ runtime)
//更安全但更低效的访问是通过复制数据提供的。不匹配的元素将使用默认值初始化。
//调用者负责使用HTuple::FreeArr()来释放数组(不要直接使用“delete[]”,因为
//在DLL边界上传输内存所有权可能会导致c++运行时出现问题)
// Returns the tuple data as an array of Hlong. Release using DeleteArr()!
//将tuple数据作为Hlong数组返回。使用DeleteArr()释放!
Hlong* ToLArr() const;
// Returns the tuple data as an array of double. Release using DeleteArr()!
//将tuple数据作为double数组返回。使用DeleteArr()释放!
double* ToDArr() const;
// Returns the tuple data as an array of HString. Release using DeleteArr()!
//将tuple数据作为HString数组返回。使用DeleteArr()释放!
HString* ToSArr() const;
static void DeleteArr(Hlong* arr);
static void DeleteArr(double* arr);
static void DeleteArr(HString* arr);
// Intentionally no ToPArr() as correctly releasing memory
// for a Hcpar* array is problematic for the library user.
// Assignment operator
HTuple& operator = (const HTuple& obj);
// Element access
HTupleElement operator [] (Hlong index);
const HTupleElement operator [] (Hlong index) const;
HTupleElement operator [] (const HTuple& index);
const HTupleElement operator [] (const HTuple& index) const;
// Convenience access for first element
//第一个元素的方便访问
#if defined(HCPP_INT_OVERLOADS)
// Access integer value in first tuple element
//在第一个元组元素中访问整数值
int I() const { return (*this)[0].I(); }
#endif
// Access integer value in first tuple element
//在第一个元组元素中访问整数值
Hlong L() const { return (*this)[0].L(); }
// Access floating-point value in first tuple element
//在第一个元组元素中访问浮点值
double D() const { return (*this)[0].D(); }
// Access string value in first tuple element
//在第一个元组元素中访问字符串值
HString S() const { return (*this)[0].S(); }
/***************************************************************************
* Operators 操作函数 *
***************************************************************************/
// Test whether the types of the elements of a tuple are of type string.
//测试元组的元素类型是否为字符串类型
HTuple TupleIsStringElem() const;
// Test whether the types of the elements of a tuple are of type real.
//测试元组元素的类型是否为实数类型
HTuple TupleIsRealElem() const;
// Test whether the types of the elements of a tuple are of type integer.
//测试元组元素的类型是否为整数类型
HTuple TupleIsIntElem() const;
// Return the types of the elements of a tuple.
//返回元组元素的类型
HTuple TupleTypeElem() const;
// Test whether a tuple is of type mixed.
//测试一个元组是否是混合类型
HTuple TupleIsMixed() const;
// Test whether a tuple is of type string.
//测试一个元组是否为字符串类型
HTuple TupleIsString() const;
// Test whether the types of the elements of a tuple are of type real.
//测试元组元素的类型是否为实数类型
HTuple TupleIsReal() const;
// Test whether a tuple is of type integer.
//测试一个元组是否为整数
HTuple TupleIsInt() const;
// Return the type of a tuple.
//返回元组的类型
HTuple TupleType() const;
// Calculate the value distribution of a tuple within a certain value range.
//计算一个元组在一定值范围内的值分布
HTuple TupleHistoRange(const HTuple& Min, const HTuple& Max, const HTuple& NumBins, HTuple* BinSize) const;
// Select tuple elements matching a regular expression.
// 选择与正则表达式匹配的元组元素
HTuple TupleRegexpSelect(const HTuple& Expression) const;
// Test if a string matches a regular expression.
//测试字符串是否匹配正则表达式
HTuple TupleRegexpTest(const HTuple& Expression) const;
// Replace a substring using regular expressions.
//使用正则表达式替换子字符串
HTuple TupleRegexpReplace(const HTuple& Expression, const HTuple& Replace) const;
// Extract substrings using regular expressions.
//使用正则表达式提取子字符串
HTuple TupleRegexpMatch(const HTuple& Expression) const;
// Return a tuple of random numbers between 0 and 1.
//返回0到1之间的随机数字的一个元组
static HTuple TupleRand(const HTuple& Length);
// Return the number of elements of a tuple.
//返回元组的元素个数
HTuple TupleLength() const;
// Calculate the sign of a tuple.
//计算一个元组的符号
HTuple TupleSgn() const;
// Calculate the elementwise maximum of two tuples.
//计算两个元组的最大元素
HTuple TupleMax2(const HTuple& T2) const;
// Calculate the elementwise minimum of two tuples.
//计算两个元组的最小最小值?
HTuple TupleMin2(const HTuple& T2) const;
// Return the maximal element of a tuple.
//返回元组的最大元素
HTuple TupleMax() const;
// Return the minimal element of a tuple.
//返回元组的最小元素
HTuple TupleMin() const;
// Calculate the cumulative sums of a tuple.
//计算元组的累计和
HTuple TupleCumul() const;
// Select the element of rank n of a tuple.
//选择一个元组的排序n的元素
HTuple TupleSelectRank(const HTuple& RankIndex) const;
// Return the median of the elements of a tuple.
//返回元组元素的中位数
HTuple TupleMedian() const;
// Return the sum of all elements of a tuple.
//返回元组所有元素的和
HTuple TupleSum() const;
// Return the mean value of a tuple of numbers.
//返回一组数字的平均值
HTuple TupleMean() const;
// Return the standard deviation of the elements of a tuple.
//返回元组元素的标准偏差
HTuple TupleDeviation() const;
// Discard all but one of successive identical elements of a tuple.
//将一个元组的连续相同元素丢弃
HTuple TupleUniq() const;
// Return the indices of all occurrences of a tuple within another tuple.
//返回另一个元组中所有出现的元组的索引
HTuple TupleFind(const HTuple& ToFind) const;
// Sort the elements of a tuple and return the indices of the sorted tuple.
//对元组的元素进行排序,并返回已排序的元组的索引
HTuple TupleSortIndex() const;
// Sort the elements of a tuple in ascending order.
//按升序对元组的元素进行排序
HTuple TupleSort() const;
// Invert a tuple.
//反转一个元组
HTuple TupleInverse() const;
// Concatenate two tuples to a new one.
//将两个元组连接到一个新的元组
HTuple TupleConcat(const HTuple& T2) const;
// Select several elements of a tuple.
//选择一个元组的几个元素
HTuple TupleSelectRange(const HTuple& Leftindex, const HTuple& Rightindex) const;
// Select all elements from index "n" to the end of a tuple.
//从索引“n”中选择所有元素到一个元组的末尾
HTuple TupleLastN(const HTuple& Index) const;
// Select the first elements of a tuple.
//选择元组的第一个元素
HTuple TupleFirstN(const HTuple& Index) const;
// Inserts one or more elements into a tuple at index.
//将一个或多个元素插入到一个tuple中
HTuple TupleInsert(const HTuple& Index, const HTuple& InsertTuple) const;
// Replaces one or more elements of a tuple.
//替换元组中的一个或多个元素
HTuple TupleReplace(const HTuple& Index, const HTuple& ReplaceTuple) const;
// Remove elements from a tuple.
//从元组中删除元素
HTuple TupleRemove(const HTuple& Index) const;
// Select in mask specified elements of a tuple.
//选择一个元组的指定元素
HTuple TupleSelectMask(const HTuple& Mask) const;
// Select single elements of a tuple.
//选择一个元组的单个元素
HTuple TupleSelect(const HTuple& Index) const;
// Select single character or bit from a tuple.
//从元组中选择单个字符或位
HTuple TupleStrBitSelect(const HTuple& Index) const;
// Generate a tuple with a sequence of equidistant values.
//生成一个带有等距值序列的元组
static HTuple TupleGenSequence(const HTuple& Start, const HTuple& End, const HTuple& Step);
// Generate a tuple of a specific length and initialize its elements.
//生成一个特定长度的元组并初始化其元素
static HTuple TupleGenConst(const HTuple& Length, const HTuple& Const);
// Read one or more environment variables.
//读取一个或多个环境变量
HTuple TupleEnvironment() const;
// Split strings into substrings between predefined separator symbol(s).
//将字符串拆分为预定义分隔符符号(s)之间的子字符串
HTuple TupleSplit(const HTuple& Separator) const;
// Cut characters from position "n1" through "n2" out of a string tuple.
//从字符串元组的“n2”中从位置“n1”中剪切字符
HTuple TupleSubstr(const HTuple& Position1, const HTuple& Position2) const;
// Cut all characters starting at position "n" out of a string tuple.
//从字符串元组中从位置“n”处开始切割所有字符
HTuple TupleStrLastN(const HTuple& Position) const;
// Cut the first characters up to position "n" out of a string tuple.
//将第一个字符剪成字符串tuple中的“n”
HTuple TupleStrFirstN(const HTuple& Position) const;
// Backward search for characters within a string tuple.
//向后搜索字符串元组中的字符
HTuple TupleStrrchr(const HTuple& ToFind) const;
// Forward search for characters within a string tuple.
//向前搜索字符串元组中的字符
HTuple TupleStrchr(const HTuple& ToFind) const;
// Backward search for strings within a string tuple.
//向后搜索字符串元组中的字符串
HTuple TupleStrrstr(const HTuple& ToFind) const;
// Forward search for strings within a string tuple.
// //向前搜索字符串元组中的字符串
HTuple TupleStrstr(const HTuple& ToFind) const;
// Determine the length of every string within a tuple of strings.
//确定字符串中每个字符串的长度
HTuple TupleStrlen() const;
// Test, whether a tuple is elementwise less or equal to another tuple.
//测试,一个元组是否小于或等于另一个元组
HTuple TupleLessEqualElem(const HTuple& T2) const;
// Test, whether a tuple is elementwise less than another tuple.
//测试,一个元组是否比另一个元组更小
HTuple TupleLessElem(const HTuple& T2) const;
// Test, whether a tuple is elementwise greater or equal to another tuple.
//测试,一个元组是否大于或等于另一个元组
HTuple TupleGreaterEqualElem(const HTuple& T2) const;
// Test, whether a tuple is elementwise greater than another tuple.
//测试,一个元组是否大于另一个元组
HTuple TupleGreaterElem(const HTuple& T2) const;
// Test, whether two tuples are elementwise not equal.
//测试,是否两个元组不相等
HTuple TupleNotEqualElem(const HTuple& T2) const;
// Test, whether two tuples are elementwise equal.
//测试,两个元组是否相等
HTuple TupleEqualElem(const HTuple& T2) const;
// Test whether a tuple is less or equal to another tuple.
//测试,一个元组是否小于或等于另一个元组
HTuple TupleLessEqual(const HTuple& T2) const;
// Test whether a tuple is less than another tuple.
//测试一个元组是否小于另一个元组
HTuple TupleLess(const HTuple& T2) const;
// Test whether a tuple is greater or equal to another tuple.
//测试一个元组是否大于或等于另一个元组
HTuple TupleGreaterEqual(const HTuple& T2) const;
// Test whether a tuple is greater than another tuple.
//测试一个元组是否大于另一个元组
HTuple TupleGreater(const HTuple& T2) const;
// Test whether two tuples are not equal.
//测试两个元组是否 - 不相等
HTuple TupleNotEqual(const HTuple& T2) const;
// Test whether two tuples are equal.
//测试两个元组是否 - 相等
HTuple TupleEqual(const HTuple& T2) const;
// Compute the logical not of a tuple.
//计算一个元组的逻辑"非"
HTuple TupleNot() const;
// Compute the logical exclusive or of two tuples.
//计算一个元组的逻辑"异或"
HTuple TupleXor(const HTuple& T2) const;
// Compute the logical or of two tuples.
//计算一个元组的逻辑"或"
HTuple TupleOr(const HTuple& T2) const;
// Compute the logical and of two tuples.
//计算一个元组的逻辑"与"
HTuple TupleAnd(const HTuple& T2) const;
// Compute the bitwise not of a tuple.
//按位计算一个元组的逻辑"非"
HTuple TupleBnot() const;
// Compute the bitwise exclusive or of two tuples.
//按位计算一个元组的逻辑"异或"
HTuple TupleBxor(const HTuple& T2) const;
// Compute the bitwise or of two tuples.
//按位计算一个元组的逻辑"或"
HTuple TupleBor(const HTuple& T2) const;
// Compute the bitwise and of two tuples.
//按位计算一个元组的逻辑"与"
HTuple TupleBand(const HTuple& T2) const;
// Shift a tuple bitwise to the right.
//向右移一位
HTuple TupleRsh(const HTuple& Shift) const;
// Shift a tuple bitwise to the left.
//向左移一位
HTuple TupleLsh(const HTuple& Shift) const;
// Convert a tuple of integers into strings with the corresponding ASCII codes.
//用相应的ASCII码将一个整数元转换成字符串
HTuple TupleChrt() const;
// Convert a tuple of strings into a tuple of their ASCII codes.
//将一组字符串转换成它们的ASCII码元组
HTuple TupleOrds() const;
// Convert a tuple of integers into strings with the corresponding ASCII codes.
//用相应的ASCII码将一个整数元转换成字符串
HTuple TupleChr() const;
// Convert a tuple of strings of length 1 into a tuple of their ASCII codes.
//将长度为1的一组字符串转换成它们的ASCII码元组
HTuple TupleOrd() const;
// Convert a tuple into a tuple of strings.
//将一个元组转换成一个字符串元组
HTuple TupleString(const HTuple& Format) const;
// Check a tuple (of strings) whether it represents numbers.
//检查一个元组(字符串)是否表示数字
HTuple TupleIsNumber() const;
// Convert a tuple (of strings) into a tuple of numbers.
//将一个元组(字符串)转换成数字的元组
HTuple TupleNumber() const;
// Convert a tuple into a tuple of integer numbers.
//将一个元组转换成整数的元组
HTuple TupleRound() const;
// Convert a tuple into a tuple of integer numbers.
//将一个元组转换成整数的元组
HTuple TupleInt() const;
// Convert a tuple into a tuple of floating point numbers.
//将一个元组转换成浮点数的元组
HTuple TupleReal() const;
// Calculate the ldexp function of two tuples.
//计算两个元组的ldexp函数(ldexp:计算value乘以2的exp次幂)
HTuple TupleLdexp(const HTuple& T2) const;
// Calculate the remainder of the floating point division of two tuples.
//计算两个元组浮点除法的 - 余数
HTuple TupleFmod(const HTuple& T2) const;
// Calculate the remainder of the integer division of two tuples.
//计算两个元组的整数除数的 - 余数
HTuple TupleMod(const HTuple& T2) const;
// Compute the ceiling function of a tuple.
//向上取整:取大于等于数值n的最小整数
HTuple TupleCeil() const;
// Compute the floor function of a tuple.
//向下取整:取小于等于数值n的最小整数
HTuple TupleFloor() const;
// Calculate the power function of two tuples.
//计算两个元组的幂函数
HTuple TuplePow(const HTuple& T2) const;
// Compute the base 10 logarithm of a tuple.
//计算一个元组的10对数
HTuple TupleLog10() const;
// Compute the natural logarithm of a tuple.
//计算一个元组的对数Log
HTuple TupleLog() const;
// Compute the exponential of a tuple.
//计算一个元组的指数
HTuple TupleExp() const;
// Compute the hyperbolic tangent of a tuple.
//计算一个元组的双曲正切
HTuple TupleTanh() const;
// Compute the hyperbolic cosine of a tuple.
//计算一个元组的双曲余弦
HTuple TupleCosh() const;
// Compute the hyperbolic sine of a tuple.
//计算一个元组的双曲正弦
HTuple TupleSinh() const;
// Convert a tuple from degrees to radians.
//将一个元组从角度转换成弧度
HTuple TupleRad() const;
// Convert a tuple from radians to degrees.
//将一个元组从弧度转换成角度
HTuple TupleDeg() const;
// Compute the arctangent of a tuple for all four quadrants.
//计算所有四个象限的一个元组的arctan
HTuple TupleAtan2(const HTuple& X) const;
// Compute the arctangent of a tuple.
//计算一个元组的arctan()
HTuple TupleAtan() const;
// Compute the arccosine of a tuple.
//计算一个元组的反余弦
HTuple TupleAcos() const;
// Compute the arcsine of a tuple.
//计算一个元组的反正弦
HTuple TupleAsin() const;
// Compute the tangent of a tuple.
//计算一个元组的正切
HTuple TupleTan() const;
// Compute the cosine of a tuple.
//计算一个元组的cos()
HTuple TupleCos() const;
// Compute the sine of a tuple.
//计算一个元组的sin()
HTuple TupleSin() const;
// Compute the absolute value of a tuple (as floating point numbers).
//计算元组的绝对值(浮点数)
HTuple TupleFabs() const;
// Compute the square root of a tuple.
//计算元组的平方根
HTuple TupleSqrt() const;
// Compute the absolute value of a tuple.
//计算元组的绝对值
HTuple TupleAbs() const;
// Negate a tuple.
//一个元组的非?
HTuple TupleNeg() const;
// Divide two tuples.
//两个元组相除
HTuple TupleDiv(const HTuple& Q2) const;
// Multiply two tuples.
//两个元组相乘
HTuple TupleMult(const HTuple& P2) const;
// Subtract two tuples.
//两个元组相减
HTuple TupleSub(const HTuple& D2) const;
// Add two tuples.
//两个元组相加
HTuple TupleAdd(const HTuple& S2) const;
// Deserialize a serialized tuple.
//反序列化一个序列化元组
static HTuple DeserializeTuple(const HSerializedItem& SerializedItemHandle);
// Serialize a tuple.
//序列化一个元组
HSerializedItem SerializeTuple() const;
// Write a tuple to a file.
//将一个元组写入文件
void WriteTuple(const HTuple& FileName) const;
// Read a tuple from a file.
//从文件读取一个元组
static HTuple ReadTuple(const HTuple& FileName);
/***************************************************************************/
/* Compatibility Layer 兼容性层 */
/***************************************************************************/
#if defined(HCPP_LEGACY_API)
#include "HTupleLegacy.h"
#endif
#if (!defined(HCPP_LEGACY_API) || defined(_LIntDLL))
// Casts from a HTuple to element data types are disabled in legacy mode,
// as they may lead to ambiguous operator calls in existing user code
// 从HTuple到元素数据类型的强制转换在遗留模式下是禁用的,因为它们可能会导致现有用户代码中的不明确的操作调用
#if defined(HCPP_INT_OVERLOADS)
// Access integer value in first tuple element
//在第一个元组元素中访问整数值
operator int() const { return I(); }
#endif
// Access integer value in first tuple element
//在第一个元组元素中访问整数值
operator Hlong() const { return L(); }
// Access floating-point value in first tuple element
//在第一个元组元素中访问浮点值
operator float() const { return (float) D(); }
// Access floating-point value in first tuple element
//在第一个元组元素中访问浮点值
operator double() const { return D(); }
// Access string value in first tuple element
//在第一个元组元素中访问字符串值
operator HString() const { return S(); }
#endif
/***************************************************************************/
/* Operator overloads 运算符重载 */
/***************************************************************************/
/* Unary operators 一元操作符 */
bool operator ! (void) const;
HTuple operator ~ (void) const;
HTuple operator - (void) const;
HTuple &operator ++ (void);
/* Binary operators are declared below outside class HTuple 二元运算符被声明在类的外部*/
/* Selected compound operators 选择复合算子*/
HTuple& operator += (const HTuple &val);
H_COMPOUND_OP_OVERLOAD_DECLARATION(HTuple,+=)
HTuple& operator -= (const HTuple &val);
H_COMPOUND_OP_OVERLOAD_DECLARATION(HTuple,-=)
HTuple& operator *= (const HTuple &val);
H_COMPOUND_OP_OVERLOAD_DECLARATION(HTuple,*=)
/***************************************************************************/
/* Helpers for code export or extension packages, do not call in used code
用于代码导出或扩展包的助手,不要调用使用过的代码*/
/***************************************************************************/
bool Continue(const HTuple &final_value, const HTuple &increment);
// Internal use, exposed for extension packages and hdevengine only
//内部使用,只用于扩展包和hdevengine
HTuple(const Hctuple& tuple, bool copy=true);
// Internal use, exposed for extension packages and hdevengine only
//内部使用,只用于扩展包和hdevengine
Hctuple GetHctuple(bool copy) const;
const Hctuple &GetHctupleRef() const;
//被保护的!
protected:
// Create tuple wrapping internal representation
//创建元组包装内部表示
HTuple(HTupleData* data);
// Initialize during construction or from cleared tuple state
//在构造或清除元组状态期间初始化
void InitFromTupleData(HTupleData* data);
void InitFromTuple(const HTuple& tuple);
// Internal use, exposed for extension packages and hdevengine only
//内部使用,只用于扩展包和hdevengine
void SetFromHctuple(const Hctuple& tuple, bool copy/*=true*/);
// Revert internal representation to mixed tuple
//将内部表示还原为混合元组
void ConvertToMixed();
// Resolve lazy copying on write access
//解决写访问时的延迟复制
bool AssertOwnership();
protected:
// Smart pointer to typed data container
//智能指针到类型化数据容器
HTupleDataPtr* mData;
// Direct pointer for small tuple optimizations
//用于小型元组优化的直接指针
HTupleData* mDataPtr;
};
/***************************************************************************/
/* Operator overloads 运算符重载 */
/***************************************************************************/
#if defined(HCPP_OVERLOAD_TUPLE_OPERATORS)
#define H_BIN_OP_OVERLOAD_DECLARATION(RET,OP) \
LIntExport RET operator OP (const HTuple& op1, int op2 ); \
LIntExport RET operator OP (const HTuple& op1, Hlong op2 ); \
LIntExport RET operator OP (const HTuple& op1, float op2 ); \
LIntExport RET operator OP (const HTuple& op1, double op2 ); \
LIntExport RET operator OP (const HTuple& op1, const HString& op2); \
LIntExport RET operator OP (const HTuple& op1, const char* op2 ); \
LIntExport RET operator OP (const HTuple& op1, const HTupleElement& op2); \
\
LIntExport RET operator OP (const HTupleElement& op1, int op2 ); \
LIntExport RET operator OP (const HTupleElement& op1, Hlong op2 ); \
LIntExport RET operator OP (const HTupleElement& op1, float op2 ); \
LIntExport RET operator OP (const HTupleElement& op1, double op2 ); \
LIntExport RET operator OP (const HTupleElement& op1, const HString& op2 ); \
LIntExport RET operator OP (const HTupleElement& op1, const char* op2 ); \
LIntExport RET operator OP (const HTupleElement& op1, const HTupleElement &op2); \
LIntExport RET operator OP (const HTupleElement& op1, const HTuple& op2 ); \
\
LIntExport RET operator OP (int op1 ,const HTuple& op2); \
LIntExport RET operator OP (Hlong op1 ,const HTuple& op2); \
LIntExport RET operator OP (float op1 ,const HTuple& op2); \
LIntExport RET operator OP (double op1 ,const HTuple& op2); \
LIntExport RET operator OP (const HString& op1 ,const HTuple& op2); \
LIntExport RET operator OP (const char* op1 ,const HTuple& op2); \
\
LIntExport RET operator OP (int op1 ,const HTupleElement& op2); \
LIntExport RET operator OP (Hlong op1 ,const HTupleElement& op2); \
LIntExport RET operator OP (float op1 ,const HTupleElement& op2); \
LIntExport RET operator OP (double op1 ,const HTupleElement& op2); \
LIntExport RET operator OP (const HString& op1 ,const HTupleElement& op2); \
LIntExport RET operator OP (const char* op1 ,const HTupleElement& op2);
#else
#define H_BIN_OP_OVERLOAD_DECLARATION(RET,OP)
#endif
/* Arithmetic operators */
LIntExport HTuple operator +(const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(HTuple,+)
LIntExport HTuple operator - (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(HTuple,-)
LIntExport HTuple operator * (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(HTuple,*)
LIntExport HTuple operator / (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(HTuple,/)
LIntExport HTuple operator % (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(HTuple,%)
/* Boolean operators */
LIntExport bool operator == (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(bool,==)
LIntExport bool operator != (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(bool,!=)
LIntExport bool operator >= (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(bool,>=)
LIntExport bool operator <= (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(bool,<=)
LIntExport bool operator > (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(bool,>)
LIntExport bool operator < (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(bool,<)
LIntExport bool operator && (const HTuple& val1, const HTuple &val2);
// it is regarded as bad practice to overload logical operators as this leeds
// to the unexpected behaviour that both operands must be evaluated
// H_BIN_OP_OVERLOAD_DECLARATION(bool,&&)
LIntExport bool operator || (const HTuple& val1, const HTuple &val2);
// H_BIN_OP_OVERLOAD_DECLARATION(bool,||)
/* Bitwise operators */
LIntExport HTuple operator | (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(HTuple,|)
LIntExport HTuple operator & (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(HTuple,&)
LIntExport HTuple operator ^ (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(HTuple,^)
LIntExport HTuple operator << (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(HTuple,<<)
LIntExport HTuple operator >> (const HTuple& val1, const HTuple &val2);
H_BIN_OP_OVERLOAD_DECLARATION(HTuple,>>)
}
#endif