]> rtime.felk.cvut.cz Git - frescor/frsh.git/blobdiff - fres/contract/fres_container_internal.h
Fixed the number of available container blocks
[frescor/frsh.git] / fres / contract / fres_container_internal.h
index 13173c9e54e45098d1986b32669cd872230d4a69..19ac8a8ad05f55ff1ec5bac4626d36deb329759c 100644 (file)
@@ -1,10 +1,56 @@
+/**************************************************************************/
+/* ---------------------------------------------------------------------- */
+/* 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_internal.h
  * @author Michal Sojka <sojkam1@fel.cvut.cz>
  * 
  * @brief  Internal interface to fres_container.
  *
- * This header should only be included by files in frsh/cm library.
+ * This header should only be included by files in frsh/fres library.
  * 
  */
 #ifndef FRES_CONTAINER_INTERNAL_H
@@ -27,15 +73,19 @@ enum fres_block_state {
 #define FRES_BLOCK_FLAG_ENDIAN_m 0x0001
 #define FRES_BLOCK_LITTLE_ENDIAN 0x0001
 
-/**< Unserialized (unknown) contracts blocks */
+/** Unserialized (unknown) contracts blocks */
 typedef struct fres_block_stream {
        void *data; /**< Serialized data */
        CORBA_unsigned_short flags; /**< Flags: bit 1 - little endian */
        size_t length;              /**< Length of the stream */
 } fres_block_stream_t;
 
+/**
+ * Contract block.
+ * 
+ */
 struct fres_block {
-       enum fres_block_state state;
+       enum fres_block_state state; /**< State of the block */
        union {
                /** Pointer to data according to param_type
                 * (state == FRES_BLOCK_DATA) */
@@ -47,13 +97,25 @@ struct fres_block {
        } u;
 };
 
+/**
+ * Container for contract blocks.
+ *
+ * This is currently implemented as fixed size array of ::fres_block
+ * structures, which means that the container cannot contain multiple
+ * blocks of the same type.
+ */
 struct fres_container {
-       struct fres_block blocks[FRES_NUM_BLOCKS];
+       struct fres_block blocks[__FRES_NUM_BLOCKS];
 };
 
+/** Checks wheder the @a type is valid number of the block */
 #define FRES_BLOCK_TYPE_VALID(type)    \
-       ((type) < FRES_NUM_BLOCKS &&    \
+       ((type) < __FRES_NUM_BLOCKS &&  \
         (type) >= 0)
 
+int
+fres_block_duplicate(struct fres_block *dest,
+                    const struct fres_block *source,
+                    enum fres_block_type type);
 
 #endif