Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
document ConditionVariables in the new way
[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
15 namespace simgrid {
16
17 namespace s4u {
18 class Activity;
19
20 class Actor;
21 /** Smart pointer to a simgrid::s4u::Actor */
22 typedef boost::intrusive_ptr<Actor> ActorPtr;
23 XBT_PUBLIC void intrusive_ptr_release(const Actor* actor);
24 XBT_PUBLIC void intrusive_ptr_add_ref(const Actor* actor);
25
26 class Barrier;
27 /** Smart pointer to a simgrid::s4u::Barrier */
28 typedef boost::intrusive_ptr<Barrier> BarrierPtr;
29 XBT_PUBLIC void intrusive_ptr_release(Barrier* m);
30 XBT_PUBLIC void intrusive_ptr_add_ref(Barrier* m);
31
32 class Comm;
33 /** Smart pointer to a simgrid::s4u::Comm */
34 typedef boost::intrusive_ptr<Comm> CommPtr;
35 XBT_PUBLIC void intrusive_ptr_release(Comm* c);
36 XBT_PUBLIC void intrusive_ptr_add_ref(Comm* c);
37
38 class ConditionVariable;
39 /** @beginrst
40  * Smart pointer to a :cpp:type:`simgrid::s4u::ConditionVariable`
41  * @endrst
42  */
43 typedef boost::intrusive_ptr<ConditionVariable> ConditionVariablePtr;
44 XBT_PUBLIC void intrusive_ptr_release(const ConditionVariable* c);
45 XBT_PUBLIC void intrusive_ptr_add_ref(const ConditionVariable* c);
46
47 class Engine;
48
49 class Exec;
50 /** Smart pointer to a simgrid::s4u::Exec */
51 typedef boost::intrusive_ptr<Exec> ExecPtr;
52 XBT_PUBLIC void intrusive_ptr_release(Exec* e);
53 XBT_PUBLIC void intrusive_ptr_add_ref(Exec* e);
54 class ExecSeq;
55 typedef boost::intrusive_ptr<ExecSeq> ExecSeqPtr;
56 class ExecPar;
57 typedef boost::intrusive_ptr<ExecPar> ExecParPtr;
58
59 class Host;
60
61 class Io;
62 /** Smart pointer to a simgrid::s4u::Io */
63 typedef boost::intrusive_ptr<Io> IoPtr;
64 XBT_PUBLIC void intrusive_ptr_release(Io* i);
65 XBT_PUBLIC void intrusive_ptr_add_ref(Io* i);
66
67 class Link;
68
69 class Mailbox;
70
71 class Mutex;
72 XBT_PUBLIC void intrusive_ptr_release(const Mutex* m);
73 XBT_PUBLIC void intrusive_ptr_add_ref(const Mutex* m);
74 /**
75  * @beginrst
76  * Smart pointer to a :cpp:type:`simgrid::s4u::Mutex`
77  * @endrst
78  */
79 typedef boost::intrusive_ptr<Mutex> MutexPtr;
80
81 class NetZone;
82 class VirtualMachine;
83 class File;
84
85 class Semaphore;
86 /** Smart pointer to a simgrid::s4u::Semaphore */
87 typedef boost::intrusive_ptr<Semaphore> SemaphorePtr;
88 XBT_PUBLIC void intrusive_ptr_release(Semaphore* m);
89 XBT_PUBLIC void intrusive_ptr_add_ref(Semaphore* m);
90
91 class Disk;
92 class Storage;
93 } // namespace s4u
94
95 namespace config {
96 template <class T> class Flag;
97 }
98
99 namespace kernel {
100 class EngineImpl;
101 namespace actor {
102 class ActorImpl;
103 typedef boost::intrusive_ptr<ActorImpl> ActorImplPtr;
104 } // namespace actor
105
106 namespace activity {
107   class ActivityImpl;
108   enum class State;
109   typedef boost::intrusive_ptr<ActivityImpl> ActivityImplPtr;
110   XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity);
111   XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity);
112
113   class ConditionVariableImpl;
114
115   class CommImpl;
116   typedef boost::intrusive_ptr<CommImpl> CommImplPtr;
117   class ExecImpl;
118   typedef boost::intrusive_ptr<ExecImpl> ExecImplPtr;
119   class IoImpl;
120   typedef boost::intrusive_ptr<IoImpl> IoImplPtr;
121   class MutexImpl;
122   typedef boost::intrusive_ptr<MutexImpl> MutexImplPtr;
123   class RawImpl;
124   typedef boost::intrusive_ptr<RawImpl> RawImplPtr;
125   class SemaphoreImpl;
126   typedef boost::intrusive_ptr<SemaphoreImpl> SemaphoreImplPtr;
127   class SleepImpl;
128   typedef boost::intrusive_ptr<SleepImpl> SleepImplPtr;
129
130   class MailboxImpl;
131 }
132 namespace context {
133 class Context;
134 class ContextFactory;
135 } // namespace context
136 namespace lmm {
137 class Element;
138 class Variable;
139 class Constraint;
140 class ConstraintLight;
141 class System;
142 }
143 namespace resource {
144 class Action;
145 class Cpu;
146 class Model;
147 class Resource;
148 class CpuModel;
149 class NetworkModel;
150 class LinkImpl;
151 class NetworkAction;
152 class DiskImpl;
153 class DiskModel;
154 class StorageImpl;
155 class StorageType;
156 class StorageModel;
157 }
158 namespace routing {
159 class ClusterCreationArgs;
160 class LinkCreationArgs;
161 class NetPoint;
162 class NetZoneImpl;
163 class RouteCreationArgs;
164 }
165 namespace profile {
166 class Event;
167 class FutureEvtSet;
168 class Profile;
169 } // namespace profile
170 } // namespace kernel
171 namespace simix {
172   class Host;
173   class Timer;
174 }
175 namespace surf {
176   class HostImpl;
177   class HostModel;
178 }
179 namespace mc {
180 class CommunicationDeterminismChecker;
181 class SimcallInspector;
182 }
183 namespace vm {
184 class VMModel;
185 class VirtualMachineImpl;
186 } // namespace vm
187 } // namespace simgrid
188
189 typedef simgrid::s4u::Actor s4u_Actor;
190 typedef simgrid::s4u::Barrier s4u_Barrier;
191 typedef simgrid::s4u::Host s4u_Host;
192 typedef simgrid::s4u::Link s4u_Link;
193 typedef simgrid::s4u::File s4u_File;
194 typedef simgrid::s4u::ConditionVariable s4u_ConditionVariable;
195 typedef simgrid::s4u::Mutex s4u_Mutex;
196 typedef simgrid::s4u::Semaphore s4u_Semaphore;
197 typedef simgrid::s4u::Disk s4u_Disk;
198 typedef simgrid::s4u::Storage s4u_Storage;
199 typedef simgrid::s4u::NetZone s4u_NetZone;
200 typedef simgrid::s4u::VirtualMachine s4u_VM;
201 typedef boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> smx_activity_t;
202
203 typedef simgrid::simix::Timer* smx_timer_t;
204 typedef simgrid::kernel::actor::ActorImpl* smx_actor_t;
205 typedef simgrid::kernel::activity::ConditionVariableImpl* smx_cond_t;
206 typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
207 typedef simgrid::kernel::activity::MutexImpl* smx_mutex_t;
208 typedef simgrid::kernel::activity::SemaphoreImpl* smx_sem_t;
209 typedef simgrid::kernel::activity::State e_smx_state_t;
210 #else
211
212 typedef struct s4u_Actor s4u_Actor;
213 typedef struct s4u_Barrier s4u_Barrier;
214 typedef struct s4u_Host s4u_Host;
215 typedef struct s4u_Link s4u_Link;
216 typedef struct s4u_File s4u_File;
217 typedef struct s4u_ConditionVariable s4u_ConditionVariable;
218 typedef struct s4u_Mutex s4u_Mutex;
219 typedef struct s4u_Semaphore s4u_Semaphore;
220 typedef struct s4u_Disk s4u_Disk;
221 typedef struct s4u_Storage s4u_Storage;
222 typedef struct s4u_NetZone s4u_NetZone;
223 typedef struct s4u_VM s4u_VM;
224 typedef struct kernel_Activity* smx_activity_t;
225 typedef enum kernel_activity_state e_smx_state_t;
226
227 typedef struct s_smx_timer* smx_timer_t;
228 typedef struct s_smx_actor* smx_actor_t;
229 typedef struct s_smx_cond_t* smx_cond_t;
230 typedef struct s_smx_mailbox* smx_mailbox_t;
231 typedef struct s_smx_mutex* smx_mutex_t;
232 typedef struct s_smx_sem* smx_sem_t;
233
234 #endif
235
236 typedef s4u_Barrier* sg_bar_t;
237 typedef const s4u_Barrier* const_sg_bar_t;
238 typedef s4u_ConditionVariable* sg_cond_t;
239 typedef const s4u_ConditionVariable* const_sg_cond_t;
240 typedef s4u_Mutex* sg_mutex_t;
241 typedef const s4u_Mutex* const_sg_mutex_t;
242 typedef s4u_Semaphore* sg_sem_t;
243 typedef const s4u_Semaphore* const_sg_sem_t;
244 typedef s4u_NetZone* sg_netzone_t;
245 typedef const s4u_NetZone* const_sg_netzone_t;
246 typedef s4u_Host* sg_host_t;
247 typedef const s4u_Host* const_sg_host_t;
248 typedef s4u_Link* sg_link_t;
249 typedef const s4u_Link* const_sg_link_t;
250 typedef s4u_Disk* sg_disk_t;
251 typedef const s4u_Disk* const_sg_disk_t;
252 typedef s4u_Storage* sg_storage_t;
253 typedef const s4u_Storage* const_sg_storage_t;
254 typedef s4u_File* sg_file_t;
255 typedef const s4u_File* const_sg_file_t;
256 typedef s4u_VM* sg_vm_t;
257 typedef const s4u_VM* const_sg_vm_t;
258 typedef s4u_Actor* sg_actor_t;
259 typedef const s4u_Actor* const_sg_actor_t;
260
261 typedef struct s_smx_simcall* smx_simcall_t;
262
263 /** @ingroup m_datatypes_management_details
264  * @brief Type for any simgrid size
265  */
266 typedef unsigned long long sg_size_t;
267
268 /** @ingroup m_datatypes_management_details
269  * @brief Type for any simgrid offset
270  */
271 typedef long long sg_offset_t;
272
273 /** Actor's ID, just like the classical processes' have PID in UNIX */
274 typedef long aid_t;
275
276 #endif /* SIMGRID_TYPES_H */