1 /* 2 3 Copyright (C) 2008-2015 Michele Martone 4 5 This file is part of librsb. 6 7 librsb is free software; you can redistribute it and/or modify it 8 under the terms of the GNU Lesser General Public License as published 9 by the Free Software Foundation; either version 3 of the License, or 10 (at your option) any later version. 11 12 librsb is distributed in the hope that it will be useful, but WITHOUT 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 15 License for more details. 16 17 You should have received a copy of the GNU Lesser General Public 18 License along with librsb; see the file COPYING. 19 If not, see <http://www.gnu.org/licenses/>. 20 21 */ 22 /* @cond INNERDOC */ 23 /** 24 * @file 25 * @author Michele Martone 26 * @brief Timing/limiting mechanisms. 27 */ 28 29 #ifndef RSB_LIMITER_H_INCLUDED 30 #define RSB_LIMITER_H_INCLUDED 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif /* __cplusplus */ 35 #include "rsb.h" /* public API specification */ 36 #define RSB_TIMES_MAX 1000000000 37 #define RSB_TIMES_MIN 0 38 #define RSB_TIMES_ZERO 0 39 #define RSB_TIME_MAX RSB_CONST_IMPOSSIBLY_BIG_TIME 40 #define RSB_TIME_MIN RSB_TIME_ZERO 41 struct rsb_limiter 42 { 43 /*rsb_bool_t is_time_based;*/ 44 rsb_time_t t0,t1; 45 rsb_time_t max_time; 46 rsb__times_t max_times; 47 rsb__times_t times; 48 }; 49 rsb_err_t rsb_limiter_init(struct rsb_limiter* lsp, const rsb_time_t max_time, const rsb__times_t max_times); 50 rsb_err_t rsb__limiter_init_from_str(struct rsb_limiter* lsp, const char *tls); 51 rsb_err_t rsb__limiter_step(struct rsb_limiter* lsp); 52 rsb_bool_t rsb__limiter_done(const struct rsb_limiter* lsp); 53 rsb_bool_t rsb__limiter_continue(const struct rsb_limiter* lsp); 54 rsb_err_t rsb__limiter_info(const struct rsb_limiter* lsp); 55 #ifdef __cplusplus 56 } 57 #endif /* __cplusplus */ 58 59 #endif /* RSB_LIMITER_H_INCLUDED */ 60 /* @endcond */ 61