ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
mthreadtriggered.hpp
Go to the documentation of this file.
1/** ************************************************************************************************
2 * \file
3 * This header file is part of module \alib_threads of the \aliblong.
4 *
5 * \emoji :copyright: 2013-2019 A-Worx GmbH, Germany.
6 * Published under \ref mainpage_license "Boost Software License".
7 **************************************************************************************************/
8#ifndef HPP_AWORX_ALIB_THREADS_MODEL_MTHREAD_TRIGGERED
9#define HPP_AWORX_ALIB_THREADS_MODEL_MTHREAD_TRIGGERED
10
11
12#if !defined(ALIB_DOX) // todo remove
13
14#if !defined(HPP_AWORX_ALIB_THREADS_MODEL_MTHREAD)
16#endif
17
18#if !defined(HPP_AWORX_ALIB_THREADS_MODEL_TRIGGERED)
20#endif
21namespace alib { namespace threads::model {
22
23/** ************************************************************************************************
24 * TODOX
25 * Implements a distinct thread communication model...with priority queues...
26 **************************************************************************************************/
27class MThreadTriggered : public MThread, protected Triggered
28{
29 protected:
30 /**
31 * Command ids to push to the \b MThread's pipe in respect to triggeing.
32 */
33 enum class TriggerCommands
34 {
35 Trigger , ///< Trigger
36 };
37
38 /**
39 * Constructor. Passes the name to both parents. Usually these names are
40 * hard-coded C++ character arrays. If progarmmatically created, it has to be assured that
41 * the life-cycle of the string supersedes the lifecycle of the instnace of this class.
42 * @param pName The name of this object.
43 */
44 MThreadTriggered(const String& pName)
45 : MThread(pName)
46 , Triggered( pName ) {}
47
48
49 /**
50 * Implementation of parent classes' interface. This pushes command
51 * \ref TriggerCommands "TriggerCommands::Trigger" into the pipe.
52 */
53 virtual void trigger() override
54 {
55 cmdPipe.Push( TriggerCommands::Trigger, 1 );
56 }
57
58
59}; // class MThreadTriggered
60
61
62} // namespace alib[::threads::model]
63
64/// Type alias in namespace #alib.
65using MThreadTriggered = alib::threads::model::MThreadTriggered;
66
67} // namespace [alib]
68
69
70#endif // !defined(ALIB_DOX)
71
72#endif // HPP_AWORX_ALIB_THREADS_MODEL_MTHREAD_TRIGGERED
Definition alib.cpp:57