/src/wrappers/common/attic/dummy_factory.e
Specman e | 46 lines | 24 code | 5 blank | 17 comment | 0 complexity | 9eb7d9dfc25c2d0d020e26fad26743b4 MD5 | raw file
1note 2 description: 3 "Dummy wrapper factory." 4 copyright: 5 "(C) 2007 Paolo Redaelli" 6 license: 7 "LGPL v2 or later" 8 date: 9 "$Date:$" 10 revision: 11 "$Revision:$" 12class DUMMY_FACTORY[ITEM_ -> SHARED_C_STRUCT] 13 -- A dummy factory. 14 -- Sometimes a wrapper needs to convert an Eiffel COLLECTION into 15 -- an array to be passed to the underlying C library; it is useful 16 -- for such an array to be implemented using C_ARRAY or 17 -- NULL_TERMINATED_C_ARRAY, so that memory is handled by the 18 -- Garbage Collector. They expect to be provided a wrapper factory 19 -- to use to create new wrappers from the pointers retrieved from 20 -- the underlying array. 21 -- Note: when the called function take property of the array it 22 -- wrond to use this design. The Eiffel GC will soon free the array 23 -- robbing it from function it belongs to and causing horrible 24 -- crashes. Paolo 2007-09-02 25 26inherit 27 WRAPPER_FACTORY[ITEM_] 28 29create {ANY} 30 default_create 31 32feature {WRAPPER, WRAPPER_HANDLER} -- Implementation 33 wrapper (a_pointer: POINTER): ITEM_ 34 -- A wrapper for the structure at address `a_pointer'. The 35 -- default implementation in WRAPPER_FACTORY "creates" a new 36 -- wrapper every time, while their heirs are allowed to 37 -- provide implementations that fits better to peculiar 38 -- memory handling schemes. 39 do 40 raise(do_not_use_me) 41 end 42 43feature {} -- 44 do_not_use_me: STRING "DUMMY_FACTORY.wrapper invoked. This is clearly a bug; please inform the developers of the application, since another implementation of WRAPPER_FACTORY should be used." 45 46end -- class DUMMY_FACTORY