X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/a645478a85d9a74bbe9a98353ea585992131ae05..e9ae1f101b5418c0ba2e6c9d86b23c12f0140982:/include/stg/resetable.h diff --git a/include/stg/resetable.h b/include/stg/resetable.h deleted file mode 100644 index f3cecac8..00000000 --- a/include/stg/resetable.h +++ /dev/null @@ -1,70 +0,0 @@ - /* - $Revision: 1.9 $ - $Date: 2010/03/11 14:42:04 $ - $Author: faust $ - */ - -/* - * Copyright (c) 2001 by Peter Simons . - * All rights reserved. - */ - -#ifndef RESETABLE_VARIABLE_H -#define RESETABLE_VARIABLE_H - -// This is a wrapper class about variables where you want to keep -// track of whether it has been assigened yet or not. - -#include - -template -class RESETABLE -{ -public: - typedef T value_type; - - RESETABLE() : value(), is_set(false) {} - - RESETABLE(const RESETABLE & rvalue) - : value(rvalue.value), - is_set(rvalue.is_set) - {} - - RESETABLE(const value_type& val) : value(val), is_set(true) {} - - RESETABLE & operator=(const RESETABLE & rvalue) - { - value = rvalue.value; - is_set = rvalue.is_set; - return *this; - } - - RESETABLE & operator=(const value_type& rhs) - { - value = rhs; - is_set = true; - return *this; - } - - const value_type & const_data() const throw() { return value; } - value_type & data() throw() { return value; } - operator const value_type&() const throw() { return value; } - bool res_empty() const throw() { return !is_set; } - void reset() throw() { is_set = false; } - -private: - value_type value; - bool is_set; -}; - -template -std::ostream & operator<<(std::ostream & o, const RESETABLE & v); - -template -inline -std::ostream & operator<<(std::ostream & o, const RESETABLE & v) -{ - return o << v.const_data(); -} - -#endif // RESETABLE_VARIABLE_H