254 lines
7.8 KiB
C++
254 lines
7.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_HMESSAGE
|
|
#define HCPP_HMESSAGE
|
|
|
|
namespace HalconCpp
|
|
{
|
|
|
|
// Represents an instance of a data container to be sent via message queues.
|
|
class LIntExport HMessage : public HHandle
|
|
{
|
|
|
|
public:
|
|
|
|
// Copy constructor
|
|
HMessage(const HMessage& source) : HHandle(source) {}
|
|
|
|
// Copy constructor
|
|
HMessage(const HHandle& handle);
|
|
|
|
// Create HMessage from handle, taking ownership
|
|
explicit HMessage(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 ('message')!
|
|
virtual void AssertType(Hphandle handle) const;
|
|
|
|
public:
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
* Operator-based class constructors
|
|
*****************************************************************************/
|
|
|
|
// create_message: Create a new empty message.
|
|
explicit HMessage();
|
|
|
|
// read_message: Read a message from a file.
|
|
explicit HMessage(const HString& FileName, const HTuple& GenParamName, const HTuple& GenParamValue);
|
|
|
|
// read_message: Read a message from a file.
|
|
explicit HMessage(const HString& FileName, const HString& GenParamName, const HString& GenParamValue);
|
|
|
|
// read_message: Read a message from a file.
|
|
explicit HMessage(const char* FileName, const char* GenParamName, const char* GenParamValue);
|
|
|
|
#ifdef _WIN32
|
|
// read_message: Read a message from a file.
|
|
explicit HMessage(const wchar_t* FileName, const wchar_t* GenParamName, const wchar_t* GenParamValue);
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
* Operators *
|
|
***************************************************************************/
|
|
|
|
// Query message parameters or information about the message.
|
|
HTuple GetMessageParam(const HString& GenParamName, const HTuple& Key) const;
|
|
|
|
// Query message parameters or information about the message.
|
|
HTuple GetMessageParam(const HString& GenParamName, const HString& Key) const;
|
|
|
|
// Query message parameters or information about the message.
|
|
HTuple GetMessageParam(const char* GenParamName, const char* Key) const;
|
|
|
|
#ifdef _WIN32
|
|
// Query message parameters or information about the message.
|
|
HTuple GetMessageParam(const wchar_t* GenParamName, const wchar_t* Key) const;
|
|
#endif
|
|
|
|
// Set message parameter or invoke commands on the message.
|
|
void SetMessageParam(const HString& GenParamName, const HTuple& Key, const HTuple& GenParamValue) const;
|
|
|
|
// Set message parameter or invoke commands on the message.
|
|
void SetMessageParam(const HString& GenParamName, const HString& Key, const HTuple& GenParamValue) const;
|
|
|
|
// Set message parameter or invoke commands on the message.
|
|
void SetMessageParam(const char* GenParamName, const char* Key, const HTuple& GenParamValue) const;
|
|
|
|
#ifdef _WIN32
|
|
// Set message parameter or invoke commands on the message.
|
|
void SetMessageParam(const wchar_t* GenParamName, const wchar_t* Key, const HTuple& GenParamValue) const;
|
|
#endif
|
|
|
|
// Retrieve an object associated with the key from the message.
|
|
HObject GetMessageObj(const HTuple& Key) const;
|
|
|
|
// Retrieve an object associated with the key from the message.
|
|
HObject GetMessageObj(const HString& Key) const;
|
|
|
|
// Retrieve an object associated with the key from the message.
|
|
HObject GetMessageObj(const char* Key) const;
|
|
|
|
#ifdef _WIN32
|
|
// Retrieve an object associated with the key from the message.
|
|
HObject GetMessageObj(const wchar_t* Key) const;
|
|
#endif
|
|
|
|
// Add a key/object pair to the message.
|
|
void SetMessageObj(const HObject& ObjectData, const HTuple& Key) const;
|
|
|
|
// Add a key/object pair to the message.
|
|
void SetMessageObj(const HObject& ObjectData, const HString& Key) const;
|
|
|
|
// Add a key/object pair to the message.
|
|
void SetMessageObj(const HObject& ObjectData, const char* Key) const;
|
|
|
|
#ifdef _WIN32
|
|
// Add a key/object pair to the message.
|
|
void SetMessageObj(const HObject& ObjectData, const wchar_t* Key) const;
|
|
#endif
|
|
|
|
// Retrieve a tuple associated with the key from the message.
|
|
HTuple GetMessageTuple(const HTuple& Key) const;
|
|
|
|
// Retrieve a tuple associated with the key from the message.
|
|
HTuple GetMessageTuple(const HString& Key) const;
|
|
|
|
// Retrieve a tuple associated with the key from the message.
|
|
HTuple GetMessageTuple(const char* Key) const;
|
|
|
|
#ifdef _WIN32
|
|
// Retrieve a tuple associated with the key from the message.
|
|
HTuple GetMessageTuple(const wchar_t* Key) const;
|
|
#endif
|
|
|
|
// Add a key/tuple pair to the message.
|
|
void SetMessageTuple(const HTuple& Key, const HTuple& TupleData) const;
|
|
|
|
// Add a key/tuple pair to the message.
|
|
void SetMessageTuple(const HString& Key, const HTuple& TupleData) const;
|
|
|
|
// Add a key/tuple pair to the message.
|
|
void SetMessageTuple(const char* Key, const HTuple& TupleData) const;
|
|
|
|
#ifdef _WIN32
|
|
// Add a key/tuple pair to the message.
|
|
void SetMessageTuple(const wchar_t* Key, const HTuple& TupleData) const;
|
|
#endif
|
|
|
|
// Close a message handle and release all associated resources.
|
|
static void ClearMessage(const HMessageArray& MessageHandle);
|
|
|
|
// Close a message handle and release all associated resources.
|
|
void ClearMessage() const;
|
|
|
|
// Create a new empty message.
|
|
void CreateMessage();
|
|
|
|
// Read a message from a file.
|
|
void ReadMessage(const HString& FileName, const HTuple& GenParamName, const HTuple& GenParamValue);
|
|
|
|
// Read a message from a file.
|
|
void ReadMessage(const HString& FileName, const HString& GenParamName, const HString& GenParamValue);
|
|
|
|
// Read a message from a file.
|
|
void ReadMessage(const char* FileName, const char* GenParamName, const char* GenParamValue);
|
|
|
|
#ifdef _WIN32
|
|
// Read a message from a file.
|
|
void ReadMessage(const wchar_t* FileName, const wchar_t* GenParamName, const wchar_t* GenParamValue);
|
|
#endif
|
|
|
|
// Write a message to a file.
|
|
void WriteMessage(const HString& FileName, const HTuple& GenParamName, const HTuple& GenParamValue) const;
|
|
|
|
// Write a message to a file.
|
|
void WriteMessage(const HString& FileName, const HString& GenParamName, const HString& GenParamValue) const;
|
|
|
|
// Write a message to a file.
|
|
void WriteMessage(const char* FileName, const char* GenParamName, const char* GenParamValue) const;
|
|
|
|
#ifdef _WIN32
|
|
// Write a message to a file.
|
|
void WriteMessage(const wchar_t* FileName, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
|
|
#endif
|
|
|
|
};
|
|
|
|
// forward declarations and types for internal array implementation
|
|
|
|
template<class T> class HSmartPtr;
|
|
template<class T> class HHandleBaseArrayRef;
|
|
|
|
typedef HHandleBaseArrayRef<HMessage> HMessageArrayRef;
|
|
typedef HSmartPtr< HMessageArrayRef > HMessageArrayPtr;
|
|
|
|
|
|
// Represents multiple tool instances
|
|
class LIntExport HMessageArray : public HHandleBaseArray
|
|
{
|
|
|
|
public:
|
|
|
|
// Create empty array
|
|
HMessageArray();
|
|
|
|
// Create array from native array of tool instances
|
|
HMessageArray(HMessage* classes, Hlong length);
|
|
|
|
// Copy constructor
|
|
HMessageArray(const HMessageArray &tool_array);
|
|
|
|
// Destructor
|
|
virtual ~HMessageArray();
|
|
|
|
// Assignment operator
|
|
HMessageArray &operator=(const HMessageArray &tool_array);
|
|
|
|
// Clears array and all tool instances
|
|
virtual void Clear();
|
|
|
|
// Get array of native tool instances
|
|
const HMessage* 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
|
|
HMessageArrayPtr *mArrayPtr;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|