Thanks for your deep explaintation. It's well known that  MythTV's architecture 
with OOP thinking, It's programming  with Class of Application or Interface(my English is poor ,Maybe I can explain what I am thinking), For example, There are a lots  of Class of  Application or  Interface in  ../libmythtv:
          tv_play.h/tv_rec.h/channelbase.h/channel.h/recordedbase.h/dtvrecorder.h/
 and so on. recoderbase is base Class, it was derived by DVBRecorder/HDTVRecorder/FireWareRecorder. channelbase is base class ,it also was derived by others. So I thinks Tables as Class and Record as Object is very different from MythTV's architecture. There are only four core tables for handle  Channel/Program(i.e channel/program/record/recorded), These tables are  dependent in OS/Application/Hardware, So I define these tables as follow:
Class ChannelInfo
{
       public:
                ...
           void getChannelInfo();
           void setChannelInfo();
          
           void ChangeContrast();
           void ChangeHue();
           void ChangeBrightness();
 
           void ChannelUp();
           void ChannelDown();
          
           void CheckChannelSignal();
           ...
           datatype chanid;
           datatype channum;
           datatype callsign;
           ...
}
Class ProgramInfo
{
       public:
          ...
          void getProgramInfo();
          void setProgramInfo();
         
           ...
           datatype chanid;  //pk(chanid)
           datatype starttime; //pk(starttime)
           ...
}
Class RecordInfo
{
       public:
          ...
          void getRecordInfo();
          void setRecordInfo();
          ...
          void getRecType();
          void getRecStatus();
          void getRecPrority();
          ...
          void isTimeslot();
          void isSameProgram();
          void isConflicting();
}
My question is how can I to define the methond of Class, That is my assume on above NOT ture for really.
Thanks
David Rudder <[EMAIL PROTECTED]> 写道:
I think this is a good idea, but it's not as easy as all that. This is a
fairly standard programming problem. The problem with simply modeling
each table as a class is that it doesn't take into account foreign
relationships. For instance, with the CardInput class, you'd want to be
able to store a reference to the CaptureCard class, not just an integer
CardID. So, you can say "CaptureCard card = cardInput.getCaptureCard()"
and it will return a CaptureCard. Rather than having to say "CaptureCard
card = database.loadCaptureCard(cardInput.getCaptureCard())".

I guess what I'm saying is that I think you have a good beginning here
to make some very useful automation code, but you have to be careful
that your classes match the data model, or it'll end up being difficult
to use.

There's a Java project called Druid (available in Sourceforge. Search
google for it). It'll automatically generate C, C++ or Java code for
representing the data. It should help you get started.

Feel free to email me off line at
drig at noses dot org

-Dave

P.S. I also have 45 tables.
P.P.S. Once you have the database modeled in code, what are you going to
do with it? Any cool tools?

YanJun Lu wrote:

> Hi All
> How many tables in your database of MythTV,As for me, There are 45
> tables in my MySQL. I have a idea for that create Class for every
> tables, Well, I mean that we can think table as an Class and record of
> table as Object, So do my idea is good?
>
> ------------------------------------------------------------------------
> 雅虎1G免费邮箱百分百防垃圾信
> 雅虎助手-搜索、杀毒、防骚扰
>
>------------------------------------------------------------------------
>
>_______________________________________________
>mythtv-users mailing list
>[email protected]
>http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>
>


_______________________________________________
mythtv-users mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com

_______________________________________________
mythtv-users mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users

Reply via email to