+/**************************************************************************/
+/* ---------------------------------------------------------------------- */
+/* Copyright (C) 2006 - 2008 FRESCOR consortium partners: */
+/* */
+/* Universidad de Cantabria, SPAIN */
+/* University of York, UK */
+/* Scuola Superiore Sant'Anna, ITALY */
+/* Kaiserslautern University, GERMANY */
+/* Univ. Politécnica Valencia, SPAIN */
+/* Czech Technical University in Prague, CZECH REPUBLIC */
+/* ENEA SWEDEN */
+/* Thales Communication S.A. FRANCE */
+/* Visual Tools S.A. SPAIN */
+/* Rapita Systems Ltd UK */
+/* Evidence ITALY */
+/* */
+/* See http://www.frescor.org for a link to partners' websites */
+/* */
+/* FRESCOR project (FP6/2005/IST/5-034026) is funded */
+/* in part by the European Union Sixth Framework Programme */
+/* The European Union is not liable of any use that may be */
+/* made of this code. */
+/* */
+/* */
+/* This file is part of FRSH (FRescor ScHeduler) */
+/* */
+/* FRSH is free software; you can redistribute it and/or modify it */
+/* under terms of the GNU General Public License as published by the */
+/* Free Software Foundation; either version 2, or (at your option) any */
+/* later version. FRSH is distributed in the hope that it will be */
+/* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
+/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
+/* General Public License for more details. You should have received a */
+/* copy of the GNU General Public License along with FRSH; see file */
+/* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
+/* Cambridge, MA 02139, USA. */
+/* */
+/* As a special exception, including FRSH header files in a file, */
+/* instantiating FRSH generics or templates, or linking other files */
+/* with FRSH objects to produce an executable application, does not */
+/* by itself cause the resulting executable application to be covered */
+/* by the GNU General Public License. This exception does not */
+/* however invalidate any other reasons why the executable file might be */
+/* covered by the GNU Public License. */
+/**************************************************************************/
+
/**
* @file fres_container.h
* @author Michal Sojka <sojkam1@fel.cvut.cz>
/*============================================================================*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Identification of different contract blocks.
*
FRES_BLOCK_RESOURCE,
FRES_BLOCK_BASIC,
FRES_BLOCK_TIMING_REQS,
+ FRES_BLOCK_CSECTS,
FRES_BLOCK_SPARE_CAPACITY,
+ FRES_BLOCK_POWER_MANAGEMENT,
FRES_BLOCK_DUMMY_SCHED, /**< See resources/dummy/res_dummy_idl.idl */
+ FRES_BLOCK_DISK_SCHED, /** < See resources/disk_bfq/res_disk_idl.idl */
FRES_BLOCK_CLUSTER_TREE_TRAFFIC, /**< resources/cluster_tree/cluster_tree_idl.idl */
FRES_BLOCK_FWP_SCHED,
FRES_BLOCK_ITEM_NODES, /**< resources/item/item_idl.idl */
- FRES_NUM_BLOCKS
+ FRES_BLOCK_FPGA, /**< resources/fpga/res_fpga_idl.idl */
+ FRES_BLOCK_FWP,
+ __FRES_NUM_BLOCKS,
};
-typedef CORBA_boolean (fres_block_serialize_fnc_t)(CDR_Codec *codec, const void *block_data);
-typedef CORBA_boolean (fres_block_deserialize_fnc_t)(CDR_Codec *codec, void **block_data);
-
+typedef CORBA_boolean (fres_block_serialize_fnc_t)(FORB_CDR_Codec *codec, const void *block_data);
+typedef CORBA_boolean (fres_block_deserialize_fnc_t)(FORB_CDR_Codec *codec, void **block_data);
+
+/**
+ * Description of contract blocks.
+ */
struct fres_block_desc {
const char *name; /**< Name of the block for use fres_container_to_string() */
size_t size; /**< Size of the block (used by fres_block_duplicate_default() and fres_container_ptr_deserialize()) */
fres_block_serialize_fnc_t *serialize;
fres_block_deserialize_fnc_t *deserialize;
void *(*duplicate)(enum fres_block_type type, const void *block_data);
+ int (*to_string)(char *dest, size_t size, enum fres_block_type type, const void *block_data);
};
struct fres_container *
enum fres_block_type type);
void *
-fres_container_get_block(struct fres_container *container,
- enum fres_block_type type);
+fres_container_get_block(const struct fres_container *container,
+ enum fres_block_type type);
+/**
+ * Macro which defines type-safe container "accessor" functions for
+ * various blocks.
+ *
+ * This macro declares the following inline functions:
+ * - fres_container_add_<type>
+ * - fres_container_get_<type>
+ * - fres_container_del_<type>
+ *
+ * These functions are equivalent to fres_container_add_block(),
+ * fres_container_del_block() and fres_container_get_block() with
+ * appropriate parameters.
+ */
#define FRES_CONTAINER_ACCESSOR(TYPE, type) \
static inline int \
fres_container_add_##type(struct fres_container *container, \
container, FRES_BLOCK_##TYPE, block); \
} \
static inline fres_block_##type * \
- fres_container_get_##type(struct fres_container *container) \
+ fres_container_get_##type(const struct fres_container *container) \
{ \
- return fres_container_get_block( \
+ return (fres_block_##type *)fres_container_get_block( \
container, FRES_BLOCK_##TYPE); \
} \
static inline void \
FRES_CONTAINER_ACCESSOR(RESOURCE, resource)
FRES_CONTAINER_ACCESSOR(BASIC, basic)
FRES_CONTAINER_ACCESSOR(TIMING_REQS, timing_reqs)
+FRES_CONTAINER_ACCESSOR(CSECTS, csects)
FRES_CONTAINER_ACCESSOR(SPARE_CAPACITY, spare_capacity)
+FRES_CONTAINER_ACCESSOR(POWER_MANAGEMENT, power_management)
int
fres_block_register(enum fres_block_type, const struct fres_block_desc *desc);
int
fres_container_to_string(char *dest, size_t size, const struct fres_container *c);
+int
+fres_container_get_num_blocks(const struct fres_container *c);
+
+int fres_container_merge(struct fres_container *dest,
+ const struct fres_container *src);
+
+int fres_container_copy(struct fres_container *dest,
+ const struct fres_container *src);
+
+#ifdef __cplusplus
+} /* extern "C"*/
+#endif
+
#endif