Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[Data description]
[simgrid.git] / src / gras / DataDesc / ddt_remote.c
1 /* $Id$ */
2
3 /* ddt_remote - Stuff needed to get datadescs about remote hosts            */
4
5 /* Authors: Olivier Aumage, Martin Quinson                                  */
6 /* Copyright (C) 2003, 2004 the GRAS posse.                                 */
7
8 /* This program is free software; you can redistribute it and/or modify it
9    under the terms of the license (GNU LGPL) which comes with this package. */
10
11 #include "DataDesc/datadesc_private.h"
12
13
14 /***
15  *** Table of all known architectures. 
16  ***/
17
18 const gras_arch_sizes_t gras_arch_sizes[gras_arch_count] = {
19   {"i386",   0,   {1,2,4,4,8,   4,4,   4,8}}
20 };
21
22 /**
23  * gras_free_ddt:
24  *
25  * gime that memory back, dude. I mean it.
26  */
27 static void gras_free_ddt(void *ddt) {
28   gras_datadesc_type_t *type= (gras_datadesc_type_t *)ddt;
29   
30   if (type) {
31     gras_ddt_free(&type);
32   }
33 }
34
35 /**
36  * gras_ddt_register:
37  *
38  * Add a type to a type set
39  */
40 gras_error_t gras_ddt_register(gras_datadesc_type_t *type) {
41   return gras_set_add(gras_datadesc_set_local,
42                       (gras_set_elm_t*)type,
43                        &gras_free_ddt);
44
45 }
46
47 /**
48  * gras_datadesc_by_name:
49  *
50  * Retrieve a type from its name
51  */
52 gras_error_t gras_datadesc_by_name(const char            *name,
53                                    gras_datadesc_type_t **type) {
54   return gras_set_get_by_name(gras_datadesc_set_local,
55                               name,(gras_set_elm_t**)type);
56 }
57
58 /**
59  * gras_datadesc_by_id:
60  *
61  * Retrieve a type from its code
62  */
63 gras_error_t gras_datadesc_by_id(long int               code,
64                                  gras_datadesc_type_t **type) {
65   return gras_set_get_by_id(gras_datadesc_set_local,
66                             code,(gras_set_elm_t**)type);
67 }
68
69 /**
70  * gras_dd_convert_elm:
71  *
72  * Convert the element described by @type comming from architecture @r_arch.
73  * The data to be converted is stored in @src, and is to be stored in @dst.
74  * Both pointers may be the same location if no resizing is needed.
75  */
76 gras_error_t
77 gras_dd_convert_elm(gras_datadesc_type_t *type,
78                     int r_arch, 
79                     void *src, void *dst) {
80
81   if (r_arch != GRAS_THISARCH) 
82     RAISE_UNIMPLEMENTED;
83
84   return no_error;
85 }
86
87 /**
88  * gras_arch_selfid:
89  *
90  * returns the ID of the architecture the process is running on
91  */
92 int
93 gras_arch_selfid(void) {
94   return GRAS_THISARCH;
95 }