Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

Svm* Impala::Persistency::SvmRepositoryInFile::Get ( const ModelLocator loc  )  [inline]

Definition at line 34 of file SvmRepositoryInFile.h.

References Impala::Persistency::File::CopyFrom(), Impala::Persistency::File::Delete(), Impala::FileNameTmp(), Impala::Persistency::ModelLocator::GetConcept(), GetDir(), Impala::Persistency::RepositoryInFileSystem::GetFile(), Impala::Persistency::File::GetPath(), Impala::Persistency::Locator::GetProtocol(), ILOG_ERROR, RepFS(), Impala::Core::Training::Svm::SetModel(), and Impala::Persistency::File::Valid().

00035     {
00036         String dir = GetDir(loc, false);
00037         File file = RepFS().GetFile(loc, dir, loc.GetConcept() + ".model",
00038                                     false, false);
00039         if (!file.Valid())
00040             return 0;
00041 
00042         svm_model* model = 0;
00043         if (loc.GetProtocol() == "file")
00044         {
00045             String path = file.GetPath();
00046             model = svm_load_model(path.c_str());
00047         }
00048         else
00049         {
00050             FileLocator tmpLoc("file", "direct", FileNameTmp());
00051             File tmpFile = RepFS().GetFile(tmpLoc, true, false);
00052             tmpFile.CopyFrom(file);
00053             String path = tmpFile.GetPath();
00054             model = svm_load_model(path.c_str());
00055             tmpFile.Delete();
00056         }
00057         if (!model)
00058         {
00059             ILOG_ERROR("[Get] Unable to load " << loc);
00060             return 0;
00061         }
00062         Svm* res = new Svm();
00063         res->SetModel(model);
00064         return res;
00065     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:23:50 2011 for ImpalaSrc by  doxygen 1.5.1