monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file/directory/device services


From: Jan-Henrik Haukeland
Subject: Re: file/directory/device services
Date: Wed, 06 Aug 2003 14:52:36 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Civil Service, linux)

Martin Pala <address@hidden> writes:

>>
>>                      Common_T
>>          /         |                    |                 \
>>        /           |                    |                   \
>>      /             |                    |                     \
>> File_T   Device_T   Process_T   Directory_T
>>    \               |                    |                     /
>>      \             |                    |                   /
>>        \           |                    |                 /
>>                      Service_T
>>
>
> It is possible to refactor monit to work as outlined in above diagram,
> but i think it is not necessary.

No, I do not think it's necessary, as you so well put it; Service_T is
the virtual-class and depending on how it is instantiated it takes the
form of one of the other types. Remember this type, (I think it was
you who added it) in Service_T:

  int  task;       /**< Monitored task type */

This defines the object type. Think of typedef struct myservice { } as
the class and an instance of this ADT (Abstract Data Type) is the
object type. E.g. in this example the instance is a process type;

  Service_T process;
  NEW(process)
  /* process->task= TASK_PROCESS; */

and in this example, the instance of Service_T is a device object:

  Service_T device;
  NEW(device)
  /* process->task= TASK_DEVICE; */


BTW, since we are speaking OO, I think the variable *task* should be
renamed to *type* and the defines from TASK_XXX to TYPE_XXX because
what they actually do is define the (Service_T) object TYPE.

#define TYPE_DEVICE        0
#define TYPE_DIRECTORY     1
#define TYPE_FILE          2
#define TYPE_PROCESS       3

Let's change it!

-- 
Jan-Henrik Haukeland




reply via email to

[Prev in Thread] Current Thread [Next in Thread]