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 
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 
44  {
45  public:
46 
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 
65 
67 
68  BlackboardStringValue entryName;
69  };
70 }
Definition: Behaviour.h:21
Definition: BehaviourTreeContext.h:24
Definition: Blackboard.h:35
Definition: MathOperationBehaviour.h:44
Definition: MathOperationBehaviour.h:22
MapMetadata class.
Definition: MapMetadata.h:24
Atoms namespace.
Definition: Agent.h:29
Definition: Behaviour.h:34