1 #ifndef DBALLE_MESSAGE_H 2 #define DBALLE_MESSAGE_H 5 #include <wreport/varinfo.h> 30 virtual Datetime get_datetime()
const = 0;
33 virtual std::unique_ptr<Message> clone()
const = 0;
41 virtual const wreport::Var*
get(wreport::Varcode code,
const Level& lev,
const Trange& tr)
const = 0;
44 virtual void print(FILE* out)
const = 0;
55 virtual unsigned diff(
const Message& msg)
const = 0;
67 std::vector<Message*> msgs;
70 template<
typename VAL,
typename WRAPPED>
71 class base_iterator :
public std::iterator<std::random_access_iterator_tag, VAL, typename WRAPPED::difference_type, VAL*, VAL&>
81 inline VAL& operator*()
const {
return **current; }
82 inline VAL* operator->()
const {
return *current; }
83 inline base_iterator& operator++() { ++current;
return *
this; }
87 inline base_iterator& operator--() { --current;
return *
this; }
91 inline VAL& operator[](
typename WRAPPED::difference_type n)
const {
return *current[n]; }
92 inline base_iterator& operator+=(
typename WRAPPED::difference_type n) { current += n;
return *
this; }
94 inline base_iterator& operator-=(
typename WRAPPED::difference_type n) { current -= n;
return *
this; }
98 template<
typename O>
inline bool operator==(
const O& o)
const {
return current == o.current; }
99 template<
typename O>
inline bool operator!=(
const O& o)
const {
return current != o.current; }
100 template<
typename O>
inline bool operator<(
const O& o)
const {
return current < o.current; }
101 template<
typename O>
inline bool operator<=(
const O& o)
const {
return current <= o.current; }
102 template<
typename O>
inline bool operator>(
const O& o)
const {
return current > o.current; }
103 template<
typename O>
inline bool operator>=(
const O& o)
const {
return current >= o.current; }
104 template<
typename O>
inline typename WRAPPED::difference_type operator-(
const O& o)
const {
return current - o.current; }
119 iterator begin() {
return iterator(msgs.begin()); }
120 iterator end() {
return iterator(msgs.end()); }
121 const_iterator begin()
const {
return const_iterator(msgs.begin()); }
122 const_iterator end()
const {
return const_iterator(msgs.end()); }
124 Message& operator[](
size_t pos) {
return *msgs[pos]; }
125 const Message& operator[](
size_t pos)
const {
return *msgs[pos]; }
134 void append(
const Message& msg);
137 void append(std::unique_ptr<Message>&& msg);
143 void print(FILE* out)
const;
156 unsigned diff(
const Messages& msgs)
const;
Common base types used by most of DB-All.e code.
Information on how a value has been sampled or computed with regards to time.
Definition: types.h:565
A bulletin that has been decoded and physically interpreted.
Definition: message.h:25
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
Vertical level or layer.
Definition: types.h:515
Ordered collection of messages.
Definition: message.h:64
Definition: conversion.h:6
Date and time.
Definition: types.h:147