1 /* 2 * Open BEAGLE 3 * Copyright (C) 2001-2004 by Christian Gagne and Marc Parizeau 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * 19 * Contact: 20 * Laboratoire de Vision et Systemes Numeriques 21 * Departement de genie electrique et de genie informatique 22 * Universite Laval, Quebec, Canada, G1V 4J7 23 * http://vision.gel.ulaval.ca 24 * 25 */ 26 27 /*! 28 * \file beagle/LinGP/Context.hpp 29 * \brief Definition of the type LinGP::System. 30 * \author Christian Gagne <cgagne@gel.ulaval.ca> 31 * \author Alain-Daniel Bourdage <adb@btc.bm> 32 * $Revision: 1.1 $ 33 * $Date: 2005/10/06 15:43:44 $ 34 */ 35 36 /*! 37 * \defgroup LinGPSys Linear GP Evolutionary System 38 * \ingroup LinGPF 39 * \brief Linear GP evolutionary system components, part of the linear GP frameowork. 40 */ 41 42 #ifndef Beagle_LinGP_System_hpp 43 #define Beagle_LinGP_System_hpp 44 45 #include "beagle/config.hpp" 46 #include "beagle/macros.hpp" 47 #include "beagle/Object.hpp" 48 #include "beagle/AllocatorT.hpp" 49 #include "beagle/PointerT.hpp" 50 #include "beagle/ContainerT.hpp" 51 #include "beagle/AssertException.hpp" 52 #include "beagle/Context.hpp" 53 #include "beagle/LinGP/InstructionSuperSet.hpp" 54 55 namespace Beagle { 56 namespace LinGP { 57 58 /*! 59 * \class System beagle/LinGP/System.hpp "beagle/LinGP/System.hpp" 60 * \brief The linear GP system class. 61 * \ingroup LinGPF 62 * \ingroup LinGPSys 63 */ 64 class System : public Beagle::System { 65 66 public: 67 68 //! LinGP::System allocator type. 69 typedef AllocatorT<System,Beagle::System::Alloc> 70 Alloc; 71 //! LinGP::System handle type. 72 typedef PointerT<System,Beagle::System::Handle> 73 Handle; 74 //! LinGP::System bag type. 75 typedef ContainerT<System,Beagle::System::Bag> 76 Bag; 77 78 System(); 79 explicit System(LinGP::InstructionSuperSet::Handle inSuperSet); 80 explicit System(LinGP::InstructionSuperSet::Handle inSuperSet, 81 Beagle::Context::Alloc::Handle inContextAllocator); 82 explicit System(LinGP::InstructionSuperSet::Handle inSuperSet, 83 Beagle::Context::Alloc::Handle inContextAllocator, 84 Randomizer::Handle inRandomizer, 85 Register::Handle inRegister, 86 Logger::Handle inLogger); 87 explicit System(LinGP::InstructionSet::Handle inSet); 88 explicit System(LinGP::InstructionSet::Handle inSet, 89 Beagle::Context::Alloc::Handle inContextAllocator); 90 explicit System(LinGP::InstructionSet::Handle inSet, 91 Beagle::Context::Alloc::Handle inContextAllocator, 92 Randomizer::Handle inRandomizer, 93 Register::Handle inRegister, 94 Logger::Handle inLogger); ~System()95 virtual ~System() { } 96 97 virtual void initialize(int& ioArgc, char** ioArgv); 98 virtual void initialize(Beagle::string inRegisterFileName); 99 100 /*! 101 * \brief Get a constant reference to the linear GP context allocator of the system. 102 * \return Constant reference to the linear GP context allocator. 103 */ getContextAllocator() const104 inline const Beagle::Context::Alloc& getContextAllocator() const 105 { 106 return castObjectT<const Beagle::Context::Alloc&>(*mContextAllocator); 107 } 108 109 /*! 110 * \brief Get reference to the linear GP context allocator of the system. 111 * \return Reference to the linear GP context allocator. 112 */ getContextAllocator()113 inline Beagle::Context::Alloc& getContextAllocator() 114 { 115 return castObjectT<Beagle::Context::Alloc&>(*mContextAllocator); 116 } 117 118 /*! 119 * \brief Get a handle to the linear GP context allocator of the system. 120 * \return Handle to the linear GP context allocator. 121 */ getContextAllocatorHandle()122 inline Beagle::Context::Alloc::Handle getContextAllocatorHandle() 123 { 124 return castHandleT<Beagle::Context::Alloc>(mContextAllocator); 125 } 126 127 /*! 128 * \brief Get a constant reference to the linear GP instruction super set of the system. 129 * \return Constant reference to the linear GP instruction super set allocator. 130 */ getInstructionSuperSet() const131 inline const LinGP::InstructionSuperSet& getInstructionSuperSet() const 132 { 133 return *mInstructionSuperSet; 134 } 135 136 /*! 137 * \brief Get a reference to the linear GP instruction super set of the system. 138 * \return Reference to the linear GP instruction super set allocator. 139 */ getInstructionSuperSet()140 inline LinGP::InstructionSuperSet& getInstructionSuperSet() 141 { 142 return *mInstructionSuperSet; 143 } 144 145 /*! 146 * \brief Get a handle to the linear GP instruction super set of the system. 147 * \return Handle to the linear GP instruction super set allocator. 148 */ getInstructionSuperSetHandle()149 inline LinGP::InstructionSuperSet::Handle getInstructionSuperSetHandle() 150 { 151 return mInstructionSuperSet; 152 } 153 154 protected: 155 LinGP::InstructionSuperSet::Handle mInstructionSuperSet; //!< The super set of instructions 156 157 }; 158 159 } 160 } 161 162 #endif // Beagle_LinGP_System_hpp 163 164 165 166