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

📄 ruleidsource.h

📁 网络流量采集及分析软件
💻 H
字号:
/*! \file   RuleIdSource.h    Copyright 2003-2004 Fraunhofer Institute for Open Communication Systems (FOKUS),                        Berlin, Germany    This file is part of Network Measurement and Accounting System (NETMATE).    NETMATE is free software; you can redistribute it and/or modify     it under the terms of the GNU General Public License as published by     the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    NETMATE is distributed in the hope that it will be useful,     but WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this software; if not, write to the Free Software     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    Description:    manage unique numeric rule id space    $Id: RuleIdSource.h,v 1.2 2005/03/24 23:58:46 s_zander Exp $*/#ifndef _RULEIDSOURCE_H_#define _RULEIDSOURCE_H_#include "stdincpp.h"#include "Error.h"#include "Logger.h"/*! \short   generate unique id numbers      The RuleIdSource class can generate unique 32 bit integer numbers for    use by other functions. A single number can be lent from the pool of    available numbers, and this number will not be generated by a call to     the newId function until it has been previously released with a call    to the freeId function.*/class RuleIdSource{  private:    unsigned long long num;    int unique;    list<unsigned long long> freeIds; //!< list of previously freed (now unused) ids      public:    //! construct and initialize a RuleIdSource object    // if unique is set to 1 Ids should be unique until we wrap around 2^63    RuleIdSource(int unique = 0);    //! destroy a RuleIdSource object    ~RuleIdSource();    /*! \short   generate a new internal id number        return a new Id value that is currently not in use. This value will be        marked as used and will not returned by a call to newId unless it has        been released again with a call to freeId        \returns unique unused id value    */    unsigned long long newId( void );    /*! \short   release an id number        The released id number can be reused (i.e. returned by newId) after        the call to freeId. Do not release numbers that have not been obtained        by a call to newId this will result in unpredictable behaviour.        \arg \c id - id value that is to be released for future use    */    void freeId( unsigned long long id );    //! dump a RuleIdSource object    void dump( ostream &os );};//! overload for <<, so that a RuleIdSource object can be thrown into an iostreamostream& operator<< ( ostream &os, RuleIdSource &ris );#endif // _RULEIDSOURCE_H_

⌨️ 快捷键说明

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