/*********************************************************** * File generated by the HALCON-Compiler hcomp version 20.11 * 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 text or binary format. explicit HFile(const HString& FileName, const HTuple& FileType); // open_file: Open a file in text or binary format. explicit HFile(const HString& FileName, const HString& FileType); // open_file: Open a file in text or binary format. explicit HFile(const char* FileName, const char* FileType); #ifdef _WIN32 // open_file: Open a file in text or binary format. explicit HFile(const wchar_t* FileName, const wchar_t* FileType); #endif /*************************************************************************** * Operators * ***************************************************************************/ // Open a file in text or binary format. void OpenFile(const HString& FileName, const HTuple& FileType); // Open a file in text or binary format. void OpenFile(const HString& FileName, const HString& FileType); // Open a file in text or binary format. void OpenFile(const char* FileName, const char* FileType); #ifdef _WIN32 // Open a file in text or binary format. void OpenFile(const wchar_t* FileName, const wchar_t* FileType); #endif // Write strings and numbers into a text file. void FwriteString(const HTuple& String) const; // Write strings and numbers into a text file. void FwriteString(const HString& String) const; // Write strings and numbers into a text file. void FwriteString(const char* String) const; #ifdef _WIN32 // Write strings and numbers into a text file. void FwriteString(const wchar_t* String) const; #endif // Read a character line from a text file. HString FreadLine(Hlong* IsEOF) const; // Read a string from a text file. HString FreadString(Hlong* IsEOF) const; // Read one character from a text file. HString FreadChar() const; // Write a line break and clear the output buffer. void FnewLine() const; // Closing a text file. static void CloseFile(const HFileArray& FileHandle); // Closing a text file. void CloseFile() const; // Read bytes from a binary file. HTuple FreadBytes(Hlong NumberOfBytes, Hlong* IsEOF) const; // Write bytes to a binary file. Hlong FwriteBytes(const HTuple& DataToWrite) const; }; // forward declarations and types for internal array implementation template class HSmartPtr; template class HHandleBaseArrayRef; typedef HHandleBaseArrayRef 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