Isis 3 Programmer Reference
AutoRegFactory.cpp
Go to the documentation of this file.
1 
24 #include "AutoRegFactory.h"
25 #include "AutoReg.h"
26 #include "Plugin.h"
27 #include "IException.h"
28 #include "FileName.h"
29 
30 namespace Isis {
62  // Get the algorithm name to create
63  PvlGroup &algo = pvl.findGroup("Algorithm", Pvl::Traverse);
64  QString algorithm = algo["Name"];
65 
66  // Open the factory plugin file
67  Plugin p;
68  FileName f("AutoReg.plugin");
69  if(f.fileExists()) {
70  p.read("AutoReg.plugin");
71  }
72  else {
73  p.read("$ISISROOT/lib/AutoReg.plugin");
74  }
75 
76  // Get the algorithm specific plugin and return it
77  AutoReg * (*plugin)(Pvl & pvl);
78  plugin = (AutoReg * ( *)(Pvl & pvl)) p.GetPlugin(algorithm);
79  return (*plugin)(pvl);
80  }
81 } // end namespace isis
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:141
File name manipulation and expansion.
Definition: FileName.h:116
Search child objects.
Definition: PvlObject.h:170
Loads plugins from a shared library.
Definition: Plugin.h:71
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
Container for cube-like labels.
Definition: Pvl.h:135
Auto Registration class.
Definition: AutoReg.h:183
static AutoReg * Create(Pvl &pvl)
Create an AutoReg object using a PVL specification.
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