[Insight-developers] Borland sees pure virtual class where none
exists?
Pablo Ybalo
pablo at veccsa.com
Mon Oct 31 08:22:17 EST 2005
Kent Williams wrote:
> I'm going to see about getting BCC32 installed on a Windows box here
> to test with, but maybe some of you all might have been bitten by this
> problem before:
>
> I checked in a new class itk::QuaternionOrientationAdapter earlier
> this week. This is derived from itk::OrienationAdapter.
> OrientationAdapter is a pure virtual class, whose reason to exist is
> to define function signature for different orientation adapters; it's
> templated over the type used to represent orientation.
>
> The QuaternionOrientationAdapter is derived using
> itk::QuaternionRigidTransform<double> as the Orientation Type. Every
> compiler besides BCC32 accepts this without a whimper. BCC32 has this
> complaint:
> *
> *Error E2352
> c:\Builder\Sources\Insight\Code\Common\itkOrientationAdapter.h 47:
> Cannot create instance of abstract class
> 'itk::QuaternionRigidTransform<double>'
>
> Well, If you look at itkQuaternionRigidTransform.h, it's the case that
> it is NOT an abstract class; it contains no virtual methods without a
> definition. So the Borland compiler must be confused, and I'm not
> clear how I would de-confuse it. Anyone have a guess as to what I
> should do?
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
>
>
(Warning/Disclaimer: English is not my first language)
Hi Kent, hi all.
It is my first post to this list. Then, don't expect too much.... ;).
In my Windows box with BCC32, the simple inclusion of
"itkOrientationAdapter.h" stop the compiling.
What about to change the first template parameter of
OrientationAdapterBase, and rewriting OrientationType as
OrientationType::Pointer?
The attached code pass the compiling, but I don't know how to "really"
test a QuaternionOrientationAdapter...
Regards
Pablo Ybalo
-------------- next part --------------
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkQuaternionOrientationAdapter.h,v $
Language: C++
Date: $Date: 2005/10/26 20:26:37 $
Version: $Revision: 1.1 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
Portions of this code are covered under the VTK copyright.
See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkQuaternionOrientationAdapter_h
#define __itkQuaternionOrientationAdapter_h
#include "itkOrientationAdapter.h"
#include "itkQuaternionRigidTransform.h"
#include "itkConceptChecking.h"
namespace itk
{
/** \class QuaternionOrientationAdapter
* \brief converts QuaternionOrientation flags to/from direction cosines
*/
template <int Dimension>
class QuaternionOrientationAdapter :
public OrientationAdapterBase<QuaternionRigidTransform<double>,Dimension>
{
public:
/** typedef for superclass */
typedef QuaternionOrientationAdapter Self;
typedef OrientationAdapterBase<QuaternionRigidTransform<double>,Dimension>
SuperClass;
typedef QuaternionRigidTransform<double> OrientationRootType;
typedef OrientationRootType OrientationType;
/** The dimension of the input image must be 3. */
itkConceptMacro(DimensionShouldBe3,
(Concept::SameDimension<Dimension,3>));
/** typedef for direction cosines */
typedef typename SuperClass::DirectionType DirectionType;
/** convert from direction cosines. */
virtual OrientationType::Pointer FromDirectionCosines(const DirectionType &Dir)
{
OrientationType::Pointer q = OrientationRootType::New();
q->SetMatrix(Dir);
return q;
}
/** convert to direction cosines. */
virtual DirectionType ToDirectionCosines(const OrientationType::Pointer &Or)
{
return Or->GetMatrix();
}
};
} // namespace itk
#endif // __itkQuaternionOrientationAdapter_h
-------------- next part --------------
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkOrientationAdapter.h,v $
Language: C++
Date: $Date: 2005/10/08 23:11:38 $
Version: $Revision: 1.3 $
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
Portions of this code are covered under the VTK copyright.
See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkOrientationAdapter_h
#define __itkOrientationAdapter_h
#include "itkImageBase.h"
namespace itk
{
/** \class OrientationAdapterBase
* \brief base class that converts Orientation representations to direction cosines.
*
* OrientationAdapterBase is a pure virtual base class that defines the
* member function signatures for any subclass that concretely defines the
* conversion relation between a method of representing orientation, and the
* direction cosines managed in itk::ImageBase.
*/
template<class OrientationType, unsigned int Dimension = 3>
class OrientationAdapterBase
{
public:
/** typedef for matching ImageBase*/
typedef typename itk::ImageBase<Dimension> ImageType;
/** typedef for matching Direction Cosines type */
typedef typename ImageType::DirectionType DirectionType;
/** Convert direction cosines to the Orientation type */
virtual OrientationType::Pointer FromDirectionCosines(const DirectionType &Dir) = 0;
/** Convert Orientation type direction cosines */
virtual DirectionType ToDirectionCosines(const OrientationType::Pointer &Orient) = 0;
protected:
/** destructor, to silence "virtual class has non-virtual destructor()" warnings */
virtual ~OrientationAdapterBase() {}
};
} // namespace itk
#endif // __itkOrientationAdapter_h
More information about the Insight-developers
mailing list