Commit 87c6965e authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Add macros to simplify adding children to an XdmfItem.

The macros
XDMF_CHILDREN and XDMF_CHILDREN_IMPLEMENTATION

add capabilities to add and remove children by index or property from a parent item.  This simplifies the code
as the same insert() getChild() calls were used throughout the code.
parent f617b9b8
......@@ -9,6 +9,9 @@
#include "XdmfGrid.hpp"
#include "XdmfGridCollection.hpp"
XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain, XdmfGrid, Grid, Name)
XDMF_CHILDREN_IMPLEMENTATION(XdmfDomain, XdmfGridCollection, GridCollection, Name)
boost::shared_ptr<XdmfDomain> XdmfDomain::New()
{
boost::shared_ptr<XdmfDomain> p(new XdmfDomain());
......@@ -25,34 +28,6 @@ XdmfDomain::~XdmfDomain()
const std::string XdmfDomain::ItemTag = "Domain";
boost::shared_ptr<XdmfGrid> XdmfDomain::getGrid(const unsigned int index)
{
return boost::const_pointer_cast<XdmfGrid>(static_cast<const XdmfDomain &>(*this).getGrid(index));
}
boost::shared_ptr<const XdmfGrid> XdmfDomain::getGrid(const unsigned int index) const
{
if(index >= mGrids.size())
{
assert(false);
}
return mGrids[index];
}
boost::shared_ptr<XdmfGridCollection> XdmfDomain::getGridCollection(const unsigned int index)
{
return boost::const_pointer_cast<XdmfGridCollection>(static_cast<const XdmfDomain &>(*this).getGridCollection(index));
}
boost::shared_ptr<const XdmfGridCollection> XdmfDomain::getGridCollection(const unsigned int index) const
{
if(index >= mGridCollections.size())
{
assert(false);
}
return mGridCollections[index];
}
std::map<std::string, std::string> XdmfDomain::getItemProperties() const
{
std::map<std::string, std::string> domainProperties;
......@@ -64,26 +39,6 @@ std::string XdmfDomain::getItemTag() const
return ItemTag;
}
unsigned int XdmfDomain::getNumberGrids() const
{
return mGrids.size();
}
unsigned int XdmfDomain::getNumberGridCollections() const
{
return mGridCollections.size();
}
void XdmfDomain::insert(const boost::shared_ptr<XdmfGrid> grid)
{
mGrids.push_back(grid);
}
void XdmfDomain::insert(const boost::shared_ptr<XdmfGridCollection> gridCollection)
{
mGridCollections.push_back(gridCollection);
}
void XdmfDomain::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
XdmfItem::populateItem(itemProperties, childItems, reader);
......@@ -100,24 +55,6 @@ void XdmfDomain::populateItem(const std::map<std::string, std::string> & itemPro
}
}
void XdmfDomain::removeGrid(const unsigned int index)
{
if(index >= mGrids.size())
{
assert(false);
}
mGrids.erase(mGrids.begin() + index);
}
void XdmfDomain::removeGridCollection(const unsigned int index)
{
if(index >= mGridCollections.size())
{
assert(false);
}
mGridCollections.erase(mGridCollections.begin() + index);
}
void XdmfDomain::traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor)
{
XdmfItem::traverse(visitor);
......
......@@ -27,88 +27,16 @@ public:
virtual ~XdmfDomain();
LOKI_DEFINE_VISITABLE(XdmfDomain, XdmfItem)
XDMF_CHILDREN(XdmfGrid, Grid, Name)
XDMF_CHILDREN(XdmfGridCollection, GridCollection, Name)
static const std::string ItemTag;
/**
* Get a XdmfGrid attached to the domain.
*
* @param index of the grid to retrieve.
* @return grid at the specified index attached to this domain.
*/
boost::shared_ptr<XdmfGrid> getGrid(const unsigned int index);
/**
* Get a XdmfGrid attached to this domain (const version).
*
* @param index of the grid to retrieve.
* @return grid at the specified index attached to this domain.
*/
boost::shared_ptr<const XdmfGrid> getGrid(const unsigned int index) const;
/**
* Get a XdmfGridCollection attached to the domain.
*
* @param index of the grid collection to retrieve.
* @return grid collection at the specified index attached to this domain.
*/
boost::shared_ptr<XdmfGridCollection> getGridCollection(const unsigned int index);
/**
* Get a XdmfGridCollection attached to the domain (const version).
*
* @param index of the grid collection to retrieve.
* @return grid collection at the specified index attached to this domain.
*/
boost::shared_ptr<const XdmfGridCollection> getGridCollection(const unsigned int index) const;
std::map<std::string, std::string> getItemProperties() const;
virtual std::string getItemTag() const;
/**
* Get the number of XdmfGrids attached to this domain.
*
* @return unsigned int containing the number of XdmfGrids attached to this domain.
*/
unsigned int getNumberGrids() const;
/**
* Get the number of XdmfGridCollections attached to this domain.
*
* @return unsigned int containing the number of XdmfGridCollections attached to this domain.
*/
unsigned int getNumberGridCollections() const;
using XdmfItem::insert;
/**
* Insert a XdmfGrid into the domain.
*
* @param grid a XdmfGrid to insert into the domain.
*/
void insert(const boost::shared_ptr<XdmfGrid> grid);
/**
* Insert a XdmfGridCollection into the domain.
*
* @param gridCollection a XdmfGridCollection to insert into the domain.
*/
void insert(const boost::shared_ptr<XdmfGridCollection> gridCollection);
/**
* Remove an XdmfGrid from the domain.
*
* @param index of the XdmfGrid to remove.
*/
void removeGrid(const unsigned int index);
/**
* Remove an XdmfGridCollection from the domain.
*
* @param index of the XdmfGridCollection to remove.
*/
void removeGridCollection(const unsigned int index);
virtual void traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor);
protected:
......@@ -121,8 +49,6 @@ private:
XdmfDomain(const XdmfDomain & domain); // Not implemented.
void operator=(const XdmfDomain & domain); // Not implemented.
std::vector<boost::shared_ptr<XdmfGrid> > mGrids;
std::vector<boost::shared_ptr<XdmfGridCollection> > mGridCollections;
};
#endif /* XDMFDOMAIN_HPP_ */
......@@ -49,7 +49,7 @@ public:
/**
* Set the XdmfGeometryType associated with this geometry.
*
* @param geometryType the XdmfGeometryType to set.
* @param type the XdmfGeometryType to set.
*/
void setType(const boost::shared_ptr<const XdmfGeometryType> type);
......
......@@ -13,6 +13,9 @@
#include "XdmfTime.hpp"
#include "XdmfTopology.hpp"
XDMF_CHILDREN_IMPLEMENTATION(XdmfGrid, XdmfAttribute, Attribute, Name)
XDMF_CHILDREN_IMPLEMENTATION(XdmfGrid, XdmfSet, Set, Name)
boost::shared_ptr<XdmfGrid> XdmfGrid::New()
{
boost::shared_ptr<XdmfGrid> p(new XdmfGrid());
......@@ -34,37 +37,6 @@ XdmfGrid::~XdmfGrid()
const std::string XdmfGrid::ItemTag = "Grid";
boost::shared_ptr<XdmfAttribute> XdmfGrid::getAttribute(const unsigned int index)
{
return boost::const_pointer_cast<XdmfAttribute>(static_cast<const XdmfGrid &>(*this).getAttribute(index));
}
boost::shared_ptr<const XdmfAttribute> XdmfGrid::getAttribute(const unsigned int index) const
{
if(index < mAttributes.size())
{
return mAttributes[index];
}
return boost::shared_ptr<XdmfAttribute>();
}
boost::shared_ptr<XdmfAttribute> XdmfGrid::getAttribute(const std::string & name)
{
return boost::const_pointer_cast<XdmfAttribute>(static_cast<const XdmfGrid &>(*this).getAttribute(name));
}
boost::shared_ptr<const XdmfAttribute> XdmfGrid::getAttribute(const std::string & name) const
{
for(std::vector<boost::shared_ptr<XdmfAttribute> >::const_iterator iter = mAttributes.begin(); iter != mAttributes.end(); ++iter)
{
if((*iter)->getName().compare(name) == 0)
{
return *iter;
}
}
return boost::shared_ptr<XdmfAttribute>();
}
boost::shared_ptr<XdmfGeometry> XdmfGrid::getGeometry()
{
return boost::const_pointer_cast<XdmfGeometry>(static_cast<const XdmfGrid &>(*this).getGeometry());
......@@ -102,47 +74,6 @@ std::string XdmfGrid::getName() const
return mName;
}
unsigned int XdmfGrid::getNumberAttributes() const
{
return mAttributes.size();
}
unsigned int XdmfGrid::getNumberSets() const
{
return mSets.size();
}
boost::shared_ptr<XdmfSet> XdmfGrid::getSet(const unsigned int index)
{
return boost::const_pointer_cast<XdmfSet>(static_cast<const XdmfGrid &>(*this).getSet(index));
}
boost::shared_ptr<const XdmfSet> XdmfGrid::getSet(const unsigned int index) const
{
if(index < mSets.size())
{
return mSets[index];
}
return boost::shared_ptr<XdmfSet>();
}
boost::shared_ptr<XdmfSet> XdmfGrid::getSet(const std::string & name)
{
return boost::const_pointer_cast<XdmfSet>(static_cast<const XdmfGrid &>(*this).getSet(name));
}
boost::shared_ptr<const XdmfSet> XdmfGrid::getSet(const std::string & name) const
{
for(std::vector<boost::shared_ptr<XdmfSet> >::const_iterator iter = mSets.begin(); iter != mSets.end(); ++iter)
{
if((*iter)->getName().compare(name) == 0)
{
return *iter;
}
}
return boost::shared_ptr<XdmfSet>();
}
boost::shared_ptr<XdmfTime> XdmfGrid::getTime()
{
return boost::const_pointer_cast<XdmfTime>(static_cast<const XdmfGrid &>(*this).getTime());
......@@ -163,16 +94,6 @@ boost::shared_ptr<const XdmfTopology> XdmfGrid::getTopology() const
return mTopology;
}
void XdmfGrid::insert(const boost::shared_ptr<XdmfAttribute> attribute)
{
mAttributes.push_back(attribute);
}
void XdmfGrid::insert(const boost::shared_ptr<XdmfSet> set)
{
mSets.push_back(set);
}
void XdmfGrid::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
XdmfItem::populateItem(itemProperties, childItems, reader);
......@@ -214,48 +135,6 @@ void XdmfGrid::populateItem(const std::map<std::string, std::string> & itemPrope
}
}
void XdmfGrid::removeAttribute(const unsigned int index)
{
if(index < mAttributes.size())
{
mAttributes.erase(mAttributes.begin() + index);
}
}
void XdmfGrid::removeAttribute(const std::string & name)
{
for(std::vector<boost::shared_ptr<XdmfAttribute> >::iterator iter = mAttributes.begin(); iter != mAttributes.end(); ++iter)
{
if((*iter)->getName().compare(name) == 0)
{
mAttributes.erase(iter);
return;
}
}
return;
}
void XdmfGrid::removeSet(const unsigned int index)
{
if(index < mSets.size())
{
mSets.erase(mSets.begin() + index);
}
}
void XdmfGrid::removeSet(const std::string & name)
{
for(std::vector<boost::shared_ptr<XdmfSet> >::iterator iter = mSets.begin(); iter != mSets.end(); ++iter)
{
if((*iter)->getName().compare(name) == 0)
{
mSets.erase(iter);
return;
}
}
return;
}
void XdmfGrid::setGeometry(const boost::shared_ptr<XdmfGeometry> geometry)
{
mGeometry = geometry;
......
......@@ -34,40 +34,10 @@ public:
virtual ~XdmfGrid();
LOKI_DEFINE_VISITABLE(XdmfGrid, XdmfItem)
XDMF_CHILDREN(XdmfAttribute, Attribute, Name)
XDMF_CHILDREN(XdmfSet, Set, Name)
static const std::string ItemTag;
/**
* Get an attribute attached to this grid by index.
*
* @param index of the attribute to retrieve.
* @return requested attribute. If not found a NULL pointer is returned.
*/
boost::shared_ptr<XdmfAttribute> getAttribute(const unsigned int index);
/**
* Get an attribute attached to this grid by index (const version).
*
* @param index of the attribute to retrieve.
* @return requested attribute. If not found a NULL pointer is returned.
*/
boost::shared_ptr<const XdmfAttribute> getAttribute(const unsigned int index) const;
/**
* Get an attribute attached to this grid by name.
*
* @param name of the attribute to retrieve.
* @return requested attribute. If not found a NULL pointer is returned.
*/
boost::shared_ptr<XdmfAttribute> getAttribute(const std::string & name);
/**
* Get an attribute attached to this grid by name (const version).
*
* @param name the name of the attribute to retrieve.
* @return requested attribute. If not found a NULL pointer is returned.
*/
boost::shared_ptr<const XdmfAttribute> getAttribute(const std::string & name) const;
/**
* Get the geometry associated with this grid.
*
......@@ -107,52 +77,6 @@ public:
*/
std::string getName() const;
/**
* Get the number of attributes attached to this grid.
*
* @return the number of attributes attached to this grid.
*/
unsigned int getNumberAttributes() const;
/**
* Get the number of sets attached to this grid.
*
* @return the number of sets attached to this grid.
*/
unsigned int getNumberSets() const;
/**
* Get a set attached to this grid by index.
*
* @param index of the set to retrieve.
* @return requested set. If not found a NULL pointer is returned.
*/
boost::shared_ptr<XdmfSet> getSet(const unsigned int index);
/**
* Get a set attached to this grid by index (const version).
*
* @param index of the set to retrieve.
* @return requested set. If not found a NULL pointer is returned.
*/
boost::shared_ptr<const XdmfSet> getSet(const unsigned int index) const;
/**
* Get a set attached to this grid by name.
*
* @param name of the set to retrieve.
* @return requested set. If not found a NULL pointer is returned.
*/
boost::shared_ptr<XdmfSet> getSet(const std::string & name);
/**
* Get a set attached to this grid by name (const version).
*
* @param name of the set to retrieve.
* @return requested set. If not found a NULL pointer is returned.
*/
boost::shared_ptr<const XdmfSet> getSet(const std::string & name) const;
/**
* Get the time associated with this grid.
*
......@@ -183,48 +107,6 @@ public:
using XdmfItem::insert;
/**
* Insert an attribute into the grid.
*
* @param attribute an XdmfAttribute to attach to this grid.
*/
void insert(const boost::shared_ptr<XdmfAttribute> attribute);
/**
* Insert a set into the grid.
*
* @param set an XdmfSet to attach to this grid.
*/
void insert(const boost::shared_ptr<XdmfSet> set);
/**
* Remove an attribute from the grid by index. If no attribute is at that index, no attributes are removed.
*
* @param index of the attribute to remove.
*/
void removeAttribute(const unsigned int index);
/**
* Remove an attribute from the grid by name. If no attribute having the name is found, no attributes are removed.
*
* @param name of the attribute to remove.
*/
void removeAttribute(const std::string & name);
/**
* Remove an set from the grid by index. If no set is at that index, no sets are removed.
*
* @param index of the set to remove.
*/
void removeSet(const unsigned int index);
/**
* Remove an set from the grid by name. If no set having the name is found, no sets are removed.
*
* @param name of the set to remove.
*/
void removeSet(const std::string & name);
/**
* Set the geometry associated with this grid.
*
......@@ -274,10 +156,8 @@ private:
XdmfGrid(const XdmfGrid & grid); // Not implemented.
void operator=(const XdmfGrid & grid); // Not implemented.
std::vector<boost::shared_ptr<XdmfAttribute> > mAttributes;
boost::shared_ptr<XdmfGeometry> mGeometry;
boost::shared_ptr<XdmfMap> mMap;
std::vector<boost::shared_ptr<XdmfSet> > mSets;
boost::shared_ptr<XdmfTime> mTime;
boost::shared_ptr<XdmfTopology> mTopology;
};
......
......@@ -57,7 +57,7 @@ public:
/**
* Set the XdmfGridCollectionType associated with this grid collection.
*
* @param collectionType the XdmfGridCollectionType to set.
* @param type the XdmfGridCollectionType to set.
*/
void setType(const boost::shared_ptr<const XdmfGridCollectionType> type);
......
......@@ -124,7 +124,7 @@ public:
/**
* Set the XdmfSetType associated with this set.
*
* @param setType the XdmfSetType to set.
* @param type the XdmfSetType to set.
*/
void setType(const boost::shared_ptr<const XdmfSetType> type);
......
......@@ -16,7 +16,7 @@ public:
/**
* Create a new XdmfTime.
*
* @param timeValue the value of the XdmfTime to create.
* @param value the timeValue of the XdmfTime to create.
* @return the new XdmfTime.
*/
static boost::shared_ptr<XdmfTime> New(const double & value = 0);
......@@ -40,7 +40,7 @@ public:
/**
* Set the time value associated with this XdmfTime.
*
* @return a double containing the time value.
* @param time a double containing the time value.
*/
void setValue(const double & time);
......
......@@ -51,7 +51,7 @@ public:
/**
* Set the XdmfTopologyType associated with this topology.
*
* @param topologyType the XdmfTopologyType to set.
* @param type the XdmfTopologyType to set.
*/
void setType(const boost::shared_ptr<const XdmfTopologyType> type);
......
......@@ -99,7 +99,7 @@ public:
/**
* Get the number of nodes per element associated with this topology type.
*
* @return an unsinged int containing number of nodes per element.
* @return an unsigned int containing number of nodes per element.
*/
unsigned int getNodesPerElement() const;
......
......@@ -57,6 +57,6 @@ install(TARGETS XdmfCore LIBRARY DESTINATION lib)
set(XdmfCore_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} ${HDF5_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS} CACHE INTERNAL "")
if(XDMF_BUILD_TESTING)
if(BUILD_TESTING)
add_subdirectory(tests)
endif(XDMF_BUILD_TESTING)
endif(BUILD_TESTING)
#include "XdmfInformation.hpp"
#include "XdmfItem.hpp"
XDMF_CHILDREN_IMPLEMENTATION(XdmfItem, XdmfInformation, Information, Key)
XdmfItem::XdmfItem()
{
}
......@@ -9,47 +11,6 @@ XdmfItem::~XdmfItem()
{
}
boost::shared_ptr<XdmfInformation> XdmfItem::getInformation(const unsigned int index)
{
return boost::const_pointer_cast<XdmfInformation>(static_cast<const XdmfItem &>(*this).getInformation(index));
}
boost::shared_ptr<const XdmfInformation> XdmfItem::getInformation(const unsigned int index) const
{
if(index < mInformations.size())
{
return mInformations[index];
}
return boost::shared_ptr<XdmfInformation>();
}
boost::shared_ptr<XdmfInformation> XdmfItem::getInformation(const std::string & key)
{
return boost::const_pointer_cast<XdmfInformation>(static_cast<const XdmfItem &>(*this).getInformation(key));
}
boost::shared_ptr<const XdmfInformation> XdmfItem::getInformation(const std::string & key) const
{
for(std::vector<boost::shared_ptr<XdmfInformation> >::const_iterator iter = mInformations.begin(); iter != mInformations.end(); ++iter)
{
if((*iter)->getKey().compare(key) == 0)
{
return *iter;
}
}
return boost::shared_ptr<XdmfInformation>();
}
unsigned int XdmfItem::getNumberInformations() const
{
return mInformations.size();
}
void XdmfItem::insert(const boost::shared_ptr<XdmfInformation> information)
{
mInformations.push_back(information);
}
void XdmfItem::populateItem(const std::map<std::string, std::string> &, std::vector<boost::shared_ptr<XdmfItem > > & childItems, const XdmfCoreReader * const)
{
for(std::vector<boost::shared_ptr<XdmfItem> >::const_iterator iter = childItems.begin(); iter != childItems.end(); ++iter)
......@@ -61,26 +22,6 @@ void XdmfItem::populateItem(const std::map<std::string, std::string> &, std::vec
}
}
void XdmfItem::removeInformation(const unsigned int index)
{
if(index < mInformations.size())
{
mInformations.erase(mInformations.begin() + index);
}
}
void XdmfItem::removeInformation(const std::string & key)
{
for(std::vector<boost::shared_ptr<XdmfInformation> >::iterator iter = mInformations.begin(); iter != mInformations.end(); ++iter)
{
if((*iter)->getKey().compare(key) == 0)
{
mInformations.erase(iter);
return;
}
}
}
void XdmfItem::traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor)
{
for(std::vector<boost::shared_ptr<XdmfInformation> >::const_iterator iter = mInformations.begin(); iter != mInformations.end(); ++iter)
......
......@@ -13,6 +13,105 @@ class XdmfVisitor;
#include <string>
#include <vector>
// MMacro that allows children XdmfItems to be attached to a parent XdmfItem. -- For Header File
#define XDMF_CHILDREN(ChildClass, ChildName, SearchName) \
public: \
/** Get a ChildClass attached to this item by index.
@param index of the ChildClass to retrieve.
@return requested ChildClass. If no ChildClass##s exist at the index, a NULL pointer is returned.
*/ \
virtual boost::shared_ptr<ChildClass> get##ChildName(const unsigned int index); \
/** Get a ChildClass attached to this item by index (const version).
@param index of the ChildClass to retrieve.
@return requested ChildClass. If no ChildClass##s exist at the index, a NULL pointer is returned.
*/ \
virtual boost::shared_ptr<const ChildClass> get##ChildName(const unsigned int index) const; \
/** Get a ChildClass attached to this item by SearchName.
@param SearchName of the ChildClass to retrieve.
@return requested ChildClass. If no ChildClass##s are found with the correct SearchName, a NULL pointer is returned.
*/ \
virtual boost::shared_ptr<ChildClass> get##ChildName(const std::string & SearchName); \
/** Get a ChildClass attached to this item by SearchName (const version).
@param SearchName of the ChildClass to retrieve.
@return requested ChildClass. If no ChildClass##s are found with the correct SearchName, a NULL pointer is returned.
*/ \
virtual boost::shared_ptr<const ChildClass> get##ChildName(const std::string & SearchName) const; \
/** Get the number of ChildClass##s attached to this item.
@return number of ChildClass##s attached to this item.
*/ \
virtual unsigned int getNumber##ChildName##s() const; \
/** Insert a ChildClass into to this item.
@param ChildName to attach to this item.
*/ \
virtual void insert(const boost::shared_ptr<ChildClass> ChildName); \
/** Remove a ChildClass from this item by index. If no ChildClass##s exist at the index, nothing is removed.
@param index of the ChildClass to remove.
*/ \
virtual void remove##ChildName(const unsigned int index); \
/** Remove a ChildClass from this item by SearchName. If no ChildClass##s have the correct SearchName, nothing is removed.
@param SearchName of the ChildClass to remove.
*/ \
virtual void remove##ChildName(const std::string & SearchName); \
protected : \
std::vector<boost::shared_ptr<ChildClass> > m##ChildName##s; \
public : \
// Macro that allows children XdmfItems to be attached to a parent XdmfItem. -- For Implementation File
#define XDMF_CHILDREN_IMPLEMENTATION(ParentClass, ChildClass, ChildName, SearchName) \
boost::shared_ptr<ChildClass> ParentClass::get##ChildName(const unsigned int index) \
{ \
return boost::const_pointer_cast<ChildClass>(static_cast<const ParentClass &>(*this).get##ChildName(index)); \
} \
boost::shared_ptr<const ChildClass> ParentClass::get##ChildName(const unsigned int index) const \
{ \
if(index < m##ChildName##s.size()) \
{ \
return m##ChildName##s[index]; \
} \
return boost::shared_ptr<ChildClass>(); \
} \
boost::shared_ptr<ChildClass> ParentClass::get##ChildName(const std::string & SearchName) \
{ \
return boost::const_pointer_cast<ChildClass>(static_cast<const ParentClass &>(*this).get##ChildName(SearchName)); \
} \
boost::shared_ptr<const ChildClass> ParentClass::get##ChildName(const std::string & SearchName) const \
{ \
for(std::vector<boost::shared_ptr<ChildClass> >::const_iterator iter = m##ChildName##s.begin(); iter != m##ChildName##s.end(); ++iter) \
{ \
if((*iter)->get##SearchName().compare(SearchName) == 0) \
{ \
return *iter; \
} \
} \
return boost::shared_ptr<ChildClass>(); \
} \
unsigned int ParentClass::getNumber##ChildName##s() const \
{ \
return m##ChildName##s.size(); \
} \