Isis 3 Programmer Reference
AutoRegFactory.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 
8 #include "AutoRegFactory.h"
9 #include "AutoReg.h"
10 #include "Plugin.h"
11 #include "IException.h"
12 #include "FileName.h"
13 
14 namespace Isis {
46  // Get the algorithm name to create
47  PvlGroup &algo = pvl.findGroup("Algorithm", Pvl::Traverse);
48  QString algorithm = algo["Name"];
49 
50  // Open the factory plugin file
51  Plugin p;
52  FileName f("AutoReg.plugin");
53  if(f.fileExists()) {
54  p.read("AutoReg.plugin");
55  }
56  else {
57  p.read("$ISISROOT/lib/AutoReg.plugin");
58  }
59 
60  // Get the algorithm specific plugin and return it
61  AutoReg * (*plugin)(Pvl & pvl);
62  plugin = (AutoReg * ( *)(Pvl & pvl)) p.GetPlugin(algorithm);
63  return (*plugin)(pvl);
64  }
65 } // end namespace isis
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::FileName::fileExists
bool fileExists() const
Returns true if the file exists; false otherwise.
Definition: FileName.cpp:449
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::AutoReg
Auto Registration class.
Definition: AutoReg.h:167
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::Pvl::read
void read(const QString &file)
Loads PVL information from a stream.
Definition: Pvl.cpp:90
Isis::Plugin::GetPlugin
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:39
Isis::AutoRegFactory::Create
static AutoReg * Create(Pvl &pvl)
Create an AutoReg object using a PVL specification.
Definition: AutoRegFactory.cpp:45
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::Plugin
Loads plugins from a shared library.
Definition: Plugin.h:55