Line data Source code
1 : /*
2 : * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.
3 : * Description: ccu representation base header file
4 : * Create: 2025-02-18
5 : */
6 :
7 : #ifndef CCU_LOOP_CALL_H
8 : #define CCU_LOOP_CALL_H
9 :
10 : #include "ccu_rep_loopcall_v1.h"
11 : #include "ccu_rep_context_v1.h"
12 :
13 : namespace hcomm {
14 : namespace CcuRep {
15 :
16 : class LoopCall {
17 : public:
18 : LoopCall(CcuRepContext *context, const std::string &label);
19 1 : const std::string &GetLabel() const
20 : {
21 1 : return label;
22 : }
23 :
24 : template <typename... Arguments> LoopCall &operator()(const Arguments &...args)
25 : {
26 : SetArgHelper(args...);
27 : AppendToContext();
28 : return *this;
29 : }
30 :
31 : LoopCall &operator()()
32 : {
33 : AppendToContext();
34 : return *this;
35 : }
36 :
37 : void AppendToContext();
38 :
39 : private:
40 : template <typename First> void SetArgHelper(const First &first)
41 : {
42 : repLoopCall->SetInArg(first);
43 : }
44 :
45 : template <typename First, typename... Rest> void SetArgHelper(const First &first, const Rest &...rest)
46 : {
47 : repLoopCall->SetInArg(first);
48 : SetArgHelper(rest...);
49 : }
50 :
51 : CcuRepContext *context{nullptr};
52 : std::string label;
53 :
54 : std::shared_ptr<CcuRepLoopCall> repLoopCall{nullptr};
55 : };
56 :
57 : }; // namespace CcuRep
58 : }; // namespace hcomm
59 : #endif // _CCU_LOOP_CALL_H
|