BioDynaMo
v1.05.125-2619fe54
Home
Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
i
k
l
n
o
p
r
s
t
u
v
w
Functions
a
b
c
d
e
f
g
i
l
n
o
p
r
s
t
u
v
w
Variables
Typedefs
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
b
c
d
e
f
i
n
p
r
t
v
Enumerations
Enumerator
Related Functions
:
d
e
i
m
o
p
r
s
t
Files
File List
File Members
All
_
b
c
d
h
n
p
s
Functions
Variables
Macros
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
core
operation
operation_registry.h
Go to the documentation of this file.
1
// -----------------------------------------------------------------------------
2
//
3
// Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4
// BioDynaMo collaboration. All Rights Reserved.
5
//
6
// Licensed under the Apache License, Version 2.0 (the "License");
7
// you may not use this file except in compliance with the License.
8
//
9
// See the LICENSE file distributed with this work for details.
10
// See the NOTICE file distributed with this work for additional information
11
// regarding copyright ownership.
12
//
13
// -----------------------------------------------------------------------------
14
15
#ifndef CORE_OPERATION_OPERATION_REGISTRY_H_
16
#define CORE_OPERATION_OPERATION_REGISTRY_H_
17
18
#include "
core/operation/operation.h
"
19
20
#include <unordered_map>
21
22
namespace
bdm
{
23
27
class
OperationRegistry
{
28
public
:
30
static
OperationRegistry
*
GetInstance
();
31
38
Operation
*
GetOperation
(
const
std::string &op_name);
39
50
bool
AddOperationImpl
(
const
std::string &op_name,
OpComputeTarget
target,
51
OperationImpl
*impl, uint32_t frequency = 1);
52
53
private
:
55
std::unordered_map<std::string, Operation *>
operations_
;
56
57
OperationRegistry
();
58
~OperationRegistry
();
59
};
60
64
#define BDM_REGISTER_OP(op, name, target) \
65
bool op::registered_ = OperationRegistry::GetInstance()->AddOperationImpl( \
66
name, OpComputeTarget::target, new op());
67
71
#define BDM_REGISTER_OP_WITH_FREQ(op, name, target, frequency) \
72
bool op::registered_ = OperationRegistry::GetInstance()->AddOperationImpl( \
73
name, OpComputeTarget::target, new op(), frequency);
74
78
#define BDM_REGISTER_TEMPLATE_OP(op, T, name, target) \
79
template <> \
80
bool op<T>::registered_ = \
81
OperationRegistry::GetInstance()->AddOperationImpl( \
82
name, OpComputeTarget::target, new op<T>());
83
85
inline
Operation
*
NewOperation
(
const
std::string &name) {
86
return
OperationRegistry::GetInstance
()->
GetOperation
(name)->
Clone
();
87
}
88
91
#define BDM_OP_HEADER(class_name) \
92
private: \
93
static bool registered_; \
94
\
95
public: \
96
class_name *Clone() override { return new class_name(*this); }
97
98
}
// namespace bdm
99
100
#endif // CORE_OPERATION_OPERATION_REGISTRY_H_
bdm::OperationRegistry::~OperationRegistry
~OperationRegistry()
Definition:
operation_registry.cc:19
bdm::OperationRegistry::GetOperation
Operation * GetOperation(const std::string &op_name)
Definition:
operation_registry.cc:30
bdm
Definition:
agent.cc:39
operation.h
bdm::OperationImpl
Definition:
operation.h:46
bdm::Operation::Clone
Operation * Clone()
Definition:
operation.cc:32
bdm::OperationRegistry::AddOperationImpl
bool AddOperationImpl(const std::string &op_name, OpComputeTarget target, OperationImpl *impl, uint32_t frequency=1)
Definition:
operation_registry.cc:39
bdm::OpComputeTarget
OpComputeTarget
Definition:
operation.h:31
bdm::OperationRegistry::OperationRegistry
OperationRegistry()
bdm::OperationRegistry::GetInstance
static OperationRegistry * GetInstance()
Singleton class - returns the static instance.
Definition:
operation_registry.cc:25
bdm::NewOperation
Operation * NewOperation(const std::string &name)
A convenient function to get a new operation from the registry by its name.
Definition:
operation_registry.h:85
bdm::OperationRegistry::operations_
std::unordered_map< std::string, Operation * > operations_
The map containing the operations; accessible by their name.
Definition:
operation_registry.h:55
bdm::Operation
Definition:
operation.h:99
bdm::OperationRegistry
Definition:
operation_registry.h:27
Generated by
1.8.17