Logo AND Algorithmique Numérique Distribuée

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