00001 /* Copyright (c) 2006, Gennady Bystritsky <bystr@mac.com> 00002 * 00003 * Distributed under the MIT Licence. 00004 * This is free software. See 'LICENSE' for details. 00005 * You must read and accept the license prior to use. 00006 */ 00007 00008 #ifndef _SK_SYS_DELEGATINGEXECUTABLE_ 00009 #define _SK_SYS_DELEGATINGEXECUTABLE_ 00010 00011 #include <sk/sys/Executable.h> 00012 00013 namespace sk { 00014 namespace sys { 00015 class DelegatingExecutable 00016 : public virtual sk::sys::Executable 00017 { 00018 public: 00019 DelegatingExecutable(); 00020 virtual ~DelegatingExecutable(); 00021 00022 // sk::util::Object re-implementation. 00023 const sk::util::Class getClass() const; 00024 00025 // sk::sys::Executable implementation. 00026 void stop(); 00027 void join(); 00028 bool isSuccess() const; 00029 bool isExited() const; 00030 bool isKilled() const; 00031 bool isAlive() const; 00032 int exitStatus() const; 00033 int signal() const; 00034 00035 protected: 00036 // This way of obtaining an object to delegate to was chosen here over 00037 // passing it in the constructor for the reason. At least one compiler 00038 // (gcc-3.4.3) does not handle the latter correctly when used to 00039 // delegate to a data member. 00040 // 00041 virtual sk::sys::Executable& getExecutable() = 0; 00042 virtual const sk::sys::Executable& getExecutable() const = 0; 00043 00044 }; 00045 } 00046 } 00047 00048 #endif /* _SK_SYS_DELEGATINGEXECUTABLE_ */