TimeTableCatalogUtil.hh
1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* TimeTableCatalogUtil.hh
*
* Created on: 6 août 2013
* Author: CS
*/
#ifndef TIMETABLECATALOGUTIL_HH_
#define TIMETABLECATALOGUTIL_HH_
#include <string>
#include "TimeTable.hh"
/**
* Some convenient method to handle ISO time representations.
*/
namespace TimeTableCatalog {
/**
* Gets ISO time format, with or without msk.
*/
TimeTable::TIME_FORMAT getTimeFormat(const std::string& ptime, int& size);
/**
* Reads an ISO time, automatically detect time format.
*/
double readISOTime(const std::string& ptime);
/**
* Reads an ISO time of the given format.
*/
double readISOTime(const std::string& ptime,
const TimeTable::TIME_FORMAT pformat);
/**
* Writes an ISO time to a given stream with a given format.
*/
void writeISOTime(const double pTime, const TimeTable::TIME_FORMAT pFormat, std::ostream& pOut);
/**
* Writes an time into a stream with a given format.
*/
void writeTimeData(const double pTime, const AMDA::OutputFormatTime pFormat, std::ostream& pOut);
/**
* Checks a line contains or not a metadata keyword.
*/
bool contains(const std::string & pline, const std::string & pkeyword, const std::string& pprefix=std::string());
/**
* Extracts a metadata value (a metadata is formated as key:value).
*/
void extractvalue(const std::string & pline, std::string& pvalue);
/**
* Splits a string around a given delimiter.
*/
std::vector<std::string> &split(const std::string &s, char delim,
std::vector<std::string> &elems);
} /* namespace TimeTableCatalog */
#endif /* TIMETABLECATALOGUTIL_HH_ */