1 #ifndef DBALLE_MESSAGE_H 2 #define DBALLE_MESSAGE_H 33 virtual Datetime get_datetime()
const = 0;
36 virtual std::unique_ptr<Message> clone()
const = 0;
47 virtual void print(FILE* out)
const = 0;
58 virtual unsigned diff(
const Message& msg)
const = 0;
70 std::vector<Message*> msgs;
73 template<
typename VAL,
typename WRAPPED>
74 class base_iterator :
public std::iterator<std::random_access_iterator_tag, VAL, typename WRAPPED::difference_type, VAL*, VAL&>
84 inline VAL& operator*()
const {
return **current; }
85 inline VAL* operator->()
const {
return *current; }
86 inline base_iterator& operator++() { ++current;
return *
this; }
90 inline base_iterator& operator--() { --current;
return *
this; }
94 inline VAL& operator[](
typename WRAPPED::difference_type n)
const {
return *current[n]; }
95 inline base_iterator& operator+=(
typename WRAPPED::difference_type n) { current += n;
return *
this; }
97 inline base_iterator& operator-=(
typename WRAPPED::difference_type n) { current -= n;
return *
this; }
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 bool operator<=(
const O& o)
const {
return current <= o.current; }
105 template<
typename O>
inline bool operator>(
const O& o)
const {
return current > o.current; }
106 template<
typename O>
inline bool operator>=(
const O& o)
const {
return current >= o.current; }
107 template<
typename O>
inline typename WRAPPED::difference_type operator-(
const O& o)
const {
return current - o.current; }
122 iterator begin() {
return iterator(msgs.begin()); }
123 iterator end() {
return iterator(msgs.end()); }
124 const_iterator begin()
const {
return const_iterator(msgs.begin()); }
125 const_iterator end()
const {
return const_iterator(msgs.end()); }
127 Message& operator[](
size_t pos) {
return *msgs[pos]; }
128 const Message& operator[](
size_t pos)
const {
return *msgs[pos]; }
137 void append(
const Message& msg);
140 void append(std::unique_ptr<Message>&& msg);
146 void print(FILE* out)
const;
159 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:587
A bulletin that has been decoded and physically interpreted.
Definition: message.h:28
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
Vertical level or layer.
Definition: types.h:532
Ordered collection of messages.
Definition: message.h:67
Date and time.
Definition: types.h:158