Files
externals/linux/include/ActivMiddleware/ActivBase/PagingFileMappedMemoryFactory.h

87 lines
2.6 KiB
C++

/**
* @file include/ActivMiddleware/ActivBase/PagingFileMappedMemoryFactory.h
*
* @brief Header file for the paging file mapped memory factory class.
*/
#if (!defined ACTIV_BASE_PAGING_FILE_MAPPED_MEMORY_FACTORY_H)
#define ACTIV_BASE_PAGING_FILE_MAPPED_MEMORY_FACTORY_H
#include "ActivMiddleware/ActivBase/External.h"
#include "ActivMiddleware/ActivBase/IMappedMemory.h"
#include "ActivMiddleware/ActivBase/Timeout.h"
#include "ActivMiddleware/Misc/Singleton.h"
//! Activ namespace.
namespace Activ
{
/**
* @brief Paging file mapped memory factory class.
*/
class PagingFileMappedMemoryFactory : public Singleton<PagingFileMappedMemoryFactory>
{
public:
/**
* @brief Create a paging file mapped memory segment that can be shared via name.
*
* @param name the name of the mapped memory segment.
* @param size the size of the mapped memory segment.
* @param mappingFlags creation flags.
*
* @return Pointer to an object providing an IMappedMemory interface.
*
* @throw Exception
*/
ACTIV_BASE_API IMappedMemory *Create(const String &name, const size_t size,
const IMappedMemory::MappingFlags::Type mappingFlags = IMappedMemory::MappingFlags::Type());
/**
* @brief Create an anonymous paging file mapped memory segment.
*
* @param size the size of the mapped memory segment.
* @param mappingFlags creation flags.
*
* @return Pointer to an object providing an IMappedMemory interface.
*
* @throw Exception
*/
ACTIV_BASE_API IMappedMemory *Create(const size_t size,
const IMappedMemory::MappingFlags::Type mappingFlags = IMappedMemory::MappingFlags::Type());
/**
* @brief Open an existing paging file mapped memory segment.
*
* @param name the name of the mapped memory segment.
* @param mappingFlags flags that indicate how the memory segment should be mapped.
* @param timeout object specifying how long to wait for the segment to exist, in ms.
*
* @return pointer to an object providing an IMappedMemory interface.
*
* @throw OsException
* @throw BaseException
*/
ACTIV_BASE_API IMappedMemory *Open(const String &name,
const IMappedMemory::MappingFlags::Type mappingFlags = IMappedMemory::MappingFlags::Type(),
Timeout &timeout = Timeout::GetInfinite());
/**
* @brief Get a reference to the singleton instance.
*
* @return Reference.
*/
ACTIV_BASE_API static PagingFileMappedMemoryFactory &GetInstance();
private:
/**
* @brief Default constructor.
*/
ACTIV_BASE_API PagingFileMappedMemoryFactory();
friend class Singleton<PagingFileMappedMemoryFactory>;
};
} // namespace Activ
#endif // (!defined ACTIV_BASE_PAGING_FILE_MAPPED_MEMORY_FACTORY_H)