// src/backend/dynamic_thread.hh - Copyright 2005, 2006, University // of Padova, dept. of Pure and Applied // Mathematics // // This file is part of SGPEMv2. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // SGPEMv2 is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with SGPEMv2; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #ifndef DYNAMIC_THREAD_HH #define DYNAMIC_THREAD_HH 1 #include "gettext.h" #include "glibmm/ustring.h" #include #include #include "dynamic_process.hh" #include "dynamic_schedulable.hh" #include namespace sgpem { class DynamicThread; class DynamicProcess; class StaticThread; class Request; class DynamicRequest; class SG_DLLLOCAL DynamicThread : public DynamicSchedulable, public Thread { public: DynamicThread(StaticThread* core, DynamicProcess* parent); DynamicThread(const DynamicThread &other, DynamicProcess* parent); virtual ~DynamicThread(); DynamicProcess& get_process(); state get_state() const; state set_state(state new_state); int get_last_acquisition() const; void set_last_acquisition(int instant); int get_last_release() const; void set_last_release(int instant); unsigned int get_elapsed_time() const; void decrease_remaining_time(); std::vector get_requests(); void serialize(SerializeVisitor& translator) const; virtual StaticThread& get_core(); virtual const StaticThread& get_core() const; // Does also the job of "add_request" and "remove_request" std::vector& get_dynamic_requests(); private: // Undefined DynamicThread(const DynamicThread &other); memory::smart_ptr _core; state _state; std::vector _dynamic_requests; DynamicProcess* _parent; unsigned int _ran_for; int _last_acquisition; int _last_release; }; } #endif