OpenCores
URL https://opencores.org/ocsvn/altor32/altor32/trunk

Subversion Repositories altor32

[/] [altor32/] [trunk/] [gcc-x64/] [or1knd-elf/] [or1knd-elf/] [include/] [c++/] [4.8.0/] [ext/] [pb_ds/] [detail/] [resize_policy/] [sample_resize_trigger.hpp] - Blame information for rev 35

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 35 ultra_embe
// -*- C++ -*-
2
 
3
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
4
// Free Software Foundation, Inc.
5
//
6
// This file is part of the GNU ISO C++ Library.  This library is free
7
// software; you can redistribute it and/or modify it under the terms
8
// of the GNU General Public License as published by the Free Software
9
// Foundation; either version 3, or (at your option) any later
10
// version.
11
 
12
// This library is distributed in the hope that it will be useful, but
13
// WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
// General Public License for more details.
16
 
17
// Under Section 7 of GPL version 3, you are granted additional
18
// permissions described in the GCC Runtime Library Exception, version
19
// 3.1, as published by the Free Software Foundation.
20
 
21
// You should have received a copy of the GNU General Public License and
22
// a copy of the GCC Runtime Library Exception along with this program;
23
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24
// <http://www.gnu.org/licenses/>.
25
 
26
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
27
 
28
// Permission to use, copy, modify, sell, and distribute this software
29
// is hereby granted without fee, provided that the above copyright
30
// notice appears in all copies, and that both that copyright notice
31
// and this permission notice appear in supporting documentation. None
32
// of the above authors, nor IBM Haifa Research Laboratories, make any
33
// representation about the suitability of this software for any
34
// purpose. It is provided "as is" without express or implied
35
// warranty.
36
 
37
/**
38
 * @file sample_resize_trigger.hpp
39
 * Contains a sample resize trigger policy class.
40
 */
41
 
42
#ifndef PB_DS_SAMPLE_RESIZE_TRIGGER_HPP
43
#define PB_DS_SAMPLE_RESIZE_TRIGGER_HPP
44
 
45
namespace __gnu_pbds
46
{
47
  /// A sample resize trigger policy.
48
  class sample_resize_trigger
49
  {
50
  public:
51
    /// Size type.
52
    typedef std::size_t size_type;
53
 
54
    /// Default constructor.
55
    sample_resize_trigger();
56
 
57
    /// Copy constructor.
58
    sample_range_hashing(const sample_resize_trigger&);
59
 
60
    /// Swaps content.
61
    inline void
62
    swap(sample_resize_trigger&);
63
 
64
  protected:
65
    /// Notifies a search started.
66
    inline void
67
    notify_insert_search_start();
68
 
69
    /// Notifies a search encountered a collision.
70
    inline void
71
    notify_insert_search_collision();
72
 
73
    /// Notifies a search ended.
74
    inline void
75
    notify_insert_search_end();
76
 
77
    /// Notifies a search started.
78
    inline void
79
    notify_find_search_start();
80
 
81
    /// Notifies a search encountered a collision.
82
    inline void
83
    notify_find_search_collision();
84
 
85
    /// Notifies a search ended.
86
    inline void
87
    notify_find_search_end();
88
 
89
    /// Notifies a search started.
90
    inline void
91
    notify_erase_search_start();
92
 
93
    /// Notifies a search encountered a collision.
94
    inline void
95
    notify_erase_search_collision();
96
 
97
    /// Notifies a search ended.
98
    inline void
99
    notify_erase_search_end();
100
 
101
    /// Notifies an element was inserted. the total number of entries in
102
    /// the table is num_entries.
103
    inline void
104
    notify_inserted(size_type num_entries);
105
 
106
    /// Notifies an element was erased.
107
    inline void
108
    notify_erased(size_type num_entries);
109
 
110
    /// Notifies the table was cleared.
111
    void
112
    notify_cleared();
113
 
114
    /// Notifies the table was resized as a result of this object's
115
    /// signifying that a resize is needed.
116
    void
117
    notify_resized(size_type new_size);
118
 
119
    /// Notifies the table was resized externally.
120
    void
121
    notify_externally_resized(size_type new_size);
122
 
123
    /// Queries whether a resize is needed.
124
    inline bool
125
    is_resize_needed() const;
126
 
127
    /// Queries whether a grow is needed.
128
    inline bool
129
    is_grow_needed(size_type size, size_type num_entries) const;
130
 
131
  private:
132
    /// Resizes to new_size.
133
    virtual void
134
    do_resize(size_type);
135
  };
136
}
137
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.