Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Resolved merge "merge changes. Strange, it seems to ate pierre commit" and
[simgrid.git] / include / simgrid / platf.h
1 /* platf.h - Public interface to the SimGrid platforms                      */
2
3 /* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010, 2011. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #ifndef SG_PLATF_H
10 #define SG_PLATF_H
11
12 #include <xbt.h>                /* our toolbox */
13
14 typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
15
16 /** Defines whether a given resource is working or not */
17 typedef enum {
18   SURF_RESOURCE_ON = 1,                   /**< Up & ready        */
19   SURF_RESOURCE_OFF = 0                   /**< Down & broken     */
20 } e_surf_resource_state_t;
21
22
23 /*
24  * Platform creation functions. Instead of passing 123 arguments to the creation functions
25  * (one for each possible XML attribute), we pass structures containing them all. It removes the
26  * chances of switching arguments by error, and reduce the burden when we add a new attribute:
27  * old models can just continue to ignore it without having to update their headers.
28  *
29  * It shouldn't be too costly at runtime, provided that structures living on the stack are
30  * used, instead of malloced structures.
31  */
32
33 typedef struct {
34   char* V_host_id;                          //id
35   double V_host_power_peak;                     //power
36   int V_host_core;                          //core
37   double V_host_power_scale;                      //availability
38   tmgr_trace_t V_host_power_trace;                  //availability file
39   e_surf_resource_state_t V_host_state_initial;           //state
40   tmgr_trace_t V_host_state_trace;                  //state file
41   const char* V_host_coord;
42 } s_sg_platf_host_cbarg_t, *sg_platf_host_cbarg_t;
43
44 typedef struct {
45   const char* V_router_id;
46   const char* V_router_coord;
47 } s_sg_platf_router_cbarg_t, *sg_platf_router_cbarg_t;
48
49
50 XBT_PUBLIC(void) sg_platf_new_AS_open(const char *id, const char *mode);
51 XBT_PUBLIC(void) sg_platf_new_AS_close(void);
52
53 XBT_PUBLIC(void) sg_platf_new_host  (sg_platf_host_cbarg_t   host);
54 XBT_PUBLIC(void) sg_platf_new_router(sg_platf_router_cbarg_t router);
55
56
57 #endif                          /* SG_PLATF_H */