123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- /***********************************************************
- * 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 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
|