helics  3.3.0
PublicationInfo.hpp
1 /*
2 Copyright (c) 2017-2022,
3 Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable
4 Energy, LLC. See the top-level NOTICE for additional details. All rights reserved.
5 SPDX-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 <vector>
15 
16 namespace helics {
19  public:
22  std::string_view pkey,
23  std::string_view ptype,
24  std::string_view punits):
25  id(pid),
26  key(pkey), type(ptype), units(punits)
27  {
28  }
29  const GlobalHandle id;
30  std::vector<GlobalHandle> subscribers;
31  const std::string key;
32  const std::string type;
33  const std::string units;
36  bool has_update{false};
37  bool only_update_on_change{false};
38  bool required{false};
39  bool buffer_data{false};
40  int32_t required_connections{0};
42 
43  bool CheckSetValue(const char* dataToCheck,
44  uint64_t len,
45  Time currentTime,
46  bool forceChangeCheck);
50  bool addSubscriber(GlobalHandle newSubscriber);
51 
53  void removeSubscriber(GlobalHandle subscriberToRemove);
54 
55  void setProperty(int32_t option, int32_t value);
56  int32_t getProperty(int32_t option) const;
57 };
58 } // namespace helics
helics::timeZero
constexpr Time timeZero
Definition: helicsTime.hpp:31
helics::PublicationInfo::subscribers
std::vector< GlobalHandle > subscribers
container for all the subscribers of a publication
Definition: PublicationInfo.hpp:30
helics::SmallBuffer
Definition: SmallBuffer.hpp:24
helics::PublicationInfo::units
const std::string units
the units of the publication data
Definition: PublicationInfo.hpp:33
helics_definitions.hpp
base helics enumerations for C++ API's, a namespace wrapper for the definitions defined in helics_enu...
helics::SmallBuffer::assign
void assign(const void *start, const void *end)
Definition: SmallBuffer.hpp:177
helics::PublicationInfo::minTimeGap
Time minTimeGap
a time restriction on amount of publishing
Definition: PublicationInfo.hpp:41
helics::Time
TimeRepresentation< count_time< 9 > > Time
Definition: helicsTime.hpp:27
helics::PublicationInfo::addSubscriber
bool addSubscriber(GlobalHandle newSubscriber)
Definition: PublicationInfo.cpp:39
helics::SmallBuffer::to_string
std::string_view to_string() const
Definition: SmallBuffer.hpp:225
helics::PublicationInfo::PublicationInfo
PublicationInfo(GlobalHandle pid, std::string_view pkey, std::string_view ptype, std::string_view punits)
Definition: PublicationInfo.hpp:21
helics::PublicationInfo::has_update
bool has_update
indicator that the publication has updates
Definition: PublicationInfo.hpp:36
helics::CONNECTIONS
@ CONNECTIONS
print summary+federate level connection information
Definition: logging.hpp:27
helics::PublicationInfo::type
const std::string type
the type of the publication data
Definition: PublicationInfo.hpp:32
helics::PublicationInfo::required_connections
int32_t required_connections
the number of required connections 0 is no requirement
Definition: PublicationInfo.hpp:40
helics::PublicationInfo::data
SmallBuffer data
the most recent publication data
Definition: PublicationInfo.hpp:34
helics::PublicationInfo::id
const GlobalHandle id
the identifier for the containing federate
Definition: PublicationInfo.hpp:29
helics::PublicationInfo::buffer_data
bool buffer_data
indicator that the publication should buffer data
Definition: PublicationInfo.hpp:39
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::PublicationInfo
Definition: PublicationInfo.hpp:18
helics::PublicationInfo::removeSubscriber
void removeSubscriber(GlobalHandle subscriberToRemove)
Definition: PublicationInfo.cpp:50
helics::PublicationInfo::CheckSetValue
bool CheckSetValue(const char *dataToCheck, uint64_t len, Time currentTime, bool forceChangeCheck)
Definition: PublicationInfo.cpp:16
helics::PublicationInfo::key
const std::string key
the key identifier for the publication
Definition: PublicationInfo.hpp:31
helics::PublicationInfo::lastPublishTime
Time lastPublishTime
the time of the last publication
Definition: PublicationInfo.hpp:35
helics::GlobalHandle
Definition: GlobalFederateId.hpp:144
helics::PublicationInfo::required
bool required
indicator that it is required to be output someplace
Definition: PublicationInfo.hpp:38
helicsTime.hpp