158 lines
3.6 KiB
C++
158 lines
3.6 KiB
C++
/***********************************************************
|
|||
|
|
* File generated by the HALCON-Compiler hcomp version 18.05
|
||
|
|
* Usage: Interface to C++
|
||
|
|
*
|
||
|
|
* Software by: MVTec Software GmbH, www.mvtec.com
|
||
|
|
***********************************************************/
|
||
|
|
|
||
|
|
|
||
|
|
#ifndef HCPP_HFILE
|
||
|
|
#define HCPP_HFILE
|
||
|
|
|
||
|
|
namespace HalconCpp
|
||
|
|
{
|
||
|
|
|
||
|
|
// Represents an instance of a file.
|
||
|
|
class LIntExport HFile : public HHandle
|
||
|
|
{
|
||
|
|
|
||
|
|
public:
|
||
|
|
|
||
|
|
// Create an uninitialized instance
|
||
|
|
HFile():HHandle() {}
|
||
|
|
|
||
|
|
// Copy constructor
|
||
|
|
HFile(const HFile& source) : HHandle(source) {}
|
||
|
|
|
||
|
|
// Copy constructor
|
||
|
|
HFile(const HHandle& handle);
|
||
|
|
|
||
|
|
// Create HFile from handle, taking ownership
|
||
|
|
explicit HFile(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 ('file')!
|
||
|
|
virtual void AssertType(Hphandle handle) const;
|
||
|
|
|
||
|
|
public:
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/*****************************************************************************
|
||
|
|
* Operator-based class constructors
|
||
|
|
*****************************************************************************/
|
||
|
|
|
||
|
|
// open_file: Open a file in ASCII or a binary format.
|
||
|
|
explicit HFile(const HString& FileName, const HString& FileType);
|
||
|
|
|
||
|
|
// open_file: Open a file in ASCII or a binary format.
|
||
|
|
explicit HFile(const char* FileName, const char* FileType);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/***************************************************************************
|
||
|
|
* Operators *
|
||
|
|
***************************************************************************/
|
||
|
|
|
||
|
|
// Open a file in ASCII or a binary format.
|
||
|
|
void OpenFile(const HString& FileName, const HString& FileType);
|
||
|
|
|
||
|
|
// Open a file in ASCII or a binary format.
|
||
|
|
void OpenFile(const char* FileName, const char* FileType);
|
||
|
|
|
||
|
|
// Write values in a file.
|
||
|
|
void FwriteString(const HTuple& String) const;
|
||
|
|
|
||
|
|
// Write values in a file.
|
||
|
|
void FwriteString(const HString& String) const;
|
||
|
|
|
||
|
|
// Write values in a file.
|
||
|
|
void FwriteString(const char* String) const;
|
||
|
|
|
||
|
|
// Read a line from a file.
|
||
|
|
HString FreadLine(Hlong* IsEOF) const;
|
||
|
|
|
||
|
|
// Read strings from a file.
|
||
|
|
HString FreadString(Hlong* IsEOF) const;
|
||
|
|
|
||
|
|
// Read a character from a file.
|
||
|
|
HString FreadChar() const;
|
||
|
|
|
||
|
|
// Create a line feed.
|
||
|
|
void FnewLine() const;
|
||
|
|
|
||
|
|
// Closing a text file.
|
||
|
|
static void CloseFile(const HFileArray& FileHandle);
|
||
|
|
|
||
|
|
// Closing a text file.
|
||
|
|
void CloseFile() const;
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
// forward declarations and types for internal array implementation
|
||
|
|
|
||
|
|
template<class T> class HSmartPtr;
|
||
|
|
template<class T> class HHandleBaseArrayRef;
|
||
|
|
|
||
|
|
typedef HHandleBaseArrayRef<HFile> HFileArrayRef;
|
||
|
|
typedef HSmartPtr< HFileArrayRef > HFileArrayPtr;
|
||
|
|
|
||
|
|
|
||
|
|
// Represents multiple tool instances
|
||
|
|
class LIntExport HFileArray : public HHandleBaseArray
|
||
|
|
{
|
||
|
|
|
||
|
|
public:
|
||
|
|
|
||
|
|
// Create empty array
|
||
|
|
HFileArray();
|
||
|
|
|
||
|
|
// Create array from native array of tool instances
|
||
|
|
HFileArray(HFile* classes, Hlong length);
|
||
|
|
|
||
|
|
// Copy constructor
|
||
|
|
HFileArray(const HFileArray &tool_array);
|
||
|
|
|
||
|
|
// Destructor
|
||
|
|
virtual ~HFileArray();
|
||
|
|
|
||
|
|
// Assignment operator
|
||
|
|
HFileArray &operator=(const HFileArray &tool_array);
|
||
|
|
|
||
|
|
// Clears array and all tool instances
|
||
|
|
virtual void Clear();
|
||
|
|
|
||
|
|
// Get array of native tool instances
|
||
|
|
const HFile* 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
|
||
|
|
HFileArrayPtr *mArrayPtr;
|
||
|
|
};
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif
|