Commit fa564313 authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Remove static New implementation from header files and move to implementation files.

parent 860ab6c0
......@@ -9,6 +9,12 @@
#include "XdmfAttributeCenter.hpp"
#include "XdmfAttributeType.hpp"
boost::shared_ptr<XdmfAttribute> XdmfAttribute::New()
{
boost::shared_ptr<XdmfAttribute> p(new XdmfAttribute());
return p;
}
XdmfAttribute::XdmfAttribute() :
mName(""),
mAttributeType(XdmfAttributeType::NoAttributeType()),
......
......@@ -23,11 +23,7 @@ public:
*
* @return constructed XdmfAttribute.
*/
static boost::shared_ptr<XdmfAttribute> New()
{
boost::shared_ptr<XdmfAttribute> p(new XdmfAttribute());
return p;
};
static boost::shared_ptr<XdmfAttribute> New();
virtual ~XdmfAttribute();
......
......@@ -9,6 +9,12 @@
#include "XdmfGrid.hpp"
#include "XdmfGridCollection.hpp"
boost::shared_ptr<XdmfDomain> XdmfDomain::New()
{
boost::shared_ptr<XdmfDomain> p(new XdmfDomain());
return p;
}
XdmfDomain::XdmfDomain()
{
}
......
......@@ -23,12 +23,7 @@ public:
*
* @return constructed XdmfDomain.
*/
static boost::shared_ptr<XdmfDomain> New()
{
boost::shared_ptr<XdmfDomain> p(new XdmfDomain());
return p;
};
static boost::shared_ptr<XdmfDomain> New();
virtual ~XdmfDomain();
LOKI_DEFINE_VISITABLE(XdmfDomain, XdmfItem)
......
......@@ -9,6 +9,12 @@
#include "XdmfGeometry.hpp"
#include "XdmfGeometryType.hpp"
boost::shared_ptr<XdmfGeometry> XdmfGeometry::New()
{
boost::shared_ptr<XdmfGeometry> p(new XdmfGeometry());
return p;
}
XdmfGeometry::XdmfGeometry() :
mGeometryType(XdmfGeometryType::NoGeometryType()),
mNumberPoints(0)
......
......@@ -23,11 +23,7 @@ public:
*
* @return constructed XdmfGeometry.
*/
static boost::shared_ptr<XdmfGeometry> New()
{
boost::shared_ptr<XdmfGeometry> p(new XdmfGeometry());
return p;
};
static boost::shared_ptr<XdmfGeometry> New();
virtual ~XdmfGeometry();
......
......@@ -12,6 +12,12 @@
#include "XdmfTime.hpp"
#include "XdmfTopology.hpp"
boost::shared_ptr<XdmfGrid> XdmfGrid::New()
{
boost::shared_ptr<XdmfGrid> p(new XdmfGrid());
return p;
}
XdmfGrid::XdmfGrid() :
mGeometry(XdmfGeometry::New()),
mTime(boost::shared_ptr<XdmfTime>()),
......
......@@ -28,11 +28,7 @@ public:
*
* @return constructed XdmfGrid.
*/
static boost::shared_ptr<XdmfGrid> New()
{
boost::shared_ptr<XdmfGrid> p(new XdmfGrid());
return p;
};
static boost::shared_ptr<XdmfGrid> New();
virtual ~XdmfGrid();
......
......@@ -8,6 +8,12 @@
#include "XdmfGridCollection.hpp"
#include "XdmfGridCollectionType.hpp"
boost::shared_ptr<XdmfGridCollection> XdmfGridCollection::New()
{
boost::shared_ptr<XdmfGridCollection> p(new XdmfGridCollection());
return p;
};
XdmfGridCollection::XdmfGridCollection() :
mCollectionType(XdmfGridCollectionType::NoCollectionType())
{
......
......@@ -25,11 +25,7 @@ public:
*
* @return constructed XdmfGridCollection.
*/
static boost::shared_ptr<XdmfGridCollection> New()
{
boost::shared_ptr<XdmfGridCollection> p(new XdmfGridCollection());
return p;
};
static boost::shared_ptr<XdmfGridCollection> New();
virtual ~XdmfGridCollection();
......
......@@ -9,6 +9,12 @@
#include "XdmfTime.hpp"
#include "XdmfTopology.hpp"
boost::shared_ptr<XdmfItemFactory> XdmfItemFactory::New()
{
boost::shared_ptr<XdmfItemFactory> p(new XdmfItemFactory());
return p;
}
XdmfItemFactory::XdmfItemFactory()
{
}
......
......@@ -19,11 +19,7 @@ public:
*
* @return constructed XdmfItemFactory.
*/
static boost::shared_ptr<XdmfItemFactory> New()
{
boost::shared_ptr<XdmfItemFactory> p(new XdmfItemFactory());
return p;
};
static boost::shared_ptr<XdmfItemFactory> New();
virtual ~XdmfItemFactory();
......
......@@ -4,6 +4,12 @@
#include "XdmfItemFactory.hpp"
#include "XdmfReader.hpp"
boost::shared_ptr<XdmfReader> XdmfReader::New()
{
boost::shared_ptr<XdmfReader> p(new XdmfReader());
return p;
}
XdmfReader::XdmfReader() :
XdmfCoreReader(XdmfItemFactory::New())
{
......
......@@ -19,11 +19,7 @@ public:
*
* @return constructed XdmfReader.
*/
static boost::shared_ptr<XdmfReader> New()
{
boost::shared_ptr<XdmfReader> p(new XdmfReader());
return p;
};
static boost::shared_ptr<XdmfReader> New();
virtual ~XdmfReader();
......
......@@ -8,6 +8,12 @@
#include "XdmfSet.hpp"
#include "XdmfSetType.hpp"
boost::shared_ptr<XdmfSet> XdmfSet::New()
{
boost::shared_ptr<XdmfSet> p(new XdmfSet());
return p;
}
XdmfSet::XdmfSet() :
mSetType(XdmfSetType::NoSetType()),
mName("")
......
......@@ -24,11 +24,7 @@ public:
*
* @return constructed XdmfSet.
*/
static boost::shared_ptr<XdmfSet> New()
{
boost::shared_ptr<XdmfSet> p(new XdmfSet());
return p;
};
static boost::shared_ptr<XdmfSet> New();
virtual ~XdmfSet();
......
......@@ -8,6 +8,12 @@
#include <sstream>
#include "XdmfTime.hpp"
boost::shared_ptr<XdmfTime> XdmfTime::New(const double & value)
{
boost::shared_ptr<XdmfTime> p(new XdmfTime(value));
return p;
}
XdmfTime::XdmfTime(const double & value) :
mValue(value)
{
......
......@@ -19,11 +19,7 @@ public:
* @param timeValue the value of the XdmfTime to create.
* @return the new XdmfTime.
*/
static boost::shared_ptr<XdmfTime> New(const double & value = 0)
{
boost::shared_ptr<XdmfTime> p(new XdmfTime(value));
return p;
}
static boost::shared_ptr<XdmfTime> New(const double & value = 0);
virtual ~XdmfTime();
......
......@@ -10,6 +10,12 @@
#include "XdmfTopology.hpp"
#include "XdmfTopologyType.hpp"
boost::shared_ptr<XdmfTopology> XdmfTopology::New()
{
boost::shared_ptr<XdmfTopology> p(new XdmfTopology());
return p;
}
XdmfTopology::XdmfTopology() :
mTopologyType(XdmfTopologyType::NoTopologyType())
{
......
......@@ -23,11 +23,7 @@ public:
*
* @return constructed XdmfTopology.
*/
static boost::shared_ptr<XdmfTopology> New()
{
boost::shared_ptr<XdmfTopology> p(new XdmfTopology());
return p;
};
static boost::shared_ptr<XdmfTopology> New();
virtual ~XdmfTopology();
......
......@@ -315,6 +315,12 @@ private:
const unsigned int mSize;
};
boost::shared_ptr<XdmfArray> XdmfArray::New()
{
boost::shared_ptr<XdmfArray> p(new XdmfArray());
return p;
}
XdmfArray::XdmfArray() :
mHaveArray(false),
mHaveArrayPointer(false),
......
......@@ -54,11 +54,7 @@ public:
*
* @return constructed XdmfArray.
*/
static boost::shared_ptr<XdmfArray> New()
{
boost::shared_ptr<XdmfArray> p(new XdmfArray());
return p;
};
static boost::shared_ptr<XdmfArray> New();
virtual ~XdmfArray();
......
......@@ -8,6 +8,12 @@
#include "XdmfHDF5Controller.hpp"
#include "XdmfSystemUtils.hpp"
boost::shared_ptr<XdmfHDF5Controller> XdmfHDF5Controller::New(const std::string & hdf5FilePath, const std::string & dataSetPath, const unsigned int size, const boost::shared_ptr<const XdmfArrayType> type)
{
boost::shared_ptr<XdmfHDF5Controller> p(new XdmfHDF5Controller(hdf5FilePath, dataSetPath, size, type));
return p;
}
XdmfHDF5Controller::XdmfHDF5Controller(const std::string & hdf5FilePath, const std::string & dataSetPath, const unsigned int size, const boost::shared_ptr<const XdmfArrayType> type) :
mDataSetPath(dataSetPath),
mSize(size),
......
......@@ -5,6 +5,9 @@
class XdmfArray;
class XdmfArrayType;
// Includes
#include <boost/shared_ptr.hpp>
/**
* @brief Couples an XdmfArray with HDF5 data stored on disk.
*
......@@ -21,11 +24,7 @@ public:
/**
* Create a new controller for an hdf5 data set on disk.
*/
static boost::shared_ptr<XdmfHDF5Controller> New(const std::string & hdf5FilePath, const std::string & dataSetPath, const unsigned int size, const boost::shared_ptr<const XdmfArrayType> type)
{
boost::shared_ptr<XdmfHDF5Controller> p(new XdmfHDF5Controller(hdf5FilePath, dataSetPath, size, type));
return p;
}
static boost::shared_ptr<XdmfHDF5Controller> New(const std::string & hdf5FilePath, const std::string & dataSetPath, const unsigned int size, const boost::shared_ptr<const XdmfArrayType> type);
/**
* Get the path of the data set within the hdf5 file owned by this controller. For "/home/output.h5:/foo/data" this is "/foo/data"
......
......@@ -93,6 +93,12 @@ public:
}
};
boost::shared_ptr<XdmfHDF5Writer> XdmfHDF5Writer::New(const std::string & hdf5FilePath)
{
boost::shared_ptr<XdmfHDF5Writer> p(new XdmfHDF5Writer(hdf5FilePath));
return p;
}
XdmfHDF5Writer::XdmfHDF5Writer(const std::string & hdf5FilePath) :
mImpl(new XdmfHDF5WriterImpl(hdf5FilePath))
{
......
......@@ -28,24 +28,20 @@ class XdmfHDF5Writer : public XdmfVisitor,
public:
enum Mode {
Default, Overwrite, Append
};
/**
* Construct XdmfHDF5Writer
*
* @param hdf5FilePath the location of the hdf5 file to output to on disk.
* @return new XdmfHDF5Writer
*/
static boost::shared_ptr<XdmfHDF5Writer> New(const std::string & hdf5FilePath)
{
boost::shared_ptr<XdmfHDF5Writer> p(new XdmfHDF5Writer(hdf5FilePath));
return p;
}
static boost::shared_ptr<XdmfHDF5Writer> New(const std::string & hdf5FilePath);
virtual ~XdmfHDF5Writer();
enum Mode {
Default, Overwrite, Append
};
/**
* Get the path to the hdf5 file on disk this writer is writing to.
*
......
......@@ -7,6 +7,12 @@
#include "XdmfInformation.hpp"
boost::shared_ptr<XdmfInformation> XdmfInformation::New()
{
boost::shared_ptr<XdmfInformation> p(new XdmfInformation());
return p;
};
XdmfInformation::XdmfInformation() :
mKey(""),
mValue("")
......
......@@ -18,11 +18,7 @@ public:
*
* @return constructed XdmfInformation.
*/
static boost::shared_ptr<XdmfInformation> New()
{
boost::shared_ptr<XdmfInformation> p(new XdmfInformation());
return p;
};
static boost::shared_ptr<XdmfInformation> New();
virtual ~XdmfInformation();
......
......@@ -61,6 +61,12 @@ public:
std::string mXPathString;
};
boost::shared_ptr<XdmfWriter> XdmfWriter::New(const std::string & xmlFilePath)
{
boost::shared_ptr<XdmfWriter> p(new XdmfWriter(xmlFilePath));
return p;
}
XdmfWriter::XdmfWriter(const std::string & xmlFilePath)
{
std::stringstream heavyFileName;
......
......@@ -27,8 +27,6 @@ class XdmfWriter : public XdmfVisitor,
public:
virtual ~XdmfWriter();
enum Mode {
Default, DistributedHeavyData
};
......@@ -40,11 +38,9 @@ public:
* @param xmlFilePath the path to the xml file to write to.
* @return the new XdmfWriter.
*/
static boost::shared_ptr<XdmfWriter> New(const std::string & xmlFilePath)
{
boost::shared_ptr<XdmfWriter> p(new XdmfWriter(xmlFilePath));
return p;
}
static boost::shared_ptr<XdmfWriter> New(const std::string & xmlFilePath);
virtual ~XdmfWriter();
/**
* Create a new XdmfWriter to write Xdmf data to disk. This will utilize the supplied hdf5Writer to write any
......
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