LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
SimpleStreamHandler.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 "SimpleStreamHandler.h"
13
14namespace Lima
15{
16
17namespace LinguisticProcessing
18{
20
22{
23 friend class SimpleStreamHandler;
24
26
28
30
31 std::ostream* m_out;
32};
33
34SimpleStreamHandlerPrivate::SimpleStreamHandlerPrivate():
35 m_out(0)
36{}
37
38SimpleStreamHandlerPrivate::SimpleStreamHandlerPrivate(const SimpleStreamHandlerPrivate& sshp):
39 m_out(0)
40{
41 LIMA_UNUSED(sshp);
42}
43
44
45SimpleStreamHandlerPrivate::~SimpleStreamHandlerPrivate()
46{}
47
48
52
55{}
56
57
62
65
68
70{
72 LDEBUG << "SimpleStreamHandler::endAnalysis";
73 if (m_d->m_out != 0) m_d->m_out->flush();
74}
75
78
79
80void SimpleStreamHandler::handle(const char* buf,int length)
81{
83 LDEBUG << "SimpleStreamHandler::handle";
84
85 if (m_d->m_out != 0) m_d->m_out->write(buf,length);
86}
87
88void SimpleStreamHandler::startNode( const std::string& /*elementName*/, bool /*forIndexing*/ )
89{}
90
94
95void SimpleStreamHandler::setOut(std::ostream* out)
96{
97 m_d->m_out = out;
98}
99
100// void SimpleStreamHandler::handleProc(
101// const std::string& tagName,
102// const std::string& content,
103// const std::map<std::string,std::string>& metaData,
104// const std::string& pipeline,
105// const std::set<std::string>& inactiveUnits)
106// {
107// getAnalysisClient("fre")->analyze(content, metaData,pipeline,inactiveUnits);
108//
109// }
110
111} // closing namespace LinguisticProcessing
112
113} // closing namespace Lima
#define LIMA_UNUSED(x)
Definition LimaCommon.h:224
#define LDEBUG
Definition LimaCommon.h:157
#define DUMPERLOGINIT
Defines a Factory to create Object of type Base.
#define SIMPLESTREAMHANDLER_CLASSID
void startAnalysis() override
function called by the LIMA analyzer on start of a new document
void setOut(std::ostream *out) override
set the output stream.
void endNode(const Common::Misc::GenericDocumentProperties &props) override
notify the end of a hierarchyNode
void startNode(const std::string &elementName, bool forIndexing) override
notify the start of a new hierarchyNode
void startDocument(const Common::Misc::GenericDocumentProperties &props) override
notify the start of a new document
void endDocument() override
notify the end of the document
void endAnalysis() override
function called by the LIMA analyzer on the end of a text part that is to be analyzed
void handle(const char *buf, int length) override
gives content.
SimpleFactory< AbstractResource, SimpleStreamHandler > simpleStreamHandlerFactory(SIMPLESTREAMHANDLER_CLASSID)
NAUTITIA.