1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- G N A T . B O U N D E D _ B U F F E R S --
9 -- Copyright (C) 2003-2010, AdaCore --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com). --
29 ------------------------------------------------------------------------------
31 package body GNAT.Bounded_Buffers is
37 protected body Bounded_Buffer is
43 entry Insert (Item : Element) when Count /= Capacity is
45 Values (Next_In) := Item;
46 Next_In := (Next_In mod Capacity) + 1;
54 entry Remove (Item : out Element) when Count > 0 is
56 Item := Values (Next_Out);
57 Next_Out := (Next_Out mod Capacity) + 1;
65 function Empty return Boolean is
74 function Full return Boolean is
76 return Count = Capacity;
83 function Extent return Natural is
90 end GNAT.Bounded_Buffers;