helics  3.0.1
PublicationInfo.hpp
1 /*
2 Copyright (c) 2017-2021,
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 "GlobalFederateId.hpp"
10 
11 #include <cstdint>
12 #include <string>
13 #include <vector>
14 
15 namespace helics {
18  public:
21  const std::string& pkey,
22  const std::string& ptype,
23  const std::string& punits):
24  id(pid),
25  key(pkey), type(ptype), units(punits)
26  {
27  }
28  const GlobalHandle id;
29  std::vector<GlobalHandle> subscribers;
30  const std::string key;
31  const std::string type;
32  const std::string units;
33  std::string data;
34  bool has_update{false};
35  bool only_update_on_change{false};
36  bool required{false};
37  bool buffer_data{false};
38  int32_t required_connections{0};
39 
40  bool CheckSetValue(const char* dataToCheck, uint64_t len);
44  bool addSubscriber(GlobalHandle newSubscriber);
45 
47  void removeSubscriber(GlobalHandle subscriberToRemove);
48 };
49 } // namespace helics
helics::PublicationInfo::subscribers
std::vector< GlobalHandle > subscribers
container for all the subscribers of a publication
Definition: PublicationInfo.hpp:29
helics::PublicationInfo::data
std::string data
the most recent publication data
Definition: PublicationInfo.hpp:33
helics::PublicationInfo::units
const std::string units
the units of the publication data
Definition: PublicationInfo.hpp:32
helics::PublicationInfo::addSubscriber
bool addSubscriber(GlobalHandle newSubscriber)
Definition: PublicationInfo.cpp:23
helics::PublicationInfo::has_update
bool has_update
indicator that the publication has updates
Definition: PublicationInfo.hpp:34
helics::PublicationInfo::type
const std::string type
the type of the publication data
Definition: PublicationInfo.hpp:31
helics::PublicationInfo::required_connections
int32_t required_connections
the number of required connections 0 is no requirement
Definition: PublicationInfo.hpp:38
helics::PublicationInfo::id
const GlobalHandle id
the identifier for the containing federate
Definition: PublicationInfo.hpp:28
helics::PublicationInfo::buffer_data
bool buffer_data
indicator that the publication should buffer data
Definition: PublicationInfo.hpp:37
helics::PublicationInfo::PublicationInfo
PublicationInfo(GlobalHandle pid, const std::string &pkey, const std::string &ptype, const std::string &punits)
Definition: PublicationInfo.hpp:20
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:17
helics::PublicationInfo::removeSubscriber
void removeSubscriber(GlobalHandle subscriberToRemove)
Definition: PublicationInfo.cpp:34
helics::PublicationInfo::key
const std::string key
the key identifier for the publication
Definition: PublicationInfo.hpp:30
helics::PublicationInfo::CheckSetValue
bool CheckSetValue(const char *dataToCheck, uint64_t len)
Definition: PublicationInfo.cpp:14
helics::GlobalHandle
Definition: GlobalFederateId.hpp:128
helics::PublicationInfo::required
bool required
indicator that it is required to be output someplace
Definition: PublicationInfo.hpp:36