Commit 5aa71a64 authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Hide use of boost::shared_ptr and boost::shared_dynamic_cast.

Using statements have been added to XdmfSharedPtr.hpp. All used of
boost::shared_ptr and boost::shared_dynamic_cast have been replaced
by shared_ptr and shared_dynamic_cast. Slight modification to XdmfCore.i
to get swig wrapping working again.
parent 518b5838
...@@ -58,45 +58,45 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i ...@@ -58,45 +58,45 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
// Typemaps that work for Java // Typemaps that work for Java
%typemap(out) boost::shared_ptr<XdmfItem> { %typemap(out) shared_ptr<XdmfItem> {
if(boost::shared_ptr<XdmfAttribute> value = boost::shared_dynamic_cast<XdmfAttribute>($1)) { if(shared_ptr<XdmfAttribute> value = shared_dynamic_cast<XdmfAttribute>($1)) {
*(boost::shared_ptr< XdmfAttribute > **)&($result) = value ? new boost::shared_ptr< XdmfAttribute >(value) : 0; *(shared_ptr< XdmfAttribute > **)&($result) = value ? new shared_ptr< XdmfAttribute >(value) : 0;
} }
else if(boost::shared_ptr<XdmfCurvilinearGrid> value = boost::shared_dynamic_cast<XdmfCurvilinearGrid>($1)) { else if(shared_ptr<XdmfCurvilinearGrid> value = shared_dynamic_cast<XdmfCurvilinearGrid>($1)) {
*(boost::shared_ptr< XdmfCurvilinearGrid > **)&($result) = value ? new boost::shared_ptr< XdmfCurvilinearGrid >(value) : 0; *(shared_ptr< XdmfCurvilinearGrid > **)&($result) = value ? new shared_ptr< XdmfCurvilinearGrid >(value) : 0;
} }
else if(boost::shared_ptr<XdmfDomain> value = boost::shared_dynamic_cast<XdmfDomain>($1)) { else if(shared_ptr<XdmfDomain> value = shared_dynamic_cast<XdmfDomain>($1)) {
*(boost::shared_ptr< XdmfDomain > **)&($result) = value ? new boost::shared_ptr< XdmfDomain >(value) : 0; *(shared_ptr< XdmfDomain > **)&($result) = value ? new shared_ptr< XdmfDomain >(value) : 0;
} }
else if(boost::shared_ptr<XdmfGeometry> value = boost::shared_dynamic_cast<XdmfGeometry>($1)) { else if(shared_ptr<XdmfGeometry> value = shared_dynamic_cast<XdmfGeometry>($1)) {
*(boost::shared_ptr< XdmfGeometry > **)&($result) = value ? new boost::shared_ptr< XdmfGeometry >(value) : 0; *(shared_ptr< XdmfGeometry > **)&($result) = value ? new shared_ptr< XdmfGeometry >(value) : 0;
} }
else if(boost::shared_ptr<XdmfGridCollection> value = boost::shared_dynamic_cast<XdmfGridCollection>($1)) { else if(shared_ptr<XdmfGridCollection> value = shared_dynamic_cast<XdmfGridCollection>($1)) {
*(boost::shared_ptr< XdmfGridCollection > **)&($result) = value ? new boost::shared_ptr< XdmfGridCollection >(value) : 0; *(shared_ptr< XdmfGridCollection > **)&($result) = value ? new shared_ptr< XdmfGridCollection >(value) : 0;
} }
else if(boost::shared_ptr<XdmfInformation> value = boost::shared_dynamic_cast<XdmfInformation>($1)) { else if(shared_ptr<XdmfInformation> value = shared_dynamic_cast<XdmfInformation>($1)) {
*(boost::shared_ptr< XdmfInformation > **)&($result) = value ? new boost::shared_ptr< XdmfInformation >(value) : 0; *(shared_ptr< XdmfInformation > **)&($result) = value ? new shared_ptr< XdmfInformation >(value) : 0;
} }
else if(boost::shared_ptr<XdmfRectilinearGrid> value = boost::shared_dynamic_cast<XdmfRectilinearGrid>($1)) { else if(shared_ptr<XdmfRectilinearGrid> value = shared_dynamic_cast<XdmfRectilinearGrid>($1)) {
*(boost::shared_ptr< XdmfRectilinearGrid > **)&($result) = value ? new boost::shared_ptr< XdmfRectilinearGrid >(value) : 0; *(shared_ptr< XdmfRectilinearGrid > **)&($result) = value ? new shared_ptr< XdmfRectilinearGrid >(value) : 0;
} }
else if(boost::shared_ptr<XdmfRegularGrid> value = boost::shared_dynamic_cast<XdmfRegularGrid>($1)) { else if(shared_ptr<XdmfRegularGrid> value = shared_dynamic_cast<XdmfRegularGrid>($1)) {
*(boost::shared_ptr< XdmfRegularGrid > **)&($result) = value ? new boost::shared_ptr< XdmfRegularGrid >(value) : 0; *(shared_ptr< XdmfRegularGrid > **)&($result) = value ? new shared_ptr< XdmfRegularGrid >(value) : 0;
} }
else if(boost::shared_ptr<XdmfSet> value = boost::shared_dynamic_cast<XdmfSet>($1)) { else if(shared_ptr<XdmfSet> value = shared_dynamic_cast<XdmfSet>($1)) {
*(boost::shared_ptr< XdmfSet > **)&($result) = value ? new boost::shared_ptr< XdmfSet >(value) : 0; *(shared_ptr< XdmfSet > **)&($result) = value ? new shared_ptr< XdmfSet >(value) : 0;
} }
else if(boost::shared_ptr<XdmfTime> value = boost::shared_dynamic_cast<XdmfTime>($1)) { else if(shared_ptr<XdmfTime> value = shared_dynamic_cast<XdmfTime>($1)) {
*(boost::shared_ptr< XdmfTime > **)&($result) = value ? new boost::shared_ptr< XdmfTime >(value) : 0; *(shared_ptr< XdmfTime > **)&($result) = value ? new shared_ptr< XdmfTime >(value) : 0;
} }
else if(boost::shared_ptr<XdmfTopology> value = boost::shared_dynamic_cast<XdmfTopology>($1)) { else if(shared_ptr<XdmfTopology> value = shared_dynamic_cast<XdmfTopology>($1)) {
*(boost::shared_ptr< XdmfTopology > **)&($result) = value ? new boost::shared_ptr< XdmfTopology >(value) : 0; *(shared_ptr< XdmfTopology > **)&($result) = value ? new shared_ptr< XdmfTopology >(value) : 0;
} }
else if(boost::shared_ptr<XdmfUnstructuredGrid> value = boost::shared_dynamic_cast<XdmfUnstructuredGrid>($1)) { else if(shared_ptr<XdmfUnstructuredGrid> value = shared_dynamic_cast<XdmfUnstructuredGrid>($1)) {
*(boost::shared_ptr< XdmfUnstructuredGrid > **)&($result) = value ? new boost::shared_ptr< XdmfUnstructuredGrid >(value) : 0; *(shared_ptr< XdmfUnstructuredGrid > **)&($result) = value ? new shared_ptr< XdmfUnstructuredGrid >(value) : 0;
} }
else { else {
*(boost::shared_ptr< XdmfItem > **)&($result) = &($1); *(shared_ptr< XdmfItem > **)&($result) = &($1);
} }
} }
...@@ -171,48 +171,48 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i ...@@ -171,48 +171,48 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
from XdmfCore import * from XdmfCore import *
} }
%typemap(out) boost::shared_ptr<XdmfItem> { %typemap(out) shared_ptr<XdmfItem> {
if(boost::shared_ptr<XdmfAttribute> attribute = boost::shared_dynamic_cast<XdmfAttribute>($1)) { if(shared_ptr<XdmfAttribute> attribute = shared_dynamic_cast<XdmfAttribute>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfAttribute>(attribute)), SWIGTYPE_p_boost__shared_ptrT_XdmfAttribute_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfAttribute>(attribute)), SWIGTYPE_p_boost__shared_ptrT_XdmfAttribute_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfCurvilinearGrid> gridCurvilinear = boost::shared_dynamic_cast<XdmfCurvilinearGrid>($1)) { else if(shared_ptr<XdmfCurvilinearGrid> gridCurvilinear = shared_dynamic_cast<XdmfCurvilinearGrid>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfCurvilinearGrid>(gridCurvilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfCurvilinearGrid_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfCurvilinearGrid>(gridCurvilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfCurvilinearGrid_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfDomain> domain = boost::shared_dynamic_cast<XdmfDomain>($1)) { else if(shared_ptr<XdmfDomain> domain = shared_dynamic_cast<XdmfDomain>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfDomain>(domain)), SWIGTYPE_p_boost__shared_ptrT_XdmfDomain_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfDomain>(domain)), SWIGTYPE_p_boost__shared_ptrT_XdmfDomain_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfGeometry> geometry = boost::shared_dynamic_cast<XdmfGeometry>($1)) { else if(shared_ptr<XdmfGeometry> geometry = shared_dynamic_cast<XdmfGeometry>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfGeometry>(geometry)), SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGeometry>(geometry)), SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfGridCollection> gridCollection = boost::shared_dynamic_cast<XdmfGridCollection>($1)) { else if(shared_ptr<XdmfGridCollection> gridCollection = shared_dynamic_cast<XdmfGridCollection>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfGridCollection>(gridCollection)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridCollection_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGridCollection>(gridCollection)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridCollection_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfInformation> information = boost::shared_dynamic_cast<XdmfInformation>($1)) { else if(shared_ptr<XdmfInformation> information = shared_dynamic_cast<XdmfInformation>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfInformation>(information)), SWIGTYPE_p_boost__shared_ptrT_XdmfInformation_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfInformation>(information)), SWIGTYPE_p_boost__shared_ptrT_XdmfInformation_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfMap> map = boost::shared_dynamic_cast<XdmfMap>($1)) { else if(shared_ptr<XdmfMap> map = shared_dynamic_cast<XdmfMap>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfMap>(map)), SWIGTYPE_p_boost__shared_ptrT_XdmfMap_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfMap>(map)), SWIGTYPE_p_boost__shared_ptrT_XdmfMap_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfRectilinearGrid> gridRectilinear = boost::shared_dynamic_cast<XdmfRectilinearGrid>($1)) { else if(shared_ptr<XdmfRectilinearGrid> gridRectilinear = shared_dynamic_cast<XdmfRectilinearGrid>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfRectilinearGrid>(gridRectilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfRectilinearGrid_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfRectilinearGrid>(gridRectilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfRectilinearGrid_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfRegularGrid> gridRegular = boost::shared_dynamic_cast<XdmfRegularGrid>($1)) { else if(shared_ptr<XdmfRegularGrid> gridRegular = shared_dynamic_cast<XdmfRegularGrid>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfRegularGrid>(gridRegular)), SWIGTYPE_p_boost__shared_ptrT_XdmfRegularGrid_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfRegularGrid>(gridRegular)), SWIGTYPE_p_boost__shared_ptrT_XdmfRegularGrid_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfSet> set = boost::shared_dynamic_cast<XdmfSet>($1)) { else if(shared_ptr<XdmfSet> set = shared_dynamic_cast<XdmfSet>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfSet>(set)), SWIGTYPE_p_boost__shared_ptrT_XdmfSet_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfSet>(set)), SWIGTYPE_p_boost__shared_ptrT_XdmfSet_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfTime> time = boost::shared_dynamic_cast<XdmfTime>($1)) { else if(shared_ptr<XdmfTime> time = shared_dynamic_cast<XdmfTime>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfTime>(time)), SWIGTYPE_p_boost__shared_ptrT_XdmfTime_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfTime>(time)), SWIGTYPE_p_boost__shared_ptrT_XdmfTime_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfTopology> topology = boost::shared_dynamic_cast<XdmfTopology>($1)) { else if(shared_ptr<XdmfTopology> topology = shared_dynamic_cast<XdmfTopology>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfTopology>(topology)), SWIGTYPE_p_boost__shared_ptrT_XdmfTopology_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfTopology>(topology)), SWIGTYPE_p_boost__shared_ptrT_XdmfTopology_t, SWIG_POINTER_OWN);
} }
else if(boost::shared_ptr<XdmfUnstructuredGrid> gridUnstructured = boost::shared_dynamic_cast<XdmfUnstructuredGrid>($1)) { else if(shared_ptr<XdmfUnstructuredGrid> gridUnstructured = shared_dynamic_cast<XdmfUnstructuredGrid>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfUnstructuredGrid>(gridUnstructured)), SWIGTYPE_p_boost__shared_ptrT_XdmfUnstructuredGrid_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfUnstructuredGrid>(gridUnstructured)), SWIGTYPE_p_boost__shared_ptrT_XdmfUnstructuredGrid_t, SWIG_POINTER_OWN);
} }
else { else {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfItem>($1)), SWIGTYPE_p_boost__shared_ptrT_XdmfItem_t, SWIG_POINTER_OWN); $result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfItem>($1)), SWIGTYPE_p_boost__shared_ptrT_XdmfItem_t, SWIG_POINTER_OWN);
} }
} }
......
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
#include "XdmfAttributeType.hpp" #include "XdmfAttributeType.hpp"
#include "XdmfError.hpp" #include "XdmfError.hpp"
boost::shared_ptr<XdmfAttribute> shared_ptr<XdmfAttribute>
XdmfAttribute::New() XdmfAttribute::New()
{ {
boost::shared_ptr<XdmfAttribute> p(new XdmfAttribute()); shared_ptr<XdmfAttribute> p(new XdmfAttribute());
return p; return p;
} }
...@@ -46,7 +46,7 @@ XdmfAttribute::~XdmfAttribute() ...@@ -46,7 +46,7 @@ XdmfAttribute::~XdmfAttribute()
const std::string XdmfAttribute::ItemTag = "Attribute"; const std::string XdmfAttribute::ItemTag = "Attribute";
boost::shared_ptr<const XdmfAttributeCenter> shared_ptr<const XdmfAttributeCenter>
XdmfAttribute::getCenter() const XdmfAttribute::getCenter() const
{ {
return mCenter; return mCenter;
...@@ -74,7 +74,7 @@ XdmfAttribute::getName() const ...@@ -74,7 +74,7 @@ XdmfAttribute::getName() const
return mName; return mName;
} }
boost::shared_ptr<const XdmfAttributeType> shared_ptr<const XdmfAttributeType>
XdmfAttribute::getType() const XdmfAttribute::getType() const
{ {
return mType; return mType;
...@@ -82,7 +82,7 @@ XdmfAttribute::getType() const ...@@ -82,7 +82,7 @@ XdmfAttribute::getType() const
void void
XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemProperties, XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemProperties,
std::vector<boost::shared_ptr<XdmfItem> > & childItems, std::vector<shared_ptr<XdmfItem> > & childItems,
const XdmfCoreReader * const reader) const XdmfCoreReader * const reader)
{ {
XdmfItem::populateItem(itemProperties, childItems, reader); XdmfItem::populateItem(itemProperties, childItems, reader);
...@@ -98,12 +98,11 @@ XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemPrope ...@@ -98,12 +98,11 @@ XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemPrope
mCenter = XdmfAttributeCenter::New(itemProperties); mCenter = XdmfAttributeCenter::New(itemProperties);
mType = XdmfAttributeType::New(itemProperties); mType = XdmfAttributeType::New(itemProperties);
for(std::vector<boost::shared_ptr<XdmfItem> >::const_iterator iter = for(std::vector<shared_ptr<XdmfItem> >::const_iterator iter =
childItems.begin(); childItems.begin();
iter != childItems.end(); iter != childItems.end();
++iter) { ++iter) {
if(boost::shared_ptr<XdmfArray> array = if(shared_ptr<XdmfArray> array = shared_dynamic_cast<XdmfArray>(*iter)) {
boost::shared_dynamic_cast<XdmfArray>(*iter)) {
this->swap(array); this->swap(array);
} }
// TODO: If multiple dataitems. // TODO: If multiple dataitems.
...@@ -111,7 +110,7 @@ XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemPrope ...@@ -111,7 +110,7 @@ XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemPrope
} }
void void
XdmfAttribute::setCenter(const boost::shared_ptr<const XdmfAttributeCenter> center) XdmfAttribute::setCenter(const shared_ptr<const XdmfAttributeCenter> center)
{ {
mCenter = center; mCenter = center;
} }
...@@ -123,7 +122,7 @@ XdmfAttribute::setName(const std::string & name) ...@@ -123,7 +122,7 @@ XdmfAttribute::setName(const std::string & name)
} }
void void
XdmfAttribute::setType(const boost::shared_ptr<const XdmfAttributeType> type) XdmfAttribute::setType(const shared_ptr<const XdmfAttributeType> type)
{ {
mType = type; mType = type;
} }
...@@ -43,14 +43,14 @@ class XdmfAttributeType; ...@@ -43,14 +43,14 @@ class XdmfAttributeType;
*/ */
class XDMF_EXPORT XdmfAttribute : public XdmfArray { class XDMF_EXPORT XdmfAttribute : public XdmfArray {
public: public:
/** /**
* Create a new XdmfAttribute. * Create a new XdmfAttribute.
* *
* @return constructed XdmfAttribute. * @return constructed XdmfAttribute.
*/ */
static boost::shared_ptr<XdmfAttribute> New(); static shared_ptr<XdmfAttribute> New();
virtual ~XdmfAttribute(); virtual ~XdmfAttribute();
...@@ -62,7 +62,7 @@ class XDMF_EXPORT XdmfAttribute : public XdmfArray { ...@@ -62,7 +62,7 @@ class XDMF_EXPORT XdmfAttribute : public XdmfArray {
* *
* @return XdmfAttributeCenter of the attribute. * @return XdmfAttributeCenter of the attribute.
*/ */
boost::shared_ptr<const XdmfAttributeCenter> getCenter() const; shared_ptr<const XdmfAttributeCenter> getCenter() const;
std::map<std::string, std::string> getItemProperties() const; std::map<std::string, std::string> getItemProperties() const;
...@@ -80,14 +80,14 @@ class XDMF_EXPORT XdmfAttribute : public XdmfArray { ...@@ -80,14 +80,14 @@ class XDMF_EXPORT XdmfAttribute : public XdmfArray {
* *
* @return XdmfAttributeType of the attribute. * @return XdmfAttributeType of the attribute.
*/ */
boost::shared_ptr<const XdmfAttributeType> getType() const; shared_ptr<const XdmfAttributeType> getType() const;
/** /**
* Set the XdmfAttributeCenter associated with this attribute. * Set the XdmfAttributeCenter associated with this attribute.
* *
* @param center the XdmfAttributeCenter to set. * @param center the XdmfAttributeCenter to set.
*/ */
void setCenter(const boost::shared_ptr<const XdmfAttributeCenter> center); void setCenter(const shared_ptr<const XdmfAttributeCenter> center);
/** /**
* Set the name of the attribute. * Set the name of the attribute.
...@@ -101,32 +101,32 @@ class XDMF_EXPORT XdmfAttribute : public XdmfArray { ...@@ -101,32 +101,32 @@ class XDMF_EXPORT XdmfAttribute : public XdmfArray {
* *
* @param type XdmfAttributeType to set. * @param type XdmfAttributeType to set.
*/ */
void setType(const boost::shared_ptr<const XdmfAttributeType> type); void setType(const shared_ptr<const XdmfAttributeType> type);
protected: protected:
XdmfAttribute(); XdmfAttribute();
virtual void virtual void
populateItem(const std::map<std::string, std::string> & itemProperties, populateItem(const std::map<std::string, std::string> & itemProperties,
std::vector<boost::shared_ptr<XdmfItem> > & childItems, std::vector<shared_ptr<XdmfItem> > & childItems,
const XdmfCoreReader * const reader); const XdmfCoreReader * const reader);
private: private:
XdmfAttribute(const XdmfAttribute &); // Not implemented. XdmfAttribute(const XdmfAttribute &); // Not implemented.
void operator=(const XdmfAttribute &); // Not implemented. void operator=(const XdmfAttribute &); // Not implemented.
boost::shared_ptr<const XdmfAttributeCenter> mCenter; shared_ptr<const XdmfAttributeCenter> mCenter;
std::string mName; std::string mName;
boost::shared_ptr<const XdmfAttributeType> mType; shared_ptr<const XdmfAttributeType> mType;
}; };
#ifdef _WIN32 #ifdef _WIN32
XDMF_TEMPLATE template class XDMF_EXPORT XDMF_TEMPLATE template class XDMF_EXPORT
boost::shared_ptr<const XdmfAttributeType>; shared_ptr<const XdmfAttributeType>;
XDMF_TEMPLATE template class XDMF_EXPORT XDMF_TEMPLATE template class XDMF_EXPORT
boost::shared_ptr<const XdmfAttributeCenter>; shared_ptr<const XdmfAttributeCenter>;
#endif #endif
#endif /* XDMFATTRIBUTE_HPP_ */ #endif /* XDMFATTRIBUTE_HPP_ */
...@@ -25,42 +25,42 @@ ...@@ -25,42 +25,42 @@
#include "XdmfError.hpp" #include "XdmfError.hpp"
// Supported XdmfAttributeCenters // Supported XdmfAttributeCenters
boost::shared_ptr<const XdmfAttributeCenter> shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Grid() XdmfAttributeCenter::Grid()
{ {
static boost::shared_ptr<const XdmfAttributeCenter> static shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Grid")); p(new XdmfAttributeCenter("Grid"));
return p; return p;
} }
boost::shared_ptr<const XdmfAttributeCenter> shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Cell() XdmfAttributeCenter::Cell()
{ {
static boost::shared_ptr<const XdmfAttributeCenter> static shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Cell")); p(new XdmfAttributeCenter("Cell"));
return p; return p;
} }
boost::shared_ptr<const XdmfAttributeCenter> shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Face() XdmfAttributeCenter::Face()
{ {
static boost::shared_ptr<const XdmfAttributeCenter> static shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Face")); p(new XdmfAttributeCenter("Face"));
return p; return p;
} }
boost::shared_ptr<const XdmfAttributeCenter> shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Edge() XdmfAttributeCenter::Edge()
{ {
static boost::shared_ptr<const XdmfAttributeCenter> static shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Edge")); p(new XdmfAttributeCenter("Edge"));
return p; return p;
} }
boost::shared_ptr<const XdmfAttributeCenter> shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Node() XdmfAttributeCenter::Node()
{ {
static boost::shared_ptr<const XdmfAttributeCenter> static shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Node")); p(new XdmfAttributeCenter("Node"));
return p; return p;
} }
...@@ -74,7 +74,7 @@ XdmfAttributeCenter::~XdmfAttributeCenter() ...@@ -74,7 +74,7 @@ XdmfAttributeCenter::~XdmfAttributeCenter()
{ {
} }
boost::shared_ptr<const XdmfAttributeCenter> shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperties) XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperties)
{ {
std::map<std::string, std::string>::const_iterator center = std::map<std::string, std::string>::const_iterator center =
...@@ -97,11 +97,15 @@ XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperti ...@@ -97,11 +97,15 @@ XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperti
return Node(); return Node();
} }
else { else {
XdmfError::message(XdmfError::FATAL, "Center not of 'Grid','Cell','Face','Edge','Node' in XdmfAttributeCenter::New"); XdmfError::message(XdmfError::FATAL,
"Center not of 'Grid','Cell','Face','Edge','Node' "
"in XdmfAttributeCenter::New");
} }
} }
XdmfError::message(XdmfError::FATAL, "'Center' not found in itemProperties in XdmfAttributeCenter::New"); XdmfError::message(XdmfError::FATAL,
return boost::shared_ptr<const XdmfAttributeCenter>(); "'Center' not found in itemProperties in "
"XdmfAttributeCenter::New");
return shared_ptr<const XdmfAttributeCenter>();
} }
void void
......
...@@ -45,24 +45,24 @@ ...@@ -45,24 +45,24 @@
*/ */
class XDMF_EXPORT XdmfAttributeCenter : public XdmfItemProperty { class XDMF_EXPORT XdmfAttributeCenter : public XdmfItemProperty {
public: public:
virtual ~XdmfAttributeCenter(); virtual ~XdmfAttributeCenter();
friend class XdmfAttribute; friend class XdmfAttribute;
// Supported Xdmf Attribute Centers // Supported Xdmf Attribute Centers
static boost::shared_ptr<const XdmfAttributeCenter> Grid(); static shared_ptr<const XdmfAttributeCenter> Grid();
static boost::shared_ptr<const XdmfAttributeCenter> Cell(); static shared_ptr<const XdmfAttributeCenter> Cell();
static boost::shared_ptr<const XdmfAttributeCenter> Face(); static shared_ptr<const XdmfAttributeCenter> Face();
static boost::shared_ptr<const XdmfAttributeCenter> Edge(); static shared_ptr<const XdmfAttributeCenter> Edge();
static boost::shared_ptr<const XdmfAttributeCenter> Node(); static shared_ptr<const XdmfAttributeCenter> Node();
void void
getProperties(std::map<std::string, std::string> & collectedProperties) const; getProperties(std::map<std::string, std::string> & collectedProperties) const;
protected: protected:
/** /**
* Protected constructor for XdmfAttributeCenter. The constructor * Protected constructor for XdmfAttributeCenter. The constructor
...@@ -75,12 +75,12 @@ class XDMF_EXPORT XdmfAttributeCenter : public XdmfItemProperty { ...@@ -75,12 +75,12 @@ class XDMF_EXPORT XdmfAttributeCenter : public XdmfItemProperty {
*/ */
XdmfAttributeCenter(const std::string & name); XdmfAttributeCenter(const std::string & name);
private: private:
XdmfAttributeCenter(const XdmfAttributeCenter &); // Not implemented. XdmfAttributeCenter(const XdmfAttributeCenter &); // Not implemented.
void operator=(const XdmfAttributeCenter &); // Not implemented. void operator=(const XdmfAttributeCenter &); // Not implemented.
static boost::shared_ptr<const XdmfAttributeCenter> static shared_ptr<const XdmfAttributeCenter>
New(const std::map<std::string, std::string> & itemProperties); New(const std::map<std::string, std::string> & itemProperties);
std::string mName; std::string mName;
......
...@@ -25,58 +25,58 @@ ...@@ -25,58 +25,58 @@
#include "XdmfError.hpp" #include "XdmfError.hpp"
// Supported XdmfAttributeTypes // Supported XdmfAttributeTypes
boost::shared_ptr<const XdmfAttributeType> shared_ptr<const XdmfAttributeType>
XdmfAttributeType::NoAttributeType() XdmfAttributeType::NoAttributeType()
{ {
static boost::shared_ptr<const XdmfAttributeType> static shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("None")); p(new XdmfAttributeType("None"));
return p; return p;
} }
boost::shared_ptr<const XdmfAttributeType> shared_ptr<const XdmfAttributeType>
XdmfAttributeType::Scalar() XdmfAttributeType::Scalar()
{ {
static boost::shared_ptr<const XdmfAttributeType> static shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("Scalar")); p(new XdmfAttributeType("Scalar"));
return p; return p;
} }
boost::shared_ptr<const XdmfAttributeType> shared_ptr<const XdmfAttributeType>
XdmfAttributeType::Vector() XdmfAttributeType::Vector()
{ {
static boost::shared_ptr<const XdmfAttributeType> static shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("Vector")); p(new XdmfAttributeType("Vector"));
return p; return p;
} }
boost::shared_ptr<const XdmfAttributeType> shared_ptr<const XdmfAttributeType>
XdmfAttributeType::Tensor() XdmfAttributeType::Tensor()
{ {
static boost::shared_ptr<const XdmfAttributeType> static shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("Tensor")); p(new XdmfAttributeType("Tensor"));
return p; return p;
} }
boost::shared_ptr<const XdmfAttributeType> shared_ptr<const XdmfAttributeType>
XdmfAttributeType::Matrix() XdmfAttributeType::Matrix()
{ {