cpp_photon/src/Task.cpp

63 lines
992 B
C++
Raw Normal View History

2005-03-15 19:21:51 +00:00
//This file is part of Photon (http://photon.sourceforge.net)
//Copyright (C) 2004-2005 James Turk
//
// Author:
// James Turk (jpt2433@rit.edu)
//
// Version:
2005-07-19 01:31:37 +00:00
// $Id: Task.cpp,v 1.2 2005/07/19 01:31:38 cozman Exp $
2005-03-15 19:21:51 +00:00
#include "Task.hpp"
namespace photon
{
Task::Task(const std::string& name, PriorityLevel priority) :
name_(name), priority_(priority), alive_(true), paused_(false)
{
}
2005-07-19 01:31:37 +00:00
// do nothing.. again (oh how I wish destructors were virtual by default)
2005-03-15 19:21:51 +00:00
Task::~Task() { }
2005-07-19 01:31:37 +00:00
// do nothings (not pure-virtual since some tasks may not need special behavior)
2005-03-15 19:21:51 +00:00
void Task::onStart() { }
void Task::onKill() { }
void Task::onPause()
{
paused_ = true;
}
void Task::onUnpause()
{
paused_ = false;
}
void Task::kill()
{
alive_ = false;
}
std::string Task::getName() const
{
return name_;
}
PriorityLevel Task::getPriority() const
{
return priority_;
}
bool Task::isAlive() const
{
return alive_;
}
bool Task::isPaused() const
{
return paused_;
}
}