1// -*- C++ -*- 2 3// Copyright (C) 2005, 2006 Free Software Foundation, Inc. 4// 5// This file is part of the GNU ISO C++ Library. This library is free 6// software; you can redistribute it and/or modify it under the terms 7// of the GNU General Public License as published by the Free Software 8// Foundation; either version 2, or (at your option) any later 9// version. 10 11// This library is distributed in the hope that it will be useful, but 12// WITHOUT ANY WARRANTY; without even the implied warranty of 13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14// General Public License for more details. 15 16// You should have received a copy of the GNU General Public License 17// along with this library; see the file COPYING. If not, write to 18// the Free Software Foundation, 59 Temple Place - Suite 330, Boston, 19// MA 02111-1307, USA. 20 21// As a special exception, you may use this file as part of a free 22// software library without restriction. Specifically, if other files 23// instantiate templates or use macros or inline functions from this 24// file, or you compile this file and link it with other files to 25// produce an executable, this file does not by itself cause the 26// resulting executable to be covered by the GNU General Public 27// License. This exception does not however invalidate any other 28// reasons why the executable file might be covered by the GNU General 29// Public License. 30 31// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. 32 33// Permission to use, copy, modify, sell, and distribute this software 34// is hereby granted without fee, provided that the above copyright 35// notice appears in all copies, and that both that copyright notice 36// and this permission notice appear in supporting documentation. None 37// of the above authors, nor IBM Haifa Research Laboratories, make any 38// representation about the suitability of this software for any 39// purpose. It is provided "as is" without express or implied 40// warranty. 41 42/** 43 * @file binomial_heap_.hpp 44 * Contains an implementation class for a binomial heap. 45 */ 46 47/* 48 * Binomial heap. 49 * Vuillemin J is the mastah. 50 * Modified from CLRS. 51 */ 52 53#include <debug/debug.h> 54#include <ext/pb_ds/detail/cond_dealtor.hpp> 55#include <ext/pb_ds/detail/type_utils.hpp> 56#include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp> 57 58namespace pb_ds 59{ 60 namespace detail 61 { 62 63#define PB_DS_CLASS_T_DEC \ 64 template<typename Value_Type, class Cmp_Fn, class Allocator> 65 66#define PB_DS_CLASS_C_DEC \ 67 binomial_heap_<Value_Type, Cmp_Fn, Allocator> 68 69#define PB_DS_BASE_C_DEC \ 70 binomial_heap_base_<Value_Type, Cmp_Fn, Allocator> 71 72 /** 73 * class description = "8y|\|0|\/|i41 h34p 74813"> 74 **/ 75 template<typename Value_Type, class Cmp_Fn, class Allocator> 76 class binomial_heap_ : public PB_DS_BASE_C_DEC 77 { 78 private: 79 typedef PB_DS_BASE_C_DEC base_type; 80 typedef typename base_type::node_pointer node_pointer; 81 typedef typename base_type::const_node_pointer const_node_pointer; 82 83 public: 84 typedef Value_Type value_type; 85 typedef typename Allocator::size_type size_type; 86 typedef typename Allocator::difference_type difference_type; 87 typedef typename base_type::pointer pointer; 88 typedef typename base_type::const_pointer const_pointer; 89 typedef typename base_type::reference reference; 90 typedef typename base_type::const_reference const_reference; 91 typedef typename base_type::const_point_iterator const_point_iterator; 92 typedef typename base_type::point_iterator point_iterator; 93 typedef typename base_type::const_iterator const_iterator; 94 typedef typename base_type::iterator iterator; 95 typedef typename base_type::cmp_fn cmp_fn; 96 typedef typename base_type::allocator allocator; 97 98 binomial_heap_(); 99 100 binomial_heap_(const Cmp_Fn& r_cmp_fn); 101 102 binomial_heap_(const PB_DS_CLASS_C_DEC& other); 103 104 ~binomial_heap_(); 105 106 protected: 107#ifdef _GLIBCXX_DEBUG 108 void 109 assert_valid() const; 110#endif 111 }; 112 113#include <ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp> 114#include <ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp> 115 116#undef PB_DS_CLASS_C_DEC 117 118#undef PB_DS_CLASS_T_DEC 119 120#undef PB_DS_BASE_C_DEC 121 } // namespace detail 122} // namespace pb_ds 123