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

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) ...@@ -4,6 +4,14 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
MESSAGE(STATUS "Configuring CAMPVis Core") 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 # glob sources from core directories
FILE(GLOB CampvisCoreSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FILE(GLOB CampvisCoreSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
classification/*.cpp classification/*.cpp
...@@ -23,6 +31,7 @@ ENDFOREACH() ...@@ -23,6 +31,7 @@ ENDFOREACH()
FILE(GLOB CampvisCoreHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FILE(GLOB CampvisCoreHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.h
classification/*.h classification/*.h
datastructures/*.h datastructures/*.h
eventhandlers/*.h eventhandlers/*.h
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <tbb/atomic.h> #include <tbb/atomic.h>
#include <tbb/mutex.h> #include <tbb/mutex.h>
#include "core/coreapi.h"
#include "core/datastructures/datahandle.h" #include "core/datastructures/datahandle.h"
#include "core/tools/concurrenthistogram.h" #include "core/tools/concurrenthistogram.h"
...@@ -56,7 +57,7 @@ namespace campvis { ...@@ -56,7 +57,7 @@ namespace campvis {
* context. Even though other internals might be changed meanwhile, this ensures that * context. Even though other internals might be changed meanwhile, this ensures that
* the OpenGL stuff (e.g. the texture) stays valid for this time. * the OpenGL stuff (e.g. the texture) stays valid for this time.
*/ */
class AbstractTransferFunction { class CAMPVIS_CORE_API AbstractTransferFunction {
public: public:
typedef ConcurrentGenericHistogramND<float, 1> IntensityHistogramType; typedef ConcurrentGenericHistogramND<float, 1> IntensityHistogramType;
......
...@@ -36,7 +36,7 @@ namespace campvis { ...@@ -36,7 +36,7 @@ namespace campvis {
/** /**
* A 1D transfer function built from multiple geometries. * A 1D transfer function built from multiple geometries.
*/ */
class Geometry1DTransferFunction : public GenericGeometryTransferFunction<TFGeometry1D> { class CAMPVIS_CORE_API Geometry1DTransferFunction : public GenericGeometryTransferFunction<TFGeometry1D> {
public: public:
/** /**
* Creates a new Geometry1DTransferFunction. * Creates a new Geometry1DTransferFunction.
......
...@@ -36,7 +36,7 @@ namespace campvis { ...@@ -36,7 +36,7 @@ namespace campvis {
/** /**
* A 2D transfer function built from multiple geometries. * A 2D transfer function built from multiple geometries.
*/ */
class Geometry2DTransferFunction : public GenericGeometryTransferFunction<TFGeometry2D> { class CAMPVIS_CORE_API Geometry2DTransferFunction : public GenericGeometryTransferFunction<TFGeometry2D> {
public: public:
/** /**
* Creates a new Geometry2DTransferFunction. * Creates a new Geometry2DTransferFunction.
......
...@@ -32,7 +32,7 @@ namespace campvis { ...@@ -32,7 +32,7 @@ namespace campvis {
/** /**
* A very simple ramp transfer function, just for testing purposes... * A very simple ramp transfer function, just for testing purposes...
*/ */
class SimpleTransferFunction : public AbstractTransferFunction { class CAMPVIS_CORE_API SimpleTransferFunction : public AbstractTransferFunction {
public: public:
/** /**
* Creates a new SimpleTransferFunction. * Creates a new SimpleTransferFunction.
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include "tgt/vector.h" #include "tgt/vector.h"
#include <vector> #include <vector>
#include "core/coreapi.h"
namespace tgt { namespace tgt {
class Texture; class Texture;
} }
...@@ -40,9 +42,9 @@ namespace campvis { ...@@ -40,9 +42,9 @@ namespace campvis {
* Defines a single shape for the GeometryTransferFunction class. * Defines a single shape for the GeometryTransferFunction class.
* TFGeometry1D is defined by a sorted list of KeyPoints, each having a position and a color. * TFGeometry1D is defined by a sorted list of KeyPoints, each having a position and a color.
*/ */
class TFGeometry1D { class CAMPVIS_CORE_API TFGeometry1D {
public: public:
struct KeyPoint { struct CAMPVIS_CORE_API KeyPoint {
explicit KeyPoint(float position, const tgt::col4& color) explicit KeyPoint(float position, const tgt::col4& color)
: _position(position) : _position(position)
, _color(color) , _color(color)
...@@ -151,7 +153,7 @@ namespace campvis { ...@@ -151,7 +153,7 @@ namespace campvis {
* \param right RightKeyPoint to compare * \param right RightKeyPoint to compare
* \return left._position < right._position * \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 @@ ...@@ -29,6 +29,8 @@
#include "tgt/vector.h" #include "tgt/vector.h"
#include <vector> #include <vector>
#include "core/coreapi.h"
namespace tgt { namespace tgt {
class Texture; class Texture;
} }
...@@ -39,9 +41,9 @@ namespace campvis { ...@@ -39,9 +41,9 @@ namespace campvis {
* Defines a single shape for the GeometryTransferFunction class. * Defines a single shape for the GeometryTransferFunction class.
* TFGeometry2D is defined by a sorted list of KeyPoints, each having a position and a color. * TFGeometry2D is defined by a sorted list of KeyPoints, each having a position and a color.
*/ */
class TFGeometry2D { class CAMPVIS_CORE_API TFGeometry2D {
public: public:
struct KeyPoint { struct CAMPVIS_CORE_API KeyPoint {
explicit KeyPoint(const tgt::vec2& position, const tgt::col4& color) explicit KeyPoint(const tgt::vec2& position, const tgt::col4& color)
: _position(position) : _position(position)
, _color(color) , _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 @@ ...@@ -31,6 +31,8 @@
#define ABSTRACTDATA_H__ #define ABSTRACTDATA_H__
#include "tgt/bounds.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/datastructures/scopedtypeddata.h" // not directly needed here but by many classes including AbstractData
#include "core/tools/referencecounted.h" #include "core/tools/referencecounted.h"
...@@ -39,7 +41,7 @@ namespace campvis { ...@@ -39,7 +41,7 @@ namespace campvis {
/** /**
* Interface class for data which can compute their bounds in world coordinates. * Interface class for data which can compute their bounds in world coordinates.
*/ */
class IHasWorldBounds { class CAMPVIS_CORE_API IHasWorldBounds {
public: public:
/// Default empty constructor /// Default empty constructor
IHasWorldBounds() {}; IHasWorldBounds() {};
...@@ -60,7 +62,7 @@ namespace campvis { ...@@ -60,7 +62,7 @@ namespace campvis {
* *
* \todo * \todo
*/ */
class AbstractData : public ReferenceCounted { class CAMPVIS_CORE_API AbstractData : public ReferenceCounted {
public: public:
/** /**
* Constructor, simply calles ReferenceCounted ctor. * Constructor, simply calles ReferenceCounted ctor.
......
...@@ -34,6 +34,10 @@ namespace campvis { ...@@ -34,6 +34,10 @@ namespace campvis {
tgtAssert(parent != 0, "Parent ImageData must not be 0!"); tgtAssert(parent != 0, "Parent ImageData must not be 0!");
} }
AbstractImageRepresentation::AbstractImageRepresentation(const AbstractImageRepresentation& rhs) {
}
AbstractImageRepresentation::~AbstractImageRepresentation() { AbstractImageRepresentation::~AbstractImageRepresentation() {
} }
...@@ -57,5 +61,9 @@ namespace campvis { ...@@ -57,5 +61,9 @@ namespace campvis {
const_cast<ImageData*>(_parent)->addRepresentation(this); const_cast<ImageData*>(_parent)->addRepresentation(this);
} }
AbstractImageRepresentation& AbstractImageRepresentation::operator=(const AbstractImageRepresentation& rhs) {
return *this;
}
} }
\ No newline at end of file
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "tgt/bounds.h" #include "tgt/bounds.h"
#include "tgt/vector.h" #include "tgt/vector.h"
#include "core/coreapi.h"
#include "core/datastructures/abstractdata.h" #include "core/datastructures/abstractdata.h"
namespace campvis { namespace campvis {
...@@ -38,7 +40,7 @@ namespace campvis { ...@@ -38,7 +40,7 @@ namespace campvis {
* the semantically same image but have their data at different locations (e.g. disk, * the semantically same image but have their data at different locations (e.g. disk,
* RAM, OpenGL texture, ...) * RAM, OpenGL texture, ...)
*/ */
class AbstractImageRepresentation { class CAMPVIS_CORE_API AbstractImageRepresentation {
public: public:
/** /**
* Creates a new abstract representation for the image \a parent. * Creates a new abstract representation for the image \a parent.
...@@ -111,13 +113,14 @@ namespace campvis { ...@@ -111,13 +113,14 @@ namespace campvis {
*/ */
void addToParent() const; void addToParent() const;
const ImageData* _parent; ///< Image this representation represents, must not be 0.
private:
/// Not copy-constructable /// Not copy-constructable
AbstractImageRepresentation(const AbstractImageRepresentation& rhs); AbstractImageRepresentation(const AbstractImageRepresentation& rhs);
/// Not assignable /// Not assignable
AbstractImageRepresentation& operator=(const AbstractImageRepresentation& rhs); AbstractImageRepresentation& operator=(const AbstractImageRepresentation& rhs);
const ImageData* _parent; ///< Image this representation represents, must not be 0.
static const std::string loggerCat_; static const std::string loggerCat_;
}; };
} }
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "sigslot/sigslot.h" #include "sigslot/sigslot.h"
#include <tbb/concurrent_unordered_map.h> #include <tbb/concurrent_unordered_map.h>
#include <tbb/spin_mutex.h> #include <tbb/spin_mutex.h>
#include "core/coreapi.h"
#include "core/datastructures/datahandle.h" #include "core/datastructures/datahandle.h"
#include <string> #include <string>
...@@ -50,7 +52,7 @@ namespace campvis { ...@@ -50,7 +52,7 @@ namespace campvis {
* *
* \todo Check thread-safety * \todo Check thread-safety
*/ */
class DataContainer { class CAMPVIS_CORE_API DataContainer {
public: public:
/** /**
* Creates a new empty DataContainer * Creates a new empty DataContainer
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include <ctime> #include <ctime>
#include "core/coreapi.h"
namespace campvis { namespace campvis {
class AbstractData; class AbstractData;
...@@ -45,7 +47,7 @@ namespace campvis { ...@@ -45,7 +47,7 @@ namespace campvis {
* with its reference counting! * with its reference counting!
* \note Reference counting implementation inspired from Scott Meyers: More Effective C++, Item 29 * \note Reference counting implementation inspired from Scott Meyers: More Effective C++, Item 29
*/ */
class DataHandle { class CAMPVIS_CORE_API DataHandle {
public: public:
/** /**
* Creates a new DataHandle for the given data. * Creates a new DataHandle for the given data.
......
...@@ -44,7 +44,7 @@ namespace campvis { ...@@ -44,7 +44,7 @@ namespace campvis {
* \note This class expects all vertices lying within one plane. Everything other that that * \note This class expects all vertices lying within one plane. Everything other that that
* leads to undefined behavior. * leads to undefined behavior.
*/ */
class FaceGeometry : public GeometryData { class CAMPVIS_CORE_API FaceGeometry : public GeometryData {
public: public:
/** /**
* Creates a new empty FaceGeometry. * Creates a new empty FaceGeometry.
......
...@@ -50,7 +50,7 @@ namespace campvis { ...@@ -50,7 +50,7 @@ namespace campvis {
* - Vertex normals: Vertex attribute 3 * - Vertex normals: Vertex attribute 3
* *
*/ */
class GeometryData : public AbstractData, public IHasWorldBounds { class CAMPVIS_CORE_API GeometryData : public AbstractData, public IHasWorldBounds {
public: public:
/** /**
* Constructor * Constructor
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
namespace campvis { namespace campvis {
class GeometryDataFactory { class CAMPVIS_CORE_API GeometryDataFactory {
public: public:
/** /**
* Creates a FaceGeometry building an axis-aligned rectangle face in the YX plane (quad) * Creates a FaceGeometry building an axis-aligned rectangle face in the YX plane (quad)
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <tbb/concurrent_vector.h> #include <tbb/concurrent_vector.h>
#include "tgt/logmanager.h" #include "tgt/logmanager.h"
#include "tgt/vector.h" #include "tgt/vector.h"
#include "core/coreapi.h"
#include "core/datastructures/abstractdata.h" #include "core/datastructures/abstractdata.h"
#include "core/datastructures/abstractimagerepresentation.h" #include "core/datastructures/abstractimagerepresentation.h"
#include "core/datastructures/imagemappinginformation.h" #include "core/datastructures/imagemappinginformation.h"
...@@ -45,7 +47,7 @@ namespace campvis { ...@@ -45,7 +47,7 @@ namespace campvis {
* *
* \todo * \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 so that it can add itself as representation
friend class AbstractImageRepresentation; friend class AbstractImageRepresentation;
...@@ -231,13 +233,13 @@ namespace campvis { ...@@ -231,13 +233,13 @@ namespace campvis {
} }
template<> 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 #ifdef CAMPVIS_HAS_MODULE_ITK
class AbstractImageRepresentationItk; class AbstractImageRepresentationItk;
template<> 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 #endif
template<typename T> template<typename T>
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "tgt/matrix.h" #include "tgt/matrix.h"
#include "tgt/vector.h" #include "tgt/vector.h"
#include "core/coreapi.h"
#include "core/tools/mapping.h" #include "core/tools/mapping.h"
namespace campvis { namespace campvis {
...@@ -37,7 +39,7 @@ namespace campvis { ...@@ -37,7 +39,7 @@ namespace campvis {
* \todo Make a full list of fields that belong in this class. Then check * \todo Make a full list of fields that belong in this class. Then check
* which of them belong together and which are derived measures. * which of them belong together and which are derived measures.
*/ */
class ImageMappingInformation { class CAMPVIS_CORE_API ImageMappingInformation {
public: public:
/** /**
* Creates a new default ImageMappingInformation. * Creates a new default ImageMappingInformation.
......
Supports Markdown
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