TimerId.h revision 354280cf
1354280cfSShuo Chen// excerpts from http://code.google.com/p/muduo/ 2354280cfSShuo Chen// 3354280cfSShuo Chen// Use of this source code is governed by a BSD-style license 4354280cfSShuo Chen// that can be found in the License file. 5354280cfSShuo Chen// 6354280cfSShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com) 7354280cfSShuo Chen 8354280cfSShuo Chen#ifndef MUDUO_NET_TIMERID_H 9354280cfSShuo Chen#define MUDUO_NET_TIMERID_H 10354280cfSShuo Chen 11354280cfSShuo Chen#include "datetime/copyable.h" 12354280cfSShuo Chen 13354280cfSShuo Chennamespace muduo 14354280cfSShuo Chen{ 15354280cfSShuo Chen 16354280cfSShuo Chenclass Timer; 17354280cfSShuo Chen 18354280cfSShuo Chen/// 19354280cfSShuo Chen/// An opaque identifier, for canceling Timer. 20354280cfSShuo Chen/// 21354280cfSShuo Chenclass TimerId : public muduo::copyable 22354280cfSShuo Chen{ 23354280cfSShuo Chen public: 24354280cfSShuo Chen TimerId(Timer* timer = NULL, int64_t seq = 0) 25354280cfSShuo Chen : timer_(timer), 26354280cfSShuo Chen sequence_(seq) 27354280cfSShuo Chen { 28354280cfSShuo Chen } 29354280cfSShuo Chen 30354280cfSShuo Chen // default copy-ctor, dtor and assignment are okay 31354280cfSShuo Chen 32354280cfSShuo Chen friend class TimerQueue; 33354280cfSShuo Chen 34354280cfSShuo Chen private: 35354280cfSShuo Chen Timer* timer_; 36354280cfSShuo Chen int64_t sequence_; 37354280cfSShuo Chen}; 38354280cfSShuo Chen 39354280cfSShuo Chen} 40354280cfSShuo Chen 41354280cfSShuo Chen#endif // MUDUO_NET_TIMERID_H 42