Started implementing shared library support for campvis-core.

Builds and runs fine so far, but no elaborate testing done yet. Compiler throws a bunch of C4275 warning, since sigslot:has_slots<> is used in exported classes but is itself not exported. While this is no direct problem for campvis-internal builds, it should still be fixed some time.

refs #377
parent 0be65bc3
......@@ -4,6 +4,14 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
MESSAGE(STATUS "Configuring CAMPVis Core")
# configuration
IF(CAMPVIS_SHARED_LIBS)
SET(BUILD_SHARED_LIBS TRUE)
IF(MSVC)
ADD_DEFINITIONS("-DCAMPVIS_CORE_BUILD_DLL")
ENDIF()
ENDIF()
# glob sources from core directories
FILE(GLOB CampvisCoreSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
classification/*.cpp
......@@ -23,6 +31,7 @@ ENDFOREACH()
FILE(GLOB CampvisCoreHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.h
classification/*.h
datastructures/*.h
eventhandlers/*.h
......
......@@ -30,6 +30,7 @@
#include <tbb/atomic.h>
#include <tbb/mutex.h>
#include "core/coreapi.h"
#include "core/datastructures/datahandle.h"
#include "core/tools/concurrenthistogram.h"
......@@ -56,7 +57,7 @@ namespace campvis {
* context. Even though other internals might be changed meanwhile, this ensures that
* the OpenGL stuff (e.g. the texture) stays valid for this time.
*/
class AbstractTransferFunction {
class CAMPVIS_CORE_API AbstractTransferFunction {
public:
typedef ConcurrentGenericHistogramND<float, 1> IntensityHistogramType;
......
......@@ -43,7 +43,7 @@ namespace campvis {
* \tparam T Type of the base geometry class.
*/
template<class T>
class GenericGeometryTransferFunction : public AbstractTransferFunction, public sigslot::has_slots<> {
class GenericGeometryTransferFunction : public AbstractTransferFunction, public sigslot::has_slots<> {
public:
/// Typedef for the geometry class this transfer function is built from.
typedef T GeometryType;
......
......@@ -36,7 +36,7 @@ namespace campvis {
/**
* A 1D transfer function built from multiple geometries.
*/
class Geometry1DTransferFunction : public GenericGeometryTransferFunction<TFGeometry1D> {
class CAMPVIS_CORE_API Geometry1DTransferFunction : public GenericGeometryTransferFunction<TFGeometry1D> {
public:
/**
* Creates a new Geometry1DTransferFunction.
......
......@@ -36,7 +36,7 @@ namespace campvis {
/**
* A 2D transfer function built from multiple geometries.
*/
class Geometry2DTransferFunction : public GenericGeometryTransferFunction<TFGeometry2D> {
class CAMPVIS_CORE_API Geometry2DTransferFunction : public GenericGeometryTransferFunction<TFGeometry2D> {
public:
/**
* Creates a new Geometry2DTransferFunction.
......
......@@ -32,7 +32,7 @@ namespace campvis {
/**
* A very simple ramp transfer function, just for testing purposes...
*/
class SimpleTransferFunction : public AbstractTransferFunction {
class CAMPVIS_CORE_API SimpleTransferFunction : public AbstractTransferFunction {
public:
/**
* Creates a new SimpleTransferFunction.
......
......@@ -29,6 +29,8 @@
#include "tgt/vector.h"
#include <vector>
#include "core/coreapi.h"
namespace tgt {
class Texture;
}
......@@ -40,9 +42,9 @@ namespace campvis {
* Defines a single shape for the GeometryTransferFunction class.
* TFGeometry1D is defined by a sorted list of KeyPoints, each having a position and a color.
*/
class TFGeometry1D {
class CAMPVIS_CORE_API TFGeometry1D {
public:
struct KeyPoint {
struct CAMPVIS_CORE_API KeyPoint {
explicit KeyPoint(float position, const tgt::col4& color)
: _position(position)
, _color(color)
......@@ -151,7 +153,7 @@ namespace campvis {
* \param right RightKeyPoint to compare
* \return left._position < right._position
*/
bool operator< (const TFGeometry1D::KeyPoint& left, const TFGeometry1D::KeyPoint& right);
CAMPVIS_CORE_API bool operator< (const TFGeometry1D::KeyPoint& left, const TFGeometry1D::KeyPoint& right);
}
......
......@@ -29,6 +29,8 @@
#include "tgt/vector.h"
#include <vector>
#include "core/coreapi.h"
namespace tgt {
class Texture;
}
......@@ -39,9 +41,9 @@ namespace campvis {
* Defines a single shape for the GeometryTransferFunction class.
* TFGeometry2D is defined by a sorted list of KeyPoints, each having a position and a color.
*/
class TFGeometry2D {
class CAMPVIS_CORE_API TFGeometry2D {
public:
struct KeyPoint {
struct CAMPVIS_CORE_API KeyPoint {
explicit KeyPoint(const tgt::vec2& position, const tgt::col4& color)
: _position(position)
, _color(color)
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2013, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// 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
//
// 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.
//
// ================================================================================================
#ifndef CAMPVIS_COREAPI_H__
#define CAMPVIS_COREAPI_H__
#ifdef CAMPVIS_DYNAMIC_LIBS
#ifdef CAMPVIS_CORE_BUILD_DLL
// building library -> export symbols
#ifdef WIN32
#define CAMPVIS_CORE_API __declspec(dllexport)
#else
#define CAMPVIS_CORE_API
#endif
#else
// including library -> import symbols
#ifdef WIN32
#define CAMPVIS_CORE_API __declspec(dllimport)
#else
#define CAMPVIS_CORE_API
#endif
#endif
#else
// building/including static library -> do nothing
#define CAMPVIS_CORE_API
#endif
#endif // CAMPVIS_COREAPI_H__
......@@ -31,6 +31,8 @@
#define ABSTRACTDATA_H__
#include "tgt/bounds.h"
#include "core/coreapi.h"
#include "core/datastructures/scopedtypeddata.h" // not directly needed here but by many classes including AbstractData
#include "core/tools/referencecounted.h"
......@@ -39,7 +41,7 @@ namespace campvis {
/**
* Interface class for data which can compute their bounds in world coordinates.
*/
class IHasWorldBounds {
class CAMPVIS_CORE_API IHasWorldBounds {
public:
/// Default empty constructor
IHasWorldBounds() {};
......@@ -60,7 +62,7 @@ namespace campvis {
*
* \todo
*/
class AbstractData : public ReferenceCounted {
class CAMPVIS_CORE_API AbstractData : public ReferenceCounted {
public:
/**
* Constructor, simply calles ReferenceCounted ctor.
......
......@@ -34,6 +34,10 @@ namespace campvis {
tgtAssert(parent != 0, "Parent ImageData must not be 0!");
}
AbstractImageRepresentation::AbstractImageRepresentation(const AbstractImageRepresentation& rhs) {
}
AbstractImageRepresentation::~AbstractImageRepresentation() {
}
......@@ -57,5 +61,9 @@ namespace campvis {
const_cast<ImageData*>(_parent)->addRepresentation(this);
}
AbstractImageRepresentation& AbstractImageRepresentation::operator=(const AbstractImageRepresentation& rhs) {
return *this;
}
}
\ No newline at end of file
......@@ -27,6 +27,8 @@
#include "tgt/bounds.h"
#include "tgt/vector.h"
#include "core/coreapi.h"
#include "core/datastructures/abstractdata.h"
namespace campvis {
......@@ -38,7 +40,7 @@ namespace campvis {
* the semantically same image but have their data at different locations (e.g. disk,
* RAM, OpenGL texture, ...)
*/
class AbstractImageRepresentation {
class CAMPVIS_CORE_API AbstractImageRepresentation {
public:
/**
* Creates a new abstract representation for the image \a parent.
......@@ -111,13 +113,14 @@ namespace campvis {
*/
void addToParent() const;
const ImageData* _parent; ///< Image this representation represents, must not be 0.
private:
/// Not copy-constructable
AbstractImageRepresentation(const AbstractImageRepresentation& rhs);
/// Not assignable
AbstractImageRepresentation& operator=(const AbstractImageRepresentation& rhs);
const ImageData* _parent; ///< Image this representation represents, must not be 0.
static const std::string loggerCat_;
};
}
......
......@@ -28,6 +28,8 @@
#include "sigslot/sigslot.h"
#include <tbb/concurrent_unordered_map.h>
#include <tbb/spin_mutex.h>
#include "core/coreapi.h"
#include "core/datastructures/datahandle.h"
#include <string>
......@@ -50,7 +52,7 @@ namespace campvis {
*
* \todo Check thread-safety
*/
class DataContainer {
class CAMPVIS_CORE_API DataContainer {
public:
/**
* Creates a new empty DataContainer
......
......@@ -27,6 +27,8 @@
#include <ctime>
#include "core/coreapi.h"
namespace campvis {
class AbstractData;
......@@ -45,7 +47,7 @@ namespace campvis {
* with its reference counting!
* \note Reference counting implementation inspired from Scott Meyers: More Effective C++, Item 29
*/
class DataHandle {
class CAMPVIS_CORE_API DataHandle {
public:
/**
* Creates a new DataHandle for the given data.
......
......@@ -44,7 +44,7 @@ namespace campvis {
* \note This class expects all vertices lying within one plane. Everything other that that
* leads to undefined behavior.
*/
class FaceGeometry : public GeometryData {
class CAMPVIS_CORE_API FaceGeometry : public GeometryData {
public:
/**
* Creates a new empty FaceGeometry.
......
......@@ -41,7 +41,7 @@ namespace campvis {
* \tparam T Base class of the ImageRepresentation to get.
*/
template<typename T>
class GenericAbstractImageRepresentation : public AbstractImageRepresentation {
class GenericAbstractImageRepresentation : public AbstractImageRepresentation {
public:
struct ScopedRepresentation {
/**
......
......@@ -50,7 +50,7 @@ namespace campvis {
* - Vertex normals: Vertex attribute 3
*
*/
class GeometryData : public AbstractData, public IHasWorldBounds {
class CAMPVIS_CORE_API GeometryData : public AbstractData, public IHasWorldBounds {
public:
/**
* Constructor
......
......@@ -37,7 +37,7 @@
namespace campvis {
class GeometryDataFactory {
class CAMPVIS_CORE_API GeometryDataFactory {
public:
/**
* Creates a FaceGeometry building an axis-aligned rectangle face in the YX plane (quad)
......
......@@ -28,6 +28,8 @@
#include <tbb/concurrent_vector.h>
#include "tgt/logmanager.h"
#include "tgt/vector.h"
#include "core/coreapi.h"
#include "core/datastructures/abstractdata.h"
#include "core/datastructures/abstractimagerepresentation.h"
#include "core/datastructures/imagemappinginformation.h"
......@@ -45,7 +47,7 @@ namespace campvis {
*
* \todo
*/
class ImageData : public AbstractData, public IHasWorldBounds {
class CAMPVIS_CORE_API ImageData : public AbstractData, public IHasWorldBounds {
// friend so that it can add itself as representation
friend class AbstractImageRepresentation;
......@@ -231,13 +233,13 @@ namespace campvis {
}
template<>
const campvis::ImageRepresentationLocal* campvis::ImageData::getRepresentation<ImageRepresentationLocal>(bool performConversion) const;
CAMPVIS_CORE_API const campvis::ImageRepresentationLocal* campvis::ImageData::getRepresentation<ImageRepresentationLocal>(bool performConversion) const;
#ifdef CAMPVIS_HAS_MODULE_ITK
class AbstractImageRepresentationItk;
template<>
const campvis::AbstractImageRepresentationItk* campvis::ImageData::getRepresentation<AbstractImageRepresentationItk>(bool performConversion) const;
CAMPVIS_CORE_API const campvis::AbstractImageRepresentationItk* campvis::ImageData::getRepresentation<AbstractImageRepresentationItk>(bool performConversion) const;
#endif
template<typename T>
......
......@@ -27,6 +27,8 @@
#include "tgt/matrix.h"
#include "tgt/vector.h"
#include "core/coreapi.h"
#include "core/tools/mapping.h"
namespace campvis {
......@@ -37,7 +39,7 @@ namespace campvis {
* \todo Make a full list of fields that belong in this class. Then check
* which of them belong together and which are derived measures.
*/
class ImageMappingInformation {
class CAMPVIS_CORE_API ImageMappingInformation {
public:
/**
* Creates a new default ImageMappingInformation.
......
......@@ -37,7 +37,7 @@ namespace campvis {
*
* \todo Number of channels
*/
class ImageRepresentationDisk : public GenericAbstractImageRepresentation<ImageRepresentationDisk> {
class CAMPVIS_CORE_API ImageRepresentationDisk : public GenericAbstractImageRepresentation<ImageRepresentationDisk> {
public:
/**
* Creates a new ImageRepresentationDisk with the given parameters and automatically
......
......@@ -42,7 +42,7 @@ namespace campvis {
* Stores image data as OpenGL texture.
* Can bei instantiated either by a WeaklyTypedPointer or strongly typed by an GenericImageRepresentationLocal.
*/
class ImageRepresentationGL : public GenericAbstractImageRepresentation<ImageRepresentationGL> {
class CAMPVIS_CORE_API ImageRepresentationGL : public GenericAbstractImageRepresentation<ImageRepresentationGL> {
public:
/**
* Creates a new ImageRepresentationGL representation from a tgt::Texture and automatically
......
......@@ -40,7 +40,7 @@ namespace campvis {
*
* \todo implement padding, add some kind of cool iterators
*/
class ImageRepresentationLocal : public GenericAbstractImageRepresentation<ImageRepresentationLocal> {
class CAMPVIS_CORE_API ImageRepresentationLocal : public GenericAbstractImageRepresentation<ImageRepresentationLocal> {
public:
/**
* Destructor
......
......@@ -35,7 +35,7 @@ namespace campvis {
/**
* Class encapsulating a series of images.
*/
class ImageSeries : public AbstractData {
class CAMPVIS_CORE_API ImageSeries : public AbstractData {
public:
/**
* Constructor
......
......@@ -43,7 +43,7 @@ namespace campvis {
* \note Like all Geometry classes IndexedMeshGeometry has value-sematics: Once created, the
* faces cannot be altered anymore.
*/
class IndexedMeshGeometry : public GeometryData {
class CAMPVIS_CORE_API IndexedMeshGeometry : public GeometryData {
public:
/**
* Creates a new IndexedMeshGeometry built from the given faces.
......
......@@ -40,7 +40,7 @@ namespace campvis {
*
* The internal OpenGL buffers are lazy-instantiated.
*/
class MeshGeometry : public GeometryData {
class CAMPVIS_CORE_API MeshGeometry : public GeometryData {
public:
/**
* Creates a new MeshGeometry built from the given faces.
......
......@@ -42,7 +42,7 @@ namespace campvis {
*
* The internal OpenGL buffers are lazy-instantiated.
*/
class MultiIndexedGeometry : public GeometryData {
class CAMPVIS_CORE_API MultiIndexedGeometry : public GeometryData {
public:
/**
* Creates a new MultiIndexedGeometry using the given geometry. Indices are to be provided later.
......
......@@ -49,7 +49,7 @@ namespace campvis {
* \note RenderData does not care whether its textures have the same size and their formats
* make sense.
*/
class RenderData : public AbstractData {
class CAMPVIS_CORE_API RenderData : public AbstractData {
public:
/**
* Constructor, creates empty RenderData.
......
......@@ -28,13 +28,15 @@
#include "tgt/logmanager.h"
#include "tgt/event/eventlistener.h"
#include "core/coreapi.h"
namespace campvis {
class INumericProperty;
/**
* Event handler that maps mouse wheel events to a numeric property.
*/
class MWheelToNumericPropertyEventListener : public tgt::EventListener {
class CAMPVIS_CORE_API MWheelToNumericPropertyEventListener : public tgt::EventListener {
public:
/**
* Creates a MWheelToNumericPropertyEventListener.
......
......@@ -32,6 +32,7 @@
#include "tgt/event/eventlistener.h"
#include "tgt/navigation/trackball.h"
#include "core/coreapi.h"
#include "core/datastructures/datahandle.h"
#include "core/properties/numericproperty.h"
......@@ -45,7 +46,7 @@ namespace campvis {
/**
* Wrapper to adapt a CameraProperty to the tgt::Trackball interface.
*/
class CamPropNavigationWrapper : public tgt::IHasCamera {
class CAMPVIS_CORE_API CamPropNavigationWrapper : public tgt::IHasCamera {
public:
/**
* Constructor
......@@ -78,7 +79,7 @@ namespace campvis {
* \note Also takes care of automatically adjusting the window ratio for the wrapped
* camera when the viewport size changes.
*/
class TrackballNavigationEventListener : public tgt::EventListener, public sigslot::has_slots<> {
class CAMPVIS_CORE_API TrackballNavigationEventListener : public tgt::EventListener, public sigslot::has_slots<> {
public:
/**
* Creates a TrackballNavigationEventListener.
......
......@@ -29,6 +29,8 @@
#include "tgt/vector.h"
#include "tgt/event/eventlistener.h"
#include "core/coreapi.h"
namespace campvis {
class TransferFunctionProperty;
......@@ -36,7 +38,7 @@ namespace campvis {
* Event handler that maps mouse click-and-drag events to the windowing of a transfer function.
*
*/
class TransFuncWindowingEventListener : public tgt::EventListener {
class CAMPVIS_CORE_API TransFuncWindowingEventListener : public tgt::EventListener {
public:
/**
* Creates a TransFuncWindowingEventListener.
......
......@@ -35,6 +35,7 @@
#include <tbb/spin_mutex.h>
#include <tbb/mutex.h>
#include "core/coreapi.h"
#include "core/datastructures/datacontainer.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/floatingpointproperty.h"
......@@ -53,7 +54,7 @@ namespace campvis {
/**
* Abstract base class for CAMPVis Pipelines.
*/
class AbstractPipeline : public HasPropertyCollection, public tgt::EventHandler, public tgt::EventListener {
class CAMPVIS_CORE_API AbstractPipeline : public HasPropertyCollection, public tgt::EventHandler, public tgt::EventListener {
public:
/**
* Creates a AbstractPipeline.
......
......@@ -29,6 +29,8 @@
#include <tbb/atomic.h>
#include <tbb/concurrent_queue.h>
#include "tgt/logmanager.h"
#include "core/coreapi.h"
#include "core/datastructures/datacontainer.h"
#include "core/properties/propertycollection.h"
......@@ -51,7 +53,7 @@ namespace campvis {
*
* \sa AbstractPipeline
*/
class AbstractProcessor : public HasPropertyCollection {
class CAMPVIS_CORE_API AbstractProcessor : public HasPropertyCollection {
public:
/**
* Available invalidation levels
......@@ -249,7 +251,7 @@ namespace campvis {
* Scoped lock of an AbstractProcessor that automatically unlocks the processor on destruction.
* Useful for exception safety.
*/
struct ScopedLock {
struct CAMPVIS_CORE_API ScopedLock {
/**
* Constructs a new Scoped lock, locking \a p and unlocking \a p on destruction.
* \param p Processor to lock
......
......@@ -28,6 +28,8 @@
#include <vector>
#include <string>
#include "core/coreapi.h"
namespace tgt {
class Shader;
}
......@@ -41,7 +43,7 @@ namespace campvis {
* ProcessorDecorators are created and assigned to a processor during its construction. The
* virtual methods are then calles at an appropriate time.
*/
class AbstractProcessorDecorator {
class CAMPVIS_CORE_API AbstractProcessorDecorator {
public:
/**
* Pure virtual Destructor
......@@ -86,7 +88,7 @@ namespace campvis {
/**
* Pure virtual base class for processors using decorators.
*/
class HasProcessorDecorators {
class CAMPVIS_CORE_API HasProcessorDecorators {
public:
/**
* Virtual Destructor, deletes all Decorators
......
......@@ -42,7 +42,7 @@ namespace campvis {
* \param dc Pointer to the DataContainer containing local working set of data for this
* pipeline, must not be 0, must be valid the whole lifetime of this pipeline.
*/
class AutoEvaluationPipeline : public AbstractPipeline {
class CAMPVIS_CORE_API AutoEvaluationPipeline : public AbstractPipeline {
public:
/**
* Creates a AutoEvaluationPipeline.
......
......@@ -30,7 +30,7 @@
namespace campvis {
class ProcessorDecoratorBackground : public AbstractProcessorDecorator {
class CAMPVIS_CORE_API ProcessorDecoratorBackground : public AbstractProcessorDecorator {
public:
ProcessorDecoratorBackground();
virtual ~ProcessorDecoratorBackground();
......
......@@ -39,7 +39,7 @@ namespace campvis {
* generateHeader() to define computeGradient(tex, texParams, texCoords) in GLSL calling
* the selected function.
*/
class ProcessorDecoratorGradient : public AbstractProcessorDecorator {
class CAMPVIS_CORE_API ProcessorDecoratorGradient : public AbstractProcessorDecorator {
public:
/// Method for online-calculating gradients
enum GradientMethod {
......
......@@ -35,7 +35,7 @@
namespace campvis {
class ProcessorDecoratorMasking : public AbstractProcessorDecorator, public sigslot::has_slots<> {
class CAMPVIS_CORE_API ProcessorDecoratorMasking : public AbstractProcessorDecorator, public sigslot::has_slots<> {
public:
ProcessorDecoratorMasking();
virtual ~ProcessorDecoratorMasking();
......