Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Bov3 by
Diff: Stack.h
- Revision:
- 18:eb675df59c7f
diff -r 3dac99cf2b89 -r eb675df59c7f Stack.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Stack.h Mon Jun 30 07:01:58 2014 +0000 @@ -0,0 +1,51 @@ +/* + * mbed library for Stack + * Copyright (c) 2011 Hiroshi Suga + * Released under the MIT License: http://mbed.org/license/mit + */ + +/** @file Stack.h + * @brief Stack + */ + +#ifndef Stack_H +#define Stack_H + +#include "mbed.h" + +/** Stack class + */ +template <class T> +class Stack { +public: + /** init Stack class + * @param p_size size of stack + */ + Stack (int p_size); + ~Stack (); + + /** push to stack + * @param dat data + * @return data or -1:error + */ + int push (T dat); + + /** pop from stack + * @param dat data + * @return 0:ok / -1:error + */ + int pop (T *dat); + + int read (T *dat); + + void clear (); + int available (); + int use (); + +private: + T *buf; + int size; + int addr; +}; + +#endif