Skip to content
Snippets Groups Projects
Commit 34859d47 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

Added services directory

parent b07f436c
No related branches found
No related tags found
No related merge requests found
build/*
cmake_minimum_required(VERSION 3.10)
# Find CLARA (the CMAKE_INSTALL_PREFIX should be the same used when compiling CLARA)
find_package(clara CONFIG REQUIRED)
# List the services implementation files, without extension
set(SERVICES
SimpleEngine
)
# Create one shared library per service
foreach(service ${SERVICES})
add_library(${service} SHARED ${service}.cxx)
target_compile_features(${service}
PUBLIC cxx_std_14 )
target_link_libraries(${service} Clara::clara)
endforeach()
# Install the services
install(TARGETS ${SERVICES} DESTINATION $ENV{CLARA_HOME}/plugins/clas12/lib)
#include "SimpleEngine.h"
//#include <image_data_type.hpp>
//#include <pupil_detector.hpp>
#include <clara/stdlib/json_utils.hpp>
#include <cmath>
#include <iostream>
extern "C"
std::unique_ptr<clara::Engine> create_engine()
{
return std::make_unique<SimpleEngine>();
}
clara::EngineData SimpleEngine::configure(clara::EngineData& input)
{
// Clara provides a simple JSON parser to read configuration data
// and configure the service.
auto config = clara::stdlib::parse_json(input);
// Example for when the service has state that is configured by
// the orchestrator. The "state" object should be a std::shared_ptr
// accessed atomically.
//
// (This service is actually stateless, so detector_ could just simply be
// initialized in the service constructor).
//std::atomic_store(&detector_, std::make_shared<PupilDetector>());
return {};
}
clara::EngineData SimpleEngine::execute(clara::EngineData& input)
{
auto output = clara::EngineData{};
return output;
}
clara::EngineData SimpleEngine::execute_group(const std::vector<clara::EngineData>&)
{
return {};
}
std::vector<clara::EngineDataType> SimpleEngine::input_data_types() const
{
return { clara::type::JSON};//, IMAGE_TYPE };
}
std::vector<clara::EngineDataType> SimpleEngine::output_data_types() const
{
return { clara::type::JSON};//, IMAGE_TYPE };
}
std::set<std::string> SimpleEngine::states() const
{
return std::set<std::string>{};
}
std::string SimpleEngine::name() const
{
return "SimpleEngine";
}
std::string SimpleEngine::author() const
{
return "Joey Jo-Jo Junior Shabadoo";
}
std::string SimpleEngine::description() const
{
return "Does nothing";
}
std::string SimpleEngine::version() const
{
return "0.1";
}
#ifndef SIMPLE_SERVICE_HPP
#define SIMPLE_SERVICE_HPP
#include <clara/engine.hpp>
#include <atomic>
#include <memory>
class SimpleEngine : public clara::Engine
{
public:
clara::EngineData configure(clara::EngineData& input) override ;
clara::EngineData execute(clara::EngineData& input) override;
clara::EngineData execute_group(const std::vector<clara::EngineData>& inputs) override;
public:
std::vector<clara::EngineDataType> input_data_types() const override;
std::vector<clara::EngineDataType> output_data_types() const override;
std::set<std::string> states() const override;
public:
std::string name() const override ;//{ return "derp";}
std::string author() const override;//{ return "derp";}
std::string description() const override;//{ return "derp";}
std::string version() const override;//{ return "derp";}
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment