Commit 09a33a67 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - WDataSetScalar and WDataSetVector now also use the prototype...

[CHANGE] - WDataSetScalar and WDataSetVector now also use the prototype mechanism -> makes them work properly for connectors
parent 0665bc51
......@@ -28,6 +28,8 @@
#include "WDataSetScalar.h"
// prototype instance as singleton
boost::shared_ptr< WPrototyped > WDataSetScalar::m_prototype = boost::shared_ptr< WPrototyped >();
WDataSetScalar::WDataSetScalar( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid )
......@@ -51,6 +53,12 @@ WDataSetScalar::WDataSetScalar( boost::shared_ptr< WValueSetBase > newValueSet,
m_minimum = min;
}
WDataSetScalar::WDataSetScalar()
: WDataSetSingle()
{
// default constructor used by the prototype mechanism
}
WDataSetScalar::WDataSetScalar( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid,
double max,
......@@ -80,3 +88,14 @@ double WDataSetScalar::getMin() const
{
return m_minimum;
}
boost::shared_ptr< WPrototyped > WDataSetScalar::getPrototype()
{
if ( !m_prototype )
{
m_prototype = boost::shared_ptr< WPrototyped >( new WDataSetScalar() );
}
return m_prototype;
}
......@@ -59,6 +59,11 @@ public:
double min,
double max );
/**
* Construct an empty and unusable instance. This is needed for the prototype mechanism.
*/
WDataSetScalar();
/**
* Destroys this DataSet instance
*/
......@@ -74,7 +79,20 @@ public:
*/
double getMin() const;
/**
* Returns a prototype instantiated with the true type of the deriving class.
*
* \return the prototype.
*/
static boost::shared_ptr< WPrototyped > getPrototype();
protected:
/**
* The prototype as singleton.
*/
static boost::shared_ptr< WPrototyped > m_prototype;
private:
double m_maximum; //!< Largest scalar of data set.
double m_minimum; //!< Smallest scalar of data set.
......
......@@ -27,6 +27,8 @@
#include "WDataSetVector.h"
// prototype instance as singleton
boost::shared_ptr< WPrototyped > WDataSetVector::m_prototype = boost::shared_ptr< WPrototyped >();
WDataSetVector::WDataSetVector( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid )
......@@ -38,6 +40,22 @@ WDataSetVector::WDataSetVector( boost::shared_ptr< WValueSetBase > newValueSet,
WAssert( newValueSet->order() == 1, "The value set does not contain vectors." );
}
WDataSetVector::WDataSetVector()
: WDataSetSingle()
{
}
WDataSetVector::~WDataSetVector()
{
}
boost::shared_ptr< WPrototyped > WDataSetVector::getPrototype()
{
if ( !m_prototype )
{
m_prototype = boost::shared_ptr< WPrototyped >( new WDataSetVector() );
}
return m_prototype;
}
......@@ -44,12 +44,30 @@ public:
WDataSetVector( boost::shared_ptr< WValueSetBase > newValueSet,
boost::shared_ptr< WGrid > newGrid );
/**
* Construct an empty and unusable instance. This is needed for the prototype mechanism.
*/
WDataSetVector();
/**
* Destroys this DataSet instance
*/
virtual ~WDataSetVector();
/**
* Returns a prototype instantiated with the true type of the deriving class.
*
* \return the prototype.
*/
static boost::shared_ptr< WPrototyped > getPrototype();
protected:
/**
* The prototype as singleton.
*/
static boost::shared_ptr< WPrototyped > m_prototype;
private:
};
......
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