LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
FsaRwAccessResource.cpp
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/***************************************************************************
7 * Copyright (C) 2004-2012 by CEA LIST *
8 * *
9 ***************************************************************************/
10#include "FsaRwAccessResource.h"
16
18using namespace Lima::Common;
19using namespace std;
20
21namespace Lima
22{
23namespace LinguisticProcessing
24{
25namespace AnalysisDict
26{
27
29
31// : m_fsaAccess(0), m_fsaRwAccess(0)
32 : FsaAccessResource(), m_fsaRwAccess(0)
33{}
34
35
37{
38/*
39 if (m_fsaAccess!=0)
40 {
41 delete m_fsaAccess;
42 }
43*/
44}
45
48 Manager* manager)
49{
56 try
57 {
58 QString keyfile = Common::Misc::findFileInPaths(Common::MediaticData::MediaticData::single().getResourcesPath().c_str(), unitConfiguration.getParamsValueAtKey("keyFile").c_str());
59 auto fsaAccess = std::make_shared<FsaAccess::FsaAccessBuilderRandom16>();
60 fsaAccess->read(keyfile.toUtf8().constData());
61 m_fsaAccess = fsaAccess;
62 m_fsaRwAccess = fsaAccess;
63 }
64 catch (NoSuchParam& )
65 {
66 LERROR << "no param 'keyFile' in FsaAccessResource group for language " << (int) manager->getInitializationParameters().language;
68 }
69}
70
71
72std::shared_ptr<AbstractAccessByString> FsaRwAccessResource::getAccessByString() const
73 { return m_fsaAccess;}
74
75
76std::shared_ptr<AbstractModifierOnAccessByString> FsaRwAccessResource::getRwAccessByString() const
77 { return m_fsaRwAccess;}
78
79}
80
81}
82
83}
#define FSARWACCESSRESSOURCE_CLASSID
#define LERROR
Definition LimaCommon.h:161
#define ANALYSISDICTLOGINIT
Defines a Factory to create Object of type Base.
return a message when a 'param' was not found
Use this exception to signal an error in one of the configuration files.
Definition LimaCommon.h:345
std::shared_ptr< Common::AbstractAccessByString > m_fsaAccess
virtual std::shared_ptr< Common::AbstractModifierOnAccessByString > getRwAccessByString() const
void init(Common::XMLConfigurationFiles::GroupConfigurationStructure &unitConfiguration, Manager *manager) override
initialize with parameters from configuration file.
virtual std::shared_ptr< Common::AbstractAccessByString > getAccessByString() const override
static const MediaticData & single()
const singleton accessor
Definition Singleton.h:51
QString findFileInPaths(const QString &paths, const QString &fileName, const QChar &separator)
Find the given file in the given paths.
SimpleFactory< AbstractResource, FsaRwAccessResource > fsaRwAccessResourceFactory(FSARWACCESSRESSOURCE_CLASSID)
NAUTITIA.
STL namespace.
launch exception related to the configuration file parsing