|
1 |
| -// |
2 |
| -// Created by andrew on 2022/2/21. |
3 |
| -// |
| 1 | +/** |
| 2 | + * @file IContext.h |
| 3 | + * @brief Interface for context operations in a system. |
| 4 | + * |
| 5 | + * This file contains the IContext interface which provides |
| 6 | + * methods to initialize, start, stop, reset processes, and |
| 7 | + * manage plugins. |
| 8 | + */ |
4 | 9 |
|
5 | 10 | #ifndef DLMS_DLMS_BASH_H
|
6 | 11 | #define DLMS_DLMS_BASH_H
|
|
11 | 16 |
|
12 | 17 |
|
13 | 18 | class Plugin;
|
| 19 | +/** |
| 20 | + * @brief Interface for context operations. |
| 21 | + * |
| 22 | + * This class defines an interface for managing the lifecycle of |
| 23 | + * a process and handling plugins. |
| 24 | + */ |
14 | 25 | class IContext {
|
15 | 26 | public:
|
16 | 27 |
|
17 | 28 |
|
18 | 29 | public:
|
| 30 | + /// Destructor |
19 | 31 | virtual ~IContext() = default;
|
20 | 32 |
|
21 | 33 | /**
|
22 |
| - * @brief 主进程初始化 |
| 34 | + * @brief Initializes the main process. |
23 | 35 | *
|
24 |
| - * @return 0:成功,其他:失败 |
| 36 | + * This method is responsible for setting up the initial state |
| 37 | + * of the main process. |
| 38 | + * |
| 39 | + * @return 0 if success, other values indicate failure. |
25 | 40 | */
|
26 | 41 | virtual Status Init() = 0;
|
27 | 42 |
|
28 | 43 | /**
|
29 |
| - * @brief 启动主进程 |
| 44 | + * @brief Starts the main process. |
| 45 | + * |
| 46 | + * This method will start the execution of the main process. |
30 | 47 | *
|
31 |
| - * @return 0:成功,其他:失败 |
| 48 | + * @return 0 if success, other values indicate failure. |
32 | 49 | */
|
33 | 50 | virtual Status Start() = 0;
|
34 | 51 |
|
35 | 52 | /**
|
36 |
| - * @brief 停止主进程 |
| 53 | + * @brief Stops the main process. |
| 54 | + * |
| 55 | + * This method is called to stop the execution of the main process. |
37 | 56 | *
|
38 |
| - * @return 0:成功,其他:失败 |
| 57 | + * @return 0 if success, other values indicate failure. |
39 | 58 | */
|
40 | 59 | virtual Status Stop() = 0;
|
41 | 60 |
|
42 | 61 | /**
|
43 |
| - * @brief 退出主进程 |
| 62 | + * @brief Resets the main process. |
44 | 63 | *
|
45 |
| - * @return 0:成功,其他:失败 |
| 64 | + * This method will reset the main process state. |
| 65 | + * |
| 66 | + * @return 0 if success, other values indicate failure. |
46 | 67 | */
|
47 | 68 | virtual Status Reset() = 0;
|
48 | 69 |
|
49 | 70 | /**
|
50 |
| - * @brief 获取插件对象 |
| 71 | + * @brief Gets a plugin object. |
| 72 | + * |
| 73 | + * This method retrieves a plugin instance based on the plugin name |
| 74 | + * and type provided. |
51 | 75 | *
|
52 |
| - * @return nullptr:失败,其他:成功 |
| 76 | + * @param[in] pluginName The name of the plugin. |
| 77 | + * @param[in] type The type of the plugin. |
| 78 | + * @return A pointer to the plugin object if found, nullptr otherwise. |
53 | 79 | */
|
54 | 80 | virtual Plugin *GetPlugin(std::string &pluginName, std::string &type) = 0;
|
55 | 81 |
|
56 |
| - // 将需要工作的线程放到Push里面 |
| 82 | + /** |
| 83 | + * @brief Dispatches a work function to a thread. |
| 84 | + * |
| 85 | + * This method assigns a work function to be executed by a thread. |
| 86 | + * |
| 87 | + * @param[in] workFunction The function to be executed by the thread. |
| 88 | + * @return 0 if success, other values indicate failure. |
| 89 | + */ |
57 | 90 | virtual Status Dispatch(Func workFunction) = 0;
|
58 | 91 | };
|
59 | 92 |
|
|
0 commit comments