The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: Re: Class Inheritance


  • Subject: Re: Re: Class Inheritance
  • From: Stuart Booth
  • Date: Sun, 25 May 2003 10:27:00 +0000

On Sun, 25 May 2003 08:17:54 -0000, "Patrick Lidstone"
<<a
href="/group/xAP_developer/post?postID=46Uit01ZtIn_emDWKirEdF0uEPJ3FsvT34fhs73dadYa_XqBtdjd94RF7UaNhR4WYDxuc5eKOCcFaoyJ3lXN">patrick@l...</a>>
wrote:

>- What about polymorphism? For example,
>audio.transport might have the concept of vol=10 on a 0-10 scale
>whereas the derived class audio.transport.merdian might redefine the
>concept of vol to be measured in db).

I suppose in some respects this is implicit in the device. It gets the
volume value in its native (base class) scale (0-10), and interprets
it as it sees fit anyway.

But here I'm thinking that the derived class schema alters the
formatting/meaning of the value entirely.

It seems complex.

If I had an app that looked for xAP-Audio.Transport messages, on
receiving a xAP-Audio.Transport.Meridian, I guess I'd look for
recognisable xAP-Audio.Transport message blocks, and ignore the rest,
assuming they're for the derived class(es).

Thus a xAP-Audio.Transport.Meridian message block would not be valid
in a xAP message body where the Class was "xAP-Audio.Transport".

If we have a class such as this:

Class = xAP-Audio.Transport

Audio.Transport
{
Command=[play  pause  stop  next  prev]
--- mandatory
Param=[on  off]
--- optional (depending on Command/Hardware support)
}

And we derive a class:

Class = xAP-Audio.Transport.Meridian

In this, lets just say for sake of example (I don't know if this is
supported) that the Meridian transport supports a 10s preview of each
track before skipping to the next one.

I want to add this new command to the Audio.Transport message block.
Is that appropriate?

Audio.Transport
{
Command=[<Inherited>  scan]
}

Ie "Scan" is a new command added to the block parameter.

>- What about multiple inheritance? (Where a new class is derived by
>combining two base classes, not simply by extending one base class).

So the schema for Class = Sexy.HiFi includes both xAP-Audio.Audio and
xAP-Audio.Transport, and thus all message blocks from each Class are
valid in Sexy.HiFi and can thus be combined into the one message?

That seems straightforward to me, but I wonder how often we'll be
doing multiple blocks in a single xAP message?

I support it in my framework of course, but so far I don't use it that
often. Then again, having just said that, I actually do use it in my
OSD app. This picks up events and sends a xAP-OSD.Display message with
a SliMP3 block *and* a TiVo block.

I'm just wondering if we could achieve the same effect sticking with
single inheritance, but via multiple messages, thus avoiding adding
features that we can already achieve some other way.

>- For MI: Can this be done through multiple message bodies, where the
>message body reflects base classes? I think this might actually be
>quite neat.
>
>E.g. A multifunction device with a cd player and amp could
>encapsulate a base class from xap.transport and xap.audio in the same
>message by using multiple blocks.
>
>xap-header
>{
>..
>class=sexy.hifi
>..
>}
>
>xap.transport
>{
>...
>mode=play
>...
>}
>
>xap.audio
>{
>...
>vol=10
>...
>}
>
>Obviously the base classes could be extended if required to allow for
>xap.audio.sexy.hifi and xap.transport.sexy.hifi derivatives, each
>inheriting from the respective base classes.
>
>Am I barking mad, or is this actually a very cunning scheme? There
>has to be flaw, it's all too tidy!

S
--
Stuart Booth
xAPFramework.net - a reusable xAP framework for .net

<a href="http://www.xapframework.net/";>http://www.xapframework.net/</a>
<a
href="/group/xAP_developer/post?postID=mT3vZ9yQVqhvLGPjuvHyMdzss3Z8w10ilTJSwEeZw4yGL6DKZwML-XmfPVibg9Yxbv5Rag-ABGx2zTeZztHN">stuart@x...</a>





xAP_Development Main Index | xAP_Development Thread Index | xAP_Development Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.