Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

VrTypes.h

Go to the documentation of this file.
00001 /* -*- Mode: c++ -*- */
00002 /*
00003  * Copyright 2001 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio 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
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  */
00022 /*
00023  *  Copyright 1997 Massachusetts Institute of Technology
00024  * 
00025  *  Permission to use, copy, modify, distribute, and sell this software and its
00026  *  documentation for any purpose is hereby granted without fee, provided that
00027  *  the above copyright notice appear in all copies and that both that
00028  *  copyright notice and this permission notice appear in supporting
00029  *  documentation, and that the name of M.I.T. not be used in advertising or
00030  *  publicity pertaining to distribution of the software without specific,
00031  *  written prior permission.  M.I.T. makes no representations about the
00032  *  suitability of this software for any purpose.  It is provided "as is"
00033  *  without express or implied warranty.
00034  * 
00035  */
00036 
00037 #ifndef _VRTYPES_H_
00038 #define _VRTYPES_H_
00039 
00040 extern "C" {
00041 #include <stdio.h>
00042 #include <stdlib.h>
00043 #include <unistd.h>
00044 #include <sys/types.h>
00045 #include <sys/stat.h>
00046 #include <sys/time.h>
00047 #include <errno.h>
00048 #include <signal.h>
00049 #include <string.h>
00050 #include <assert.h>
00051 #ifdef THREADS
00052 #include<pthread.h>
00053 #endif
00054 }
00055 #include <VrComplex.h>
00056 #include <VrCycleCount.h>
00057 #include <iostream>
00058 using std::cout;
00059 using std::cerr;
00060 using std::cin;
00061 using std::endl;
00062 
00063 class VrSigProc;
00064 
00065 #ifdef THREADS
00066 #define MUTEX_DECLARE(A) pthread_mutex_t A;
00067 #define MUTEX_INIT(M)    do { if (pthread_mutex_init(M, 0) != 0) abort (); } while (0)
00068 #define MUTEX_LOCK(M)    pthread_mutex_lock(M)
00069 #define MUTEX_UNLOCK(M)  pthread_mutex_unlock(M)
00070 #define THREAD_GETSPECIFIC(A)   pthread_getspecific(A)
00071 extern pthread_key_t startMarkedModule;
00072 //#define YIELD() {sched_yield();}
00073 #define YIELD() {usleep(1);}
00074 
00075 #else
00076 
00077 #define MUTEX_DECLARE(A)
00078 #define MUTEX_INIT(M)   do {} while (0)
00079 #define MUTEX_LOCK(M)   do {} while (0)
00080 #define MUTEX_UNLOCK(M) do {} while (0)
00081 #define THREAD_GETSPECIFIC(A)   (A)
00082 extern VrSigProc *startMarkedModule;
00083 #define YIELD() {usleep(1);}
00084 
00085 #endif
00086 
00087 typedef unsigned int port;
00088 
00089 enum {VR_NULL,VR_CHAR,VR_UCHAR,VR_SHORT,VR_INT,VR_FLOAT,VR_COMPLEX,
00090       VR_FRAME,VR_IPPACKET};
00091 
00092 class VrNullData {
00093   int tmp;
00094 public:
00095   VrNullData() {}
00096   VrNullData(int x) :tmp(x) {}
00097 };
00098 
00099 typedef char bit;
00100 typedef VrComplex complex;
00101 typedef unsigned char uchar;
00102 typedef unsigned long long VrSampleIndex;
00103 typedef struct {
00104         VrSampleIndex index;
00105         unsigned long size;
00106 } VrSampleRange; 
00107 
00108 inline int is_complex(VrComplex x) { return 1;}
00109 inline int is_complex(float x) { return 0;}
00110 inline int is_complex(double x) { return 0;}
00111 inline int is_complex(int x) { return 0;}
00112 inline int is_complex(char x) { return 0;}
00113 inline int is_complex(short x) { return 0;}
00114 #endif

Generated on Tue Mar 15 23:48:04 2005 for GNU Radio by  doxygen 1.4.0