helics 3.7.0
Loading...
Searching...
No Matches
PublicationInfo.hpp
1/*
2Copyright (c) 2017-2026,
3Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Energy
4Innovation LLC. See the top-level NOTICE for additional details. All rights reserved.
5SPDX-License-Identifier: BSD-3-Clause
6*/
7#pragma once
8
9#include "basic_CoreTypes.hpp"
10#include "helicsTime.hpp"
11
12#include <cstdint>
13#include <string>
14#include <utility>
15#include <vector>
16
17namespace helics {
18
20 GlobalHandle id;
21 std::string key;
22 SubscriberInformation() = default;
23 SubscriberInformation(GlobalHandle gid, std::string_view key_): id(gid), key(key_) {}
24};
25
28 public:
31 std::string_view pkey,
32 std::string_view ptype,
33 std::string_view punits): id(pid), key(pkey), type(ptype), units(punits)
34 {
35 }
38 std::vector<SubscriberInformation> subscribers;
39 const std::string key;
40 const std::string type;
41 const std::string units;
44 bool has_update{false};
45 bool only_update_on_change{false};
46 bool required{false};
47 bool buffer_data{false};
51 bool CheckSetValue(const char* dataToCheck,
52 uint64_t len,
53 Time currentTime,
54 bool forceChangeCheck);
58 bool addSubscriber(GlobalHandle newSubscriber, std::string_view inputName);
59
61 void removeSubscriber(GlobalHandle subscriberToRemove);
63 void disconnectFederate(GlobalFederateId fedToDisconnect);
64 void setProperty(int32_t option, int32_t value);
65 int32_t getProperty(int32_t option) const;
66 const std::string& getTargets() const;
67
68 private:
69 mutable std::string destTargets;
70};
71} // namespace helics
Definition GlobalFederateId.hpp:75
Definition GlobalFederateId.hpp:147
Definition PublicationInfo.hpp:27
Time minTimeGap
a time restriction on amount of publishing
Definition PublicationInfo.hpp:49
const GlobalHandle id
Definition PublicationInfo.hpp:36
PublicationInfo(GlobalHandle pid, std::string_view pkey, std::string_view ptype, std::string_view punits)
Definition PublicationInfo.hpp:30
bool addSubscriber(GlobalHandle newSubscriber, std::string_view inputName)
Definition PublicationInfo.cpp:41
bool has_update
indicator that the publication has updates
Definition PublicationInfo.hpp:44
int32_t requiredConnections
the number of required connections 0 is no requirement
Definition PublicationInfo.hpp:48
bool buffer_data
indicator that the publication should buffer data
Definition PublicationInfo.hpp:47
SmallBuffer data
the most recent publication data
Definition PublicationInfo.hpp:42
const std::string type
the type of the publication data
Definition PublicationInfo.hpp:40
void disconnectFederate(GlobalFederateId fedToDisconnect)
Definition PublicationInfo.cpp:52
const std::string units
the units of the publication data
Definition PublicationInfo.hpp:41
Time lastPublishTime
the time of the last publication
Definition PublicationInfo.hpp:43
void removeSubscriber(GlobalHandle subscriberToRemove)
Definition PublicationInfo.cpp:62
bool required
indicator that it is required to be output someplace
Definition PublicationInfo.hpp:46
std::vector< SubscriberInformation > subscribers
container for all the subscribers of a publication
Definition PublicationInfo.hpp:38
bool CheckSetValue(const char *dataToCheck, uint64_t len, Time currentTime, bool forceChangeCheck)
Definition PublicationInfo.cpp:18
const std::string key
the key identifier for the publication
Definition PublicationInfo.hpp:39
Definition SmallBuffer.hpp:25
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition AsyncFedCallInfo.hpp:14
constexpr Time timeZero
Definition helicsTime.hpp:31
TimeRepresentation< count_time< 9 > > Time
Definition helicsTime.hpp:27
Definition PublicationInfo.hpp:19