Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SGpp] make ROUTING_HOST_LEVEL private. That was painful
[simgrid.git] / include / simgrid / host.h
1 /* Copyright (c) 2013-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef SIMGRID_HOST_H_
8 #define SIMGRID_HOST_H_
9
10 #include <xbt/dict.h>
11 SG_BEGIN_DECL()
12
13 typedef xbt_dictelm_t sg_host_t;
14 XBT_PUBLIC(sg_host_t) sg_host_by_name(const char *name);
15 XBT_PUBLIC(sg_host_t) sg_host_by_name_or_create(const char *name);
16 static XBT_INLINE char *sg_host_get_name(sg_host_t host){
17         return host->key;
18 }
19
20 #ifdef __cplusplus
21 #define DEFINE_EXTERNAL_CLASS(klass) class klass;
22 class Cpu;
23 #else
24 #define DEFINE_EXTERNAL_CLASS(klass) typedef struct klass klass;
25 #endif
26
27 // ========== MSG Layer ==============
28 typedef struct s_msg_host_priv *msg_host_priv_t;
29 msg_host_priv_t sg_host_msg(sg_host_t host);
30 XBT_PUBLIC(void) sg_host_msg_set(sg_host_t host, msg_host_priv_t priv);
31 XBT_PUBLIC(void) sg_host_msg_destroy(sg_host_t host);
32
33 // ========== Simix layer =============
34 typedef struct s_smx_host_priv *smx_host_priv_t;
35 XBT_PUBLIC(smx_host_priv_t) sg_host_simix(sg_host_t host);
36 XBT_PUBLIC(void) sg_host_simix_set(sg_host_t host, smx_host_priv_t priv);
37 XBT_PUBLIC(void) sg_host_simix_destroy(sg_host_t host);
38
39 // ========== SURF CPU ============
40 DEFINE_EXTERNAL_CLASS(Cpu);
41 typedef Cpu *surf_cpu_t;
42 typedef Cpu *CpuPtr;
43 XBT_PUBLIC(surf_cpu_t) sg_host_surfcpu(sg_host_t host);
44 XBT_PUBLIC(void) sg_host_surfcpu_set(sg_host_t host, surf_cpu_t cpu);
45 XBT_PUBLIC(void) sg_host_surfcpu_destroy(sg_host_t host);
46
47 // ========== RoutingEdge ============
48 typedef struct RoutingEdge *RoutingEdgePtr;
49 XBT_PUBLIC(RoutingEdgePtr) sg_host_edge(sg_host_t host);
50 XBT_PUBLIC(void) sg_host_edge_set(sg_host_t host, RoutingEdgePtr edge);
51 XBT_PUBLIC(void) sg_host_edge_destroy(sg_host_t host, int do_callback);
52
53
54 // Module initializer. Won't survive the conversion to C++. Hopefully.
55 XBT_PUBLIC(void) sg_host_init(void);
56
57 SG_END_DECL()
58
59 #endif /* SIMGRID_HOST_H_ */