Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
608bd91ea00f857bb3d62f68e629c0ef751f351d
[simgrid.git] / include / simgrid / forward.h
1 /* Copyright (c) 2004-2020. 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::Actor */
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 class ExecSeq; // FIXME: hide this class in implementation
60 class ExecPar; // FIXME: hide this class in implementation
61
62 class Host;
63
64 class Io;
65 /** Smart pointer to a simgrid::s4u::Io */
66 using IoPtr = boost::intrusive_ptr<Io>;
67 XBT_PUBLIC void intrusive_ptr_release(Io* i);
68 XBT_PUBLIC void intrusive_ptr_add_ref(Io* i);
69
70 class Link;
71
72 class Mailbox;
73
74 class Mutex;
75 XBT_PUBLIC void intrusive_ptr_release(const Mutex* m);
76 XBT_PUBLIC void intrusive_ptr_add_ref(const Mutex* m);
77 /**
78  * @beginrst
79  * Smart pointer to a :cpp:type:`simgrid::s4u::Mutex`
80  * @endrst
81  */
82 using MutexPtr = boost::intrusive_ptr<Mutex>;
83
84 class NetZone;
85 class VirtualMachine;
86 class File;
87
88 class Semaphore;
89 /** Smart pointer to a simgrid::s4u::Semaphore */
90 using SemaphorePtr = boost::intrusive_ptr<Semaphore>;
91 XBT_PUBLIC void intrusive_ptr_release(Semaphore* m);
92 XBT_PUBLIC void intrusive_ptr_add_ref(Semaphore* m);
93
94 class Disk;
95 class Storage;
96 } // namespace s4u
97
98 namespace config {
99 template <class T> class Flag;
100 }
101
102 namespace kernel {
103 class EngineImpl;
104 namespace actor {
105 class ActorImpl;
106 typedef boost::intrusive_ptr<ActorImpl> ActorImplPtr;
107
108 // What's executed as an actor code:
109 typedef std::function<void()> ActorCode;
110 // Create an ActorCode from the parameters parsed in the XML file (or elsewhere)
111 typedef std::function<ActorCode(std::vector<std::string> args)> ActorCodeFactory;
112 } // namespace actor
113
114 namespace activity {
115   class ActivityImpl;
116   enum class State;
117   typedef boost::intrusive_ptr<ActivityImpl> ActivityImplPtr;
118   XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
119   XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
120
121   class ConditionVariableImpl;
122
123   class CommImpl;
124   typedef boost::intrusive_ptr<CommImpl> CommImplPtr;
125   class ExecImpl;
126   typedef boost::intrusive_ptr<ExecImpl> ExecImplPtr;
127   class IoImpl;
128   typedef boost::intrusive_ptr<IoImpl> IoImplPtr;
129   class MutexImpl;
130   typedef boost::intrusive_ptr<MutexImpl> MutexImplPtr;
131   class RawImpl;
132   typedef boost::intrusive_ptr<RawImpl> RawImplPtr;
133   class SemaphoreImpl;
134   typedef boost::intrusive_ptr<SemaphoreImpl> SemaphoreImplPtr;
135   class SleepImpl;
136   typedef boost::intrusive_ptr<SleepImpl> SleepImplPtr;
137
138   class MailboxImpl;
139 }
140 namespace context {
141 class Context;
142 class ContextFactory;
143 } // namespace context
144 namespace lmm {
145 class Element;
146 class Variable;
147 class Constraint;
148 class ConstraintLight;
149 class System;
150 }
151 namespace resource {
152 class Action;
153 class Cpu;
154 class Model;
155 class Resource;
156 class CpuModel;
157 class NetworkModel;
158 class LinkImpl;
159 class NetworkAction;
160 class DiskImpl;
161 class DiskModel;
162 class StorageImpl;
163 class StorageType;
164 class StorageModel;
165 }
166 namespace routing {
167 class ClusterCreationArgs;
168 class LinkCreationArgs;
169 class NetPoint;
170 class NetZoneImpl;
171 class RouteCreationArgs;
172 }
173 namespace profile {
174 class Event;
175 class FutureEvtSet;
176 class Profile;
177 } // namespace profile
178 } // namespace kernel
179 namespace simix {
180   class Host;
181   class Timer;
182 }
183 namespace surf {
184   class HostImpl;
185   class HostModel;
186 }
187 namespace mc {
188 class CommunicationDeterminismChecker;
189 class SimcallInspector;
190 }
191 namespace vm {
192 class VMModel;
193 class VirtualMachineImpl;
194 } // namespace vm
195 } // namespace simgrid
196
197 typedef simgrid::s4u::Actor s4u_Actor;
198 typedef simgrid::s4u::Barrier s4u_Barrier;
199 typedef simgrid::s4u::Comm s4u_Comm;
200 typedef simgrid::s4u::Host s4u_Host;
201 typedef simgrid::s4u::Link s4u_Link;
202 typedef simgrid::s4u::File s4u_File;
203 typedef simgrid::s4u::ConditionVariable s4u_ConditionVariable;
204 typedef simgrid::s4u::Mailbox s4u_Mailbox;
205 typedef simgrid::s4u::Mutex s4u_Mutex;
206 typedef simgrid::s4u::Semaphore s4u_Semaphore;
207 typedef simgrid::s4u::Disk s4u_Disk;
208 typedef simgrid::s4u::Storage s4u_Storage;
209 typedef simgrid::s4u::NetZone s4u_NetZone;
210 typedef simgrid::s4u::VirtualMachine s4u_VM;
211
212 typedef simgrid::simix::Timer* smx_timer_t;
213 typedef simgrid::kernel::actor::ActorImpl* smx_actor_t;
214 typedef simgrid::kernel::activity::ActivityImpl* smx_activity_t;
215 typedef simgrid::kernel::activity::ConditionVariableImpl* smx_cond_t;
216 typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
217 typedef simgrid::kernel::activity::MutexImpl* smx_mutex_t;
218 typedef simgrid::kernel::activity::SemaphoreImpl* smx_sem_t;
219 typedef simgrid::kernel::activity::State e_smx_state_t;
220 #else
221
222 typedef struct s4u_Actor s4u_Actor;
223 typedef struct s4u_Barrier s4u_Barrier;
224 typedef struct s4u_Comm s4u_Comm;
225 typedef struct s4u_Host s4u_Host;
226 typedef struct s4u_Link s4u_Link;
227 typedef struct s4u_File s4u_File;
228 typedef struct s4u_ConditionVariable s4u_ConditionVariable;
229 typedef struct s4u_Mailbox s4u_Mailbox;
230 typedef struct s4u_Mutex s4u_Mutex;
231 typedef struct s4u_Semaphore s4u_Semaphore;
232 typedef struct s4u_Disk s4u_Disk;
233 typedef struct s4u_Storage s4u_Storage;
234 typedef struct s4u_NetZone s4u_NetZone;
235 typedef struct s4u_VM s4u_VM;
236 typedef enum kernel_activity_state e_smx_state_t;
237
238 typedef struct s_smx_timer* smx_timer_t;
239 typedef struct s_smx_actor* smx_actor_t;
240 typedef struct s_smx_activity* smx_activity_t;
241 typedef struct s_smx_cond_t* smx_cond_t;
242 typedef struct s_smx_mailbox* smx_mailbox_t;
243 typedef struct s_smx_mutex* smx_mutex_t;
244 typedef struct s_smx_sem* smx_sem_t;
245
246 #endif
247
248 /** Pointer to a SimGrid barrier object */
249 typedef s4u_Barrier* sg_bar_t;
250 /** Constant pointer to a SimGrid barrier object */
251 typedef const s4u_Barrier* const_sg_bar_t;
252 typedef s4u_Comm* sg_comm_t;
253 typedef const s4u_Comm* const_sg_comm_t;
254 typedef s4u_ConditionVariable* sg_cond_t;
255 typedef const s4u_ConditionVariable* const_sg_cond_t;
256 typedef s4u_Mailbox* sg_mailbox_t;
257 typedef const s4u_Mailbox* const_sg_mailbox_t;
258 typedef s4u_Mutex* sg_mutex_t;
259 typedef const s4u_Mutex* const_sg_mutex_t;
260 typedef s4u_Semaphore* sg_sem_t;
261 typedef const s4u_Semaphore* const_sg_sem_t;
262 typedef s4u_NetZone* sg_netzone_t;
263 typedef const s4u_NetZone* const_sg_netzone_t;
264 typedef s4u_Host* sg_host_t;
265 typedef const s4u_Host* const_sg_host_t;
266 typedef s4u_Link* sg_link_t;
267 typedef const s4u_Link* const_sg_link_t;
268 typedef s4u_Disk* sg_disk_t;
269 typedef const s4u_Disk* const_sg_disk_t;
270 typedef s4u_Storage* sg_storage_t;
271 typedef const s4u_Storage* const_sg_storage_t;
272 typedef s4u_File* sg_file_t;
273 typedef const s4u_File* const_sg_file_t;
274 typedef s4u_VM* sg_vm_t;
275 typedef const s4u_VM* const_sg_vm_t;
276 typedef s4u_Actor* sg_actor_t;
277 typedef const s4u_Actor* const_sg_actor_t;
278
279 typedef struct s_smx_simcall* smx_simcall_t;
280
281 /** @ingroup m_datatypes_management_details
282  * @brief Type for any simgrid size
283  */
284 typedef unsigned long long sg_size_t;
285
286 /** @ingroup m_datatypes_management_details
287  * @brief Type for any simgrid offset
288  */
289 typedef long long sg_offset_t;
290
291 /** Actor's ID, just like the classical processes' have PID in UNIX */
292 typedef long aid_t;
293
294 #endif /* SIMGRID_TYPES_H */