freSessionInfo.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: freSessionInfo.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 #include "freSessionInfo.h"
00023 #include "frePointerSentry.h"
00024 
00025 namespace FREE
00026 {
00027 
00031 
00032 Setup*
00033 SessionInfo::
00034 GetSetup() const
00035 {
00036         return this->m_pSetup;
00037 };
00038 
00039 void
00040 SessionInfo::
00041 SetSetup(Setup* pSetup)
00042 {
00043         this->m_pSetup = pSetup;
00044   m_smpRootCache = SessionComponentCache::New(0,pSetup->GetRootComponent(),0,0);
00045 };
00046 
00047 const SessionComponentCache*
00048 SessionInfo::
00049 GetSessionCache() const
00050 {
00051   if (this->m_smpRootCache.IsNotNull()) return this->m_smpRootCache.GetPointer();
00052   return 0;
00053 };
00054   
00055 SessionComponentCache*
00056 SessionInfo::
00057 GetSessionCache()
00058 {
00059         return this->m_smpRootCache.GetPointer();
00060 };
00061 
00062 const SessionInfo::ComponentCacheCollectionType&
00063 SessionInfo::
00064 GetComponentCaches() const
00065 {
00066   if (this->m_smpRootCache.IsNotNull())
00067   {
00068     return this->m_smpRootCache->SubCaches();
00069   }
00070   throwExceptionMacro("Error; cannot retrieve component caches, root cache is NULL. Ensure that session info has been properly builed.");
00071 };
00072 
00073 SessionInfo::ComponentCacheCollectionType&
00074 SessionInfo::
00075 GetComponentCaches()
00076 {
00077   if (this->m_smpRootCache.IsNotNull())
00078   {
00079     return this->m_smpRootCache->SubCaches();
00080   }
00081   throwExceptionMacro("Error; cannot retrieve component caches, root cache is NULL. Ensure that session info has been properly builed.");
00082 };
00083 
00084 SessionComponentCache*
00085 SessionInfo::
00086 GetCacheByIDPath(const IDPath& idPath) const
00087 {
00088         if (this->m_smpRootCache.IsNull()) return 0;
00089         return this->m_smpRootCache->GetCacheByIDPath(idPath);
00090 };
00091 
00092 SessionInfo::
00093 SessionInfo(Setup* pSetup)
00094 {
00095         this->m_smpRootCache = 0;
00096         SetSetup(pSetup);
00097   this->m_pStatistic = 0;
00098 };
00099 
00100 SessionInfo&
00101 SessionInfo::
00102 operator = (const SessionInfo& rSessionInfo)
00103 {
00104         if (this == &rSessionInfo) return *this;
00105 
00106         this->m_pSetup = rSessionInfo.GetSetup();
00107         *(this->m_smpRootCache.GetPointer()) = *(rSessionInfo.GetSessionCache());
00108 
00109         return *this;
00110 };
00111 
00112 SessionInfo::Pointer
00113 SessionInfo::
00114 New(Setup* pSetup)
00115 {
00116   Pointer smartPtr;
00117   SessionInfo *rawPtr = ::itk::ObjectFactory<SessionInfo>::Create();
00118   if(rawPtr == NULL)
00119   {
00120     rawPtr = new SessionInfo(pSetup);
00121   }
00122   smartPtr = rawPtr;
00123   rawPtr->UnRegister();
00124   
00125   return smartPtr;
00126 };
00127 
00128 }//end of namespace FREE

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