USGS

Isis 3.0 Object Programmers' Reference

Home

AutoRegFactory.cpp

Go to the documentation of this file.
00001 
00024 #include "AutoRegFactory.h"
00025 #include "AutoReg.h"
00026 #include "Plugin.h"
00027 #include "iException.h"
00028 #include "Filename.h"
00029 
00030 namespace Isis {
00061   AutoReg *AutoRegFactory::Create(Pvl &pvl) {
00062     // Get the algorithm name to create
00063     PvlGroup &algo = pvl.FindGroup("Algorithm",Pvl::Traverse);
00064     std::string algorithm = algo["Name"];
00065 
00066     // Open the factory plugin file
00067     Plugin p;
00068     Filename f("AutoReg.plugin");
00069     if (f.Exists()) {
00070       p.Read("AutoReg.plugin");
00071     }
00072     else {
00073       p.Read("$ISISROOT/lib/AutoReg.plugin");
00074     }
00075 
00076     // Get the algorithm specific plugin and return it
00077     AutoReg * (*plugin) (Pvl &pvl);
00078     plugin = (AutoReg * (*)(Pvl &pvl)) p.GetPlugin(algorithm);
00079     return (*plugin)(pvl);
00080   }
00081 } // end namespace isis