Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix another bunch of warnings in doc generation.
[simgrid.git] / include / simgrid / forward.h
1 /* Copyright (c) 2004-2021. 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 } // namespace s4u
95
96 namespace config {
97 template <class T> class Flag;
98 }
99
100 namespace kernel {
101 class EngineImpl;
102 namespace actor {
103 class ActorImpl;
104 using ActorImplPtr = boost::intrusive_ptr<ActorImpl>;
105
106 // What's executed as an actor code:
107 using ActorCode = std::function<void()>;
108 // Create an ActorCode from the parameters parsed in the XML file (or elsewhere)
109 using ActorCodeFactory = std::function<ActorCode(std::vector<std::string> args)>;
110
111 class SimcallObserver;
112 } // namespace actor
113
114 namespace activity {
115   class ActivityImpl;
116   enum class State;
117   using ActivityImplPtr = boost::intrusive_ptr<ActivityImpl>;
118   XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
119   XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
120
121   class ConditionVariableImpl;
122   using ConditionVariableImplPtr = boost::intrusive_ptr<ConditionVariableImpl>;
123   XBT_PUBLIC void intrusive_ptr_add_ref(ConditionVariableImpl* cond);
124   XBT_PUBLIC void intrusive_ptr_release(ConditionVariableImpl* cond);
125
126   class CommImpl;
127   using CommImplPtr = boost::intrusive_ptr<CommImpl>;
128   class ExecImpl;
129   using ExecImplPtr = boost::intrusive_ptr<ExecImpl>;
130   class IoImpl;
131   using IoImplPtr = boost::intrusive_ptr<IoImpl>;
132   class MutexImpl;
133   using MutexImplPtr = boost::intrusive_ptr<MutexImpl>;
134   XBT_PUBLIC void intrusive_ptr_add_ref(MutexImpl* mutex);
135   XBT_PUBLIC void intrusive_ptr_release(MutexImpl* mutex);
136   class RawImpl;
137   using RawImplPtr = boost::intrusive_ptr<RawImpl>;
138   class SemaphoreImpl;
139   using SemaphoreImplPtr = boost::intrusive_ptr<SemaphoreImpl>;
140   XBT_PUBLIC void intrusive_ptr_add_ref(SemaphoreImpl* sem);
141   XBT_PUBLIC void intrusive_ptr_release(SemaphoreImpl* sem);
142   class SleepImpl;
143   using SleepImplPtr = boost::intrusive_ptr<SleepImpl>;
144
145   class MailboxImpl;
146 }
147 namespace context {
148 class Context;
149 class ContextFactory;
150 } // namespace context
151 namespace lmm {
152 class Element;
153 class Variable;
154 class Constraint;
155 class ConstraintLight;
156 class System;
157 }
158 namespace resource {
159 class Action;
160 class CpuImpl;
161 class Model;
162 class Resource;
163 class CpuModel;
164 class NetworkModel;
165 class NetworkModelIntf;
166 class LinkImpl;
167 class SplitDuplexLinkImpl;
168 class LinkImplIntf;
169 class NetworkAction;
170 class DiskImpl;
171 class DiskModel;
172 }
173 namespace timer {
174 class Timer;
175 }
176 namespace routing {
177 class NetPoint;
178 class NetZoneImpl;
179 }
180 namespace profile {
181 class Event;
182 class FutureEvtSet;
183 class Profile;
184 } // namespace profile
185 } // namespace kernel
186 namespace simix {
187   class Host;
188 }
189 namespace surf {
190   class HostImpl;
191   class HostModel;
192 }
193 namespace mc {
194 class CommunicationDeterminismChecker;
195 }
196 namespace vm {
197 class VMModel;
198 class VirtualMachineImpl;
199 } // namespace vm
200 } // namespace simgrid
201
202 using s4u_Actor             = simgrid::s4u::Actor;
203 using s4u_Barrier           = simgrid::s4u::Barrier;
204 using s4u_Comm              = simgrid::s4u::Comm;
205 using s4u_Exec              = simgrid::s4u::Exec;
206 using s4u_Host              = simgrid::s4u::Host;
207 using s4u_Link              = simgrid::s4u::Link;
208 using s4u_File              = simgrid::s4u::File;
209 using s4u_ConditionVariable = simgrid::s4u::ConditionVariable;
210 using s4u_Mailbox           = simgrid::s4u::Mailbox;
211 using s4u_Mutex             = simgrid::s4u::Mutex;
212 using s4u_Semaphore         = simgrid::s4u::Semaphore;
213 using s4u_Disk              = simgrid::s4u::Disk;
214 using s4u_NetZone           = simgrid::s4u::NetZone;
215 using s4u_VM                = simgrid::s4u::VirtualMachine;
216
217 using smx_timer_t    = simgrid::kernel::timer::Timer*;
218 using smx_actor_t    = simgrid::kernel::actor::ActorImpl*;
219 using smx_activity_t = simgrid::kernel::activity::ActivityImpl*;
220 using smx_cond_t     = simgrid::kernel::activity::ConditionVariableImpl*;
221 using smx_mailbox_t  = simgrid::kernel::activity::MailboxImpl*;
222 using smx_mutex_t    = simgrid::kernel::activity::MutexImpl*;
223 using smx_sem_t      = simgrid::kernel::activity::SemaphoreImpl*;
224 using e_smx_state_t XBT_ATTRIB_DEPRECATED_v330("Please use kernel::activity::State") = simgrid::kernel::activity::State;
225 #else
226
227 typedef struct s4u_Actor s4u_Actor;
228 typedef struct s4u_Barrier s4u_Barrier;
229 typedef struct s4u_Comm s4u_Comm;
230 typedef struct s4u_Exec s4u_Exec;
231 typedef struct s4u_Host s4u_Host;
232 typedef struct s4u_Link s4u_Link;
233 typedef struct s4u_File s4u_File;
234 typedef struct s4u_ConditionVariable s4u_ConditionVariable;
235 typedef struct s4u_Mailbox s4u_Mailbox;
236 typedef struct s4u_Mutex s4u_Mutex;
237 typedef struct s4u_Semaphore s4u_Semaphore;
238 typedef struct s4u_Disk s4u_Disk;
239 typedef struct s4u_NetZone s4u_NetZone;
240 typedef struct s4u_VM s4u_VM;
241 XBT_ATTRIB_DEPRECATED_v330("Please stop using this type alias") typedef enum kernel_activity_state e_smx_state_t;
242
243 typedef struct s_smx_timer* smx_timer_t;
244 typedef struct s_smx_actor* smx_actor_t;
245 typedef struct s_smx_activity* smx_activity_t;
246 typedef struct s_smx_cond_t* smx_cond_t;
247 typedef struct s_smx_mailbox* smx_mailbox_t;
248 typedef struct s_smx_mutex* smx_mutex_t;
249 typedef struct s_smx_sem* smx_sem_t;
250
251 #endif
252
253 /** Pointer to a SimGrid barrier object */
254 typedef s4u_Barrier* sg_bar_t;
255 /** Constant pointer to a SimGrid barrier object */
256 typedef const s4u_Barrier* const_sg_bar_t;
257 typedef s4u_Comm* sg_comm_t;
258 typedef const s4u_Comm* const_sg_comm_t;
259 typedef s4u_Exec* sg_exec_t;
260 typedef const s4u_Exec* const_sg_exec_t;
261 typedef s4u_ConditionVariable* sg_cond_t;
262 typedef const s4u_ConditionVariable* const_sg_cond_t;
263 typedef s4u_Mailbox* sg_mailbox_t;
264 typedef const s4u_Mailbox* const_sg_mailbox_t;
265 typedef s4u_Mutex* sg_mutex_t;
266 typedef const s4u_Mutex* const_sg_mutex_t;
267 typedef s4u_Semaphore* sg_sem_t;
268 typedef const s4u_Semaphore* const_sg_sem_t;
269 typedef s4u_NetZone* sg_netzone_t;
270 typedef const s4u_NetZone* const_sg_netzone_t;
271 typedef s4u_Host* sg_host_t;
272 typedef const s4u_Host* const_sg_host_t;
273 typedef s4u_Link* sg_link_t;
274 typedef const s4u_Link* const_sg_link_t;
275 typedef s4u_Disk* sg_disk_t;
276 typedef const s4u_Disk* const_sg_disk_t;
277 /** Pointer to a SimGrid file object @ingroup plugin_filesystem */
278 typedef s4u_File* sg_file_t;
279 /** Constant pointer to a SimGrid file object @ingroup plugin_filesystem */
280 typedef const s4u_File* const_sg_file_t;
281 typedef s4u_VM* sg_vm_t;
282 typedef const s4u_VM* const_sg_vm_t;
283 typedef s4u_Actor* sg_actor_t;
284 typedef const s4u_Actor* const_sg_actor_t;
285
286 typedef struct s_smx_simcall* smx_simcall_t;
287
288 /** @ingroup m_datatypes_management_details
289  * @brief Type for any simgrid size
290  */
291 typedef unsigned long long sg_size_t;
292
293 /** @ingroup m_datatypes_management_details
294  * @brief Type for any simgrid offset
295  */
296 typedef long long sg_offset_t;
297
298 /** Actor's ID, just like the classical processes' have PID in UNIX */
299 typedef long aid_t;
300
301 typedef enum {
302   SG_OK,
303   SG_ERROR_CANCELED,
304   SG_ERROR_TIMEOUT,
305   SG_ERROR_HOST,
306   SG_ERROR_NETWORK,
307   SG_ERROR_STORAGE,
308   SG_ERROR_VM
309 } sg_error_t;
310
311 #endif /* SIMGRID_TYPES_H */