Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
another mc_model_checker call location disappears
[simgrid.git] / include / simgrid / forward.h
1 /* Copyright (c) 2004-2023. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_TYPES_H
7 #define SIMGRID_TYPES_H
8
9 #include <xbt/base.h>
10
11 #ifdef __cplusplus
12
13 #include <boost/intrusive_ptr.hpp>
14 #include <vector>
15
16 namespace simgrid {
17
18 namespace s4u {
19 class Activity;
20 /** Smart pointer to a simgrid::s4u::Activity */
21 using ActivityPtr = boost::intrusive_ptr<Activity>;
22 XBT_PUBLIC void intrusive_ptr_release(const Activity* actor);
23 XBT_PUBLIC void intrusive_ptr_add_ref(const Activity* actor);
24
25 class Actor;
26 /** Smart pointer to a simgrid::s4u::Actor */
27 using ActorPtr = boost::intrusive_ptr<Actor>;
28 XBT_PUBLIC void intrusive_ptr_release(const Actor* actor);
29 XBT_PUBLIC void intrusive_ptr_add_ref(const Actor* actor);
30
31 class Barrier;
32 /** Smart pointer to a simgrid::s4u::Barrier */
33 using BarrierPtr = boost::intrusive_ptr<Barrier>;
34 XBT_PUBLIC void intrusive_ptr_release(Barrier* m);
35 XBT_PUBLIC void intrusive_ptr_add_ref(Barrier* m);
36
37 class Comm;
38 /** Smart pointer to a simgrid::s4u::Comm */
39 using CommPtr = boost::intrusive_ptr<Comm>;
40 XBT_PUBLIC void intrusive_ptr_release(Comm* c);
41 XBT_PUBLIC void intrusive_ptr_add_ref(Comm* c);
42
43 class ConditionVariable;
44 /** @beginrst
45  * Smart pointer to a :cpp:type:`simgrid::s4u::ConditionVariable`
46  * @endrst
47  */
48 using ConditionVariablePtr = boost::intrusive_ptr<ConditionVariable>;
49 XBT_PUBLIC void intrusive_ptr_release(const ConditionVariable* c);
50 XBT_PUBLIC void intrusive_ptr_add_ref(const ConditionVariable* c);
51
52 class Engine;
53
54 class Exec;
55 /** Smart pointer to a simgrid::s4u::Exec */
56 using ExecPtr = boost::intrusive_ptr<Exec>;
57 XBT_PUBLIC void intrusive_ptr_release(Exec* e);
58 XBT_PUBLIC void intrusive_ptr_add_ref(Exec* e);
59
60 class Host;
61
62 class Io;
63 /** Smart pointer to a simgrid::s4u::Io */
64 using IoPtr = boost::intrusive_ptr<Io>;
65 XBT_PUBLIC void intrusive_ptr_release(Io* i);
66 XBT_PUBLIC void intrusive_ptr_add_ref(Io* i);
67
68 class Link;
69 class SplitDuplexLink;
70
71 class Mailbox;
72
73 class Mutex;
74 XBT_PUBLIC void intrusive_ptr_release(const Mutex* m);
75 XBT_PUBLIC void intrusive_ptr_add_ref(const Mutex* m);
76 /**
77  * @beginrst
78  * Smart pointer to a :cpp:type:`simgrid::s4u::Mutex`
79  * @endrst
80  */
81 using MutexPtr = boost::intrusive_ptr<Mutex>;
82
83 class NetZone;
84 class VirtualMachine;
85 class File;
86
87 class Semaphore;
88 /** Smart pointer to a simgrid::s4u::Semaphore */
89 using SemaphorePtr = boost::intrusive_ptr<Semaphore>;
90 XBT_PUBLIC void intrusive_ptr_release(const Semaphore* m);
91 XBT_PUBLIC void intrusive_ptr_add_ref(const Semaphore* m);
92
93 class Disk;
94 /**
95  * @brief Callback to dynamically change the resource's capacity
96  *
97  * Allows user to change resource's capacity depending on the number of concurrent activities
98  * running on the resource at a given instant
99  */
100 using NonLinearResourceCb = std::function<double(double capacity, int n_activities)>;
101 } // namespace s4u
102
103 namespace config {
104 template <class T> class Flag;
105 }
106
107 namespace kernel {
108 class EngineImpl;
109 namespace actor {
110 class ActorImpl;
111 using ActorImplPtr = boost::intrusive_ptr<ActorImpl>;
112
113 // What's executed as an actor code:
114 using ActorCode = std::function<void()>;
115 // Create an ActorCode from the parameters parsed in the XML file (or elsewhere)
116 using ActorCodeFactory = std::function<ActorCode(std::vector<std::string> args)>;
117
118 class Simcall;
119 class SimcallObserver;
120 class ObjectAccessSimcallObserver;
121 class ObjectAccessSimcallItem;
122 } // namespace actor
123
124 namespace activity {
125   class ActivityImpl;
126   enum class State;
127   using ActivityImplPtr = boost::intrusive_ptr<ActivityImpl>;
128   XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
129   XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
130
131   class BarrierImpl;
132   using BarrierImplPtr = boost::intrusive_ptr<BarrierImpl>;
133   XBT_PUBLIC void intrusive_ptr_add_ref(BarrierImpl* cond);
134   XBT_PUBLIC void intrusive_ptr_release(BarrierImpl* cond);
135   class BarrierAcquisitionImpl;
136   using BarrierAcquisitionImplPtr = boost::intrusive_ptr<BarrierAcquisitionImpl>;
137
138   class ConditionVariableImpl;
139   using ConditionVariableImplPtr = boost::intrusive_ptr<ConditionVariableImpl>;
140   XBT_PUBLIC void intrusive_ptr_add_ref(ConditionVariableImpl* cond);
141   XBT_PUBLIC void intrusive_ptr_release(ConditionVariableImpl* cond);
142
143   class CommImpl;
144   using CommImplPtr = boost::intrusive_ptr<CommImpl>;
145   class ExecImpl;
146   using ExecImplPtr = boost::intrusive_ptr<ExecImpl>;
147   class IoImpl;
148   using IoImplPtr = boost::intrusive_ptr<IoImpl>;
149   class MutexImpl;
150   using MutexImplPtr = boost::intrusive_ptr<MutexImpl>;
151   class MutexAcquisitionImpl;
152   using MutexAcquisitionImplPtr = boost::intrusive_ptr<MutexAcquisitionImpl>;
153   XBT_PUBLIC void intrusive_ptr_add_ref(MutexImpl* mutex);
154   XBT_PUBLIC void intrusive_ptr_release(MutexImpl* mutex);
155   class SynchroImpl;
156   using SynchroImplPtr = boost::intrusive_ptr<SynchroImpl>;
157   class SemaphoreImpl;
158   using SemaphoreImplPtr = boost::intrusive_ptr<SemaphoreImpl>;
159   class SemAcquisitionImpl;
160   using SemAcquisitionImplPtr = boost::intrusive_ptr<SemAcquisitionImpl>;
161   XBT_PUBLIC void intrusive_ptr_add_ref(SemaphoreImpl* sem);
162   XBT_PUBLIC void intrusive_ptr_release(SemaphoreImpl* sem);
163   class SleepImpl;
164   using SleepImplPtr = boost::intrusive_ptr<SleepImpl>;
165
166   class MailboxImpl;
167 }
168 namespace context {
169 class Context;
170 class ContextFactory;
171 } // namespace context
172 namespace lmm {
173 class Element;
174 class Variable;
175 class Constraint;
176 class ConstraintLight;
177 class System;
178 }
179 namespace resource {
180 class Action;
181 class CpuImpl;
182 class Model;
183 class Resource;
184 class CpuModel;
185 class HostImpl;
186 class HostModel;
187 class NetworkModel;
188 class LinkImpl;
189 class StandardLinkImpl;
190 class SplitDuplexLinkImpl;
191 class NetworkAction;
192 class DiskImpl;
193 class DiskModel;
194 class VirtualMachineImpl;
195 class VMModel;
196 }
197 namespace timer {
198 class Timer;
199 }
200 namespace routing {
201 class NetPoint;
202 class NetZoneImpl;
203 }
204 namespace profile {
205 class Event;
206 class FutureEvtSet;
207 class Profile;
208 } // namespace profile
209 } // namespace kernel
210 namespace mc {
211 class State;
212 class RemoteApp;
213 }
214 } // namespace simgrid
215
216 using s4u_Actor             = simgrid::s4u::Actor;
217 using s4u_Barrier           = simgrid::s4u::Barrier;
218 using s4u_Comm              = simgrid::s4u::Comm;
219 using s4u_Exec              = simgrid::s4u::Exec;
220 using s4u_Host              = simgrid::s4u::Host;
221 using s4u_Link              = simgrid::s4u::Link;
222 using s4u_File              = simgrid::s4u::File;
223 using s4u_ConditionVariable = simgrid::s4u::ConditionVariable;
224 using s4u_Mailbox           = simgrid::s4u::Mailbox;
225 using s4u_Mutex             = simgrid::s4u::Mutex;
226 using s4u_Semaphore         = simgrid::s4u::Semaphore;
227 using s4u_Disk              = simgrid::s4u::Disk;
228 using s4u_NetZone           = simgrid::s4u::NetZone;
229 using s4u_VM                = simgrid::s4u::VirtualMachine;
230
231 using smx_timer_t
232     XBT_ATTRIB_DEPRECATED_v335("Please use simgrid::kernel::timer::Timer*") = simgrid::kernel::timer::Timer*;
233 using smx_actor_t
234     XBT_ATTRIB_DEPRECATED_v335("Please use simgrid::kernel::actor::ActorImpl*") = simgrid::kernel::actor::ActorImpl*;
235 using smx_activity_t = simgrid::kernel::activity::ActivityImpl*;
236 using smx_cond_t XBT_ATTRIB_DEPRECATED_v335("Please use simgrid::kernel::activity::ConditionVariableImpl*") =
237     simgrid::kernel::activity::ConditionVariableImpl*;
238 using smx_mailbox_t XBT_ATTRIB_DEPRECATED_v335("Please use simgrid::kernel::activity::MailboxImpl*") =
239     simgrid::kernel::activity::MailboxImpl*;
240 using smx_mutex_t XBT_ATTRIB_DEPRECATED_v335("Please use simgrid::kernel::activity::MutexImpl*") =
241     simgrid::kernel::activity::MutexImpl*;
242 using smx_sem_t XBT_ATTRIB_DEPRECATED_v335("Please use simgrid::kernel::activity::SemaphoreImpl*") =
243     simgrid::kernel::activity::SemaphoreImpl*;
244 #else
245
246 typedef struct s4u_Actor s4u_Actor;
247 typedef struct s4u_Barrier s4u_Barrier;
248 typedef struct s4u_Comm s4u_Comm;
249 typedef struct s4u_Exec s4u_Exec;
250 typedef struct s4u_Host s4u_Host;
251 typedef struct s4u_Link s4u_Link;
252 typedef struct s4u_File s4u_File;
253 typedef struct s4u_ConditionVariable s4u_ConditionVariable;
254 typedef struct s4u_Mailbox s4u_Mailbox;
255 typedef struct s4u_Mutex s4u_Mutex;
256 typedef struct s4u_Semaphore s4u_Semaphore;
257 typedef struct s4u_Disk s4u_Disk;
258 typedef struct s4u_NetZone s4u_NetZone;
259 typedef struct s4u_VM s4u_VM;
260
261 XBT_ATTRIB_DEPRECATED_v335("Please stop using this type alias") typedef struct s_smx_timer* smx_timer_t;
262 XBT_ATTRIB_DEPRECATED_v335("Please stop using this type alias") typedef struct s_smx_actor* smx_actor_t;
263 typedef struct s_smx_activity* smx_activity_t;
264 XBT_ATTRIB_DEPRECATED_v335("Please stop using this type alias") typedef struct s_smx_cond_t* smx_cond_t;
265 XBT_ATTRIB_DEPRECATED_v335("Please stop using this type alias") typedef struct s_smx_mailbox* smx_mailbox_t;
266 XBT_ATTRIB_DEPRECATED_v335("Please stop using this type alias") typedef struct s_smx_mutex* smx_mutex_t;
267 XBT_ATTRIB_DEPRECATED_v335("Please stop using this type alias") typedef struct s_smx_sem* smx_sem_t;
268
269 #endif
270
271 /** Pointer to a SimGrid barrier object */
272 typedef s4u_Barrier* sg_bar_t;
273 /** Constant pointer to a SimGrid barrier object */
274 XBT_ATTRIB_DEPRECATED_v335("Please stop using this type alias") typedef const s4u_Barrier* const_sg_bar_t;
275 typedef s4u_Comm* sg_comm_t;
276 XBT_ATTRIB_DEPRECATED_v335("Please stop using this type alias") typedef const s4u_Comm* const_sg_comm_t;
277 typedef s4u_Exec* sg_exec_t;
278 typedef const s4u_Exec* const_sg_exec_t;
279 typedef s4u_ConditionVariable* sg_cond_t;
280 typedef const s4u_ConditionVariable* const_sg_cond_t;
281 typedef s4u_Mailbox* sg_mailbox_t;
282 typedef const s4u_Mailbox* const_sg_mailbox_t;
283 typedef s4u_Mutex* sg_mutex_t;
284 typedef const s4u_Mutex* const_sg_mutex_t;
285 typedef s4u_Semaphore* sg_sem_t;
286 typedef const s4u_Semaphore* const_sg_sem_t;
287 typedef s4u_NetZone* sg_netzone_t;
288 typedef const s4u_NetZone* const_sg_netzone_t;
289 typedef s4u_Host* sg_host_t;
290 typedef const s4u_Host* const_sg_host_t;
291 typedef s4u_Link* sg_link_t;
292 typedef const s4u_Link* const_sg_link_t;
293 typedef s4u_Disk* sg_disk_t;
294 typedef const s4u_Disk* const_sg_disk_t;
295 /** Pointer to a SimGrid file object @ingroup plugin_filesystem */
296 typedef s4u_File* sg_file_t;
297 /** Constant pointer to a SimGrid file object @ingroup plugin_filesystem */
298 typedef const s4u_File* const_sg_file_t;
299 typedef s4u_VM* sg_vm_t;
300 typedef const s4u_VM* const_sg_vm_t;
301 /** Pointer to an actor object */
302 typedef s4u_Actor* sg_actor_t;
303 /** Pointer to a constant actor object */
304 typedef const s4u_Actor* const_sg_actor_t;
305
306 /** @ingroup m_datatypes_management_details
307  * @brief Type for any simgrid size
308  */
309 typedef unsigned long long sg_size_t;
310
311 /** @ingroup m_datatypes_management_details
312  * @brief Type for any simgrid offset
313  */
314 typedef long long sg_offset_t;
315
316 /** Actor's ID, just like the classical processes' have PID in UNIX */
317 typedef long aid_t;
318
319 typedef enum {
320   SG_OK /** Code returned when no problem occured */,
321   SG_ERROR_CANCELED /** Code returned when something got canceled before completion */,
322   SG_ERROR_TIMEOUT /** Code returned when timeout elapsed */,
323   SG_ERROR_HOST /** Code returned when a host fails */,
324   SG_ERROR_NETWORK /** Code returned when a communication fails because of the network or because of the remote host */,
325   SG_ERROR_STORAGE /** Code returned when a storage fails */,
326   SG_ERROR_VM /** Code returned when a VM fails */
327 } sg_error_t;
328
329 XBT_PUBLIC int SMPI_is_inited();
330
331 #endif /* SIMGRID_TYPES_H */