USGS

Isis 3.0 Object Programmers' Reference

Home

InterestOperatorFactory.cpp

Go to the documentation of this file.
00001 
00024 #include "InterestOperatorFactory.h"
00025 #include "InterestOperator.h"
00026 #include "Plugin.h"
00027 #include "IException.h"
00028 #include "FileName.h"
00029 
00030 namespace Isis {
00053   InterestOperator *InterestOperatorFactory::Create(Pvl &pPvl) {
00054     // Get the algorithm name to create
00055     PvlGroup &op = pPvl.FindGroup("Operator", Pvl::Traverse);
00056     QString operatorName = op["Name"];
00057 
00058     // Open the factory plugin file
00059     Plugin p;
00060     FileName f("InterestOperator.plugin");
00061     if(f.fileExists()) {
00062       p.Read("InterestOperator.plugin");
00063     }
00064     else {
00065       p.Read("$ISISROOT/lib/InterestOperator.plugin");
00066     }
00067 
00068     // Get the algorithm specific plugin and return it
00069     InterestOperator * (*plugin)(Pvl & pPvl);
00070     plugin = (InterestOperator * ( *)(Pvl & pPvl)) p.GetPlugin(operatorName);
00071     return (*plugin)(pPvl);
00072   }
00073 } // end namespace isis