chia-hsun wu / Mbed 2 deprecated Boboobooov10

Dependencies:   mbed-rtos mbed

Fork of Boboobooov4 by kao yi

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Stack.h Source File

Stack.h

Go to the documentation of this file.
00001 /*
00002  * mbed library for Stack
00003  * Copyright (c) 2011 Hiroshi Suga
00004  * Released under the MIT License: http://mbed.org/license/mit
00005  */
00006 
00007 /** @file Stack.h
00008  * @brief Stack
00009  */
00010 
00011 #ifndef Stack_H
00012 #define Stack_H
00013 
00014 #include "mbed.h"
00015 
00016 /** Stack class
00017  */
00018 template <class T>
00019 class Stack {
00020 public:
00021     /** init Stack class
00022      * @param p_size size of stack
00023      */
00024     Stack (int p_size);
00025     ~Stack ();
00026 
00027     /** push to stack
00028      * @param dat data
00029      * @return data or -1:error
00030      */
00031     int push (T dat);
00032 
00033     /** pop from stack
00034      * @param dat data
00035      * @return 0:ok / -1:error
00036      */
00037     int pop (T *dat);
00038 
00039     int read (T *dat);
00040 
00041     void clear ();
00042     int available ();
00043     int use ();
00044 
00045 private:
00046     T *buf;
00047     int size;
00048     int addr;
00049 };
00050 
00051 #endif