XDispatch 0.7.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
base.h
Go to the documentation of this file.
00001 
00002 /*
00003 * Copyright (c) 2011-2013 MLBA-Team. 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_BASE_H_
00024 #define XDISPATCH_BASE_H_
00025 
00031 #ifndef __XDISPATCH_INDIRECT__
00032 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00033 #endif
00034 
00035 #include <string>
00036 
00037 __XDISPATCH_BEGIN_NAMESPACE
00038 
00039 class XDISPATCH_EXPORT queue;
00040 
00044 class XDISPATCH_EXPORT object {
00045 
00046     protected:
00047         object();
00048 
00049     public:
00050         virtual ~object();
00055         virtual void resume();
00065         virtual void suspend();
00072         virtual void target_queue(const queue&);
00077         virtual dispatch_object_t native() const = 0;
00078 
00079         bool operator ==(const object&);
00080         bool operator !=(const object&);
00081         bool operator ==(const dispatch_object_t&);
00082         bool operator !=(const dispatch_object_t&);
00083 };
00084 
00085 XDISPATCH_EXPORT bool operator ==(const dispatch_object_t&, const object&);
00086 XDISPATCH_EXPORT bool operator !=(const dispatch_object_t&, const object&);
00087 
00088 class queue;
00089 
00094 typedef dispatch_time_t time;
00099 static const time time_now = DISPATCH_TIME_NOW;
00104 static const time time_forever = DISPATCH_TIME_FOREVER;
00108 static const uint64_t nsec_per_sec = NSEC_PER_SEC;
00112 static const uint64_t nsec_per_msec = NSEC_PER_MSEC;
00116 static const uint64_t nsec_per_usec = NSEC_PER_USEC;
00120 static const uint64_t usec_per_sec = USEC_PER_SEC;
00125 enum queue_priority { HIGH =2, DEFAULT =1, LOW =0 };
00133 XDISPATCH_EXPORT queue main_queue();
00144 XDISPATCH_EXPORT queue global_queue(queue_priority p = DEFAULT);
00149 XDISPATCH_EXPORT queue current_queue();
00153 XDISPATCH_EXPORT time as_dispatch_time(struct tm*);
00157 inline dispatch_time_t as_native_dispatch_time(const time& t) {
00158     return t;
00159 }
00160 
00164 XDISPATCH_EXPORT struct tm as_struct_tm(const time& t);
00170 XDISPATCH_EXPORT time as_delayed_time(uint64_t delay, time base = time_now);
00181 XDISPATCH_EXPORT void exec();
00182 
00183 __XDISPATCH_END_NAMESPACE
00184 
00187 #endif /* XDISPATCH_BASE_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Sun Jan 27 2013 21:21:52 for XDispatch by Doxygen 1.7.6.1
© 2010-2013 MLBA (about | privacy) All Rights reserved.