1 /******************************************************************************* 2 3 Interfaces to manage and get information about a limitable pool. A limitable 4 pool has a maximum size (i.e. number of items) which cannot be exceeded. 5 6 Copyright: 7 Copyright (c) 2009-2016 dunnhumby Germany GmbH. 8 All rights reserved. 9 10 License: 11 Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. 12 Alternatively, this file may be distributed under the terms of the Tango 13 3-Clause BSD License (see LICENSE_BSD.txt for details). 14 15 *******************************************************************************/ 16 17 module ocean.util.container.pool.model.ILimitable; 18 19 20 21 /******************************************************************************* 22 23 Informational interface to a limitable pool. 24 25 *******************************************************************************/ 26 27 public interface ILimitableInfo 28 { 29 /*************************************************************************** 30 31 Returns: 32 limit of items in pool 33 34 ***************************************************************************/ 35 36 size_t limit ( ); 37 38 39 /*************************************************************************** 40 41 Returns: 42 true if the number of items in the pool is limited or fase otherwise 43 44 ***************************************************************************/ 45 46 bool is_limited ( ); 47 } 48 49 50 /******************************************************************************* 51 52 Management interface to a limitable pool. 53 54 *******************************************************************************/ 55 56 public interface ILimitable : ILimitableInfo 57 { 58 /************************************************************************** 59 60 Magic limit value indicating no limitation 61 62 **************************************************************************/ 63 64 static immutable size_t unlimited = size_t.max; 65 66 67 /*************************************************************************** 68 69 Sets the limit of number of items in pool or disables limitation for 70 limit = unlimited. When limiting the pool, any excess idle items are 71 reset and deleted. 72 73 Params: 74 limit = new limit of number of items in pool; unlimited disables 75 limitation 76 77 Returns: 78 new limit 79 80 ***************************************************************************/ 81 82 size_t setLimit ( size_t limit ); 83 } 84