freControllerBase.h

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: freControllerBase.h,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 #ifndef __freControllerBase_h
00023 #define __freControllerBase_h
00024 
00025 #include "freElementals.h"
00026 #include "freExceptions.h"
00027 #include "freControllerEvents.h"
00028 #include "freComponentSetup.h"
00029 #include "freComponentSetupAdaptor.h"
00030 #include "freControllerProfile.h"
00031 #include "freSessionComponentCache.h"
00032 #include "freSessionInfo.h"
00033 #include "freValidityTag.h"
00034 #include "freImagePolyStorage.h"
00035 #include "freControllerInterface.h"
00036 
00037 namespace FREE
00038 {
00039 
00040 //Macro for generation of a controller ID
00041 #define freControllerIDMacro( Class, CtrlID )\
00042         namespace ControllerID {\
00043                 static const char* const Class = CtrlID;\
00044         }
00045 
00046 
00064 freControllerIDMacro( ComponentControllerBase, "ComponentBase");
00065 template <class TControlledComponent>
00066 class ComponentControllerBase : public ComponentControllerInterface
00067 {
00068 public:
00070   typedef ComponentControllerInterface::GenericComponentType GenericComponentType;
00072   typedef ComponentControllerInterface::GenericComponentPointer GenericComponentPointer;
00076   typedef TControlledComponent ComponentType;
00078   typedef typename ComponentType::Pointer ComponentPointer;
00079   typedef ComponentControllerInterface::GenericMediaType GenericMediaType;
00080   typedef ComponentControllerInterface::GenericMediaPointer GenericMediaPointer;
00081 
00082   virtual const char *GetNameOfClass() const {return "ComponentControllerBase";};
00083 
00096   virtual CtrlProfile::ControllerProfile::Pointer GetProfile(const SessionComponentCache* pComponentCache) const;
00097 
00098   typedef ComponentControllerInterface::AffectedElementListType AffectedElementListType;
00099 
00117   virtual AffectedElementListType GetAffectedProfileElements(const IDPath& affectorID,
00118                                                              SessionComponentCache* pComponentCache,
00119                                                              const ComponentSetup* pNewAffectorSetup = 0) const;
00120 
00127   virtual bool ControllerIsResponsible(const GenericComponentType* pComponent) const;
00128 
00140   virtual void InitializeSetup(ComponentSetup* pComponentSetup, SessionComponentCache* pComponentCache) const;
00141 
00154   virtual SessionComponentCache::Pointer BuildSetup(ComponentSetup* pComponentSetup, SessionComponentCache* pParentComponentCache) const;
00155 
00168    const bool CheckComponentActualizationNecessity(const SessionComponentCache* pComponentCache) const;
00169 
00185   void ActualizeComponent(SessionComponentCache* pComponentCache, SessionInfo* pSessionInfo,
00186                           const unsigned int& iActiveLayer = 0) const;
00187 
00198   void ResetComponent(SessionComponentCache* pComponentCache, SessionInfo* pSessionInfo) const;
00199 
00211   void SetStatisticEntry(StatisticEntry& rStatisticEntry, SessionComponentCache* pComponentCache,
00212                         SessionInfo* pSessionInfo) const;
00213 
00220   virtual ComponentPointer GetComponent(const SessionComponentCache* pComponentCache) const; 
00221 
00227   virtual void SetComponent(ComponentType* pComponent, SessionComponentCache* pComponentCache) const; 
00228 
00234   virtual GenericComponentPointer GetGenericComponent(const SessionComponentCache* pComponentCache) const; 
00235 
00241   virtual void SetGenericComponent(GenericComponentType* pGenericComponent, SessionComponentCache* pComponentCache) const; 
00242 
00250   GenericComponentType* GetSubComponent(SessionComponentCache* pMainComponentCache, const ComponentID compID) const; 
00251 
00259   void SetSubComponent(SessionComponentCache* pMainComponentCache, GenericComponentType* pSubComponent, 
00260                        const ComponentID compID) const; 
00261 
00270   GenericMediaPointer GetMedia(const MediaID& mediaID,
00271                                    SessionComponentCache* pComponentCache,
00272                                    SessionInfo* pSessionInfo) const; 
00273 
00281   void SetMedia(const MediaID& mediaID, GenericMediaType* pMedia,
00282                 SessionComponentCache* pComponentCache,
00283                 SessionInfo* pSessionInfo) const; 
00284         
00301   virtual ValidityTag::Pointer GetMediaValidityTag(const MediaID& mediaID, SessionComponentCache* pComponentCache) const; 
00302 
00313   virtual ValidityTag::Pointer GetMediaValidityTagRequirement(const MediaID& mediaID, SessionComponentCache* pComponentCache) const; 
00314 
00322   virtual std::string GetMediaControllerID(const MediaID& mediaID, SessionComponentCache* pComponentCache) const; 
00323 
00334   virtual Parameter::Pointer GetParameter(const SessionComponentCache* pComponentCache, const std::string& sParameterName) const;
00335 
00349   virtual std::string GetParameterValue(const SessionComponentCache* pComponentCache, const std::string& sParameterName, const Parameter::ValueCountType iItemPos = 0, const Parameter::LayerCountType iLayer = 0) const; 
00350 
00365   virtual void SetParameterValue(SessionComponentCache* pComponentCache, const std::string& sParameterName, const std::string& sValue, const Parameter::ValueCountType iItemPos = 0, const Parameter::LayerCountType iLayer = 0) const; 
00366 
00384   virtual ValidityTag::Pointer GetParameterValidityTag(const std::string& sParameterName, SessionComponentCache* pComponentCache) const; 
00385 
00397   virtual ValidityTag::Pointer GetParameterValidityTagRequirement(const std::string& sParameterName, SessionComponentCache* pComponentCache) const; 
00398 
00399   virtual ~ComponentControllerBase();
00400 
00401 protected:
00404   ComponentControllerBase();
00405 
00419   bool MakeCallback(const CallbackCtrlEventBase::CallbackType& callbackID, void* pData, SessionComponentCache* pSender, long threadID = 0) const;
00420 
00431   void NotifyProgress(const ProgressCtrlEventBase::StatusID& statusID, const std::string& sComment, SessionComponentCache* pSender, long threadID = 0) const;
00432 
00443   virtual ComponentPointer BuildMainComponent(ComponentSetup* pComponentSetup, SessionComponentCache* pComponentCache) const;
00444 
00453   virtual void BuildSubComponents(ComponentSetup* pParentComponentSetup, SessionComponentCache* pParentComponentCache) const;
00454 
00462   virtual void BuildFinalization(ComponentSetup* pComponentSetup, SessionComponentCache* pComponentCache) const;
00463 
00475   virtual void ActualizeMainComponent(ComponentType* pMainComponent,
00476                                                                                                                                                         SessionComponentCache* pComponentCache,
00477                                       SessionInfo* pSessionInfo,
00478                                                                                                                                                         const unsigned int& iActLevel) const;
00479 
00491   virtual void ActualizeSubComponents(ComponentType* pMainComponent,
00492                                       SessionComponentCache* pComponentCache,
00493                                       SessionInfo* pSessionInfo,
00494                                       const unsigned int& iActLevel) const;
00495 
00507   virtual void ActualizeFinalization(ComponentType* pMainComponent,
00508                                      SessionComponentCache* pComponentCache,
00509                                      SessionInfo* pSessionInfo,
00510                                      const unsigned int& iActLevel) const;
00511  
00519   virtual void ResetMainComponent(SessionComponentCache* pComponentCache,
00520                                   SessionInfo* pSessionInfo) const;
00521 
00528   virtual void ResetSubComponents(SessionComponentCache* pComponentCache,
00529                                       SessionInfo* pSessionInfo) const;
00530 
00538   virtual void ResetFinalization(SessionComponentCache* pComponentCache,
00539                                  SessionInfo* pSessionInfo) const;
00540 
00552   virtual void SetStatisticEntryMainComponent(StatisticEntry& rStatisticEntry,
00553                                              ComponentType* pMainComponent,
00554                                              SessionComponentCache* pMainComponentCache,
00555                                              SessionInfo* pSessionInfo,
00556                                              StatisticDictionary& rDictionary) const;
00557 
00567   virtual void SetStatisticEntrySubComponents(StatisticEntry& rStatisticEntry,
00568                                              SessionComponentCache* pComponentCache,
00569                                              SessionInfo* pSessionInfo,
00570                                              StatisticDictionary& rDictionary) const;
00571 
00576         const bool CheckCmpActNecessitySubCmp(const SessionComponentCache* pComponentCache) const;
00577 
00584   virtual const bool CheckCmpActNecessityMainCmp(const SessionComponentCache* pComponentCache) const;
00585 
00594   virtual GenericComponentType* GetSubComponentCasted(ComponentType* pMainComponent,
00595                                                                                                                                                                                                                   const ComponentID& compID,
00596                                                       SessionComponentCache* pMainComponentCache) const; 
00597 
00606   virtual void SetSubComponentCasted(GenericComponentType* pSubComponent,
00607                                                                                                                                                  ComponentType* pMainComponent,
00608                                                                                                                                                  const ComponentID compID,
00609                                      SessionComponentCache* pMainComponentCache) const;
00610 
00621   virtual GenericMediaPointer GetMediaCasted(const MediaID& mediaID,
00622                                                                                                                                                              ComponentType* pComponent,
00623                                                  SessionComponentCache* pComponentCache,
00624                                                  SessionInfo* pSessionInfo) const; 
00625 
00634   virtual void SetMediaCasted(const MediaID& mediaID, GenericMediaType* pMedia,
00635                                                                                                                   ComponentType* pComponent,
00636                               SessionComponentCache* pComponentCache,
00637                               SessionInfo* pSessionInfo) const; 
00638 
00642   void ActualizeMediaValidityTag(const MediaID& mediaID,
00643                                  SessionComponentCache* pComponentCache) const;
00644 
00648   void ActualizeParameterValidityTag(const std::string& sParameterName,
00649                               SessionComponentCache* pComponentCache) const;
00650 
00654   void ActualizeValidityTag(const std::string& sID,
00655                               SessionComponentCache* pComponentCache) const;
00656 
00670   virtual ValidityTag::Pointer GetValidityTag(const std::string& id, SessionComponentCache* pComponentCache) const; 
00671 
00686   virtual ValidityTag::Pointer GetValidityTagRequirement(const std::string& id, SessionComponentCache* pComponentCache) const; 
00687 
00697   virtual void GenerateProfile(CtrlProfile::ControllerProfile& profile, const SessionComponentCache* pComponentCache, bool bRegardOldSetup) const;
00698 
00712   virtual void GenerateProfileTemplateRealization(CtrlProfile::ControllerProfile& profile, const SessionComponentCache* pComponentCache, const ComponentSetup& oldSetup) const;
00713   
00726   virtual StatisticEntry* AddStatisticEntry(SessionComponentCache* pComponentCache,
00727                                             SessionInfo* pSessionInfo,
00728                                             const std::string& sName, const std::string& sDescription) const;
00729 };
00730 
00731 } //end of namespace FREE
00732 
00733 #ifndef ITK_MANUAL_INSTANTIATION
00734 #include "freControllerBase.txx"
00735 #endif
00736 
00737 #endif

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