/src/wrappers/common/library/eiffel_owned.e
Specman e | 46 lines | 38 code | 7 blank | 1 comment | 3 complexity | 7964f5b3c8469a53b7c3747a0b2cab6f MD5 | raw file
1note 2 description: 3 "A wrapper for a C object whose memory is handled by the Eiffel library " 4 copyright: 5 "[ 6 Copyright (C) 2008-2017: Paolo Redaelli 7 8 This library is free software; you can redistribute it and/or 9 modify it under the terms of the GNU Lesser General Public License 10 as published by the Free Software Foundation; either version 2.1 of 11 the License, or (at your option) any later version. 12 13 This library is distributed in the hope that it will be useful, but 14 WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 Lesser General Public License for more details. 17 18 You should have received a copy of the GNU Lesser General Public 19 License along with this library; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 21 02110-1301 USA 22 ]" 23deferred class EIFFEL_OWNED 24 -- A wrapper for a C object whose memory is handled by the Eiffel library 25 26inherit 27 WRAPPER 28 undefine from_external_pointer 29 end 30 31insert 32 STDLIB_EXTERNALS 33 34feature {} -- Disposing 35 dispose 36 do 37 debug 38 print(once "Disposing an Eiffel owned ") 39 print(generating_type) 40 print(once " and freeing handle.%N") 41 end 42 free(handle) -- Note: free(NULL) is a NOP and has no side-effects 43 handle := default_pointer -- make sure the C object is not used anymore 44 end 45 46end -- class EIFFEL_OWNED