view intercom/cirbuf.h @ 6:22a74b01a099 default tip

implement more meaningful test program
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 16:14:50 +0200
parents c6c5a16ce2f2
children
line wrap: on
line source

/* cirbuf.h
 *
 * Copyright (C) DFS Deutsche Flugsicherung (2004, 2005). 
 * All Rights Reserved.
 *
 * Circular Buffers
 *
 * Version 0.2
 */
#ifndef _CIRBUF_H

// must be multiple of FRAGSIZE and FRAMESIZE
#define CIRBUFSIZE	(WIDEB*2*80*8*2)  

/* circular buffer for FRAGSIZE to FRAMESIZE conversion with 
 * overrun/underrun */
class CIRBUF {
  char buf[CIRBUFSIZE];         // must be multiple of FRAGSIZE and FRAMESIZE
  int in;
  int out;
  int len;

public:
   CIRBUF();
  void init();
  int push(char *from, int size);
  int pop(char *to, int size);
  int getlen() {
    return len;
  }
};

#define _CIRBUF_H
#endif

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.