Commit e8bee9d5 authored by schultezub's avatar schultezub
Browse files

introduced make_job factory method for more convenient creation of jobs (less...

introduced make_job factory method for more convenient creation of jobs (less need of explicitly defining template parameters)

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@444 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent e90692d8
......@@ -32,7 +32,9 @@
#include "modules/vis/pipelines/ixpvdemo.h"
#include "modules/vis/pipelines/dvrvis.h"
#include "modules/vis/pipelines/slicevis.h"
#ifdef HAS_KISSCL
#include "modules/opencl/pipelines/openclpipeline.h"
#endif
using namespace campvis;
......@@ -46,10 +48,12 @@ using namespace campvis;
int main(int argc, char** argv) {
CampVisApplication app(argc, argv);
app.addVisualizationPipeline("Advanced Ultrasound Visualization", new AdvancedUsVis());
// app.addVisualizationPipeline("IXPV", new IxpvDemo());
// app.addVisualizationPipeline("SliceVis", new SliceVis());
// app.addVisualizationPipeline("DVRVis", new DVRVis());
// app.addVisualizationPipeline("DVR with OpenCL", new OpenCLPipeline());
//app.addVisualizationPipeline("IXPV", new IxpvDemo());
//app.addVisualizationPipeline("SliceVis", new SliceVis());
//app.addVisualizationPipeline("DVRVis", new DVRVis());
#ifdef HAS_KISSCL
//app.addVisualizationPipeline("DVR with OpenCL", new OpenCLPipeline());
#endif
app.init();
int toReturn = app.run();
......
......@@ -189,7 +189,7 @@ namespace campvis {
}
void TumVisPainter::onRenderTargetChanged() {
GLJobProc.enqueueJob(getCanvas(), new CallMemberFuncJob<TumVisPainter>(this, &TumVisPainter::paint), OpenGLJobProcessor::PaintJob);
GLJobProc.enqueueJob(getCanvas(), make_job(this, &TumVisPainter::paint), OpenGLJobProcessor::PaintJob);
}
void TumVisPainter::setCanvas(tgt::GLCanvas* canvas) {
......
......@@ -181,7 +181,7 @@ namespace campvis {
}
void DataContainerInspectorCanvas::invalidate() {
GLJobProc.enqueueJob(this, new CallMemberFuncJob<DataContainerInspectorCanvas>(this, &DataContainerInspectorCanvas::paint), OpenGLJobProcessor::PaintJob);
GLJobProc.enqueueJob(this, make_job(this, &DataContainerInspectorCanvas::paint), OpenGLJobProcessor::PaintJob);
}
void DataContainerInspectorCanvas::createQuad() {
......
......@@ -225,7 +225,7 @@ namespace campvis {
}
void Geometry1DTransferFunctionEditor::invalidate() {
GLJobProc.enqueueJob(_canvas, new CallMemberFuncJob<Geometry1DTransferFunctionEditor>(this, &Geometry1DTransferFunctionEditor::paint), OpenGLJobProcessor::PaintJob);
GLJobProc.enqueueJob(_canvas, make_job(this, &Geometry1DTransferFunctionEditor::paint), OpenGLJobProcessor::PaintJob);
}
void Geometry1DTransferFunctionEditor::setupGUI() {
......
......@@ -211,7 +211,7 @@ namespace campvis {
}
void Geometry2DTransferFunctionEditor::invalidate() {
GLJobProc.enqueueJob(_canvas, new CallMemberFuncJob<Geometry2DTransferFunctionEditor>(this, &Geometry2DTransferFunctionEditor::paint), OpenGLJobProcessor::PaintJob);
GLJobProc.enqueueJob(_canvas, make_job(this, &Geometry2DTransferFunctionEditor::paint), OpenGLJobProcessor::PaintJob);
}
void Geometry2DTransferFunctionEditor::setupGUI() {
......
......@@ -57,7 +57,7 @@ namespace campvis {
virtual ~AbstractImageRepresentation();
/**
* Returns the parent ImageData this representation is representing.
* Returns the newParent ImageData this representation is representing.
* \return _parent
*/
const ImageData* getParent() const;
......@@ -103,16 +103,16 @@ namespace campvis {
* Returns the subimage representation of this representation given by \a llf and \a urb.
* TODO: Check whether it is necessary to adjust image mapping!
*
* \param parent Parent image of the newly created subimage
* \param llf Lower-Left-Front coordinates of subimage
* \param urb Upper-Right-Back coordinates of subimage
* \param newParent Parent image of the newly created subimage
* \param llf Lower-Left-Front coordinates of subimage
* \param urb Upper-Right-Back coordinates of subimage
* \return An image representation containing the subimage of this with the given coordinates.
*/
virtual AbstractImageRepresentation* getSubImage(ImageData* parent, const tgt::svec3& llf, const tgt::svec3& urb) const = 0;
virtual AbstractImageRepresentation* getSubImage(ImageData* newParent, const tgt::svec3& llf, const tgt::svec3& urb) const = 0;
protected:
/**
* Adds this image representations to the parent image data.
* Adds this image representations to the newParent image data.
*/
void addToParent() const;
......
......@@ -99,7 +99,7 @@ namespace campvis {
tgtAssert(_canvas != 0, "Set a valid canvas before calling this method!");
GLJobProc.enqueueJob(
_canvas,
new CallMemberFunc1ArgJob<VisualizationPipeline, AbstractProcessor*>(this, &VisualizationPipeline::executeProcessor, processor),
make_job<VisualizationPipeline, AbstractProcessor*>(this, &VisualizationPipeline::executeProcessor, processor),
OpenGLJobProcessor::SerialJob);
}
......
......@@ -51,7 +51,7 @@ namespace campvis {
virtual void execute() = 0;
};
// = Specific Jobs ================================================================================
/**
* Specific job, that is calling a member function pasing no argument.
......@@ -128,6 +128,33 @@ namespace campvis {
A1 _arg1; ///< Argument to pass to \a callee
};
// = Helper functions for easier creation of jobs =================================================
/**
* Creates a new CallMemberFuncJob for the object \a target.
* \note The caller takes ownership of the returned pointer.
* \param target Target object to call method from.
* \param callee Pointer to method to call.
* \return Pointer to the newly created CallMemberFuncJob. Caller has ownership!
*/
template<class T>
CallMemberFuncJob<T>* make_job(T* target, void (T::*callee)()) {
return new CallMemberFuncJob<T>(target, callee);
}
/**
* Creates a new CallMemberFunc1ArgJob for the object \a target.
* \note The caller takes ownership of the returned pointer.
* \param target Target object to call method from.
* \param callee Pointer to method to call.
* \param arg1 First argument to pass to \callee.
* \return Pointer to the newly created CallMemberFunc1ArgJob. Caller has ownership!
*/
template<class T, class A1>
CallMemberFunc1ArgJob<T, A1>* make_job(T* target, void (T::*callee)(A1), A1 arg1) {
return new CallMemberFunc1ArgJob<T, A1>(target, callee, arg1);
}
}
#endif // JOB_H__
\ No newline at end of file
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