⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 storage.hh

📁 Click is a modular router toolkit. To use it you ll need to know how to compile and install the sof
💻 HH
字号:
// -*- c-basic-offset: 4 -*-#ifndef CLICK_STORAGE_HH#define CLICK_STORAGE_HHCLICK_DECLSclass Storage { public:    Storage()				: _head(0), _tail(0) { }    operator bool() const		{ return _head != _tail; }    bool empty() const			{ return _head == _tail; }    int size() const;    int size(int head, int tail) const;    int capacity() const		{ return _capacity; }    int head() const			{ return _head; }    int tail() const			{ return _tail; }    int next_i(int i) const		{ return (i!=_capacity ? i+1 : 0); }    int prev_i(int i) const		{ return (i!=0 ? i-1 : _capacity); }    // to be used with care    void set_capacity(int c)		{ _capacity = c; }    void set_head(int h)		{ _head = h; }    void set_tail(int t)		{ _tail = t; }  protected:    int _capacity;    volatile int _head;    volatile int _tail;};inline intStorage::size(int head, int tail) const{    int x = tail - head;    return (x >= 0 ? x : _capacity + x + 1);}inline intStorage::size() const{    return size(_head, _tail);}CLICK_ENDDECLS#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -