FluxioExecutor.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <experimental/memory>
4 #include <list>
5 #include <map>
6 #include <optional>
7 #include <shared_mutex>
8 #include <string>
9 #include <vector>
10 
16 
17 #include "../FluxioSkillStatusUpdate.h"
18 
19 namespace armarx::skills
20 {
22  {
23  public:
24  virtual ~FluxioExecutor(){};
25  // Copy constructor and assignment operator would be implicitly deleted because of the mutexes
26  // this is just to make it explicit for better error messages O_o
27  FluxioExecutor(const FluxioExecutor&) = delete;
28  FluxioExecutor& operator=(const FluxioExecutor&) = delete;
29 
30  FluxioExecutor(const std::string& id, bool native) : id(id), native(native){};
31  virtual void run(const std::string executorName,
32  armarx::aron::data::DictPtr parameters,
34  virtual void abort() {};
36  virtual armarx::aron::data::VariantPtr getPossibleInputCopy(const std::string nodeId,
37  const std::string parameterId);
38 
39  virtual std::optional<std::vector<skills::FluxioSkillStatusUpdate>> getStatusUpdate();
40 
41  std::optional<skills::FluxioSkillStatusUpdate> getStatus() const;
42 
45  const FluxioParameter& parameter) const;
46 
47  const std::string id;
48  const bool native;
49 
50  protected:
51  std::optional<std::string> executorName = std::nullopt;
52 
53  std::list<skills::FluxioSkillStatusUpdate> statusUpdates;
54  std::shared_mutex statusUpdatesMutex;
55 
57  std::shared_mutex resultMutex;
58 
59  std::map<std::string, armarx::aron::data::DictPtr> possibleInputs = {};
60  std::shared_mutex possibleInputsMutex;
61 
62  std::optional<skills::FluxioSkillStatusUpdate> status = std::nullopt;
63  std::shared_mutex statusMutex;
64  virtual void setStatus(skills::SkillStatus status, const std::string& nodeId = "noId");
65  };
66 } // namespace armarx::skills
Variant.h
armarx::skills::FluxioParameter
Definition: FluxioParameter.h:23
armarx::skills::FluxioExecutor::resultMutex
std::shared_mutex resultMutex
Definition: FluxioExecutor.h:57
SkillStatusUpdate.h
armarx::skills::FluxioExecutor::getStatus
std::optional< skills::FluxioSkillStatusUpdate > getStatus() const
Definition: FluxioExecutor.cpp:69
armarx::skills::FluxioExecutor::result
armarx::aron::data::DictPtr result
Definition: FluxioExecutor.h:56
armarx::skills
This file is part of ArmarX.
Definition: PeriodicUpdateWidget.cpp:11
armarx::skills::FluxioExecutor::run
virtual void run(const std::string executorName, armarx::aron::data::DictPtr parameters, const std::experimental::observer_ptr< const FluxioProfile > profilePtr)
Definition: FluxioExecutor.h:31
armarx::skills::FluxioExecutor::executorName
std::optional< std::string > executorName
Definition: FluxioExecutor.h:51
armarx::skills::FluxioExecutor::statusMutex
std::shared_mutex statusMutex
Definition: FluxioExecutor.h:63
armarx::skills::FluxioExecutor::getPossibleInputCopy
virtual armarx::aron::data::VariantPtr getPossibleInputCopy(const std::string nodeId, const std::string parameterId)
Definition: FluxioExecutor.cpp:28
armarx::skills::FluxioExecutor::possibleInputsMutex
std::shared_mutex possibleInputsMutex
Definition: FluxioExecutor.h:60
armarx::skills::FluxioExecutor::possibleInputs
std::map< std::string, armarx::aron::data::DictPtr > possibleInputs
Definition: FluxioExecutor.h:59
FluxioProfile.h
armarx::skills::FluxioExecutor::~FluxioExecutor
virtual ~FluxioExecutor()
Definition: FluxioExecutor.h:24
armarx::skills::FluxioExecutor
Definition: FluxioExecutor.h:21
std::experimental::fundamentals_v2::observer_ptr
Definition: ManagedIceObject.h:53
Dict.h
armarx::aron::data::VariantPtr
std::shared_ptr< Variant > VariantPtr
Definition: forward_declarations.h:11
armarx::status
status
Definition: FiniteStateMachine.h:244
armarx::skills::FluxioExecutor::findParameterValue
armarx::aron::data::VariantPtr findParameterValue(const std::experimental::observer_ptr< const FluxioProfile > profilePtr, const FluxioParameter &parameter) const
Definition: FluxioExecutor.cpp:75
FluxioParameter.h
armarx::skills::FluxioExecutor::native
const bool native
Definition: FluxioExecutor.h:48
armarx::skills::FluxioExecutor::getResultsCopy
virtual armarx::aron::data::DictPtr getResultsCopy()
Definition: FluxioExecutor.cpp:51
armarx::skills::FluxioExecutor::abort
virtual void abort()
Definition: FluxioExecutor.h:34
armarx::skills::FluxioExecutor::id
const std::string id
Definition: FluxioExecutor.h:47
armarx::aron::data::DictPtr
std::shared_ptr< Dict > DictPtr
Definition: Dict.h:41
armarx::skills::FluxioExecutor::FluxioExecutor
FluxioExecutor(const std::string &id, bool native)
Definition: FluxioExecutor.h:30
armarx::skills::FluxioExecutor::statusUpdates
std::list< skills::FluxioSkillStatusUpdate > statusUpdates
Definition: FluxioExecutor.h:53
armarx::skills::FluxioExecutor::statusUpdatesMutex
std::shared_mutex statusUpdatesMutex
Definition: FluxioExecutor.h:54
armarx::skills::FluxioExecutor::FluxioExecutor
FluxioExecutor(const FluxioExecutor &)=delete
armarx::skills::FluxioExecutor::operator=
FluxioExecutor & operator=(const FluxioExecutor &)=delete
armarx::skills::FluxioExecutor::setStatus
virtual void setStatus(skills::SkillStatus status, const std::string &nodeId="noId")
Definition: FluxioExecutor.cpp:17
armarx::skills::FluxioExecutor::getStatusUpdate
virtual std::optional< std::vector< skills::FluxioSkillStatusUpdate > > getStatusUpdate()
Definition: FluxioExecutor.cpp:63
armarx::skills::SkillStatus
SkillStatus
Definition: SkillStatusUpdate.h:15