2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit fb8b1880 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Moved AbstractJob and OpenGLJobProcessor from campvis-core to tgt and adapted...

Moved AbstractJob and OpenGLJobProcessor from campvis-core to tgt and adapted and cleaned up all necessary includes/references.
parent 58512d30
......@@ -29,6 +29,7 @@
#include "tgt/glcanvas.h"
#include "tgt/glcontextmanager.h"
#include "tgt/gpucapabilities.h"
#include "tgt/opengljobprocessor.h"
#include "tgt/shadermanager.h"
#include "tgt/texturereadertga.h"
#include "tgt/qt/qtapplication.h"
......@@ -39,8 +40,6 @@
#include "application/gui/mainwindow.h"
#include "application/gui/mdi/mdidockablewindow.h"
#include "core/tools/job.h"
#include "core/tools/opengljobprocessor.h"
#include "core/tools/simplejobprocessor.h"
#include "core/tools/stringutils.h"
#include "core/tools/quadrenderer.h"
......
......@@ -37,8 +37,6 @@
#include "core/datastructures/renderdata.h"
#include "core/datastructures/imagerepresentationgl.h"
#include "core/pipeline/abstractpipeline.h"
#include "core/tools/job.h"
#include "core/tools/opengljobprocessor.h"
#include "core/tools/quadrenderer.h"
namespace campvis {
......
......@@ -34,7 +34,6 @@
#include "core/datastructures/imagerepresentationgl.h"
#include "core/datastructures/facegeometry.h"
#include "core/datastructures/geometrydatafactory.h"
#include "core/tools/job.h"
#include "core/classification/tfgeometry1d.h"
#include "core/classification/geometry1dtransferfunction.h"
......
......@@ -39,7 +39,6 @@
#include "core/properties/numericproperty.h"
#include "core/properties/propertycollection.h"
#include "core/properties/transferfunctionproperty.h"
#include "core/tools/opengljobprocessor.h"
#include "core/eventhandlers/trackballnavigationeventlistener.h"
#include "modules/base/processors/lightsourceprovider.h"
......
......@@ -35,9 +35,6 @@
#include <IL/ilu.h>
#endif
#include "core/tools/job.h"
#include "core/tools/opengljobprocessor.h"
#include "core/datastructures/abstractdata.h"
#include "core/datastructures/datacontainer.h"
#include "core/datastructures/facegeometry.h"
......
......@@ -32,7 +32,6 @@
#include "application/gui/qtdatahandle.h"
#include "application/gui/datacontainerinspectorcanvas.h"
#include "application/gui/properties/propertycollectionwidget.h"
#include "core/tools/opengljobprocessor.h"
#include <QLabel>
#include <QWidget>
......
......@@ -36,7 +36,6 @@
#include "core/classification/tfgeometry1d.h"
#include "core/datastructures/imagerepresentationlocal.h"
#include "core/properties/transferfunctionproperty.h"
#include "core/tools/opengljobprocessor.h"
#include <QCheckBox>
#include <QGridLayout>
......
......@@ -36,7 +36,6 @@
#include "core/classification/tfgeometry2d.h"
#include "core/datastructures/imagerepresentationlocal.h"
#include "core/properties/transferfunctionproperty.h"
#include "core/tools/opengljobprocessor.h"
#include <QGridLayout>
#include <QLabel>
......
......@@ -28,7 +28,7 @@ namespace campvis {
QtJobProcessor::QtJobProcessor()
: QWidget()
{
connect(this, SIGNAL(newJobSignal(AbstractJob *)), this, SLOT(onJobArrived(AbstractJob *)));
connect(this, SIGNAL(newJobSignal(tgt::AbstractJob*)), this, SLOT(onJobArrived(tgt::AbstractJob*)));
}
QtJobProcessor::~QtJobProcessor()
......@@ -36,16 +36,16 @@ namespace campvis {
}
void QtJobProcessor::enqueueJob(AbstractJob * job) {
void QtJobProcessor::enqueueJob(tgt::AbstractJob* job) {
emit newJobSignal(job);
}
void QtJobProcessor::enqueueJob(std::function<void(void)> fn)
{
emit newJobSignal(makeJobOnHeap(fn));
emit newJobSignal(tgt::makeJobOnHeap(fn));
}
void QtJobProcessor::onJobArrived(AbstractJob * job)
void QtJobProcessor::onJobArrived(tgt::AbstractJob* job)
{
tgtAssert(job, "Job must not be null!");
......
......@@ -25,14 +25,13 @@
#ifndef QTJOBPROCESSOR_H__
#define QTJOBPROCESSOR_H__
#include "core/tools/job.h"
#include "tgt/job.h"
#include "tgt/singleton.h"
#include <QWidget>
#include <functional>
namespace campvis {
/**
* This job processor singleton can be used to execute jobs (asynchronously) from inside the Qt GUI thread.
* This can result in simpler and better understandable code when only a few lines of code need
......@@ -58,18 +57,18 @@ namespace campvis {
/**
Enqueues a new job to be processed by the job processor
*/
void enqueueJob(AbstractJob * job);
void enqueueJob(tgt::AbstractJob* job);
/**
Convenience function to simplify the code, removing the necessity for a makeJobOnHeap() call
*/
void enqueueJob(std::function<void(void)> fn);
signals:
void newJobSignal(AbstractJob * job);
signals:
void newJobSignal(tgt::AbstractJob* job);
private slots:
void onJobArrived(AbstractJob * job);
void onJobArrived(tgt::AbstractJob* job);
};
}
......
......@@ -28,8 +28,6 @@
#include "tgt/glcontextmanager.h"
#include "tgt/vertexarrayobject.h"
#include "core/tools/opengljobprocessor.h"
namespace campvis {
const std::string GeometryData::loggerCat_ = "CAMPVis.core.datastructures.GeometryData";;
......
......@@ -26,10 +26,6 @@
#include "tgt/assert.h"
#include "tgt/logmanager.h"
#include "tgt/glcontextmanager.h"
#include "core/tools/opengljobprocessor.h"
#include "core/tools/job.h"
namespace campvis {
......@@ -46,7 +42,7 @@ namespace campvis {
return nullptr;
}
OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
tgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
ImageRepresentationGL* toReturn = ImageRepresentationGL::create(const_cast<ImageData*>(tester->getParent()), wtp);
switch (wtp._baseType) {
......@@ -79,7 +75,7 @@ namespace campvis {
return toReturn;
}
else if (const ImageRepresentationLocal* tester = dynamic_cast<const ImageRepresentationLocal*>(source)) {
OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
tgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
ImageRepresentationGL* toReturn = ImageRepresentationGL::create(const_cast<ImageData*>(tester->getParent()), tester->getWeaklyTypedPointer());
return toReturn;
}
......@@ -97,7 +93,7 @@ namespace campvis {
return ImageRepresentationLocal::create(tester->getParent(), tester->getImageData());
}
else if (const ImageRepresentationGL* tester = dynamic_cast<const ImageRepresentationGL*>(source)) {
OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
tgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
WeaklyTypedPointer wtp = tester->getWeaklyTypedPointerCopy();
if (wtp._pointer != nullptr)
return ImageRepresentationLocal::create(source->getParent(), wtp);
......
......@@ -25,8 +25,9 @@
#ifndef IMAGEREPRESENTATIONCONVERSIONCORE_H__
#define IMAGEREPRESENTATIONCONVERSIONCORE_H__
#include "tgt/opengljobprocessor.h"
#include "core/coreapi.h"
#include "core/tools/opengljobprocessor.h"
#include "core/datastructures/imagerepresentationconverter.h"
#include "core/datastructures/imagerepresentationdisk.h"
......@@ -95,7 +96,7 @@ namespace campvis {
else if (const ImageRepresentationGL* tester = dynamic_cast<const ImageRepresentationGL*>(source)) {
// converting from GL representation
OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
tgt::OpenGLJobProcessor::ScopedSynchronousGlJobExecution jobGuard;
if (tester->getTexture()->getDataType() != TypeTraits<BASETYPE, NUMCHANNELS>::glDataType)
LDEBUGC("CAMPVis.core.datastructures.GenericLocalConversion", "Performing conversion between data types, you may lose information or the resulting data may show other unexpected features.");
......
......@@ -35,9 +35,6 @@
#include "core/pipeline/visualizationprocessor.h"
#include "core/pipeline/abstractprocessor.h"
#include "core/tools/job.h"
#include "core/tools/opengljobprocessor.h"
#include "core/tools/simplejobprocessor.h"
#ifdef CAMPVIS_DEBUG
......
......@@ -22,16 +22,12 @@
//
// ================================================================================================
#include "abstractprocessor.h"
#include "tgt/assert.h"
#include "core/properties/abstractproperty.h"
#include <ext/threading.h>
#include "abstractprocessor.h"
#include "core/properties/abstractproperty.h"
#include "core/tools/job.h"
#include "core/tools/opengljobprocessor.h"
#include "core/tools/simplejobprocessor.h"
namespace campvis {
const std::string AbstractProcessor::loggerCat_ = "CAMPVis.core.datastructures.Processor";
......
......@@ -23,15 +23,13 @@
// ================================================================================================
#include "autoevaluationpipeline.h"
#include "tgt/tgt_gl.h"
#include "tgt/glcanvas.h"
#include "core/pipeline/visualizationprocessor.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/metaproperty.h"
#include "core/tools/job.h"
#include "core/tools/opengljobprocessor.h"
#include "core/tools/simplejobprocessor.h"
namespace campvis {
const std::string AutoEvaluationPipeline::loggerCat_ = "CAMPVis.core.datastructures.AutoEvaluationPipeline";
......
......@@ -40,8 +40,10 @@ SET(TGT_SOURCES
init.cpp
light.cpp
logmanager.cpp
job.cpp
naturalcubicspline.cpp
openglgarbagecollector.cpp
opengljobprocessor.cpp
painter.cpp
runnable.cpp
shadermanager.cpp
......
......@@ -27,9 +27,9 @@
#include <memory>
#include <new>
#include "core/tools/opengljobprocessor.h"
#include "tgt/opengljobprocessor.h"
namespace campvis {
namespace tgt {
// Implementation inspired by http://stackoverflow.com/questions/7194127/how-should-i-write-iso-c-standard-conformant-custom-new-and-delete-operators/7194149#7194149
void* AbstractJob::operator new(std::size_t size) throw(std::bad_alloc) {
......
......@@ -26,17 +26,16 @@
#define JOB_H__
#include "tgt/assert.h"
#include "core/coreapi.h"
#include "tgt/types.h"
#include <functional>
namespace campvis {
namespace tgt {
/**
* Abstract base class for a job that can be executed.
*/
class CAMPVIS_CORE_API AbstractJob {
class TGT_API AbstractJob {
public:
/**
* Pure virtual destructor.
......@@ -48,6 +47,9 @@ namespace campvis {
*/
virtual void execute() = 0;
/**
* Executes the job, calls execute().
*/
void operator()() {
this->execute();
}
......@@ -264,7 +266,7 @@ namespace campvis {
/**
* specific job that evaluates a function object
*/
class CAMPVIS_CORE_API CallFunctionObjectJob : public AbstractJob{
class TGT_API CallFunctionObjectJob : public AbstractJob {
public:
CallFunctionObjectJob(std::function<void(void)> fn)
: _fn(fn)
......
......@@ -30,9 +30,8 @@
#include "tgt/logmanager.h"
#include "tgt/openglgarbagecollector.h"
#include "tgt/glcontextmanager.h"
#include "core/tools/job.h"
namespace campvis {
namespace tgt {
OpenGLJobProcessor::ScopedSynchronousGlJobExecution::ScopedSynchronousGlJobExecution()
: _lock(nullptr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment