freNormalVariateGeneratorController.cxx

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   F.R.E.E. - flexible registration evaluation engine
00004   Version:   v.1.0.0
00005   Date:      $Date: 2006/09/01 12:00:00 $
00006   Module:    $RCSfile: freNormalVariateGeneratorController.cxx,v $
00007   Language:  C++
00008 
00009 
00010 
00011   Copyright (c) 2007 Ralf o Floca (Department of Medical Informatics,
00012   Institute for Medical Biometry and Informatics, University of Heidelberg,
00013   Germany). All rights reserved.
00014   See FREECopyright.txt or http://www.mi.med.uni-hd.de/free/copyright.htm
00015   for details.
00016 
00017      This software is distributed WITHOUT ANY WARRANTY; without even 
00018      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00019      PURPOSE.  See the above copyright notices for more information.
00020 
00021 =========================================================================*/
00022 
00023 #include "freNormalVariateGeneratorController.h"
00024 #include "freExceptions.h"
00025 
00026 #include <time.h>
00027 
00028 namespace FREE
00029 {
00030 
00034 
00035 
00036 DefineParameterMacro(NormalVariateGeneratorController, InitialSeed, "InitialSeed", "Seed for the variate gernerator.");
00037 DefineParameterMacro(NormalVariateGeneratorController, UseInitialSeed, "UseInitialSeed", "Use the initial seed for initializing the variate gernerator; otherwise use actual time to initialize.");
00038 
00039 
00040 NormalVariateGeneratorController::
00041 NormalVariateGeneratorController()
00042 {
00043   //Profile settings
00044   this->UpdateControllerID(ControllerID::VariateGeneratorControllerBase);
00045   this->UpdateControllerID(ControllerID::NormalVariateGeneratorController);
00046   this->m_Description = "A normal variate random generator.";
00047 };
00048 
00049 void
00050 NormalVariateGeneratorController::
00051 GenerateProfile(CtrlProfile::ControllerProfile& profile,
00052                 const SessionComponentCache* pComponentCache,
00053                 bool bRegardOldSetup) const
00054 {
00055         //Parameters
00056   profile.Parameters().AddParameter(cParam_InitialSeed,CtrlProfile::Parameter::PVTInteger,cParamDsc_InitialSeed,1,"21021978");
00057   profile.Parameters().AddParameter(cParam_UseInitialSeed,CtrlProfile::Parameter::PVTBool,cParamDsc_UseInitialSeed,1,"false");
00058 };
00059 
00060 NormalVariateGeneratorController::
00061 ~NormalVariateGeneratorController()
00062 {
00063 };
00064 
00065 void
00066 NormalVariateGeneratorController::
00067 ActualizeMainComponent(ComponentType* pMainComponent,
00068                        SessionComponentCache* pComponentCache, SessionInfo* pSessionInfo,
00069                                                                                          const unsigned int& iActLevel) const
00070 {
00071   int iSeed;
00072         bool bUseSeed;
00073 
00074   try
00075   {
00076     SessionAccessor::GetParameterValue(pComponentCache,cParam_InitialSeed,iSeed,0,iActLevel,true);
00077     SessionAccessor::GetParameterValue(pComponentCache,cParam_UseInitialSeed,bUseSeed,0,iActLevel,true);
00078   }
00079   catchAllNPassMacro("Error while retrieving parameter values.");
00080 
00081         if (bUseSeed)
00082         {
00083           pMainComponent->Initialize(iSeed);
00084         }
00085         else
00086         {
00087                 pMainComponent->Initialize((int)clock());
00088         }
00089 };
00090 } //end of namespace free

Generated at Sat Oct 13 16:51:00 2007 for f.r.e.e. - Flexible Registration and Evaluation Engine by doxygen 1.5.3 written by Dimitri van Heesch, © 1997-2000