herald  2.0.0
k.h
1 // Copyright 2021 Herald Project Contributors
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 #ifndef HERALD_SIMPLE_K_H
6 #define HERALD_SIMPLE_K_H
7 
8 #include "secret_key.h"
9 #include "matching_key.h"
10 #include "contact_key.h"
11 #include "contact_identifier.h"
12 #include "../../datatype/data.h"
13 #include "../../datatype/time_interval.h"
14 
15 namespace herald {
16 namespace payload {
17 namespace simple {
18 
19 using namespace herald::datatype;
20 
21 class K {
22 public:
23  K() noexcept;
24  K(const K& other) noexcept;
25  K(K&&) = delete;
26  K(int keyLength, int daysFor, int periodsInDay) noexcept;
27  K(int keyLength, int daysFor, int periodsInDay, TimeInterval epochBeginning) noexcept;
28  ~K() noexcept;
29 
30  static TimeInterval getEpoch() noexcept;
31 
32  int day(Date on) const noexcept;
33 
34  int period(Date at) const noexcept;
35 
36 
37  MatchingKey matchingKey(const SecretKey& secretKey, const int dayFor) noexcept;
38 
39  ContactKey contactKey(const SecretKey& secretKey, const int dayFor, const int periodFor) noexcept;
40 
41  ContactIdentifier contactIdentifier(const SecretKey& secretKey, const int dayFor, const int periodFor) noexcept;
42 
43  // NOTE I'm keeping the old functions here in case we need to use a caching version on another platform
44 
45  // const std::vector<MatchingKey>& matchingKeys(const SecretKey& secretKey) noexcept;
46 
47  // const std::vector<ContactKey> contactKeys(const MatchingKey& matchingKey) noexcept;
48 
49  // const ContactIdentifier contactIdentifier(const ContactKey& contactKey) noexcept;
50 
51 private:
52  const int keyLength;
53  const int daysFor;
54  const int periodsInDay;
55  const TimeInterval epoch;
56 };
57 
58 }
59 }
60 }
61 
62 #endif
The main data workhorse class of the Herald API.
Definition: data.h:33
Definition: date.h:18
Definition: time_interval.h:19
Definition: k.h:21
Contains all low-level Herald datatype implementations.
Definition: base64_string.h:14
@ on
Sensor is powered on, active and operational.
Acts as a non-global memory arena for arbitrary classes.
Definition: aggregates.h:15