65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
/**
|
|
* @file include/ActivMiddleware/ActivBase/IMappedMemory.h
|
|
*
|
|
* @brief Header file for the mapped memory interface class.
|
|
*/
|
|
|
|
#if (!defined ACTIV_BASE_IMAPPED_MEMORY_H)
|
|
#define ACTIV_BASE_IMAPPED_MEMORY_H
|
|
|
|
#include "ActivMiddleware/ActivBase/External.h"
|
|
#include "ActivMiddleware/Misc/TypeSafeFlags.h"
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
/**
|
|
* @brief Abstract base mapped memory class.
|
|
*/
|
|
class IMappedMemory : private Boost::noncopyable
|
|
{
|
|
public:
|
|
//! Flags.
|
|
class MappingFlags : public TypeSafeFlags::Underlying<uint32_t>
|
|
{
|
|
public:
|
|
typedef TypeSafeFlags::Value<MappingFlags, 0x00000000> None;
|
|
typedef TypeSafeFlags::Value<MappingFlags, 0x00000001> ReadOnly; ///< Read only access to the mapped memory segment.
|
|
typedef TypeSafeFlags::Value<MappingFlags, 0x00000002> Unique; ///< A named segment cannot already exist when creating.
|
|
typedef TypeSafeFlags::Value<MappingFlags, 0x00000004> Locked; ///< Lock the mapped data in memory (Posix only).
|
|
typedef TypeSafeFlags::Value<MappingFlags, 0x00000008> OverrideIpcGroupId; ///< Use group id as set in environment variable as owner of the mapped memory file (Posix only).
|
|
typedef TypeSafeFlags::Value<MappingFlags, 0x00000010> TryHugePages; ///< Try to use huge pages with the mapped memory file (Posix only).
|
|
typedef TypeSafeFlags::Type<MappingFlags, None> Type;
|
|
};
|
|
|
|
/**
|
|
* @brief Destructor.
|
|
*/
|
|
virtual ~IMappedMemory() = 0;
|
|
|
|
/**
|
|
* @brief Get pointer to mapped memory.
|
|
*
|
|
* @return Pointer to mapped memory.
|
|
*/
|
|
virtual void *GetPointer() const = 0;
|
|
|
|
/**
|
|
* @brief Get size of mapped memory.
|
|
*
|
|
* @return Size.
|
|
*/
|
|
virtual size_t GetSize() const = 0;
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline IMappedMemory::~IMappedMemory()
|
|
{
|
|
}
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_BASE_IMAPPED_MEMORY_H)
|