ModuleDescription.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
00004 
00005   See Doc/copyright/copyright.txt
00006   or http://www.slicer.org/copyright/copyright.txt for details.
00007 
00008   Program:   Module Description Parser
00009   Module:    $HeadURL: http://svn.slicer.org/Slicer3/trunk/Libs/SlicerExecutionModel/ModuleDescriptionParser/ModuleDescription.h $
00010   Date:      $Date: 2010-01-29 15:33:27 -0500 (Fri, 29 Jan 2010) $
00011   Version:   $Revision: 11881 $
00012 
00013 ==========================================================================*/
00014 
00015 #ifndef __ModuleDescription_h
00016 #define __ModuleDescription_h
00017 
00018 #include "ModuleDescriptionParserWin32Header.h"
00019 
00020 #include "ModuleParameterGroup.h"
00021 
00022 #include "ModuleProcessInformation.h"
00023 #include "ModuleLogo.h"
00024 
00025 #include <string>
00026 #include <vector>
00027 
00028 class ModuleDescriptionParser_EXPORT ModuleDescription
00029 {
00030 public:
00031   ModuleDescription();
00032   ModuleDescription(const ModuleDescription &md);
00033 
00034   void operator=(const ModuleDescription &md);
00035 
00036   void SetCategory(const std::string &cat)
00037   {
00038     this->Category = cat;
00039   }
00040 
00041   const std::string&  GetCategory() const
00042   {
00043     return this->Category;
00044   }
00045 
00046   void SetIndex(const std::string &ind)
00047   {
00048     this->Index = ind;
00049   }
00050 
00051   const std::string& GetIndex() const
00052   {
00053     return this->Index;
00054   }
00055   
00056   void SetTitle(const std::string &title)
00057   {
00058     this->Title = title;
00059   }
00060 
00061   const std::string& GetTitle() const
00062   {
00063     return this->Title;
00064   }
00065 
00066   void SetDescription(const std::string &description)
00067   {
00068     this->Description = description;
00069   }
00070 
00071   const std::string& GetDescription() const
00072   {
00073     return this->Description;
00074   }
00075 
00076   void SetVersion(const std::string &version)
00077   {
00078     this->Version = version;
00079   }
00080 
00081   const std::string& GetVersion() const
00082   {
00083     return this->Version;
00084   }
00085 
00086   void SetDocumentationURL(const std::string &documentationURL)
00087   {
00088     this->DocumentationURL = documentationURL;
00089   }
00090 
00091   const std::string& GetDocumentationURL() const
00092   {
00093     return this->DocumentationURL;
00094   }
00095 
00096   void SetLicense(const std::string &license)
00097   {
00098     this->License = license;
00099   }
00100 
00101   const std::string& GetLicense() const
00102   {
00103     return this->License;
00104   }
00105 
00106   void SetAcknowledgements(const std::string &acknowledgements)
00107   {
00108     this->Acknowledgements = acknowledgements;
00109   }
00110 
00111   const std::string& GetAcknowledgements() const
00112   {
00113     return this->Acknowledgements;
00114   }
00115 
00116   void SetContributor(const std::string &contributor)
00117   {
00118     this->Contributor = contributor;
00119   }
00120 
00121   const std::string& GetContributor() const
00122   {
00123     return this->Contributor;
00124   }
00125 
00127   void SetType(const std::string &type)
00128   {
00129     if (type == "SharedObjectModule" 
00130         || type == "CommandLineModule"
00131         || type == "PythonModule")
00132       {
00133       this->Type = type;
00134       }
00135     else
00136       {
00137       this->Type = "Unknown";
00138       }
00139   }
00140 
00141   
00143   const std::string& GetType() const
00144   {
00145     return this->Type;
00146   }
00147 
00151   void SetAlternativeType(const std::string &type)
00152   {
00153     if (type == "SharedObjectModule" 
00154         || type == "CommandLineModule"
00155         || type == "PythonModule")
00156       {
00157       this->AlternativeType = type;
00158       }
00159     else
00160       {
00161       this->AlternativeType = "Unknown";
00162       }
00163   }
00164 
00165   
00169   const std::string& GetAlternativeType() const
00170   {
00171     return this->AlternativeType;
00172   }
00173   
00176   void SetTarget(const std::string &target)
00177   {
00178     this->Target = target;
00179   }
00180 
00183   const std::string& GetTarget() const
00184   {
00185     return this->Target;
00186   }
00187 
00193   void SetAlternativeTarget(const std::string &target)
00194   {
00195     this->AlternativeTarget = target;
00196   }
00197 
00203   const std::string& GetAlternativeTarget() const
00204   {
00205     return this->AlternativeTarget;
00206   }
00207 
00210   void SetLocation(const std::string &target)
00211   {
00212     this->Location = target;
00213   }
00214 
00217   const std::string& GetLocation() const
00218   {
00219     return this->Location;
00220   }
00221 
00225   void SetAlternativeLocation(const std::string &target)
00226   {
00227     this->AlternativeLocation = target;
00228   }
00229 
00233   const std::string& GetAlternativeLocation() const
00234   {
00235     return this->AlternativeLocation;
00236   }
00237   
00238   void SetLogo(const ModuleLogo& logo);
00239   const ModuleLogo& GetLogo() const;
00240   
00241   void AddParameterGroup(const ModuleParameterGroup &group)
00242   {
00243     this->ParameterGroups.push_back(group);
00244   }
00245 
00246   const std::vector<ModuleParameterGroup>& GetParameterGroups() const
00247   {
00248     return this->ParameterGroups;
00249   }
00250 
00251   std::vector<ModuleParameterGroup>& GetParameterGroups()
00252   {
00253     return this->ParameterGroups;
00254   }
00255   
00256   void SetParameterGroups(const std::vector<ModuleParameterGroup>& groups)
00257   {
00258       this->ParameterGroups = groups;
00259   }
00260 
00261   bool HasParameter(const std::string& name) const;
00262 
00263   // Does the module have any simple (primitive) return types?
00264   bool HasReturnParameters() const;
00265 
00266   bool SetParameterDefaultValue(const std::string& name,
00267                                 const std::string& value);
00268 
00269   std::string GetParameterDefaultValue(const std::string& name) const;
00270 
00271   const ModuleProcessInformation* GetProcessInformation() const
00272     {return &ProcessInformation;}
00273   
00274   ModuleProcessInformation* GetProcessInformation()
00275     {return &ProcessInformation;}
00276 
00281   bool ReadParameterFile(const std::string& filename);
00282 
00288   bool WriteParameterFile(const std::string& filename, bool withHandlesToBulkParameters = true);
00289 
00290 
00291 private:
00292   std::string Title;
00293   std::string Category; 
00294   std::string Index;
00295   std::string Description;
00296   std::string Version;
00297   std::string DocumentationURL;
00298   std::string License;
00299   std::string Acknowledgements;
00300   std::string Contributor;
00301   std::string Type;
00302   std::string Target;
00303   std::string Location;
00304   std::string AlternativeType;
00305   std::string AlternativeTarget;
00306   std::string AlternativeLocation;
00307   std::vector<ModuleParameterGroup> ParameterGroups;  
00308 
00309   ModuleProcessInformation ProcessInformation;
00310   ModuleLogo Logo;
00311 };
00312 
00313 ModuleDescriptionParser_EXPORT std::ostream & operator<<(std::ostream &os, const ModuleDescription &module);
00314 
00315 #endif

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1