bit::memory
allocator_info.hpp
1 /*****************************************************************************
2  * \file
3  * \brief This header contains the generic identifier used for identifying
4  * unique named allocators
5  *****************************************************************************/
6 
7 /*
8  The MIT License (MIT)
9 
10  Copyright (c) 2018 Matthew Rodusek
11 
12  Permission is hereby granted, free of charge, to any person obtaining a copy
13  of this software and associated documentation files (the "Software"), to deal
14  in the Software without restriction, including without limitation the rights
15  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16  copies of the Software, and to permit persons to whom the Software is
17  furnished to do so, subject to the following conditions:
18 
19  The above copyright notice and this permission notice shall be included in
20  all copies or substantial portions of the Software.
21 
22  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28  SOFTWARE.
29 */
30 #ifndef BIT_MEMORY_UTILITIES_ALLOCATOR_INFO_HPP
31 #define BIT_MEMORY_UTILITIES_ALLOCATOR_INFO_HPP
32 
33 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
34 # pragma once
35 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
36 
37 namespace bit {
38  namespace memory {
39 
45  {
46  //-----------------------------------------------------------------------
47  // Constructors
48  //-----------------------------------------------------------------------
49  public:
50 
56  allocator_info( const char* name, const void* address );
57 
58  //-----------------------------------------------------------------------
59  // Observers
60  //-----------------------------------------------------------------------
61  public:
62 
66  const char* name() const noexcept;
67 
71  const void* address() const noexcept;
72 
73  //-----------------------------------------------------------------------
74  // Private Members
75  //-----------------------------------------------------------------------
76  private:
77 
78  const char* m_name;
79  const void* m_address;
81  };
82 
83  //-------------------------------------------------------------------------
84  // Comparisons
85  //-------------------------------------------------------------------------
86 
87  bool operator==( const allocator_info& lhs, const allocator_info& rhs ) noexcept;
88  bool operator!=( const allocator_info& lhs, const allocator_info& rhs ) noexcept;
89 
90 
91  } // namespace memory
92 } // namespace bit
93 
94 #include "detail/allocator_info.inl"
95 
96 #endif /* BIT_MEMORY_UTILITIES_ALLOCATOR_INFO_HPP */
const char * name() const noexcept
Gets the name of the allocator.
const void * address() const noexcept
Gets the address of the allocator.
This type is used to hold the generic information for a given allocator.
allocator_info(const char *name, const void *address)
Constructs an allocator_info with a given name and the address of the allocator.