From: <qua...@us...> - 2010-01-04 17:13:31
|
Revision: 85 http://stdair.svn.sourceforge.net/stdair/?rev=85&view=rev Author: quannaus Date: 2010-01-04 17:13:25 +0000 (Mon, 04 Jan 2010) Log Message: ----------- Seperate the linkage phase from the initialisation phase of the content child. Modified Paths: -------------- trunk/stdair/stdair/factory/FacBomContent.hpp Modified: trunk/stdair/stdair/factory/FacBomContent.hpp =================================================================== --- trunk/stdair/stdair/factory/FacBomContent.hpp 2010-01-04 10:55:59 UTC (rev 84) +++ trunk/stdair/stdair/factory/FacBomContent.hpp 2010-01-04 17:13:25 UTC (rev 85) @@ -45,22 +45,29 @@ <br>A structure object is created, under the hood, with the given key. That structure object then gets a pointer on the content object. */ template <typename BOM_CONTENT_CHILD> - BOM_CONTENT_CHILD& create (typename BOM_CONTENT_CHILD::Parent_T& ioContentParent, typename BOM_CONTENT_CHILD::BomKey_T& ioKey) { + BOM_CONTENT_CHILD& create (typename BOM_CONTENT_CHILD::BomKey_T& ioKey) { + + // Create the child structure object for the given key + BOM_CONTENT_CHILD& lBomContentChild = + createInternal<BOM_CONTENT_CHILD> (ioKey); - // Define the parent key type. + return lBomContentChild; + } + + /** Link a child content objet with his parent. */ + template <typename BOM_CONTENT_CHILD> + static void linkWithParent (BOM_CONTENT_CHILD& ioContentChild, typename BOM_CONTENT_CHILD::Parent_T& ioContentParent) { + + // Define the key types. typedef typename BOM_CONTENT_CHILD::Parent_T::BomKey_T ParentKey_T; - + // Finish the construction of the child key by setting its parent. const ParentKey_T& lParentKey = ioContentParent.getKey(); - ioKey.setParentKey (lParentKey); + ioContentChild._key.setParentKey (lParentKey); - // Create the child structure object for the given key - BOM_CONTENT_CHILD& lBomContentChild = - createInternal<BOM_CONTENT_CHILD> (ioKey); - // Retrieve the child structure object typename BOM_CONTENT_CHILD::BomStructure_T& lBomStructureChild = - lBomContentChild.getBomStructure (); + ioContentChild.getBomStructure (); // Type for the parent Bom content typedef typename BOM_CONTENT_CHILD::Parent_T PARENT_CONTENT_T; @@ -83,8 +90,6 @@ if (hasLinkBeenSuccessful == false) { throw new MemoryAllocationException(); } - - return lBomContentChild; } private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |