USGS

Isis 3.0 Object Programmers' Reference

Home

AtmosModelFactory.cpp

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