SectorZone: add attribute arc_boundary
[xcsoar.git] / src / FLARM / FlarmId.hpp
blobab95ec1666b6361cfc7161e988284bd5968ef74c
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #ifndef XCSOAR_FLARM_ID_HPP
25 #define XCSOAR_FLARM_ID_HPP
27 #include "Compiler.h"
29 #include <stdint.h>
30 #include <tchar.h>
32 /**
33 * The identification number of a FLARM traffic.
35 class FlarmId {
36 static constexpr uint32_t UNDEFINED_VALUE = 0;
38 uint32_t value;
40 constexpr
41 FlarmId(uint32_t _value):value(_value) {}
43 public:
44 FlarmId() = default;
46 constexpr
47 static FlarmId Undefined() {
48 return FlarmId(UNDEFINED_VALUE);
51 bool IsDefined() const {
52 return value != UNDEFINED_VALUE;
55 void Clear() {
56 value = UNDEFINED_VALUE;
59 bool operator==(FlarmId other) const {
60 return value == other.value;
63 bool operator<(FlarmId other) const {
64 return value < other.value;
67 static FlarmId Parse(const char *input, char **endptr_r);
68 #ifdef _UNICODE
69 static FlarmId Parse(const TCHAR *input, TCHAR **endptr_r);
70 #endif
72 const TCHAR *Format(TCHAR *buffer) const;
75 #endif