Commit 860ab6c0 authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Remove XdmfObject since it was unnecessary and broke Java wrapping for NetDMF.

parent b6127226
......@@ -16,7 +16,6 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
#include <XdmfInformation.hpp>
#include <XdmfItem.hpp>
#include <XdmfItemProperty.hpp>
#include <XdmfObject.hpp>
#include <XdmfVisitor.hpp>
#include <XdmfWriter.hpp>
......
......@@ -14,12 +14,10 @@ XdmfAttribute::XdmfAttribute() :
mAttributeType(XdmfAttributeType::NoAttributeType()),
mAttributeCenter(XdmfAttributeCenter::Grid())
{
std::cout << "Created Attribute " << this << std::endl;
}
XdmfAttribute::~XdmfAttribute()
{
std::cout << "Deleted Attribute " << this << std::endl;
}
const std::string XdmfAttribute::ItemTag = "Attribute";
......
......@@ -18,7 +18,17 @@ class XdmfAttribute : public XdmfDataItem {
public:
XdmfNewMacro(XdmfAttribute);
/**
* Create a new XdmfAttribute.
*
* @return constructed XdmfAttribute.
*/
static boost::shared_ptr<XdmfAttribute> New()
{
boost::shared_ptr<XdmfAttribute> p(new XdmfAttribute());
return p;
};
virtual ~XdmfAttribute();
LOKI_DEFINE_VISITABLE(XdmfAttribute, XdmfDataItem)
......
......@@ -53,12 +53,10 @@ boost::shared_ptr<const XdmfAttributeType> XdmfAttributeType::GlobalId()
XdmfAttributeType::XdmfAttributeType(const std::string & name) :
mName(name)
{
std::cout << "CRRRRREATED" << std::endl;
}
XdmfAttributeType::~XdmfAttributeType()
{
std::cout << "DEEEELETED" << std::endl;
}
boost::shared_ptr<const XdmfAttributeType> XdmfAttributeType::New(const std::map<std::string, std::string> & itemProperties)
......
......@@ -11,12 +11,10 @@
XdmfDomain::XdmfDomain()
{
std::cout << "Created Domain " << this << std::endl;
}
XdmfDomain::~XdmfDomain()
{
std::cout << "Deleted Domain " << this << std::endl;
}
const std::string XdmfDomain::ItemTag = "Domain";
......
......@@ -18,7 +18,17 @@ class XdmfDomain : public virtual XdmfItem {
public:
XdmfNewMacro(XdmfDomain);
/**
* Create a new XdmfDomain.
*
* @return constructed XdmfDomain.
*/
static boost::shared_ptr<XdmfDomain> New()
{
boost::shared_ptr<XdmfDomain> p(new XdmfDomain());
return p;
};
virtual ~XdmfDomain();
LOKI_DEFINE_VISITABLE(XdmfDomain, XdmfItem)
......
......@@ -13,12 +13,10 @@ XdmfGeometry::XdmfGeometry() :
mGeometryType(XdmfGeometryType::NoGeometryType()),
mNumberPoints(0)
{
std::cout << "Created Geometry " << this << std::endl;
}
XdmfGeometry::~XdmfGeometry()
{
std::cout << "Deleted Geometry " << this << std::endl;
}
const std::string XdmfGeometry::ItemTag = "Geometry";
......
......@@ -18,7 +18,17 @@ class XdmfGeometry : public XdmfDataItem {
public:
XdmfNewMacro(XdmfGeometry);
/**
* Create a new XdmfGeometry.
*
* @return constructed XdmfGeometry.
*/
static boost::shared_ptr<XdmfGeometry> New()
{
boost::shared_ptr<XdmfGeometry> p(new XdmfGeometry());
return p;
};
virtual ~XdmfGeometry();
LOKI_DEFINE_VISITABLE(XdmfGeometry, XdmfDataItem)
......
......@@ -18,12 +18,10 @@ XdmfGrid::XdmfGrid() :
mTopology(XdmfTopology::New()),
mName("Grid")
{
std::cout << "Created Grid " << this << std::endl;
}
XdmfGrid::~XdmfGrid()
{
std::cout << "Deleted Grid " << this << std::endl;
}
const std::string XdmfGrid::ItemTag = "Grid";
......
......@@ -23,7 +23,17 @@ class XdmfGrid : public virtual XdmfItem {
public:
XdmfNewMacro(XdmfGrid);
/**
* Create a new XdmfGrid.
*
* @return constructed XdmfGrid.
*/
static boost::shared_ptr<XdmfGrid> New()
{
boost::shared_ptr<XdmfGrid> p(new XdmfGrid());
return p;
};
virtual ~XdmfGrid();
LOKI_DEFINE_VISITABLE(XdmfGrid, XdmfItem)
......
......@@ -12,12 +12,10 @@ XdmfGridCollection::XdmfGridCollection() :
mCollectionType(XdmfGridCollectionType::NoCollectionType())
{
mName = "Collection";
std::cout << "Created Collection " << this << std::endl;
}
XdmfGridCollection::~XdmfGridCollection()
{
std::cout << "Deleted Collection " << this << std::endl;
}
const std::string XdmfGridCollection::ItemTag = "Grid";
......
......@@ -20,7 +20,17 @@ class XdmfGridCollection : public XdmfGrid, public XdmfDomain {
public:
XdmfNewMacro(XdmfGridCollection);
/**
* Create a new XdmfGridCollection.
*
* @return constructed XdmfGridCollection.
*/
static boost::shared_ptr<XdmfGridCollection> New()
{
boost::shared_ptr<XdmfGridCollection> p(new XdmfGridCollection());
return p;
};
virtual ~XdmfGridCollection();
LOKI_DEFINE_VISITABLE(XdmfGridCollection, XdmfGrid)
......
......@@ -14,7 +14,17 @@ class XdmfItemFactory : public XdmfCoreItemFactory {
public:
XdmfNewMacro(XdmfItemFactory);
/**
* Create a new XdmfItemFactory.
*
* @return constructed XdmfItemFactory.
*/
static boost::shared_ptr<XdmfItemFactory> New()
{
boost::shared_ptr<XdmfItemFactory> p(new XdmfItemFactory());
return p;
};
virtual ~XdmfItemFactory();
virtual boost::shared_ptr<XdmfItem> createItem(const std::string & itemTag, const std::map<std::string, std::string> & itemProperties) const;
......
......@@ -7,10 +7,8 @@
XdmfReader::XdmfReader() :
XdmfCoreReader(XdmfItemFactory::New())
{
std::cout << "Created XdmfReader " << this << std::endl;
}
XdmfReader::~XdmfReader()
{
std::cout << "Deleted XdmfReader " << this << std::endl;
}
......@@ -14,7 +14,17 @@ class XdmfReader : public XdmfCoreReader {
public:
XdmfNewMacro(XdmfReader);
/**
* Create a new XdmfReader.
*
* @return constructed XdmfReader.
*/
static boost::shared_ptr<XdmfReader> New()
{
boost::shared_ptr<XdmfReader> p(new XdmfReader());
return p;
};
virtual ~XdmfReader();
protected:
......
......@@ -12,12 +12,10 @@ XdmfSet::XdmfSet() :
mSetType(XdmfSetType::NoSetType()),
mName("")
{
std::cout << "Created Set " << this << std::endl;
}
XdmfSet::~XdmfSet()
{
std::cout << "Deleted Set " << this << std::endl;
}
const std::string XdmfSet::ItemTag = "Set";
......
......@@ -19,7 +19,17 @@ class XdmfSet : public XdmfDataItem {
public:
XdmfNewMacro(XdmfSet);
/**
* Create a new XdmfSet.
*
* @return constructed XdmfSet.
*/
static boost::shared_ptr<XdmfSet> New()
{
boost::shared_ptr<XdmfSet> p(new XdmfSet());
return p;
};
virtual ~XdmfSet();
LOKI_DEFINE_VISITABLE(XdmfSet, XdmfDataItem)
......
......@@ -11,12 +11,10 @@
XdmfTime::XdmfTime(const double & value) :
mValue(value)
{
std::cout << "Created Time " << this << std::endl;
}
XdmfTime::~XdmfTime()
{
std::cout << "Deleted Time " << this << std::endl;
}
const std::string XdmfTime::ItemTag = "Time";
......
......@@ -13,12 +13,10 @@
XdmfTopology::XdmfTopology() :
mTopologyType(XdmfTopologyType::NoTopologyType())
{
std::cout << "Created Topology " << this << std::endl;
}
XdmfTopology::~XdmfTopology()
{
std::cout << "Deleted Topology " << this << std::endl;
}
const std::string XdmfTopology::ItemTag = "Topology";
......
......@@ -18,7 +18,17 @@ class XdmfTopology : public XdmfDataItem {
public:
XdmfNewMacro(XdmfTopology);
/**
* Create a new XdmfTopology.
*
* @return constructed XdmfTopology.
*/
static boost::shared_ptr<XdmfTopology> New()
{
boost::shared_ptr<XdmfTopology> p(new XdmfTopology());
return p;
};
virtual ~XdmfTopology();
LOKI_DEFINE_VISITABLE(XdmfTopology, XdmfDataItem)
......
......@@ -31,7 +31,7 @@ MACRO(ADD_PYTHON_TEST TESTNAME FILENAME)
)
# Pass the output back to ctest
MESSAGE("\${import_output}")
#MESSAGE("\${import_output}")
IF(import_res)
MESSAGE(SEND_ERROR "\${import_res}")
ENDIF(import_res)
......
......@@ -31,7 +31,7 @@ set(XdmfCoreSources
XdmfInformation
XdmfItem
XdmfItemProperty
XdmfObject
XdmfSystemUtils
XdmfVisitor
XdmfWriter
)
......
......@@ -10,6 +10,7 @@
#include "XdmfArray.hpp"
#include "XdmfArrayType.hpp"
#include "XdmfHDF5Controller.hpp"
#include "XdmfSystemUtils.hpp"
#include "XdmfVisitor.hpp"
class XdmfArray::Clear : public boost::static_visitor<void> {
......@@ -322,12 +323,10 @@ XdmfArray::XdmfArray() :
mName(""),
mTmpReserveSize(0)
{
std::cout << "Created Array " << this << std::endl;
}
XdmfArray::~XdmfArray()
{
std::cout << "Deleted Array " << this << std::endl;
}
const std::string XdmfArray::ItemTag = "DataItem";
......@@ -586,7 +585,7 @@ void XdmfArray::populateItem(const std::map<std::string, std::string> & itemProp
{
std::string hdf5Path = contentVal.substr(0, colonLocation);
std::string dataSetPath = contentVal.substr(colonLocation + 1, contentVal.size() - colonLocation - 1);
if(hdf5Path.compare(XdmfObject::getRealPath(hdf5Path)) != 0)
if(hdf5Path.compare(XdmfSystemUtils::getRealPath(hdf5Path)) != 0)
{
// Dealing with a relative path for hdf5 location
std::stringstream newHDF5Path;
......
......@@ -49,7 +49,17 @@ class XdmfArray : public XdmfItem {
public:
XdmfNewMacro(XdmfArray);
/**
* Create a new XdmfArray.
*
* @return constructed XdmfArray.
*/
static boost::shared_ptr<XdmfArray> New()
{
boost::shared_ptr<XdmfArray> p(new XdmfArray());
return p;
};
virtual ~XdmfArray();
LOKI_DEFINE_VISITABLE(XdmfArray, XdmfItem)
......
......@@ -15,7 +15,7 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
#include <XdmfInformation.hpp>
#include <XdmfItem.hpp>
#include <XdmfItemProperty.hpp>
#include <XdmfObject.hpp>
#include <XdmfSystemUtils.hpp>
#include <XdmfVisitor.hpp>
#include <XdmfWriter.hpp>
%}
......@@ -37,7 +37,6 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
%shared_ptr(XdmfInformation)
%shared_ptr(XdmfItem)
%shared_ptr(XdmfItemProperty)
%shared_ptr(XdmfObject)
%shared_ptr(XdmfVisitor)
%shared_ptr(XdmfWriter)
......@@ -46,8 +45,6 @@ swig -v -c++ -python -o XdmfCorePython.cpp XdmfCore.i
%template() Loki::Visitor<XdmfArray>;
%template() Loki::Visitor<XdmfItem>;
%include XdmfObject.hpp
%include XdmfItem.hpp
%include XdmfDataItem.hpp
%include XdmfItemProperty.hpp
......
......@@ -5,15 +5,15 @@
class XdmfItem;
// Includes
#include <boost/shared_ptr.hpp>
#include <map>
#include "XdmfObject.hpp"
/**
* @brief Factory that constructs XdmfItems using tags and properties.
*
* XdmfCoreItemFactory is an abstract base class.
*/
class XdmfCoreItemFactory : public XdmfObject {
class XdmfCoreItemFactory {
public:
......
......@@ -3,9 +3,11 @@
#include <libxml/xpointer.h>
#include <libxml/xmlreader.h>
#include <map>
#include "XdmfCoreItemFactory.hpp"
#include "XdmfCoreReader.hpp"
#include "XdmfItem.hpp"
#include "XdmfSystemUtils.hpp"
/**
* PIMPL
......@@ -110,18 +112,16 @@ private:
XdmfCoreReader::XdmfCoreReader(const boost::shared_ptr<const XdmfCoreItemFactory> itemFactory) :
mImpl(new XdmfCoreReaderImpl(itemFactory))
{
std::cout << "Created XdmfReader " << this << std::endl;
}
XdmfCoreReader::~XdmfCoreReader()
{
delete mImpl;
std::cout << "Deleted XdmfReader " << this << std::endl;
}
boost::shared_ptr<XdmfItem> XdmfCoreReader::read(const std::string & filePath) const
{
std::string xmlDir = XdmfObject::getRealPath(filePath);
std::string xmlDir = XdmfSystemUtils::getRealPath(filePath);
size_t index = xmlDir.find_last_of("/\\");
if(index != std::string::npos)
{
......
......@@ -6,7 +6,8 @@ class XdmfCoreItemFactory;
class XdmfItem;
// Includes
#include "XdmfObject.hpp"
#include <boost/shared_ptr.hpp>
#include <string>
/**
* @brief Reads an Xdmf structured file stored on disk into memory.
......@@ -14,7 +15,7 @@ class XdmfItem;
* Reads an Xdmf structured file stored on disk into an Xdmf structure in memory. All light data is parsed in order to create appropriate
* Xdmf objects. Heavy data controllers are created and attached to XdmfArrays but no heavy data is read into memory.
*/
class XdmfCoreReader : public XdmfObject {
class XdmfCoreReader {
public:
......
......@@ -11,12 +11,10 @@
XdmfDataItem::XdmfDataItem() :
mArray(XdmfArray::New())
{
std::cout << "Created DataItem " << this << std::endl;
}
XdmfDataItem::~XdmfDataItem()
{
std::cout << "Deleted DataItem " << this << std::endl;
}
boost::shared_ptr<XdmfArray> XdmfDataItem::getArray()
......
......@@ -6,13 +6,14 @@
#include "XdmfArray.hpp"
#include "XdmfArrayType.hpp"
#include "XdmfHDF5Controller.hpp"
#include "XdmfSystemUtils.hpp"
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),
mType(type)
{
mFilePath = XdmfObject::getRealPath(hdf5FilePath);
mFilePath = XdmfSystemUtils::getRealPath(hdf5FilePath);
}
XdmfHDF5Controller::~XdmfHDF5Controller()
......
......@@ -5,9 +5,6 @@
class XdmfArray;
class XdmfArrayType;
// Includes
#include "XdmfObject.hpp"
/**
* @brief Couples an XdmfArray with HDF5 data stored on disk.
*
......@@ -15,7 +12,7 @@ class XdmfArrayType;
* written to disk an XdmfHDF5Controller is attached to XdmfArrays. This allows data to be released
* from memory but still be accessible or have its location written to light data.
*/
class XdmfHDF5Controller : public XdmfObject {
class XdmfHDF5Controller {
public:
......
......@@ -96,13 +96,11 @@ public:
XdmfHDF5Writer::XdmfHDF5Writer(const std::string & hdf5FilePath) :
mImpl(new XdmfHDF5WriterImpl(hdf5FilePath))
{
std::cout << "Created XdmfHDF5Writer " << this << std::endl;
}
XdmfHDF5Writer::~XdmfHDF5Writer()
{
delete mImpl;
std::cout << "Deleted XdmfHDF5Writer " << this << std::endl;
}
std::string XdmfHDF5Writer::getFilePath() const
......
......@@ -11,12 +11,10 @@ XdmfInformation::XdmfInformation() :
mKey(""),
mValue("")
{
std::cout << "Created Information " << this << std::endl;
}
XdmfInformation::~XdmfInformation()
{
std::cout << "Deleted Information " << this << std::endl;
}
const std::string XdmfInformation::ItemTag = "Information";
......
......@@ -13,7 +13,17 @@ class XdmfInformation : public XdmfItem {
public:
XdmfNewMacro(XdmfInformation);
/**
* Create a new XdmfInformation.
*
* @return constructed XdmfInformation.
*/
static boost::shared_ptr<XdmfInformation> New()
{
boost::shared_ptr<XdmfInformation> p(new XdmfInformation());
return p;
};
virtual ~XdmfInformation();
LOKI_DEFINE_VISITABLE(XdmfInformation, XdmfItem)
......
......@@ -5,10 +5,11 @@
class XdmfVisitor;
// Includes
#include <boost/shared_ptr.hpp>
#include <loki/Visitor.h>
#include <map>
#include <string>
#include <vector>
#include "XdmfObject.hpp"
/**
* @brief Base class of any object that is able to be added to an Xdmf structure.
......@@ -16,8 +17,7 @@ class XdmfVisitor;
* XdmfItem is an abstract base class. It represents any item that can be visited and traversed by an XdmfVisitor
* and have its contents added to an Xdmf file.
*/
class XdmfItem : public XdmfObject,
public Loki::BaseVisitable<void> {
class XdmfItem : public Loki::BaseVisitable<void> {
public:
......
......@@ -2,8 +2,9 @@
#define XDMFITEMPROPERTY_HPP_
// Includes
#include <boost/shared_ptr.hpp>
#include <map>
#include "XdmfObject.hpp"
#include <string>
/**
* @brief Represents a property attached to an XdmfItem.
......@@ -14,7 +15,7 @@
* This is an abstract base class to facilitate reading and writing of properties in a generic way.
*/
class XdmfItemProperty : public XdmfObject {
class XdmfItemProperty {
public:
......
/*
* XdmfObject.cpp
*
* Created on: Feb 1, 2010
* Author: kleiter
*/
#include "XdmfObject.hpp"
XdmfObject::XdmfObject()
{
}
XdmfObject::~XdmfObject()
{
}
std::string XdmfObject::getRealPath(const std::string & path)
{
char realPath[PATH_MAX];
realpath(path.c_str(), realPath);
return realPath;
}
#include "XdmfSystemUtils.hpp"
XdmfSystemUtils::XdmfSystemUtils()
{
}
XdmfSystemUtils::~XdmfSystemUtils()
{
}
std::string XdmfSystemUtils::getRealPath(const std::string & path)
{
char realPath[PATH_MAX];
realpath(path.c_str(), realPath);
return realPath;
}
#ifndef XDMFOBJECT_HPP_
#define XDMFOBJECT_HPP_
#ifndef XDMFSYSTEMUTILS_HPP_
#define XDMFSYSTEMUTILS_HPP_
// Includes
#include <iostream>
#include <boost/shared_ptr.hpp>
#define XdmfNewMacro(type) \
static boost::shared_ptr<type> New() \
{ \
boost::shared_ptr<type> p(new type()); \
return p; \
}
#include <string>
/**
* @brief Root Xdmf Class.
*
* XdmfObject is the root Xdmf class which all Xdmf classes are derived from.
*/
class XdmfObject {
class XdmfSystemUtils {
public:
virtual ~XdmfObject();
/**
* Converts a filesystem path to an absolute real path (absolute path with no symlinks)
*
......@@ -33,13 +23,14 @@ public:
protected:
XdmfObject();
XdmfSystemUtils();
~XdmfSystemUtils();
private:
XdmfObject(const XdmfObject & object); // Not implemented.
void operator=(const XdmfObject & object); // Not implemented.
XdmfSystemUtils(const XdmfSystemUtils & systemUtils); // Not implemented.
void operator=(const XdmfSystemUtils & systemUtils); // Not implemented.
};
#endif /* XDMFOBJECT_HPP_ */
#endif /* XDMFSYSTEMUTILS_HPP_ */
......@@ -14,6 +14,5 @@ XdmfVisitor::~XdmfVisitor()
void XdmfVisitor::visit(XdmfItem & item, const boost::shared_ptr<XdmfBaseVisitor> visitor)
{
std::cout << "Writing in base" << std::endl;
item.traverse(visitor);
}
......@@ -6,7 +6,6 @@ class XdmfItem;
// Includes
#include <loki/Visitor.h>
#include "XdmfObject.hpp"
/**
* @brief Perform an operation on an Xdmf graph structure.
......@@ -14,8 +13,7 @@ class XdmfItem;
* XdmfVisitor is an abstract base class for any operation that operates on an Xdmf graph structure. These operations could
* involve writing to disk or modifying the structure in some way.
*/
class XdmfVisitor : public XdmfObject,
public XdmfBaseVisitor,
class XdmfVisitor : public XdmfBaseVisitor,
public Loki::Visitor<XdmfItem> {
public:
......