16 #ifndef ALEXA_CLIENT_SDK_ADSL_INCLUDE_ADSL_DIRECTIVEPROCESSOR_H_ 17 #define ALEXA_CLIENT_SDK_ADSL_INCLUDE_ADSL_DIRECTIVEPROCESSOR_H_ 20 #include <condition_variable> 28 #include <unordered_map> 101 bool onDirective(std::shared_ptr<avsCommon::avs::AVSDirective> directive);
136 using ProcessorHandle =
unsigned int;
153 DirectiveHandlerResult(
154 ProcessorHandle processorHandle,
155 std::shared_ptr<avsCommon::avs::AVSDirective> directive);
157 void setCompleted()
override;
159 void setFailed(
const std::string& description)
override;
163 ProcessorHandle m_processorHandle;
166 std::shared_ptr<avsCommon::avs::AVSDirective> m_directive;
174 void onHandlingCompleted(std::shared_ptr<avsCommon::avs::AVSDirective> directive);
182 void onHandlingFailed(std::shared_ptr<avsCommon::avs::AVSDirective> directive,
const std::string& description);
190 void removeDirectiveLocked(std::shared_ptr<avsCommon::avs::AVSDirective> directive);
195 void processingLoop();
205 bool processCancelingQueueLocked(std::unique_lock<std::mutex>& lock);
215 bool handleQueuedDirectivesLocked(std::unique_lock<std::mutex>& lock);
224 void setDialogRequestIdLocked(
const std::string& dialogRequestId);
233 void scrubDialogRequestIdLocked(
const std::string& dialogRequestId);
240 void queueAllDirectivesForCancellationLocked();
251 void setDirectiveBeingHandledLocked(
252 const std::shared_ptr<avsCommon::avs::AVSDirective>& directive,
253 const avsCommon::avs::BlockingPolicy policy);
262 void clearDirectiveBeingHandledLocked(
const avsCommon::avs::BlockingPolicy policy);
273 std::set<std::shared_ptr<avsCommon::avs::AVSDirective>> clearDirectiveBeingHandledLocked(
274 std::function<
bool(
const std::shared_ptr<avsCommon::avs::AVSDirective>&)> shouldClear);
281 std::deque<DirectiveAndPolicy>::iterator getNextUnblockedDirectiveLocked();
293 bool m_isShuttingDown;
302 std::deque<std::shared_ptr<avsCommon::avs::AVSDirective>> m_cancelingQueue;
305 std::shared_ptr<avsCommon::avs::AVSDirective> m_directiveBeingPreHandled;
312 std::deque<DirectiveAndPolicy> m_handlingQueue;
318 std::thread m_processingThread;
321 std::mutex m_onDirectiveMutex;
324 static std::mutex m_handleMapMutex;
330 static std::unordered_map<ProcessorHandle, DirectiveProcessor*> m_handleMap;
333 static ProcessorHandle m_nextProcessorHandle;
342 m_directivesBeingHandled;
345 std::shared_ptr<avsCommon::utils::power::PowerResource> m_powerResource;
351 #endif // ALEXA_CLIENT_SDK_ADSL_INCLUDE_ADSL_DIRECTIVEPROCESSOR_H_ Definition: ConditionVariableWrapper.h:40
DirectiveProcessor(DirectiveRouter *directiveRouter)
::std::string string
Definition: gtest-port.h:1097
Number of mediums. This MUST be the last enum member.
Definition: BlockingPolicy.h:44
Definition: DirectiveRouter.h:36
Definition: DirectiveProcessor.h:65
Definition: DirectiveHandlerResultInterface.h:33
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
Definition: BlockingPolicy.h:31
void setDialogRequestId(const std::string &dialogRequestId)
std::string getDialogRequestId()
bool onDirective(std::shared_ptr< avsCommon::avs::AVSDirective > directive)