]> 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 20feb8facc9bdd28c05685de777c69a190824430..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
@@ -12,6 +58,7 @@
 
 #include <fres_contract_idl.h>
 
+/** State of the block in container. */
 enum fres_block_state {
        /** There is no such block in the container. */
        FRES_BLOCK_EMPTY,
@@ -23,21 +70,52 @@ enum fres_block_state {
        FRES_BLOCK_STREAM
 };
 
+#define FRES_BLOCK_FLAG_ENDIAN_m 0x0001
+#define FRES_BLOCK_LITTLE_ENDIAN 0x0001
+
+/** 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 {
-               void *data; /**< Pointer to data according to param_type */
-               fres_block_stream stream; /**< Unserialized (unknown) data */
+               /** Pointer to data according to param_type
+                * (state == FRES_BLOCK_DATA) */
+               void *data;
+               
+               /** Unserialized (unknown) data
+                * (state == FRES_BLOCK_STREAM) */
+               fres_block_stream_t stream;
        } 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