191 lines
4.8 KiB
C++
191 lines
4.8 KiB
C++
/***********************************************************
|
|
* File generated by the HALCON-Compiler hcomp version 20.11
|
|
* Usage: Interface to C++
|
|
*
|
|
* Software by: MVTec Software GmbH, www.mvtec.com
|
|
***********************************************************/
|
|
|
|
|
|
#ifndef HCPP_HLEXICON
|
|
#define HCPP_HLEXICON
|
|
|
|
namespace HalconCpp
|
|
{
|
|
|
|
// Represents an instance of a lexicon.
|
|
class LIntExport HLexicon : public HHandle
|
|
{
|
|
|
|
public:
|
|
|
|
// Create an uninitialized instance
|
|
HLexicon():HHandle() {}
|
|
|
|
// Copy constructor
|
|
HLexicon(const HLexicon& source) : HHandle(source) {}
|
|
|
|
// Copy constructor
|
|
HLexicon(const HHandle& handle);
|
|
|
|
// Create HLexicon from handle, taking ownership
|
|
explicit HLexicon(Hlong handle);
|
|
|
|
bool operator==(const HHandle& obj) const
|
|
{
|
|
return HHandleBase::operator==(obj);
|
|
}
|
|
|
|
bool operator!=(const HHandle& obj) const
|
|
{
|
|
return HHandleBase::operator!=(obj);
|
|
}
|
|
|
|
protected:
|
|
|
|
// Verify matching semantic type ('lexicon')!
|
|
virtual void AssertType(Hphandle handle) const;
|
|
|
|
public:
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
* Operator-based class constructors
|
|
*****************************************************************************/
|
|
|
|
// import_lexicon: Create a lexicon from a text file.
|
|
explicit HLexicon(const HString& Name, const HString& FileName);
|
|
|
|
// import_lexicon: Create a lexicon from a text file.
|
|
explicit HLexicon(const char* Name, const char* FileName);
|
|
|
|
#ifdef _WIN32
|
|
// import_lexicon: Create a lexicon from a text file.
|
|
explicit HLexicon(const wchar_t* Name, const wchar_t* FileName);
|
|
#endif
|
|
|
|
// create_lexicon: Create a lexicon from a tuple of words.
|
|
explicit HLexicon(const HString& Name, const HTuple& Words);
|
|
|
|
// create_lexicon: Create a lexicon from a tuple of words.
|
|
explicit HLexicon(const char* Name, const HTuple& Words);
|
|
|
|
#ifdef _WIN32
|
|
// create_lexicon: Create a lexicon from a tuple of words.
|
|
explicit HLexicon(const wchar_t* Name, const HTuple& Words);
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
* Operators *
|
|
***************************************************************************/
|
|
|
|
// Clear a lexicon.
|
|
void ClearLexicon() const;
|
|
|
|
// Find a similar word in a lexicon.
|
|
HString SuggestLexicon(const HString& Word, Hlong* NumCorrections) const;
|
|
|
|
// Find a similar word in a lexicon.
|
|
HString SuggestLexicon(const char* Word, Hlong* NumCorrections) const;
|
|
|
|
#ifdef _WIN32
|
|
// Find a similar word in a lexicon.
|
|
HString SuggestLexicon(const wchar_t* Word, Hlong* NumCorrections) const;
|
|
#endif
|
|
|
|
// Check if a word is contained in a lexicon.
|
|
Hlong LookupLexicon(const HString& Word) const;
|
|
|
|
// Check if a word is contained in a lexicon.
|
|
Hlong LookupLexicon(const char* Word) const;
|
|
|
|
#ifdef _WIN32
|
|
// Check if a word is contained in a lexicon.
|
|
Hlong LookupLexicon(const wchar_t* Word) const;
|
|
#endif
|
|
|
|
// Query all words from a lexicon.
|
|
HTuple InspectLexicon() const;
|
|
|
|
// Create a lexicon from a text file.
|
|
void ImportLexicon(const HString& Name, const HString& FileName);
|
|
|
|
// Create a lexicon from a text file.
|
|
void ImportLexicon(const char* Name, const char* FileName);
|
|
|
|
#ifdef _WIN32
|
|
// Create a lexicon from a text file.
|
|
void ImportLexicon(const wchar_t* Name, const wchar_t* FileName);
|
|
#endif
|
|
|
|
// Create a lexicon from a tuple of words.
|
|
void CreateLexicon(const HString& Name, const HTuple& Words);
|
|
|
|
// Create a lexicon from a tuple of words.
|
|
void CreateLexicon(const char* Name, const HTuple& Words);
|
|
|
|
#ifdef _WIN32
|
|
// Create a lexicon from a tuple of words.
|
|
void CreateLexicon(const wchar_t* Name, const HTuple& Words);
|
|
#endif
|
|
|
|
};
|
|
|
|
// forward declarations and types for internal array implementation
|
|
|
|
template<class T> class HSmartPtr;
|
|
template<class T> class HHandleBaseArrayRef;
|
|
|
|
typedef HHandleBaseArrayRef<HLexicon> HLexiconArrayRef;
|
|
typedef HSmartPtr< HLexiconArrayRef > HLexiconArrayPtr;
|
|
|
|
|
|
// Represents multiple tool instances
|
|
class LIntExport HLexiconArray : public HHandleBaseArray
|
|
{
|
|
|
|
public:
|
|
|
|
// Create empty array
|
|
HLexiconArray();
|
|
|
|
// Create array from native array of tool instances
|
|
HLexiconArray(HLexicon* classes, Hlong length);
|
|
|
|
// Copy constructor
|
|
HLexiconArray(const HLexiconArray &tool_array);
|
|
|
|
// Destructor
|
|
virtual ~HLexiconArray();
|
|
|
|
// Assignment operator
|
|
HLexiconArray &operator=(const HLexiconArray &tool_array);
|
|
|
|
// Clears array and all tool instances
|
|
virtual void Clear();
|
|
|
|
// Get array of native tool instances
|
|
const HLexicon* Tools() const;
|
|
|
|
// Get number of tools
|
|
virtual Hlong Length() const;
|
|
|
|
// Create tool array from tuple of handles
|
|
virtual void SetFromTuple(const HTuple& handles);
|
|
|
|
// Get tuple of handles for tool array
|
|
virtual HTuple ConvertToTuple() const;
|
|
|
|
protected:
|
|
|
|
// Smart pointer to internal data container
|
|
HLexiconArrayPtr *mArrayPtr;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|