CreOS SDK
The CreOS SDK allows you to interact with Avular robots
 
Loading...
Searching...
No Matches
subscription.hpp
1// Copyright (C) 2024 Avular Holding B.V. - All Rights Reserved
2// You may use this code under the terms of the Avular
3// Software End-User License Agreement.
4//
5// You should have received a copy of the Avular
6// Software End-User License Agreement license with
7// this file, or download it from: avular.com/eula
8//
9/*****************************************************************************
10 * Created on: 2024 June 25
11 * Author: Robbert-Jan de Jager
12 *
13 * @file This file declares objects related to subscriptions.
14 ****************************************************************************/
15#pragma once
16
17namespace creos {
18
23 static constexpr int kInvalidId{-1};
24
25public:
26 SubscriptionId() = default;
27
28 explicit SubscriptionId(int id) : id_(id) {}
29
30 std::strong_ordering operator<=>(const SubscriptionId& other) const { return id_ <=> other.id_; }
31
32 bool operator==(const SubscriptionId& other) const { return id_ == other.id_; }
33
37 operator bool() const { return id_ != kInvalidId; }
38
42 int getId() const { return id_; }
43
44private:
45 int id_{kInvalidId};
46};
47
48} // namespace creos
49
50template <>
51struct std::hash<creos::SubscriptionId> {
52 std::size_t operator()(const creos::SubscriptionId& id) const { return std::hash<int>{}(id.getId()); }
53};
This type holds an subscription ID.
Definition subscription.hpp:22
int getId() const
Get the internal subscription ID.
Definition subscription.hpp:42
The main namespace for the CreOS client library.