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