Atoms Crowd
7.0.0
MathOperationBehaviour.h
1
#pragma once
2
// ===========================================================================
3
// Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4
//
5
// Use of this software is subject to the terms of the Toolchefs license
6
// agreement provided at the time of installation or download, or which
7
// otherwise accompanies this software in either electronic or hard copy form.
8
// ===========================================================================
9
10
#include <Atoms/BehaviourTree/Behaviour.h>
11
#include <Atoms/BehaviourTree/BlackboardValue.h>
12
13
#include <functional>
14
15
namespace
Atoms
16
{
17
namespace
MathOperation {
18
struct
MathOpValType;
19
}
20
21
class
ATOMS_EXPORT
MathOperationBehaviour
:
public
Behaviour
22
{
23
public
:
24
25
MathOperationBehaviour
();
26
27
virtual
~
MathOperationBehaviour
();
28
29
virtual
const
char
* typeName()
const override
;
30
31
static
const
char
* staticTypeName();
32
33
virtual
void
update(
BehaviourTreeContext
* context,
State
* data)
override
;
34
35
virtual
void
setAttributes(
const
AtomsCore::MapMetadata
* attributes,
Blackboard
* blackboard)
override
;
36
37
virtual
void
getAttributes(
AtomsCore::MapMetadata
* attributes,
Blackboard
* blackboard)
override
;
38
39
virtual
void
getAttributeProperties(
AtomsCore::MapMetadata
* attributes)
override
;
40
41
static
Behaviour
* creator();
42
43
class
ExpressionEvaluator
44
{
45
public
:
46
47
ExpressionEvaluator
();
48
~
ExpressionEvaluator
();
49
50
void
init(
MathOperationBehaviour
* node,
const
std::string& expression);
51
52
std::function<void(MathOperation::MathOpValType& result,
const
MathOperation::MathOpValType& in0,
const
MathOperation::MathOpValType& in1)> operatorFn;
53
54
BlackboardMetadataValue
* firstOperand;
55
BlackboardMetadataValue
* secondOperand;
56
};
57
58
public
:
59
60
std::string expression;
61
62
ExpressionEvaluator
evaluator;
63
64
BlackboardMetadataValue
value0;
65
66
BlackboardMetadataValue
value1;
67
68
BlackboardStringValue
entryName;
69
};
70
}
Atoms::Behaviour
Definition:
Behaviour.h:21
Atoms::BehaviourTreeContext
Definition:
BehaviourTreeContext.h:24
Atoms::Blackboard
Definition:
Blackboard.h:35
Atoms::BlackboardValue< AtomsPtr< AtomsCore::Metadata > >
Atoms::MathOperationBehaviour::ExpressionEvaluator
Definition:
MathOperationBehaviour.h:44
Atoms::MathOperationBehaviour
Definition:
MathOperationBehaviour.h:22
AtomsCore::MapMetadata
MapMetadata class.
Definition:
MapMetadata.h:24
Atoms
Atoms namespace.
Definition:
Agent.h:29
Atoms::Behaviour::State
Definition:
Behaviour.h:34
Atoms
Public
Atoms
BehaviourTree
Behaviours
MathOperationBehaviour.h