00001 /* vim: set sw=2: 00002 * Copyright (c) 2009, Gennady Bystritsky <bystr@mac.com> 00003 * 00004 * Distributed under the MIT Licence. 00005 * This is free software. See 'LICENSE' for details. 00006 * You must read and accept the license prior to use. 00007 * 00008 * Author: Gennady Bystritsky (gennady.bystritsky@quest.com) 00009 */ 00010 00011 #ifndef _SK_RT_THREAD_STATE_H_ 00012 #define _SK_RT_THREAD_STATE_H_ 00013 00014 #include <sk/util/Object.h> 00015 #include <sk/util/String.h> 00016 #include <vector> 00017 00018 namespace sk { 00019 namespace rt { 00020 namespace thread { 00021 class State 00022 : public virtual sk::util::Object 00023 { 00024 public: 00025 virtual ~State(); 00026 static const State& valueOf(const sk::util::String& name); 00027 int toInt() const; 00028 const sk::util::String& getName() const; 00029 00030 // sk::util::Object re-implementation. 00031 const sk::util::Class getClass() const; 00032 const sk::util::String toString() const; 00033 00034 bool operator==(const State& other) const; 00035 00036 static const State SK_T_NEW; 00037 static const State SK_T_RUNNING; 00038 static const State SK_T_EXITED; 00039 static const State SK_T_STOPPED; 00040 static const State SK_T_EXCEPTION; 00041 00042 private: 00043 State(const sk::util::String& name); 00044 State(const State& other); 00045 State& operator = (const State& other); 00046 00047 static std::vector<State*> _states; 00048 00049 int _value; 00050 const sk::util::String _name; 00051 }; 00052 00053 std::ostream& operator<<(std::ostream& stream, const State& state); 00054 } 00055 } 00056 } 00057 00058 #endif /* _SK_RT_THREAD_STATE_H_ */