/** * @file include/ActivMiddleware/ActivBase/IFileMappedMemory.h * * @brief Header file for the file mapped memory interface class. */ #if (!defined ACTIV_BASE_IFILE_MAPPED_MEMORY_H) #define ACTIV_BASE_IFILE_MAPPED_MEMORY_H #include "ActivMiddleware/ActivBase/External.h" #include "ActivMiddleware/ActivBase/IMappedMemory.h" #include "ActivMiddleware/Misc/TypeSafeFlags.h" //! Activ namespace. namespace Activ { /** * @brief Abstract base file mapped memory class. */ class IFileMappedMemory : public IMappedMemory { public: static const size_t USE_CURRENT_FILE_SIZE = 0; ///< Used for creating a mapping of the current file size. //! Flags. class FileFlags : public TypeSafeFlags::Underlying { public: typedef TypeSafeFlags::Value None; typedef TypeSafeFlags::Value CreateAlways; ///< Always create new file. typedef TypeSafeFlags::Value OpenExisting; ///< Open existing file, fail if file doesn't exist. typedef TypeSafeFlags::Value ReadOnly; ///< Open file in read only mode. typedef TypeSafeFlags::Value DeleteAtClose; ///< Delete the file when the handle to it is closed. typedef TypeSafeFlags::Type Type; }; //! Destructor. virtual ~IFileMappedMemory() = 0; /** * @brief Resize a memory mapped file. * * @param size the new size of the memory mapped file. * * @return a pointer to the new mapped memory region. * * @throw Exception */ virtual void *Resize(const size_t size) = 0; /** * @brief Flush the memory mapped file to the disk. * * @param nBytesToFlush the number of bytes to flush, starting from the beginning of the file. Default flush all. * * @throw Exception */ virtual void Flush(const size_t nBytesToFlush = 0) const = 0; }; // --------------------------------------------------------------------------------------------------------------------------------- inline IFileMappedMemory::~IFileMappedMemory() { } } // namespace Activ #endif // (!defined ACTIV_BASE_IFILE_MAPPED_MEMORY_H)