-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
89 changed files
with
15,571 additions
and
956 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*========================================================================= | ||
Library: CTK | ||
Copyright (c) Kitware Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0.txt | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
This file was originally developed by Davide Punzo, [email protected], | ||
and development was supported by the Center for Intelligent Image-guided Interventions (CI3). | ||
=========================================================================*/ | ||
|
||
#include "ctkAbstractTaskPool.h" | ||
|
||
// -------------------------------------------------------------------------- | ||
ctkAbstractTaskPool::ctkAbstractTaskPool(QObject* parent) | ||
: QObject(parent) | ||
{ | ||
} | ||
|
||
// -------------------------------------------------------------------------- | ||
ctkAbstractTaskPool::~ctkAbstractTaskPool() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/*========================================================================= | ||
Library: CTK | ||
Copyright (c) Kitware Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0.txt | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
This file was originally developed by Davide Punzo, [email protected], | ||
and development was supported by the Center for Intelligent Image-guided Interventions (CI3). | ||
=========================================================================*/ | ||
|
||
#ifndef __ctkAbstractTaskPool_h | ||
#define __ctkAbstractTaskPool_h | ||
|
||
// Qt includes | ||
#include <QObject> | ||
|
||
// CTK includes | ||
#include "ctkCoreExport.h" | ||
|
||
//------------------------------------------------------------------------------ | ||
/// \ingroup Core | ||
class CTK_CORE_EXPORT ctkAbstractTaskPool : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit ctkAbstractTaskPool(QObject* parent = 0); | ||
virtual ~ctkAbstractTaskPool(); | ||
|
||
public Q_SLOTS: | ||
virtual void taskStarted() = 0; | ||
virtual void taskFinished() = 0; | ||
virtual void taskCanceled() = 0; | ||
|
||
private: | ||
Q_DISABLE_COPY(ctkAbstractTaskPool) | ||
}; | ||
|
||
|
||
#endif // ctkAbstractTaskPool_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/*========================================================================= | ||
Library: CTK | ||
Copyright (c) Kitware Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0.txt | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
This file was originally developed by Davide Punzo, [email protected], | ||
and development was supported by the Center for Intelligent Image-guided Interventions (CI3). | ||
=========================================================================*/ | ||
|
||
#include "ctkAbstractTask.h" | ||
|
||
// -------------------------------------------------------------------------- | ||
ctkAbstractTask::ctkAbstractTask() | ||
{ | ||
this->Stop = false; | ||
this->Running = false; | ||
this->Finished = false; | ||
this->TaskUID = ""; | ||
this->NumberOfRetry = 0; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
ctkAbstractTask::~ctkAbstractTask() | ||
{ | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
void ctkAbstractTask::setTaskUID(const QString &taskUID) | ||
{ | ||
this->TaskUID = taskUID; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
QString ctkAbstractTask::taskUID() const | ||
{ | ||
return this->TaskUID; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
bool ctkAbstractTask::isStopped() const | ||
{ | ||
return this->Stop; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
void ctkAbstractTask::setStop(const bool& stop) | ||
{ | ||
this->Stop = stop; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
bool ctkAbstractTask::isFinished() const | ||
{ | ||
return this->Finished; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
void ctkAbstractTask::setIsFinished(const bool& finished) | ||
{ | ||
if (finished && this->Running) | ||
{ | ||
this->Running = false; | ||
} | ||
|
||
this->Finished = finished; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
bool ctkAbstractTask::isRunning() const | ||
{ | ||
return this->Running; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
void ctkAbstractTask::setIsRunning(const bool& running) | ||
{ | ||
this->Running = running; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
int ctkAbstractTask::numberOfRetry() const | ||
{ | ||
return this->NumberOfRetry; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
void ctkAbstractTask::setNumberOfRetry(const int& numberOfRetry) | ||
{ | ||
this->NumberOfRetry = numberOfRetry; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/*========================================================================= | ||
Library: CTK | ||
Copyright (c) Kitware Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0.txt | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
This file was originally developed by Davide Punzo, [email protected], | ||
and development was supported by the Center for Intelligent Image-guided Interventions (CI3). | ||
=========================================================================*/ | ||
|
||
#ifndef __ctkAbstractTask_h | ||
#define __ctkAbstractTask_h | ||
|
||
// Qt includes | ||
#include <QObject> | ||
#include <QRunnable> | ||
|
||
// CTK includes | ||
#include "ctkCoreExport.h" | ||
|
||
//------------------------------------------------------------------------------ | ||
/// \ingroup Core | ||
class CTK_CORE_EXPORT ctkAbstractTask : public QObject, public QRunnable | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(QString taskUID READ taskUID WRITE setTaskUID); | ||
Q_PROPERTY(bool stop READ isStopped WRITE setStop); | ||
Q_PROPERTY(bool running READ isRunning WRITE setIsRunning); | ||
Q_PROPERTY(bool finished READ isFinished WRITE setIsFinished); | ||
Q_PROPERTY(bool numberOfRetry READ numberOfRetry WRITE setNumberOfRetry); | ||
|
||
public: | ||
explicit ctkAbstractTask(); | ||
virtual ~ctkAbstractTask(); | ||
|
||
/// Execute task | ||
virtual void run() = 0; | ||
|
||
/// Task UID | ||
QString taskUID() const; | ||
virtual void setTaskUID(const QString& taskUID); | ||
|
||
/// Stop task | ||
bool isStopped() const; | ||
virtual void setStop(const bool& stop); | ||
|
||
/// Finished | ||
bool isFinished() const; | ||
void setIsFinished(const bool& finished); | ||
|
||
/// Running | ||
bool isRunning() const; | ||
void setIsRunning(const bool& running); | ||
|
||
/// Number of retries: current counter of how many times | ||
/// the task has been relunched on fails | ||
int numberOfRetry() const; | ||
void setNumberOfRetry(const int& numberOfRetry); | ||
|
||
Q_SIGNALS: | ||
void started(); | ||
void finished(); | ||
void canceled(); | ||
|
||
private: | ||
Q_DISABLE_COPY(ctkAbstractTask) | ||
|
||
QString TaskUID; | ||
bool Stop; | ||
bool Running; | ||
bool Finished; | ||
int NumberOfRetry; | ||
}; | ||
|
||
|
||
#endif // ctkAbstractTask_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*========================================================================= | ||
Library: CTK | ||
Copyright (c) Kitware Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0.txt | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
This file was originally developed by Davide Punzo, [email protected], | ||
and development was supported by the Center for Intelligent Image-guided Interventions (CI3). | ||
=========================================================================*/ | ||
|
||
#include "ctkAbstractTaskPool.h" | ||
|
||
// -------------------------------------------------------------------------- | ||
ctkAbstractTaskPool::ctkAbstractTaskPool(QObject* parent) | ||
: QObject(parent) | ||
{ | ||
} | ||
|
||
// -------------------------------------------------------------------------- | ||
ctkAbstractTaskPool::~ctkAbstractTaskPool() | ||
{ | ||
} |
Oops, something went wrong.