Documentation for OpenFLUID 2.2.2
Loading...
Searching...
No Matches
ExecutionTimePoint.hpp
Go to the documentation of this file.
1/*
2
3 This file is part of OpenFLUID software
4 Copyright(c) 2021-2026, INRAE
5
6
7 == GNU General Public License Usage ==
8
9 OpenFLUID is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OpenFLUID is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21
22
23 == Other Usage ==
24
25 Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26 license, and requires a written agreement between You and INRA.
27 Licensees for Other Usage of OpenFLUID may use this file in accordance
28 with the terms contained in the written agreement between You and INRA.
29
30*/
31
32
33/**
34 @file ExecutionTimePoint.hpp
35
36 @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37*/
38
39
40#ifndef __OPENFLUID_MACHINE_EXECUTIONTIMEPOINT_HPP__
41#define __OPENFLUID_MACHINE_EXECUTIONTIMEPOINT_HPP__
42
43
46
47
48// =====================================================================
49// =====================================================================
50
51
52namespace openfluid { namespace machine {
53
61
62
63// =====================================================================
64// =====================================================================
65
66
68{
69 private:
70
71 std::list<ModelItemInstance*> m_ItemsPtrList;
72
74
75
76 public:
77
78 /**
79 Constructor
80 @param[in] TimeIndex the time index of the execution time point
81 */
83
85
86 /**
87 Appends a model item instance to the stack of the execution time point
88 @param[in] Item a pointer to the model item instance to append
89 */
91
92 /**
93 Returns true if there is at least one model item to process in the execution time point
94 @return true if there is at least one model item
95 */
96 inline bool hasItemsToProcess() const
97 {
98 return !m_ItemsPtrList.empty();
99 }
100
101 /**
102 Executes the runStep() method of the next item and pops it out of the stack
103 @return the scheduling request returned by the runStep() once it is completed
104 */
106
107 /**
108 Returns the next item to process
109 @return a pointer to the next item to process
110 */
112 {
113 return m_ItemsPtrList.front();
114 }
115
116 /**
117 Returns the time index of the execution time point
118 @return the time index
119 */
121 {
122 return m_TimeIndex;
123 }
124
125 /**
126 Sorts model items of the execution time point using their original position in the coupled model
127 */
129 {
130 m_ItemsPtrList.sort(SortModelItemsByOriginalPosition());
131 }
132
133};
134
135
136} } //namespaces
137
138
139#endif /* __OPENFLUID_MACHINE_EXECUTIONTIMEPOINT_HPP__ */
Definition SchedulingRequest.hpp:54
Definition ExecutionTimePoint.hpp:68
void sortByOriginalPosition()
Definition ExecutionTimePoint.hpp:128
void appendItem(openfluid::machine::ModelItemInstance *Item)
openfluid::base::SchedulingRequest processNextItem()
openfluid::machine::ModelItemInstance * nextItem() const
Definition ExecutionTimePoint.hpp:111
openfluid::core::TimeIndex_t getTimeIndex() const
Definition ExecutionTimePoint.hpp:120
bool hasItemsToProcess() const
Definition ExecutionTimePoint.hpp:96
ExecutionTimePoint(openfluid::core::TimeIndex_t TimeIndex)
Definition ModelItemInstance.hpp:61
unsigned int OriginalPosition
Definition ModelItemInstance.hpp:64
#define OPENFLUID_API
Definition dllexport.hpp:86
std::uint64_t TimeIndex_t
Definition TypeDefs.hpp:298
Definition ApplicationException.hpp:47
Definition ExecutionTimePoint.hpp:55
bool operator()(ModelItemInstance *a, ModelItemInstance *b) const
Definition ExecutionTimePoint.hpp:56