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
agent
new_agent_event.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_AGENT_NEW_AGENT_EVENT_H_
16
#define CORE_AGENT_NEW_AGENT_EVENT_H_
17
18
#include <limits>
19
#include <mutex>
20
#include "
core/container/inline_vector.h
"
21
#include "
core/util/log.h
"
22
23
namespace
bdm
{
24
29
using
NewAgentEventUid
= uint64_t;
30
31
class
Agent
;
32
class
Behavior
;
33
36
class
NewAgentEventUidGenerator
{
37
public
:
38
NewAgentEventUidGenerator
(
const
NewAgentEventUidGenerator
&) =
delete
;
39
NewAgentEventUidGenerator
&
operator=
(
const
NewAgentEventUidGenerator
&) =
40
delete
;
41
42
static
NewAgentEventUidGenerator
*
GetInstance
();
43
44
NewAgentEventUid
GenerateUid
() {
45
std::lock_guard<std::recursive_mutex> lock(
mutex_
);
46
constexpr uint64_t kOne = 1;
47
if
(
counter_
== 64) {
48
Log::Fatal
(
"NewAgentEventUidGenerator"
,
49
"BioDynaMo only supports 64 unique NewAgentEventUids."
50
" You requested a 65th one."
);
51
}
52
return
kOne <<
counter_
++;
53
}
54
55
private
:
56
NewAgentEventUidGenerator
() =
default
;
57
std::recursive_mutex
mutex_
;
58
uint64_t
counter_
= 0;
59
};
60
61
struct
NewAgentEvent
{
62
virtual
~NewAgentEvent
() =
default
;
63
64
virtual
NewAgentEventUid
GetUid
()
const
= 0;
65
69
mutable
Agent
*
existing_agent
;
73
mutable
InlineVector<Agent*, 3>
new_agents
;
77
mutable
Behavior
*
existing_behavior
;
82
mutable
InlineVector<Behavior*, 3>
new_behaviors
;
83
};
84
85
}
// namespace bdm
86
87
#endif // CORE_AGENT_NEW_AGENT_EVENT_H_
bdm::NewAgentEvent
Definition:
new_agent_event.h:61
inline_vector.h
bdm
Definition:
agent.cc:39
bdm::NewAgentEvent::existing_behavior
Behavior * existing_behavior
Definition:
new_agent_event.h:77
bdm::NewAgentEventUidGenerator
Definition:
new_agent_event.h:36
bdm::Behavior
Definition:
behavior.h:29
bdm::NewAgentEvent::existing_agent
Agent * existing_agent
Definition:
new_agent_event.h:69
bdm::Agent
Contains code required by all agents.
Definition:
agent.h:79
bdm::NewAgentEventUidGenerator::counter_
uint64_t counter_
Definition:
new_agent_event.h:58
bdm::NewAgentEventUidGenerator::GenerateUid
NewAgentEventUid GenerateUid()
Definition:
new_agent_event.h:44
bdm::NewAgentEvent::new_behaviors
InlineVector< Behavior *, 3 > new_behaviors
Definition:
new_agent_event.h:82
bdm::NewAgentEventUid
uint64_t NewAgentEventUid
Definition:
new_agent_event.h:29
bdm::NewAgentEvent::new_agents
InlineVector< Agent *, 3 > new_agents
Definition:
new_agent_event.h:73
bdm::Log::Fatal
static void Fatal(const std::string &location, const Args &... parts)
Prints fatal error message.
Definition:
log.h:115
bdm::NewAgentEventUidGenerator::GetInstance
static NewAgentEventUidGenerator * GetInstance()
Definition:
new_agent_event.cc:23
log.h
bdm::NewAgentEvent::~NewAgentEvent
virtual ~NewAgentEvent()=default
bdm::NewAgentEventUidGenerator::mutex_
std::recursive_mutex mutex_
Definition:
new_agent_event.h:57
bdm::NewAgentEvent::GetUid
virtual NewAgentEventUid GetUid() const =0
bdm::NewAgentEventUidGenerator::operator=
NewAgentEventUidGenerator & operator=(const NewAgentEventUidGenerator &)=delete
bdm::InlineVector
Definition:
inline_vector.h:49
bdm::NewAgentEventUidGenerator::NewAgentEventUidGenerator
NewAgentEventUidGenerator()=default
Generated by
1.8.17