comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to get _overloadSize to return N_Dimensions=0?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
How to get _overloadSize to return N_Dimensions=0? [message #88661] Tue, 27 May 2014 15:40 Go to previous message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
I was wondering how it is possible to get the _overloadSize function to return N_DIMENSION=0 when there are no dimensions. Below is an example. The docs seems like it reports N_Elements(Size(input, /DIMENSIONS), which is not correct for an undefined variable...

IDL> print, size(!Null, /N_DIMENSIONS)
0
IDL> .run test_olsize__define
Dimensions: [0]
N_Elements: 0
N_Dimensions: 1


;-----------------------------------------------
function test_olSize::_OverloadSize
return, size(*self.value, /N_DIMENSIONS)
end

function test_olSize::Init
compile_opt strictarr
self.value = Ptr_New(/ALLOCATE_HEAP)
return, 1
end

pro test_olSize__define
class = {test_olSize, $
inherits IDL_Object, $
value: ptr_new()}
end


;Main level test program
myObj = Obj_New('Test_olSize')
print, 'Dimensions: ', '[' + strjoin(strtrim(size(myObj, /DIMENSIONS), 2), ', ') + ']'
print, 'N_Elements: ', strtrim(size(myObj, /N_ELEMENTS), 2)
print, 'N_Dimensions: ', strtrim(size(myObj, /N_DIMENSIONS), 2)
obj_destroy, myObj

end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: constant time cadence
Next Topic: alignment of y-axis tick labels

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:57:51 PDT 2025

Total time taken to generate the page: 0.00185 seconds