Skip to content

Commit

Permalink
Merge pull request #27 from GMLC-TDC/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
nightlark authored Nov 19, 2019
2 parents d58fd9c + 360a3e3 commit 2d62fcd
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ jobs:
- task: CMake@1
inputs:
workingDirectory: HELICS/build
cmakeArgs: -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_HELICS_TESTS=OFF -DBUILD_HELICS_EXAMPLES=OFF ..
cmakeArgs: -GNinja -DCMAKE_BUILD_TYPE=Release -DHELICS_BUILD_CXX_SHARED_LIB=ON ..
displayName: 'Linux/macOS - Configure HELICS'
condition: ne( variables['Agent.OS'], 'Windows_NT' )
# Windows
- task: CMake@1
inputs:
workingDirectory: HELICS/build
cmakeArgs: -Ax64 -DCMAKE_BUILD_TYPE=Release -DBUILD_HELICS_TESTS=OFF -DBUILD_HELICS_EXAMPLES=OFF ..
cmakeArgs: -Ax64 -DCMAKE_BUILD_TYPE=Release -DHELICS_BUILD_CXX_SHARED_LIB=ON ..
displayName: 'Windows - Configure HELICS'
condition: eq( variables['Agent.OS'], 'Windows_NT' )

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
cmake_minimum_required(VERSION 3.4)
cmake_policy(VERSION 3.4)

project (HELICS-EXAMPLES VERSION 2.1.0)
project (HELICS-EXAMPLES VERSION 2.3.0)

# -----------------------------------------------------------------------------
# include some common macros
Expand Down
2 changes: 1 addition & 1 deletion cpp/comboFederate1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ endif()
find_package(HELICS 2 REQUIRED)

add_executable(comboFed-cpp comboFed.cpp)
target_link_libraries(comboFed-cpp HELICS::helics_apps)
target_link_libraries(comboFed-cpp HELICS::helics-apps-shared)

set_property(TARGET comboFed-cpp PROPERTY CXX_STANDARD 14)
set_target_properties(comboFed-cpp PROPERTIES FOLDER cpp/federates)
2 changes: 1 addition & 1 deletion cpp/filterFederate1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ endif()
find_package(HELICS 2 REQUIRED)

add_executable(filterFed-cpp filterFed.cpp)
target_link_libraries(filterFed-cpp HELICS::helics_apps)
target_link_libraries(filterFed-cpp HELICS::helics-apps-shared)

set_target_properties(filterFed-cpp PROPERTIES FOLDER cpp/federates)
13 changes: 7 additions & 6 deletions cpp/filterFederate1/filterFed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SPDX-License-Identifier: BSD-3-Clause

#include "helics/application_api.hpp"
#include "helics/core/helicsCLI11.hpp"
#include "helics/core/Core.hpp"
#include <iostream>
#include <thread>

Expand All @@ -17,13 +18,13 @@ int main (int argc, char *argv[])
std::string targetEndpoint = "endpoint";
std::string delay = "1.0";
std::string filtType = "delay";
helics::filter_types ftype;
helics::filter_types ftype = helics::filter_types::delay;
double dropprob = 0.33;

app.add_option ("--target,-t", targetFederate, "name of the federate to target");
app.add_option ("--endpoint,-e", targetEndpoint, "name of the endpoint to filter");
app.add_option ("--delay", delay, "the time to delay the message");
app.add_option ("--filtertype", filtType, "the type of filter to implement")
app.add_option ("--filtertype", filtType, "the type of filter to implement",true)
->check(CLI::IsMember({
"delay",
"random_drop",
Expand Down Expand Up @@ -52,11 +53,11 @@ int main (int argc, char *argv[])

std::string target = targetFederate + "/" + targetEndpoint;

auto core = helics::CoreFactory::create(argc, argv);
auto core = helics::CoreApp(argc, argv);
std::cout << " registering filter '"<< "' for " << target <<'\n';

//create a source filter object with type, the fed pointer and a target endpoint
auto filt = helics::make_filter(ftype, core.get());
auto filt = helics::make_filter(ftype, core);
filt->addSourceTarget(target);

// get a few specific parameters related to the particular filter
Expand All @@ -82,9 +83,9 @@ int main (int argc, char *argv[])
}

// setup and run
core->setCoreReadyToInit();
core.setReadyToInit();

core->waitForDisconnect();
core.waitForDisconnect();
return 0;
}

4 changes: 2 additions & 2 deletions cpp/ipcTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ find_package(HELICS 2 REQUIRED)
find_package(Threads REQUIRED)

add_executable(ipcTest1-cpp ipcTest1.cpp common.hpp)
target_link_libraries(ipcTest1-cpp HELICS::helics-static Threads::Threads)
target_link_libraries(ipcTest1-cpp HELICS::helics-shared Threads::Threads)

add_executable(ipcTest2-cpp ipcTest2.cpp common.hpp)
target_link_libraries(ipcTest2-cpp HELICS::helics-static Threads::Threads)
target_link_libraries(ipcTest2-cpp HELICS::helics-shared Threads::Threads)

set_target_properties(ipcTest1-cpp ipcTest2-cpp PROPERTIES FOLDER cpp/ipc)
10 changes: 3 additions & 7 deletions cpp/ipcTest/ipcTest1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SPDX-License-Identifier: BSD-3-Clause
#include <thread>

#include <helics/ValueFederates.hpp>
#include <helics/core/BrokerFactory.hpp>
#include <helics/application_api/BrokerApp.hpp>

#include "common.hpp"

Expand All @@ -33,7 +33,7 @@ int main (int, char **)
std::cout << "trying to create broker..." << std::endl;

auto init_string = std::string ("-f2 --name=stevebroker");
auto broker = helics::BrokerFactory::create (helics::core_type::INTERPROCESS, init_string);
helics::BrokerApp broker(helics::core_type::INTERPROCESS, init_string);

std::cout << "created broker \"" << broker->getIdentifier () << "\"\n"
<< "broker is connected: " << std::boolalpha << broker->isConnected () << std::endl;
Expand Down Expand Up @@ -77,11 +77,7 @@ int main (int, char **)
}

fed.finalize ();
do // sleep until the broker finishes
{
std::this_thread::sleep_for (std::chrono::milliseconds (500));

} while (broker->isConnected ());
broker.waitForDisconnect();

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions cpp/messageFederate1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ endif()
find_package(HELICS 2 REQUIRED)

add_executable(messageFed-cpp messageFed.cpp)
target_link_libraries(messageFed-cpp HELICS::helics_apps)
target_link_libraries(messageFed-cpp HELICS::helics-apps-shared)

add_executable(messageFedObj-cpp messageFedObj.cpp)
target_link_libraries(messageFedObj-cpp HELICS::helics_apps)
target_link_libraries(messageFedObj-cpp HELICS::helics-apps-shared)

set_target_properties(messageFed-cpp messageFedObj-cpp PROPERTIES FOLDER cpp/federates)
2 changes: 1 addition & 1 deletion cpp/valueFederate1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ endif()
find_package(HELICS 2 REQUIRED)

add_executable(valueFed-cpp valueFed.cpp)
target_link_libraries(valueFed-cpp HELICS::helics_apps)
target_link_libraries(valueFed-cpp HELICS::helics-apps-shared)

set_target_properties(valueFed-cpp PROPERTIES FOLDER cpp/federates)

0 comments on commit 2d62fcd

Please sign in to comment.