#ifndef _ANONYMOUS_SHARED_MEMORY_HEADER_INCLUDED_
#define _ANONYMOUS_SHARED_MEMORY_HEADER_INCLUDED_

#include <errno.h>
#include <string.h>
#include <strings.h>
#include <sys/types.h>
#include <sys/mman.h>

#ifndef MAP_ANON
#include <fcntl.h>
#include <unistd.h>
#endif

#include <stdexcept>
#include <iostream>
#include <sstream>
#include <string>

class AnonymousSharedMemory
{
	public:
		AnonymousSharedMemory(size_t size) throw (std::runtime_error);
		~AnonymousSharedMemory();
		void * segment();
	private:
		void *_segment;
		size_t _size;
#ifndef MAP_ANON
		int _devzerofd;
#endif
};

#endif /* _ANONYMOUS_SHARED_MEMORY_HEADER_INCLUDED_ */

