00001 /* 00002 * Copyright (c) 2010 Remko Tronçon 00003 * Licensed under the GNU General Public License v3. 00004 * See Documentation/Licenses/GPLv3.txt for more information. 00005 */ 00006 00007 #pragma once 00008 00009 namespace Swift { 00010 template<typename T> class StartStopper { 00011 public: 00012 StartStopper(T* target) : target(target) { 00013 target->start(); 00014 } 00015 00016 ~StartStopper() { 00017 target->stop(); 00018 } 00019 00020 private: 00021 T* target; 00022 }; 00023 }