00001 /* 00002 The lestes compiler suite 00003 Copyright (C) 2002, 2003, 2004, 2005 Miroslav Tichy 00004 Copyright (C) 2002, 2003, 2004, 2005 Petr Zika 00005 Copyright (C) 2002, 2003, 2004, 2005 Vojtech Hala 00006 Copyright (C) 2002, 2003, 2004, 2005 Jiri Kosina 00007 Copyright (C) 2002, 2003, 2004, 2005 Pavel Sanda 00008 Copyright (C) 2002, 2003, 2004, 2005 Jan Zouhar 00009 Copyright (C) 2002, 2003, 2004, 2005 Rudolf Thomas 00010 00011 This program is free software; you can redistribute it and/or modify 00012 it under the terms of the GNU General Public License as published by 00013 the Free Software Foundation; version 2 of the License. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 See the full text of the GNU General Public License version 2, and 00021 the limitations in the file doc/LICENSE. 00022 00023 By accepting the license the licensee waives any and all claims 00024 against the copyright holder(s) related in whole or in part to the 00025 work, its use, and/or the inability to use it. 00026 00027 */ 00028 #ifndef lestes__std__mem___simple_pointer_hh___included 00029 #define lestes__std__mem___simple_pointer_hh___included 00030 00031 /*! \file 00032 \brief Wrapped bare pointer. 00033 00034 Declaration of simple_pointer class representing wrapped bare pointer. 00035 \author pt 00036 */ 00037 #include <lestes/package.hh> 00038 00039 package(lestes); 00040 package(std); 00041 package(mem); 00042 00043 // forward declaration to avoid cycle 00044 class keystone; 00045 00046 /*! 00047 \brief Wrapped bare pointer. 00048 00049 Wrapper for bare pointer to keystone class. Provides only set and get operations. 00050 Used as common ancestor of all srp template classes. 00051 It should occupy only the space needed for the wrapped pointer. 00052 */ 00053 class simple_pointer { 00054 public: 00055 //! Marks the keystone pointed to. 00056 void gc_mark(void) const; 00057 //! Destructs the simple pointer. 00058 inline ~simple_pointer(void); 00059 protected: 00060 //! Creates the simple pointer without initializing. 00061 inline simple_pointer(void); 00062 //! Returns the bare pointer. 00063 inline keystone *pointer_get(void) const; 00064 //! Sets the bare pointer. 00065 inline void pointer_set(keystone *a_pointer); 00066 private: 00067 //! The wrapped bare pointer. 00068 keystone *pointer; 00069 //! Hides copy constructor. 00070 simple_pointer(const simple_pointer &); 00071 //! Hides assignment operator. 00072 simple_pointer &operator=(const simple_pointer &); 00073 }; 00074 00075 /*! 00076 Creates the simple pointer. Intentionally, does not initialize. 00077 */ 00078 simple_pointer::simple_pointer(void) 00079 { 00080 } 00081 00082 /*! 00083 Destructs the simple pointer. Leaves the referenced object unchanged. 00084 */ 00085 inline simple_pointer::~simple_pointer(void) 00086 { 00087 } 00088 00089 /*! 00090 Returns the underlying bare pointer. 00091 \return The bare pointer. 00092 */ 00093 inline keystone *simple_pointer::pointer_get(void) const { 00094 return pointer; 00095 } 00096 00097 /*! 00098 Sets the underlying bare pointer. 00099 \param a_pointer The new bare pointer. 00100 */ 00101 inline void simple_pointer::pointer_set(keystone *a_pointer) { 00102 pointer = a_pointer; 00103 } 00104 00105 end_package(mem); 00106 end_package(std); 00107 end_package(lestes); 00108 #endif 00109 /* vim: set ft=lestes : */
1.5.1-20070107