📄 warincrementcounter.h
字号:
/** */#ifndef WAR_INCREMENT_COUNTER_H#define WAR_INCREMENT_COUNTER_H/* SYSTEM INCLUDES *//* PROJECT INCLUDES */#ifndef WAR_AUTO_LOCK# include "WarAutoLock.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplustemplate <class intT = war_uint64_t>class WarIncrementCounter{public: typedef intT cnt_t; // LIFECYCLE /** * Default constructor. */ WarIncrementCounter() : mCounter(0) { } ~WarIncrementCounter() { } // OPERATORS // OPERATIONS cnt_t GetNext() { WarAutoLock my_lock(mLock); return ++mCounter; } std::string GetNextAsStr() { std::string buf; return WarItoa(buf, GetNext()); } // CALLBACK // ACCESS // INQUIRY protected:private: WarCriticalSection mLock; cnt_t mCounter;};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif /* WAR_INCREMENT_COUNTER_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -