Re: [Evolution-hackers] [Camel] How can I get a reference to the store class from another class?



On Tue, 2005-09-13 at 04:31 -0600, Susarla Parthasarathi wrote:
> On Tue, 2005-09-13 at 10:26 +0000, Jules Colding  wrote:
> > On Tue, 2005-09-13 at 04:08 -0600, Susarla Parthasarathi wrote:
> > > On Tue, 2005-09-13 at 09:56 +0000, Jules Colding  wrote:
> > > > Hi,
> > > > 
> > > > There is a connect method in the transport class. I would like to use
> > > > the connect method that I implemented in the store class. How do I get a
> > > > reference to that one from a CamelService?
> > > If you want to use the same session, just implementing the send_to
> > > method should do.
> > > You could get the service object from CamelTransport and further get the
> > > pointer to the CamelStore. Getting a session from the store should be
> > > easy.
> > 
> > Something like:
> > 
> >    CAMEL_SERVICE_CLASS(parent_class)->connect(service, ex);
> > 
> > from within the transport connect() method?
> > 
> yup. you could do it. Should be no problem. Guess its a clean way to do
> it.

Partha, what are you saying here?

parent_class.connect() will only call the super-class method.

Transport doesn't derive from Store, they both derive from Service.

So if you want to share the connect() implementation from both classes,
then it must be implemented in a sharable manner, and not separately.

Hence my original comment about merging the Transport and Store objects.
Infact ideally they would probably both be optional interfaces on a
Service rather than separate classes.

FWIW, I hope to be writing a decent amount of Camel documentation in the
coming weeks; a lot of it needs much more documentation beyond the
comments in the code, and many of the implementations to use as examples
aren't very clean.





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