annotate DEPENDENCIES/generic/include/boost/interprocess/xsi_key.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //////////////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@16 3 // (C) Copyright Ion Gaztanaga 2009. Distributed under the Boost
Chris@16 4 // Software License, Version 1.0. (See accompanying file
Chris@16 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 //
Chris@16 7 // See http://www.boost.org/libs/interprocess for documentation.
Chris@16 8 //
Chris@16 9 //////////////////////////////////////////////////////////////////////////////
Chris@16 10
Chris@16 11 #ifndef BOOST_INTERPROCESS_XSI_KEY_HPP
Chris@16 12 #define BOOST_INTERPROCESS_XSI_KEY_HPP
Chris@16 13
Chris@101 14 #ifndef BOOST_CONFIG_HPP
Chris@101 15 # include <boost/config.hpp>
Chris@101 16 #endif
Chris@101 17 #
Chris@101 18 #if defined(BOOST_HAS_PRAGMA_ONCE)
Chris@101 19 # pragma once
Chris@101 20 #endif
Chris@101 21
Chris@16 22 #include <boost/interprocess/detail/config_begin.hpp>
Chris@16 23 #include <boost/interprocess/detail/workaround.hpp>
Chris@16 24 #include <boost/detail/workaround.hpp>
Chris@16 25
Chris@16 26 #if !defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
Chris@16 27 #error "This header can't be used in operating systems without XSI (System V) shared memory support"
Chris@16 28 #endif
Chris@16 29
Chris@16 30 #include <boost/interprocess/creation_tags.hpp>
Chris@16 31 #include <boost/interprocess/exceptions.hpp>
Chris@16 32 #include <boost/interprocess/detail/utilities.hpp>
Chris@101 33 #include <boost/move/utility_core.hpp>
Chris@16 34 #include <boost/interprocess/detail/os_file_functions.hpp>
Chris@16 35 #include <boost/interprocess/interprocess_fwd.hpp>
Chris@16 36 #include <boost/interprocess/exceptions.hpp>
Chris@16 37 #include <sys/types.h>
Chris@16 38 #include <sys/ipc.h>
Chris@16 39 #include <cstddef>
Chris@16 40 #include <boost/cstdint.hpp>
Chris@16 41
Chris@16 42 //!\file
Chris@16 43 //!Describes a class representing a xsi key type.
Chris@16 44
Chris@16 45 namespace boost {
Chris@16 46 namespace interprocess {
Chris@16 47
Chris@16 48 //!A class that wraps XSI (System V) key_t type.
Chris@16 49 //!This type calculates key_t from path and id using ftok
Chris@16 50 //!or sets key to IPC_PRIVATE using the default constructor.
Chris@16 51 class xsi_key
Chris@16 52 {
Chris@16 53 public:
Chris@16 54
Chris@16 55 //!Default constructor.
Chris@16 56 //!Represents a private xsi_key.
Chris@16 57 xsi_key()
Chris@16 58 : m_key(IPC_PRIVATE)
Chris@16 59 {}
Chris@16 60
Chris@16 61 //!Creates a new XSI shared memory with a key obtained from a call to ftok (with path
Chris@16 62 //!"path" and id "id"), of size "size" and permissions "perm".
Chris@16 63 //!If the shared memory previously exists, throws an error.
Chris@16 64 xsi_key(const char *path, boost::uint8_t id)
Chris@16 65 {
Chris@101 66 key_t key;
Chris@16 67 if(path){
Chris@16 68 key = ::ftok(path, id);
Chris@16 69 if(((key_t)-1) == key){
Chris@16 70 error_info err = system_error_code();
Chris@16 71 throw interprocess_exception(err);
Chris@16 72 }
Chris@16 73 }
Chris@16 74 else{
Chris@16 75 key = IPC_PRIVATE;
Chris@16 76 }
Chris@16 77 m_key = key;
Chris@16 78 }
Chris@16 79
Chris@16 80 //!Returns the internal key_t value
Chris@16 81 key_t get_key() const
Chris@16 82 { return m_key; }
Chris@16 83
Chris@101 84 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
Chris@16 85 private:
Chris@16 86 key_t m_key;
Chris@101 87 #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
Chris@16 88 };
Chris@16 89
Chris@16 90 } //namespace interprocess {
Chris@16 91 } //namespace boost {
Chris@16 92
Chris@16 93 #include <boost/interprocess/detail/config_end.hpp>
Chris@16 94
Chris@16 95 #endif //BOOST_INTERPROCESS_XSI_KEY_HPP