ExecutorActivator.cpp 1.15 KB
Newer Older
Mccaskey, Alex's avatar
Mccaskey, Alex committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "graph_executor_eager.hpp"
#include "graph_executor_lazy.hpp"
#include "node_executor_talsh.hpp"
#include "node_executor_exatensor.hpp"

#include "cppmicroservices/BundleActivator.h"
#include "cppmicroservices/BundleContext.h"

#include <memory>
#include <set>

using namespace cppmicroservices;

namespace {

/**
 */
class US_ABI_LOCAL ExecutorActivator : public BundleActivator {

public:
  ExecutorActivator() {}

  /**
   */
  void Start(BundleContext context) {

    auto g1 = std::make_shared<exatn::runtime::EagerGraphExecutor>();
    auto g2 = std::make_shared<exatn::runtime::LazyGraphExecutor>();

    context.RegisterService<exatn::runtime::TensorGraphExecutor>(g1);
    context.RegisterService<exatn::runtime::TensorGraphExecutor>(g2);

    auto n1 = std::make_shared<exatn::runtime::TalshNodeExecutor>();
    auto n2 = std::make_shared<exatn::runtime::ExatensorNodeExecutor>();

    context.RegisterService<exatn::runtime::TensorNodeExecutor>(n1);
    context.RegisterService<exatn::runtime::TensorNodeExecutor>(n2);
  }

  /**
   */
  void Stop(BundleContext /*context*/) {}
};

} // namespace

CPPMICROSERVICES_EXPORT_BUNDLE_ACTIVATOR(ExecutorActivator)