From: <den...@us...> - 2010-01-28 22:49:16
|
Revision: 109 http://stdair.svn.sourceforge.net/stdair/?rev=109&view=rev Author: denis_arnaud Date: 2010-01-28 22:49:08 +0000 (Thu, 28 Jan 2010) Log Message: ----------- [Dev] Added a reference on the BomRoot in the STDAIR_Service. Modified Paths: -------------- trunk/stdair/stdair/STDAIR_Service.hpp trunk/stdair/stdair/service/STDAIR_Service.cpp Modified: trunk/stdair/stdair/STDAIR_Service.hpp =================================================================== --- trunk/stdair/stdair/STDAIR_Service.hpp 2010-01-28 15:49:36 UTC (rev 108) +++ trunk/stdair/stdair/STDAIR_Service.hpp 2010-01-28 22:49:08 UTC (rev 109) @@ -9,6 +9,10 @@ namespace stdair { + // Forward declarations + class BomRoot; + + /** Interface for the STDAIR Services. */ class STDAIR_Service { public: @@ -26,6 +30,15 @@ ~STDAIR_Service(); + // ///////////////// Getters /////////////////// + /** Get a reference on the BomRoot object. + <br>If the service context has not been initialised, that + method throws an exception (failing assertion). */ + BomRoot& getBomRoot () const { + return _bomRoot; + } + + private: // /////// Construction and Destruction helper methods /////// /** Default constructor. */ @@ -47,6 +60,12 @@ /** Finalise. */ void finalise (); + + + private: + // /////////////// Attributes /////////////// + /** Root of the BOM tree. */ + BomRoot& _bomRoot; }; } #endif // __STDAIR_SVC_STDAIR_SERVICE_HPP Modified: trunk/stdair/stdair/service/STDAIR_Service.cpp =================================================================== --- trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-01-28 15:49:36 UTC (rev 108) +++ trunk/stdair/stdair/service/STDAIR_Service.cpp 2010-01-28 22:49:08 UTC (rev 109) @@ -6,24 +6,34 @@ // StdAir #include <stdair/basic/BasChronometer.hpp> #include <stdair/bom/BomManager.hpp> // for display() +#include <stdair/bom/BomRoot.hpp> +#include <stdair/bom/Inventory.hpp> // Child of BomRoot, needed for creation of BomRoot +#include <stdair/bom/Network.hpp> // Child of BomRoot, needed for creation of BomRoot #include <stdair/factory/FacSupervisor.hpp> +#include <stdair/factory/FacBomContent.hpp> #include <stdair/service/Logger.hpp> #include <stdair/STDAIR_Service.hpp> namespace stdair { // ////////////////////////////////////////////////////////////////////// - STDAIR_Service::STDAIR_Service () { + STDAIR_Service::STDAIR_Service () + : _bomRoot (FacBomContent::instance().create<BomRoot>()) { assert (false); } // ////////////////////////////////////////////////////////////////////// - STDAIR_Service::STDAIR_Service (const STDAIR_Service& iService) { + STDAIR_Service::STDAIR_Service (const STDAIR_Service& iService) + : _bomRoot (FacBomContent::instance().create<BomRoot>()) { assert (false); } // ////////////////////////////////////////////////////////////////////// - STDAIR_Service::STDAIR_Service (const stdair::BasLogParams& iLogParams) { + STDAIR_Service::STDAIR_Service (const stdair::BasLogParams& iLogParams) + : _bomRoot (FacBomContent::instance().create<BomRoot>()) { + // The root of the BOM tree, on which all of the other BOM objects + // will be attached, is being created with the STDAIR_Service constructor. + // Set the log file logInit (iLogParams); @@ -44,8 +54,6 @@ // ////////////////////////////////////////////////////////////////////// void STDAIR_Service::init () { - // Create the static instance of the FacSupervisor object - FacSupervisor::instance(); } // ////////////////////////////////////////////////////////////////////// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |