Main Page | Class List | File List | Class Members | File Members

libmsg_gp_types.h

Go to the documentation of this file.
00001 /* libmsg_gp_types.h : general purpose types */
00002 
00003 /* 
00004    Copyright (C) 2005 Fabrice Ducos <fabrice.ducos@icare.univ-lille1.fr>
00005    This file is part of the LibXRIT Library.
00006 
00007    The LibXRIT Library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Lesser General Public
00009    License as published by the Free Software Foundation; either
00010    version 2.1 of the License, or (at your option) any later version.
00011 
00012    The LibXRIT Library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Lesser General Public License for more details.
00016 
00017    You should have received a copy of the GNU Lesser General Public
00018    License along with the LibXRIT Library; if not, write to the Free
00019    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00020    02111-1307 USA.
00021 
00022 */
00023 
00024 /* Fabrice Ducos, CGTD Icare 2005, fabrice.ducos@icare.univ-lille1.fr*/
00025 
00031 #ifndef _LIBMSG_GP_TYPES_H
00032 #define _LIBMSG_GP_TYPES_H
00033 
00034 #include <stdint.h>
00035 
00036 #define PACKED __attribute((packed)) /* FIXME: gcc specific */
00037 
00038 /* BOOLEAN */
00039 typedef uint8_t BOOLEAN_BYTE;
00040 typedef uint16_t BOOLEAN_SHORT;
00041 typedef uint32_t BOOLEAN_LONG;
00042 
00043 /* ENUMERATED */
00044 typedef uint8_t ENUMERATED_BYTE;
00045 typedef uint16_t ENUMERATED_SHORT;
00046 typedef uint32_t ENUMERATED_LONG;
00047 #define ENUMERATED_SIZE(nbits) struct { uint8_t val[nbits/8]; } PACKED
00048 
00049 /* UNSIGNED INTEGER */
00050 typedef uint8_t UNSIGNED_BYTE;
00051 typedef uint16_t UNSIGNED_SHORT;
00052 typedef uint32_t UNSIGNED;
00053 typedef uint64_t UNSIGNED_DOUBLE;
00054 #define UNSIGNED_SIZE(nbits) struct { uint8_t val[nbits/8]; } PACKED
00055 
00056 /* SIGNED INTEGER */
00057 typedef int8_t INTEGER_BYTE;
00058 typedef int16_t INTEGER_SHORT;
00059 typedef int32_t INTEGER;
00060 typedef int64_t INTEGER_DOUBLE;
00061 #define INTEGER_SIZE(nbits) struct { uint8_t val[nbits/8]; } PACKED /* usage of unsigned type uint8_t is NOT buggy, we could use any byte-long type (important here is type length) */
00062 
00063 /* REAL */
00064 typedef float REAL;
00065 typedef double REAL_DOUBLE;
00066 
00067 /* BIT_STRING */
00068 #define BITSTRING_SIZE(nbits) struct { unsigned val : (nbits); } PACKED
00069 
00070 /* OCTETSTRING */
00071 // VARIABLE_OCTETSTRING_SIZE(maxlength)
00072 
00073 /* CHARACTER_STRING */
00074 // VARIABLE_CHARACTERSTRING_SIZE(maxlength)
00075 // CHARACTERSTRING_SIZE(pfc)
00076 
00077 /* ABSOLUTE TIME */
00078 typedef struct _TIME_CDS_SHORT {
00079   uint8_t val[6];
00080 } TIME_CDS_SHORT;
00081 #define TIME_CUC_SIZE(coarse, fine) struct { uint8_t val[coarse+fine]; } PACKED
00082 typedef struct _TIME_CDS_EXPANDED {
00083   uint8_t val[10];
00084 } TIME_CDS_EXPANDED PACKED;
00085 typedef struct _TIME_GENERALIZED {
00086   uint8_t val[15];
00087 } TIME_GENERALIZED PACKED;
00088 typedef struct _TIME_GENERALIZED_EXPANDED {
00089   uint8_t val[25];
00090 } TIME_GENERALIZED_EXPANDED PACKED;
00091 
00092 typedef ENUMERATED_SHORT GP_SC_ID; /* spacecraft identification */
00093 
00094 #endif

Generated on Wed Oct 19 13:55:57 2005 for LibXRIT by doxygen 1.3.5