DPsim
Interface.cpp
1 // SPDX-License-Identifier: Apache-2.0
2 
3 #include <dpsim/Interface.h>
4 
5 using namespace CPS;
6 
7 namespace DPsim {
8 
9 void Interface::addImport(CPS::AttributeBase::Ptr attr, bool blockOnRead,
10  bool syncOnSimulationStart) {
11  if (mOpened) {
12  SPDLOG_LOGGER_ERROR(
13  mLog, "Cannot modify interface configuration after simulation start!");
14  std::exit(1);
15  }
16 
17  mImportAttrsDpsim.emplace_back(attr, 0, blockOnRead, syncOnSimulationStart);
18 }
19 
20 void Interface::addExport(CPS::AttributeBase::Ptr attr) {
21  if (mOpened) {
22  SPDLOG_LOGGER_ERROR(
23  mLog, "Cannot modify interface configuration after simulation start!");
24  std::exit(1);
25  }
26 
27  mExportAttrsDpsim.emplace_back(attr, 0);
28 }
29 
30 void Interface::setLogger(CPS::Logger::Log log) { mLog = log; }
31 
32 } // namespace DPsim