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

Home » Public Forums » archive » Re: Call a method from a class
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Call a method from a class [message #47555] Thu, 16 February 2006 10:06
vcarlos is currently offline  vcarlos
Messages: 21
Registered: February 2006
Junior Member
Antonio: Thanks for the explanation. I was asking about "static
methods", although I think a singleton could also help me. Maybe my
question was a little bit confusing :)

David: thanks for the tips :)

Vinicius
Re: Call a method from a class [message #47563 is a reply to message #47555] Thu, 16 February 2006 04:43 Go to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
vcarlos wrote:
> Hi all,
>
> In some languages is possible to call methods from a Class, instead of
> a object. For instance, the class Messager could call a method
> reportError, message. This is useful when I just need a "instance" of
> that object and everybody takes advantage of that (I think that is
> similar to Singleton design pattern). Is there any way to the same in
> IDL? Or I should set up some kind of library procedures/functions and
> use through my program?
>
> Thanks a lot
>
> Vinicius
>

Take care betweem "call methods from a Class" and a "Singleton".

The Singleton is a design pattern and it means that only exists one
instance of an object in the whole application.

a= OBJ_NEW('Some_thing')

b= OBJ_NEW('Some_thing')

'a' and 'b' are the same reference.


"Call methods of a class" is known in other languages as "static
methods" or "class methods" and it means you don't need to create an
instance to invoque a methods, only put the name of the class and the
method.

d = Image.getData()


I hope this will be usefull for you,
bye :)


--
-----------------------------------------------------
Antonio Santiago P�rez
( email: santiago<<at>>grahi.upc.edu )
( www: http://www.grahi.upc.edu/santiago )
( www: http://asantiago.blogsite.org )
-----------------------------------------------------
Grup de Recerca Aplicada en Hidrometeorologia (GRAHI)
Universitat Polit�cnica de Catalunya
Barcelona - SPAIN
-----------------------------------------------------
http://www.grahi.upc.edu
-----------------------------------------------------
Re: Call a method from a class [message #47586 is a reply to message #47563] Wed, 15 February 2006 11:41 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
vcarlos writes:

> In some languages is possible to call methods from a Class, instead of
> a object. For instance, the class Messager could call a method
> reportError, message. This is useful when I just need a "instance" of
> that object and everybody takes advantage of that (I think that is
> similar to Singleton design pattern). Is there any way to the same in
> IDL? Or I should set up some kind of library procedures/functions and
> use through my program?

IDL's object programming abilities are not want you might
call "state of the art." "Middling" might be a better word.
In any case, there is no good way to create a singleton
object, although you will find many fascinating discussions
of how you might fake a singleton object if you search the
archives of this newsgroup with the term "singleton object".

Most of them boil down to either (1) saving an object
in a system variable you create for this purpose, or
(2) tricking up some kind of fancy common block name
that only you are ever likely to think of. I have used
both successfully, although I usually go for the common
block method, since it is so much fun to think up those
names!

A third approach is to include messaging functionality
in a low-level object that is inherited by every other
object that needs this functionality. This is a little more
work, but also works well.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: "Stopped on unknown instruction" and DLMs
Next Topic: Re: Leer archivos ASCII

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

Current Time: Wed Oct 08 13:05:16 PDT 2025

Total time taken to generate the page: 0.00577 seconds