MPEG CDVA Experimentation Model (CXM)  1.0
Compact Descriptors for Visual Analisys
LogManager.h
Go to the documentation of this file.
1 /*
2 The copyright in this software is being made available under this MPEG Reference Software Copyright License. This software may be subject to other third party and contributor rights, including patent rights, and no such rights are granted under this license.
3 
4 Copyright (c) 2016, Telecom Italia
5 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8 * Neither the name of Telecom Italia nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10 */
11 
12 #pragma once
13 #include <fstream>
14 #include <string>
15 #include <vector>
16 #include "cdva.h" // needed to include MatchData declaration
17 
18 namespace mpeg7cdva
19 {
20 
24 enum LogFormat {
26  FORMAT_CSV = 1,
29 };
30 
31 
38 class LogManager {
39 private:
40  int myformats;
41  size_t numvideos;
42  std::string mydatasetpath;
43  std::string mydatasetname;
44  std::ofstream outcsv;
45  std::ofstream outhtml;
46  static const char * getModeExtension(int qmode, int refmode);
47  static const char * getFormatExtension(LogFormat format);
48  static const char * getFormatName(LogFormat format);
49 
50 public:
51  LogManager();
52 
53  virtual ~LogManager();
54 
58  void init(int formats, const std::string & datasetpath, const std::string & datasetname, size_t n_videos, int mode, int refmode = 0);
59 
63  void printExtractHeader();
67  void printExtractData(int index, const std::string & videoname, const ExtractData & data);
68 
72  void printMatchHeader();
76  void printMatchData(int index, const std::string & queryvideoname, const std::string & refvideoname, const MatchData & matchData);
77 
81  void printRetrievalHeader();
85  void printRetrievalData(int index, const std::string & queryvideoname, const std::vector<MatchData> & retrievalResults);
86 
87  void close();
88 };
89 
90 } // end namespace
void printMatchHeader()
method used by the Evaluation Framework to produce log files; do not change.
output data as free text
Definition: LogManager.h:27
A class containing the results of a matching or retrieval operation.
Definition: cdva.h:109
output data in HTML format
Definition: LogManager.h:28
Namespace used to encapsulate all MPEG-7 CDVA declarations.
Definition: Buffer.h:14
Helper class to produce log files in various formats (csv, text, XML, etc.)
Definition: LogManager.h:38
output data in CSV format
Definition: LogManager.h:26
virtual ~LogManager()
destructor
void printMatchData(int index, const std::string &queryvideoname, const std::string &refvideoname, const MatchData &matchData)
method used by the Evaluation Framework to produce log files; do not change.
void printRetrievalData(int index, const std::string &queryvideoname, const std::vector< MatchData > &retrievalResults)
method used by the Evaluation Framework to produce log files; do not change.
LogFormat
Format of output logs.
Definition: LogManager.h:24
void init(int formats, const std::string &datasetpath, const std::string &datasetname, size_t n_videos, int mode, int refmode=0)
initialization method used by the Evaluation Framework; do not change.
LogManager()
constructor
do not output any data
Definition: LogManager.h:25
void printExtractData(int index, const std::string &videoname, const ExtractData &data)
method used by the Evaluation Framework to produce log files; do not change.
void printRetrievalHeader()
method used by the Evaluation Framework to produce log files; do not change.
void printExtractHeader()
method used by the Evaluation Framework to produce log files; do not change.
A class containing the results of an extraction operation.
Definition: cdva.h:38