X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 06 May 2013 04:45 PM by  anon
programmatically determine whether function argument is an array of objects or a List of objects
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
06 May 2013 04:45 PM
    How can it be determined whether an argument is an array of objects or a List of objects (potentially empty or of length=1)?

    Deleted User



    New Member


    Posts:
    New Member


    --
    07 May 2013 09:12 AM
    I've figured out how to do it for my specific case: ENVI> clusterLog = ClusterLog() ENVI> print, obj_class(List(ClusterLog)) LIST ENVI> print, obj_class([clusterLog]) CLUSTERLOGGER As well, I could use size(expression, /type) to first determine whether the argument is an object or array of objects.

    Deleted User



    New Member


    Posts:
    New Member


    --
    07 May 2013 09:16 AM
    You can also use the functions ISA or OBJ_ISA.

    Deleted User



    New Member


    Posts:
    New Member


    --
    07 May 2013 10:13 AM
    You can also use the functions ISA or OBJ_ISA. Thanks. OBJ_ISA is much better (no need to call size(expression,/type) first). ENVI> print, obj_isa(List([clusterLog]), 'LIST') 1 ENVI> print, obj_isa([clusterLog], 'LIST') 0 ENVI> print, obj_isa([], 'LIST') 0
    You are not authorized to post a reply.