libstdc++
|
00001 // Profiling unordered containers implementation details -*- C++ -*- 00002 00003 // Copyright (C) 2014-2015 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 3, or (at your option) 00009 // any later version. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License along 00021 // with this library; see the file COPYING3. If not see 00022 // <http://www.gnu.org/licenses/>. 00023 00024 /** @file profile/ordered_base.h 00025 * This file is a GNU profile extension to the Standard C++ Library. 00026 */ 00027 00028 #ifndef _GLIBCXX_PROFILE_ORDERED 00029 #define _GLIBCXX_PROFILE_ORDERED 1 00030 00031 namespace std _GLIBCXX_VISIBILITY(default) 00032 { 00033 namespace __profile 00034 { 00035 template<typename _Cont> 00036 class _Ordered_profile 00037 { 00038 public: 00039 void 00040 _M_profile_iterate(int __rewind = 0) const 00041 { __profcxx_map2umap_iterate(this->_M_map2umap_info, __rewind); } 00042 00043 protected: 00044 _Ordered_profile() _GLIBCXX_NOEXCEPT 00045 { _M_profile_construct(); } 00046 00047 #if __cplusplus >= 201103L 00048 _Ordered_profile(const _Ordered_profile&) noexcept 00049 : _Ordered_profile() { } 00050 _Ordered_profile(_Ordered_profile&& __other) noexcept 00051 : _Ordered_profile() 00052 { _M_swap(__other); } 00053 00054 _Ordered_profile& 00055 operator=(const _Ordered_profile&) noexcept 00056 { 00057 _M_profile_destruct(); 00058 _M_profile_construct(); 00059 } 00060 00061 _Ordered_profile& 00062 operator=(_Ordered_profile&& __other) noexcept 00063 { 00064 _M_swap(__other); 00065 00066 __other._M_profile_destruct(); 00067 __other._M_profile_construct(); 00068 } 00069 #endif 00070 00071 ~_Ordered_profile() 00072 { _M_profile_destruct(); } 00073 00074 void 00075 _M_profile_construct() _GLIBCXX_NOEXCEPT 00076 { _M_map2umap_info = __profcxx_map2umap_construct(); } 00077 00078 void 00079 _M_profile_destruct() _GLIBCXX_NOEXCEPT 00080 { 00081 __profcxx_map2umap_destruct(_M_map2umap_info); 00082 _M_map2umap_info = 0; 00083 } 00084 00085 void 00086 _M_swap(_Ordered_profile& __other) 00087 { std::swap(_M_map2umap_info, __other._M_map2umap_info); } 00088 00089 __gnu_profile::__map2umap_info* _M_map2umap_info; 00090 00091 private: 00092 _Cont& 00093 _M_conjure() 00094 { return *static_cast<_Cont*>(this); } 00095 }; 00096 00097 } // namespace __profile 00098 } // namespace std 00099 00100 #endif