activemq-cpp-3.4.0

src/main/decaf/util/Timer.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef _DECAF_UTIL_TIMER_H_
00019 #define _DECAF_UTIL_TIMER_H_
00020 
00021 #include <memory>
00022 
00023 #include <decaf/util/Config.h>
00024 #include <decaf/util/Date.h>
00025 
00026 #include <decaf/lang/Pointer.h>
00027 #include <decaf/lang/exceptions/NullPointerException.h>
00028 #include <decaf/lang/exceptions/IllegalStateException.h>
00029 #include <decaf/lang/exceptions/IllegalArgumentException.h>
00030 
00031 namespace decaf {
00032 namespace util {
00033 
00034     class TimerTask;
00035     class TimerImpl;
00036 
00056     class DECAF_API Timer {
00057     private:
00058 
00059         TimerImpl* internal;
00060 
00061     private:
00062 
00063         Timer( const Timer& );
00064         Timer operator= ( const Timer& );
00065 
00066     public:
00067 
00068         Timer();
00069 
00076         Timer(const std::string& name);
00077 
00078         virtual ~Timer();
00079 
00091         void cancel();
00092 
00108         int purge();
00109 
00127         void schedule( TimerTask* task, long long delay );
00128 
00139         void schedule( const decaf::lang::Pointer<TimerTask>& task, long long delay );
00140 
00160         void schedule( TimerTask* task, const Date& time );
00161 
00174         void schedule( const decaf::lang::Pointer<TimerTask>& task, const Date& time );
00175 
00208         void schedule( TimerTask* task, long long delay, long long period );
00209 
00235         void schedule( const decaf::lang::Pointer<TimerTask>& task, long long delay, long long period );
00236 
00269         void schedule( TimerTask* task, const Date& firstTime, long long period );
00270 
00296         void schedule( const decaf::lang::Pointer<TimerTask>& task, const Date& firstTime, long long period );
00297 
00331         void scheduleAtFixedRate( TimerTask* task, long long delay, long long period );
00332 
00359         void scheduleAtFixedRate( const decaf::lang::Pointer<TimerTask>& task, long long delay, long long period );
00360 
00394         void scheduleAtFixedRate( TimerTask* task, const Date& firstTime, long long period );
00395 
00422         void scheduleAtFixedRate( const decaf::lang::Pointer<TimerTask>& task, const Date& firstTime, long long period );
00423 
00424     private:
00425 
00426         void scheduleTask( const decaf::lang::Pointer<TimerTask>& task, long long delay, long long period, bool fixed );
00427 
00428     };
00429 
00430 }}
00431 
00432 #endif /* _DECAF_UTIL_TIMER_H_ */