LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
AbstractXmlReaderClient.h
Go to the documentation of this file.
1// Copyright 2009-2021 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6#ifndef ABSTRACTCXMLREADERCLIENT_H
7#define ABSTRACTCXMLREADERCLIENT_H
8
10
15
16namespace Lima {
17 class ProcessingClientFactory;
18}
19namespace Lima
20{
21
22namespace XmlReader
23{
24
27{
28public:
29
32
39 virtual std::shared_ptr<AnalysisContent> analyze(
40 const std::string &content,
41 const std::map<std::string, std::string>& metaData,
42 const std::string& pipeline,
43 const std::map<std::string, Lima::AbstractAnalysisHandler*>& handlers = std::map<std::string, Lima::AbstractAnalysisHandler*>(),
44 const std::set<std::string>& inactiveUnits = std::set<std::string>()) const override = 0;
45
46 virtual void setAnalysisHandler(const std::string& handlerId, Lima::AbstractAnalysisHandler *handler) = 0;
47
49 virtual void releaseAnalysisHandler(const std::string& handlerId) = 0;
50
51 void setMapTagMedia(const std::map<std::string, std::string>& Ids) {
52 m_mapTagMedia = Ids;
53 };
54
55 void setDefaultMedia(const std::string& media) {
56 m_defaultMedia = media;
57 };
58
62 std::string storageType;
63 std::string cardinality;
64 std::string description;
66 };
69 using DocPropertyPublicInfoMap = std::map< std::string, DocPropertyPublicInfo >;
70
74 void setDocumentPropertyConfiguration(
76
80 DocPropertyPublicInfoMap& standardPrprtyInfos,
81 DocPropertyPublicInfoMap& extendedPrprtyInfos) const
82 {
83 standardPrprtyInfos = m_standardPrprtyInfos;
84 extendedPrprtyInfos = m_extendedPrprtyInfos;
85 }
86
88protected:
89
90 // Associates a tag name to a media id. Initialized at creation time by
91 // the factory which loads the values from its configuration
92 std::map<std::string, std::string> m_mapTagMedia;
93
94 // If there is no media associated to the current indexing element and this
95 // is set, then this media name will be used
96 std::string m_defaultMedia;
97
98 // Association of a document property name and its subset of attributes for the standard document properties
100
101 // Association of a document property name and its subset of attributes for the extended document properties
103};
104
111class AbstractXmlReaderClientFactory : public Lima::RegistrableFactory<AbstractXmlReaderClientFactory>
112{
113public:
114
116 virtual void configure(
118 const std::string& defaultMedia,
119 const std::deque<std::string>& medias,
120 const std::deque<std::string>& pipelines) = 0;
121
123 virtual std::shared_ptr< AbstractXmlReaderClient > createClient(Lima::Common::XMLConfigurationFiles::XMLConfigurationFileParser *configuration) const = 0;
124
127
128 std::shared_ptr< Lima::ProcessingClientFactory > getFactoryFromId(const std::string& id) const {
129 if(m_mapFactory.find(id) == m_mapFactory.end())
130 return 0;
131 else
132 return m_mapFactory.find(id)->second;
133 }
134 void setFactoryFromId(const std::string& id, std::shared_ptr< Lima::ProcessingClientFactory > factory) {
135 m_mapFactory[id] = factory;
136
137 }
138
139 void setMapTagMedia(const std::map<std::string, std::string>& Ids) {
140 m_mapTagMedia = Ids;
141 }
142// std::string getMediaFromTag(std::string id) const {return m_mapTagMedia.find(id)->second;}
143
144 void setMapMediaFactory(const std::map<std::string, std::string>& Ids) {
145 m_mapMediaFactory = Ids;
146 }
147
148 void setDefaultMedia(const std::string& media) {
149 m_defaultMedia = media;
150 };
151
152// std::string getFactoryFromMedia(std::string id) const {return m_mapMediaFactory.find(id)->second;}
153
154protected:
158 std::map<std::string, std::shared_ptr< Lima::ProcessingClientFactory > > m_mapFactory;
159 std::map<std::string, std::string> m_mapTagMedia;
160 std::map<std::string, std::string> m_mapMediaFactory;
161 std::string m_defaultMedia;
162
163};
164
165} // XmlReader
166} // Lima
167
168#endif
169
#define XMLREADERCLIENT_EXPORT
The AbstractAnalysisHandler class defines the callback interface: the functions that are to be define...
mother class of (abstract) clients that analyse content.
Parser class for the lima's xml configuration files.
Defines a Factory that automatically register to a MainFactory singleton.
A factory for the AbstractXmlReaderClient: contains the registration of all implemented clients that ...
void setFactoryFromId(const std::string &id, std::shared_ptr< Lima::ProcessingClientFactory > factory)
std::shared_ptr< Lima::ProcessingClientFactory > getFactoryFromId(const std::string &id) const
virtual std::shared_ptr< AbstractXmlReaderClient > createClient(Lima::Common::XMLConfigurationFiles::XMLConfigurationFileParser *configuration) const =0
This function create a XmlReader client
std::map< std::string, std::string > m_mapMediaFactory
virtual ~AbstractXmlReaderClientFactory()
virtual destructor of the XmlReader client factory
std::map< std::string, std::string > m_mapTagMedia
virtual void configure(const Lima::Common::XMLConfigurationFiles::XMLConfigurationFileParser &configuration, const std::string &defaultMedia, const std::deque< std::string > &medias, const std::deque< std::string > &pipelines)=0
std::map< std::string, std::shared_ptr< Lima::ProcessingClientFactory > > m_mapFactory
void setMapMediaFactory(const std::map< std::string, std::string > &Ids)
void setMapTagMedia(const std::map< std::string, std::string > &Ids)
interface publique au client d'analyse de fichier XML
void setDefaultMedia(const std::string &media)
virtual std::shared_ptr< AnalysisContent > analyze(const std::string &content, const std::map< std::string, std::string > &metaData, const std::string &pipeline, const std::map< std::string, Lima::AbstractAnalysisHandler * > &handlers=std::map< std::string, Lima::AbstractAnalysisHandler * >(), const std::set< std::string > &inactiveUnits=std::set< std::string >()) const override=0
Analyse un fichier XML.
std::map< std::string, DocPropertyPublicInfo > DocPropertyPublicInfoMap
Store the association of a document property name and its subset of attributes.
void getDocumentPropertyConfiguration(DocPropertyPublicInfoMap &standardPrprtyInfos, DocPropertyPublicInfoMap &extendedPrprtyInfos) const
Retrieve the document property attributes for both standard and extended properties-list.
void setMapTagMedia(const std::map< std::string, std::string > &Ids)
virtual ~AbstractXmlReaderClient()
define a virtual destructor to ensure concrete client destructors to be called
Lima::AbstractProcessingClientHandler m_processingClientHandler
virtual void setAnalysisHandler(const std::string &handlerId, Lima::AbstractAnalysisHandler *handler)=0
std::map< std::string, std::string > m_mapTagMedia
virtual void releaseAnalysisHandler(const std::string &handlerId)=0
deletes the analysis handler with the given id and removes it
NAUTITIA.
Store a subset of document property attributes extracted from configuration, for the purpose of publi...