libXDispatch 0.5
include/xdispatch/timer.h
Go to the documentation of this file.
00001 
00002 /*
00003 * Copyright (c) 2011 MLBA. All rights reserved.
00004 *
00005 * @MLBA_OPEN_LICENSE_HEADER_START@
00006 *
00007 * Licensed under the Apache License, Version 2.0 (the "License");
00008 * you may not use this file except in compliance with the License.
00009 * You may obtain a copy of the License at
00010 *
00011 *     http://www.apache.org/licenses/LICENSE-2.0
00012 *
00013 * Unless required by applicable law or agreed to in writing, software
00014 * distributed under the License is distributed on an "AS IS" BASIS,
00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016 * See the License for the specific language governing permissions and
00017 * limitations under the License.
00018 *
00019 * @MLBA_OPEN_LICENSE_HEADER_END@
00020 */
00021 
00022 
00023 #ifndef XDISPATCH_TIMER_H_
00024 #define XDISPATCH_TIMER_H_
00025 
00026 #ifndef __XDISPATCH_INDIRECT__
00027 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00028 #endif
00029 
00030 __XDISPATCH_BEGIN_NAMESPACE
00031 
00041 class XDISPATCH_EXPORT timer : public object {
00042 
00043 public:
00051     timer(uint64_t interval, const xdispatch::queue& target = global_queue(), dispatch_time_t starting = DISPATCH_TIME_NOW);
00052     timer(const timer&);
00053     timer(dispatch_source_t);
00054     ~timer();
00055 
00061     void interval(uint64_t);
00067     void latency(uint64_t);
00074     void start();
00078        void resume();
00085     void stop();
00089        void suspend();
00096     void handler(xdispatch::operation*);
00097 #ifdef XDISPATCH_HAS_BLOCKS
00098 
00101     void handler(dispatch_block_t);
00102 #endif
00103 
00106     void set_queue(const xdispatch::queue&);
00110     xdispatch::queue queue();
00114     dispatch_object_t native() const;
00119     static timer* current();
00124     static void single_shot(dispatch_time_t, const xdispatch::queue&, xdispatch::operation*);
00129     static void single_shot(struct tm*, const xdispatch::queue&, xdispatch::operation*);
00130 #ifdef XDISPATCH_HAS_BLOCKS
00131 
00135     static void single_shot(dispatch_time_t, const xdispatch::queue&, dispatch_block_t);
00140     static void single_shot(struct tm*, const xdispatch::queue&, dispatch_block_t);
00141 #endif
00142 
00143     timer& operator =(const timer&);
00144 
00145 private:
00146     class data;
00147     data* d;
00148 
00149 };
00150 
00151 __XDISPATCH_END_NAMESPACE
00152 
00153 #endif /* XDISPATCH_TIMER_H_ */

Generated on Wed Feb 22 2012 19:54:05 for libXDispatch by Doxygen 1.7.4
Content © 2011-2012 MLBA (about | privacy) – Design © 2010-2012 Emzeat. All Rights reserved.