Skip to content
Snippets Groups Projects
Commit 63e580e1 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

doc: modernise example(s)

parent ffa2299a
No related branches found
No related tags found
No related merge requests found
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
#pragma once
#include <ChimeraTK/ApplicationCore/ApplicationCore.h>
namespace ctk = ChimeraTK;
struct TemplateModule : public ctk::ApplicationModule {
using ctk::ApplicationModule::ApplicationModule;
/*
* Add input/output definition
* */
void mainLoop() override;
};
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
#pragma once
class AppVersion {
public:
// About 1xx-100: This is to prevent 08 and 09 being interpreted as
// octal, which would result in a compiler error.
static constexpr uint32_t major = 1${${PROJECT_NAME}_MAJOR_VERSION}-100;
static constexpr uint32_t minor = 1${${PROJECT_NAME}_MINOR_VERSION}-100;
static constexpr uint32_t patch = 1${${PROJECT_NAME}_PATCH_VERSION}-100;
};
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
#include "Server.h"
#include "version.h"
Server::Server(std::string appName)
: ctk::Application(appName),
dmapPath(appName + ".dmap"), config{this, "Configuration", getName() + "-Config.xml"}, device{this,
"MappedDummyDevice"},
templateModule{this, "TemplateModule", "This is a template module, adapt as needed!"} {
std::cout << "*** Construction of " << appName << " in version " << AppVersion::major << "." << AppVersion::minor
<< "." << AppVersion::patch << " starts. ***" << std::endl;
std::cout << "*** Construction of " << appName << " in version " << AppVersion::major << "." << AppVersion::minor
<< "." << AppVersion::patch << " done. ***" << std::endl;
}
Server::~Server() {
shutdown();
}
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
#include "TemplateModule.h"
void TemplateModule::mainLoop() {
/*
* Here a main infinite loop for the Module should be defined.
* It is commented out on purpose in this TemplateModule.
*
*/
/*
while(true) {
}
*/
}
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
#include "Server.h"
/// The Server instance
static Server theServer;
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
#include "Server.h"
#include <ChimeraTK/ApplicationCore/EnableXMLGenerator.h>
/// The Server instance
static Server theServer;
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
// Define a name for the test module.
#define BOOST_TEST_MODULE testTemplateServer
// Only after defining the name include the unit test header.
#include "Server.h"
#include <ChimeraTK/ApplicationCore/TestFacility.h>
#include <boost/test/included/unit_test.hpp>
// Declare the server instance
static Server theServer;
static ChimeraTK::TestFacility testFacility{theServer};
struct TestFixture {
TestFixture() { testFacility.runApplication(); }
};
static TestFixture fixture;
using namespace boost::unit_test_framework;
/// TestSuite for the server, adapt name
BOOST_AUTO_TEST_SUITE(TemplateServerTestSuite)
/**********************************************************************************************************************/
/// A template test case
BOOST_AUTO_TEST_CASE(testTemplate) {
std::cout << "testTemplate" << std::endl;
}
/**********************************************************************************************************************/
BOOST_AUTO_TEST_SUITE_END()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment