Isis 3 Programmer Reference
AtmosModelFactory.cpp
Go to the documentation of this file.
1 
24 #include "AtmosModelFactory.h"
25 #include "AtmosModel.h"
26 #include "Plugin.h"
27 #include "IException.h"
28 #include "FileName.h"
29 
30 namespace Isis {
61 
62  // Get the algorithm name to create
63  PvlGroup &algo = pvl.findObject("AtmosphericModel")
64  .findGroup("Algorithm", Pvl::Traverse);
65 
66  QString algorithm = "";
67  if(algo.hasKeyword("AtmName")) {
68  algorithm = QString(algo["AtmName"]);
69  }
70  else if(algo.hasKeyword("Name")) {
71  algorithm = QString(algo["Name"]);
72  }
73  else {
74  QString msg = "Keyword [Name] or keyword [AtmName] must ";
75  msg += "exist in [Group = Algorithm]";
77  }
78 
79  // Open the factory plugin file
80  Plugin *p = new Plugin;
81  FileName f("AtmosModel.plugin");
82  if(f.fileExists()) {
83  p->read("AtmosModel.plugin");
84  }
85  else {
86  p->read("$ISISROOT/lib/AtmosModel.plugin");
87  }
88 
89  // Get the algorithm specific plugin and return it
90  AtmosModel * (*plugin)(Pvl & pvl, PhotoModel & pmodel);
91  plugin = (AtmosModel * ( *)(Pvl & pvl, PhotoModel & pmodel))
92  p->GetPlugin(algorithm);
93  return (*plugin)(pvl, pmodel);
94  }
95 } // end namespace isis
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
File name manipulation and expansion.
Definition: FileName.h:116
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:286
Search child objects.
Definition: PvlObject.h:170
Loads plugins from a shared library.
Definition: Plugin.h:71
static AtmosModel * Create(Pvl &pvl, PhotoModel &pmodel)
Create an AtmosModel object using a PVL specification.
Isotropic atmos scattering model.
Definition: AtmosModel.h:76
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
A type of error that could only have occurred due to a mistake on the user's part (e...
Definition: IException.h:142
Container for cube-like labels.
Definition: Pvl.h:135
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QFunctionPointer GetPlugin(const QString &group)
This method returns a void pointer to a C function (i.e., the plugin) It does this by looking in itse...
Definition: Plugin.cpp:55
void read(const QString &file)
Loads PVL information from a stream.
Definition: Pvl.cpp:76
bool fileExists() const
Returns true if the file exists; false otherwise.
Definition: FileName.cpp:465