/usr/include/boost/interprocess/detail
NameSizeModeActions
atomic.hpp220360644editdlrm
cast_tags.hpp9590644editdlrm
config_begin.hpp32100644editdlrm
config_end.hpp5640644editdlrm
config_external_begin.hpp7140644editdlrm
config_external_end.hpp5290644editdlrm
file_locking_helpers.hpp70290644editdlrm
file_wrapper.hpp64070644editdlrm
intermodule_singleton.hpp16340644editdlrm
intermodule_singleton_common.hpp200680644editdlrm
interprocess_tester.hpp10280644editdlrm
intersegment_ptr.hpp343010644editdlrm
in_place_interface.hpp22840644editdlrm
managed_global_memory.hpp40720644editdlrm
managed_memory_impl.hpp300590644editdlrm
managed_multi_shared_memory.hpp147440644editdlrm
managed_open_or_create_impl.hpp154210644editdlrm
math_functions.hpp25740644editdlrm
min_max.hpp11470644editdlrm
move.hpp8790644editdlrm
mpl.hpp22590644editdlrm
named_proxy.hpp99500644editdlrm
nothrow.hpp11990644editdlrm
os_file_functions.hpp224340644editdlrm
os_thread_functions.hpp174400644editdlrm
pointer_type.hpp18900644editdlrm
portable_intermodule_singleton.hpp116700644editdlrm
posix_time_types_wrk.hpp14590644editdlrm
ptime_wrk.hpp11950644editdlrm
robust_emulation.hpp130200644editdlrm
segment_manager_helper.hpp153250644editdlrm
shared_dir_helpers.hpp69080644editdlrm
simple_swap.hpp8590644editdlrm
std_fwd.hpp17080644editdlrm
transform_iterator.hpp12830644editdlrm
type_traits.hpp29010644editdlrm
utilities.hpp59170644editdlrm
variadic_templates_tools.hpp11150644editdlrm
win32_api.hpp614660644editdlrm
windows_intermodule_singleton.hpp107450644editdlrm
workaround.hpp91350644editdlrm
xsi_shared_memory_file_wrapper.hpp31440644editdlrm
Edit: /usr/include/boost/interprocess/detail/utilities.hpp (5917B)
////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2005-2015. // (C) Copyright Gennaro Prota 2003 - 2004. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/interprocess for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_INTERPROCESS_DETAIL_UTILITIES_HPP #define BOOST_INTERPROCESS_DETAIL_UTILITIES_HPP #ifndef BOOST_CONFIG_HPP # include #endif # #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace interprocess { namespace ipcdetail { template inline T* to_raw_pointer(T* p) { return p; } template inline typename boost::intrusive::pointer_traits::element_type* to_raw_pointer(const Pointer &p) { return boost::interprocess::ipcdetail::to_raw_pointer(p.operator->()); } //Rounds "orig_size" by excess to round_to bytes template inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to) { return ((orig_size-1)/round_to+1)*round_to; } //Truncates "orig_size" to a multiple of "multiple" bytes. template inline SizeType get_truncated_size(SizeType orig_size, SizeType multiple) { return orig_size/multiple*multiple; } //Rounds "orig_size" by excess to round_to bytes. round_to must be power of two template inline SizeType get_rounded_size_po2(SizeType orig_size, SizeType round_to) { return ((orig_size-1)&(~(round_to-1))) + round_to; } //Truncates "orig_size" to a multiple of "multiple" bytes. multiple must be power of two template inline SizeType get_truncated_size_po2(SizeType orig_size, SizeType multiple) { return (orig_size & (~(multiple-1))); } template struct ct_rounded_size { BOOST_STATIC_ASSERT((RoundTo != 0)); static const std::size_t intermediate_value = (OrigSize-1)/RoundTo+1; BOOST_STATIC_ASSERT(intermediate_value <= std::size_t(-1)/RoundTo); static const std::size_t value = intermediate_value*RoundTo; }; // Gennaro Prota wrote this. Thanks! template struct ct_max_pow2_less { static const std::size_t c = 2*n < p; static const std::size_t value = c ? (ct_max_pow2_less< c*p, 2*c*n>::value) : n; }; template <> struct ct_max_pow2_less<0, 0> { static const std::size_t value = 0; }; } //namespace ipcdetail { //!Trait class to detect if an index is a node //!index. This allows more efficient operations //!when deallocating named objects. template struct is_node_index { static const bool value = false; }; //!Trait class to detect if an index is an intrusive //!index. This will embed the derivation hook in each //!allocation header, to provide memory for the intrusive //!container. template struct is_intrusive_index { static const bool value = false; }; template BOOST_INTERPROCESS_FORCEINLINE T* addressof(T& v) { return reinterpret_cast( &const_cast(reinterpret_cast(v))); } template struct sqrt_size_type_max { static const SizeType value = (SizeType(1) << (sizeof(SizeType)*(CHAR_BIT/2)))-1; }; template inline bool multiplication_overflows(SizeType a, SizeType b) { const SizeType sqrt_size_max = sqrt_size_type_max::value; return //Fast runtime check ( (a | b) > sqrt_size_max && //Slow division check b && a > SizeType(-1)/b ); } template BOOST_INTERPROCESS_FORCEINLINE bool size_overflows(SizeType count) { //Compile time-check BOOST_STATIC_ASSERT(SztSizeOfType <= SizeType(-1)); //Runtime check return multiplication_overflows(SizeType(SztSizeOfType), count); } template class pointer_offset_caster; template class pointer_offset_caster { public: BOOST_INTERPROCESS_FORCEINLINE explicit pointer_offset_caster(OffsetType offset) : m_offset(offset) {} BOOST_INTERPROCESS_FORCEINLINE explicit pointer_offset_caster(const volatile T *p) : m_offset(reinterpret_cast(p)) {} BOOST_INTERPROCESS_FORCEINLINE OffsetType offset() const { return m_offset; } BOOST_INTERPROCESS_FORCEINLINE T* pointer() const { return reinterpret_cast(m_offset); } private: OffsetType m_offset; }; template inline bool sum_overflows(SizeType a, SizeType b) { return SizeType(-1) - a < b; } //Anti-exception node eraser template class value_eraser { public: value_eraser(Cont & cont, typename Cont::iterator it) : m_cont(cont), m_index_it(it), m_erase(true){} ~value_eraser() { if(m_erase) m_cont.erase(m_index_it); } BOOST_INTERPROCESS_FORCEINLINE void release() { m_erase = false; } private: Cont &m_cont; typename Cont::iterator m_index_it; bool m_erase; }; } //namespace interprocess { } //namespace boost { #include #endif //#ifndef BOOST_INTERPROCESS_DETAIL_UTILITIES_HPP