TimerId.h revision f4e8e3d3
140161064SShuo Chen// excerpts from http://code.google.com/p/muduo/
240161064SShuo Chen//
340161064SShuo Chen// Use of this source code is governed by a BSD-style license
440161064SShuo Chen// that can be found in the License file.
540161064SShuo Chen//
640161064SShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com)
740161064SShuo Chen
840161064SShuo Chen#ifndef MUDUO_NET_TIMERID_H
940161064SShuo Chen#define MUDUO_NET_TIMERID_H
1040161064SShuo Chen
1140161064SShuo Chen#include "datetime/copyable.h"
1240161064SShuo Chen
1340161064SShuo Chennamespace muduo
1440161064SShuo Chen{
1540161064SShuo Chen
1640161064SShuo Chenclass Timer;
1740161064SShuo Chen
1840161064SShuo Chen///
1940161064SShuo Chen/// An opaque identifier, for canceling Timer.
2040161064SShuo Chen///
2140161064SShuo Chenclass TimerId : public muduo::copyable
2240161064SShuo Chen{
2340161064SShuo Chen public:
24f4e8e3d3SShuo Chen  TimerId(Timer* timer = NULL, int64_t seq = 0)
25f4e8e3d3SShuo Chen    : timer_(timer),
26f4e8e3d3SShuo Chen      seq_(seq)
2740161064SShuo Chen  {
2840161064SShuo Chen  }
2940161064SShuo Chen
3040161064SShuo Chen  // default copy-ctor, dtor and assignment are okay
3140161064SShuo Chen
32f4e8e3d3SShuo Chen  friend class TimerQueue;
33f4e8e3d3SShuo Chen
3440161064SShuo Chen private:
35f4e8e3d3SShuo Chen  Timer* timer_;
36f4e8e3d3SShuo Chen  int64_t seq_;
3740161064SShuo Chen};
3840161064SShuo Chen
3940161064SShuo Chen}
4040161064SShuo Chen
4140161064SShuo Chen#endif  // MUDUO_NET_TIMERID_H
42