1 ////////////////////////////////////////////////////////////////////////////// 2 // 3 // (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost 4 // Software License, Version 1.0. (See accompanying file 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 // 7 // See http://www.boost.org/libs/interprocess for documentation. 8 // 9 ////////////////////////////////////////////////////////////////////////////// 10 11 #ifndef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_FILE_WRAPPER_HPP 12 #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_FILE_WRAPPER_HPP 13 14 #ifndef BOOST_CONFIG_HPP 15 # include <boost/config.hpp> 16 #endif 17 # 18 #if defined(BOOST_HAS_PRAGMA_ONCE) 19 # pragma once 20 #endif 21 22 #include <boost/interprocess/detail/config_begin.hpp> 23 #include <boost/interprocess/detail/workaround.hpp> 24 #include <boost/detail/workaround.hpp> 25 26 #if !defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) 27 #error "This header can't be used in operating systems without XSI (System V) shared memory support" 28 #endif 29 30 #include <boost/interprocess/creation_tags.hpp> 31 #include <boost/interprocess/exceptions.hpp> 32 #include <boost/interprocess/detail/utilities.hpp> 33 #include <boost/interprocess/detail/os_file_functions.hpp> 34 #include <boost/interprocess/detail/shared_dir_helpers.hpp> 35 #include <boost/interprocess/interprocess_fwd.hpp> 36 #include <boost/interprocess/exceptions.hpp> 37 38 #include <boost/interprocess/xsi_shared_memory.hpp> 39 40 //!\file 41 //!Describes a class representing a pseudo-file implemented on top of xsi shared memory. 42 43 namespace boost { 44 namespace interprocess { 45 46 class xsi_shared_memory_file_wrapper 47 : public xsi_shared_memory 48 { 49 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) 50 BOOST_MOVABLE_BUT_NOT_COPYABLE(xsi_shared_memory_file_wrapper) 51 #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED 52 public: 53 xsi_shared_memory_file_wrapper()54 xsi_shared_memory_file_wrapper() : xsi_shared_memory() {} 55 xsi_shared_memory_file_wrapper(create_only_t,const xsi_key & key,mode_t,std::size_t size,const permissions & perm=permissions ())56 xsi_shared_memory_file_wrapper(create_only_t, const xsi_key &key, mode_t , std::size_t size, const permissions& perm = permissions()) 57 : xsi_shared_memory(create_only_t(), key, size, perm.get_permissions()) 58 {} 59 xsi_shared_memory_file_wrapper(open_or_create_t,const xsi_key & key,mode_t,std::size_t size,const permissions & perm=permissions ())60 xsi_shared_memory_file_wrapper(open_or_create_t, const xsi_key &key, mode_t , std::size_t size, const permissions& perm = permissions()) 61 : xsi_shared_memory(open_or_create_t(), key, size, perm.get_permissions()) 62 {} 63 xsi_shared_memory_file_wrapper(open_only_t,const xsi_key & key,mode_t,const permissions &=permissions ())64 xsi_shared_memory_file_wrapper(open_only_t, const xsi_key &key, mode_t, const permissions& = permissions()) 65 : xsi_shared_memory(open_only_t(), key) 66 {} 67 xsi_shared_memory_file_wrapper(BOOST_RV_REF (xsi_shared_memory_file_wrapper)moved)68 xsi_shared_memory_file_wrapper(BOOST_RV_REF(xsi_shared_memory_file_wrapper) moved) 69 { this->swap(moved); } 70 operator =(BOOST_RV_REF (xsi_shared_memory_file_wrapper)moved)71 xsi_shared_memory_file_wrapper &operator=(BOOST_RV_REF(xsi_shared_memory_file_wrapper) moved) 72 { 73 xsi_shared_memory_file_wrapper tmp(boost::move(moved)); 74 this->swap(tmp); 75 return *this; 76 } 77 78 //!Swaps two xsi_shared_memory_file_wrapper. Does not throw swap(xsi_shared_memory_file_wrapper & other)79 void swap(xsi_shared_memory_file_wrapper &other) 80 { this->xsi_shared_memory::swap(other); } 81 }; 82 83 } //namespace interprocess { 84 } //namespace boost { 85 86 #include <boost/interprocess/detail/config_end.hpp> 87 88 #endif //BOOST_INTERPROCESS_XSI_SHARED_MEMORY_FILE_WRAPPER_HPP 89