LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
Events.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 * @file Events.cpp
8 * @author Olivier MESNARD
9 * @date March 2010
10 * @version $Id:
11 * copyright Copyright (C) 2010 by CEA LIST
12 *
13 ***********************************************************************/
14
15
16#include "Events.h"
17
22
23
24using namespace std;
26
27namespace Lima
28{
29namespace LinguisticProcessing
30{
31namespace EventAnalysis
32{
33
34void Events::read(std::istream& file)
35{
36 int size=Common::Misc::readCodedInt(file);
37 for (int i=0;i<size;i++)
38 {
39 Event * e=new Event();
40 e->read(file);
41 push_back(e);
42 }
43}
44
45void Events::write(std::ostream& file) const
46{
48 LDEBUG << "Events::write()...";
49 Common::Misc::writeCodedInt(file,size());
50 for(std::vector<Event*>::const_iterator iT=begin(); iT !=end();iT++)
51 {
52 (*iT)->write(file);
53 }
54}
55
56std::string Events::toString(std::string parentURI) const
57{
58 std::cerr << "Events::toString(...)" << std::endl;
59
60 std::string out;
61 uint64_t eventindex=1;
62 for(std::vector<Event*>::const_iterator iT=begin(); iT !=end();iT++)
63 {
64 out.append((*iT)->toString(parentURI,eventindex));
65 eventindex++;
66 std::cerr << out << std::endl;
67 }
68 return out;
69}
70
71} // namespace
72} // namespace
73} // namespace Lima
#define LDEBUG
Definition LimaCommon.h:157
#define EVENTANALYSISLOGINIT
This class represents a list of elements, that are pointers on polymmorphic annotations that can be d...
Definition Event.h:44
virtual void read(std::istream &file)
Definition Event.cpp:176
virtual void write(std::ostream &file) const
Definition Events.cpp:45
virtual void read(std::istream &file)
Definition Events.cpp:34
std::string toString(std::string parentURI) const
Definition Events.cpp:56
uint64_t readCodedInt(std::istream &file)
read a integer coded in variable-byte format in a file
void writeCodedInt(std::ostream &file, const uint64_t number)
write a integer coded in variable-byte format in a file
NAUTITIA.
STL namespace.