comp.lang.ada
 help / color / mirror / Atom feed
* Please - has anyone got a mixed Ada/C++ sample project they could share?
@ 2017-02-24 16:50 john
  2017-02-24 17:34 ` joakimds
  2017-02-24 22:33 ` Simon Wright
  0 siblings, 2 replies; 6+ messages in thread
From: john @ 2017-02-24 16:50 UTC (permalink / raw)


Hi,

I know this is a bit of a cheek (see http://dictionary.cambridge.org/dictionary/english/cheek, the "Behaviour" item if you're not familiar with the term) asking, but has anyone got a really noddy GNAT Programming Studio project that shows something like the Observer pattern implemented in mixed C++ and Ada?

I'd be particularly interested in one where (if you consider this diagram - http://java.dzone.com/sites/all/files/observer_pattern.PNG) the Subject and Observer interfaces are defined as C++ abstract base classes (i.e. provide only pure virtual functions and no members), the ConcreteSubject is [probably] in C++, and ConcreteObserver in Ada with an Ada main procedure.

It's been a long time since I used Ada properly and also a long time since I've been in a position where there's even a vague chance I could encourage people to think about it, but now might be one of those times if I could show an example of how we might be able to use Ada to interface to one of our suppliers' large masses of C++ code. Unfortunately though, I'm way too rusty on Ada to be able to do this with little effort so I hoped it might be something that one of you guys might have knocked up to play with..

Any help would be very gratefully appreciated.

John

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Please - has anyone got a mixed Ada/C++ sample project they could share?
  2017-02-24 16:50 Please - has anyone got a mixed Ada/C++ sample project they could share? john
@ 2017-02-24 17:34 ` joakimds
  2017-03-03 13:08   ` john
  2017-02-24 22:33 ` Simon Wright
  1 sibling, 1 reply; 6+ messages in thread
From: joakimds @ 2017-02-24 17:34 UTC (permalink / raw)


Dear John,

The following code snippet in Ada might be of interest to you:
https://github.com/joakim-strandberg/circular_dependencies_between_objects/tree/master/ada12/src

Best regards,
Joakim

Den fredag 24 februari 2017 kl. 17:50:45 UTC+1 skrev jo...@mccabe.org.uk:
> Hi,
> 
> I know this is a bit of a cheek (see http://dictionary.cambridge.org/dictionary/english/cheek, the "Behaviour" item if you're not familiar with the term) asking, but has anyone got a really noddy GNAT Programming Studio project that shows something like the Observer pattern implemented in mixed C++ and Ada?
> 
> I'd be particularly interested in one where (if you consider this diagram - http://java.dzone.com/sites/all/files/observer_pattern.PNG) the Subject and Observer interfaces are defined as C++ abstract base classes (i.e. provide only pure virtual functions and no members), the ConcreteSubject is [probably] in C++, and ConcreteObserver in Ada with an Ada main procedure.
> 
> It's been a long time since I used Ada properly and also a long time since I've been in a position where there's even a vague chance I could encourage people to think about it, but now might be one of those times if I could show an example of how we might be able to use Ada to interface to one of our suppliers' large masses of C++ code. Unfortunately though, I'm way too rusty on Ada to be able to do this with little effort so I hoped it might be something that one of you guys might have knocked up to play with..
> 
> Any help would be very gratefully appreciated.
> 
> John


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Please - has anyone got a mixed Ada/C++ sample project they could share?
  2017-02-24 16:50 Please - has anyone got a mixed Ada/C++ sample project they could share? john
  2017-02-24 17:34 ` joakimds
@ 2017-02-24 22:33 ` Simon Wright
  2017-03-03 13:03   ` john
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Wright @ 2017-02-24 22:33 UTC (permalink / raw)


john@mccabe.org.uk writes:

> I'd be particularly interested in one where (if you consider this
> diagram - http://java.dzone.com/sites/all/files/observer_pattern.PNG)
> the Subject and Observer interfaces are defined as C++ abstract base
> classes (i.e. provide only pure virtual functions and no members), the
> ConcreteSubject is [probably] in C++, and ConcreteObserver in Ada with
> an Ada main procedure.

As I understand it, ConcreteSubject.notify() will end up calling
ConcreteObserver.update() for registered observers, which will then know
to get subjectState from the ConcreteSubject. Perhaps subjectState needs
to be publicly visible for this to work? or there are unstated public
operations?

Is Subject abstract? I'd expect there to be some implementation of those
operations somewhere, in Subject would be natural.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Please - has anyone got a mixed Ada/C++ sample project they could share?
  2017-02-24 22:33 ` Simon Wright
@ 2017-03-03 13:03   ` john
  2017-03-03 13:40     ` Simon Wright
  0 siblings, 1 reply; 6+ messages in thread
From: john @ 2017-03-03 13:03 UTC (permalink / raw)


On Friday, 24 February 2017 22:33:16 UTC, Simon Wright  wrote:
> john@... writes:
> 
> > I'd be particularly interested in one where (if you consider this
> > diagram - http://java.dzone.com/sites/all/files/observer_pattern.PNG)
> > the Subject and Observer interfaces are defined as C++ abstract base
> > classes (i.e. provide only pure virtual functions and no members), the
> > ConcreteSubject is [probably] in C++, and ConcreteObserver in Ada with
> > an Ada main procedure.
> 
> As I understand it, ConcreteSubject.notify() will end up calling
> ConcreteObserver.update() for registered observers, which will then know
> to get subjectState from the ConcreteSubject. Perhaps subjectState needs
> to be publicly visible for this to work? or there are unstated public
> operations?
> 
> Is Subject abstract? I'd expect there to be some implementation of those
> operations somewhere, in Subject would be natural.

Thanks Simon, but I think you might be reading too much into that - it was only to give an idea of the sort of thing I was looking for.

John


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Please - has anyone got a mixed Ada/C++ sample project they could share?
  2017-02-24 17:34 ` joakimds
@ 2017-03-03 13:08   ` john
  0 siblings, 0 replies; 6+ messages in thread
From: john @ 2017-03-03 13:08 UTC (permalink / raw)


On Friday, 24 February 2017 17:34:50 UTC, joak...@kth.se  wrote:
> Dear John,
> 
> The following code snippet in Ada might be of interest to you:
> https://github.com/joakim-strandberg/circular_dependencies_between_objects/tree/master/ada12/src
> 
> Best regards,
> Joakim

Hi Joakim,

Thank you for taking the time to reply. It's interesting, but I waas hoping for something that included both Ada and C++ which I could just build. As I mentioned in my original message, I'm very rusty on Ada and unlikely to get much time at work to catchup enough to demonstrate Ada/C++ quickly. The hope was that someone would've already played with this sort of thing and be willing to share it.

Cheers
John

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Please - has anyone got a mixed Ada/C++ sample project they could share?
  2017-03-03 13:03   ` john
@ 2017-03-03 13:40     ` Simon Wright
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Wright @ 2017-03-03 13:40 UTC (permalink / raw)


john@mccabe.org.uk writes:

> On Friday, 24 February 2017 22:33:16 UTC, Simon Wright  wrote:
>> john@... writes:
>> 
>> > I'd be particularly interested in one where (if you consider this
>> > diagram - http://java.dzone.com/sites/all/files/observer_pattern.PNG)
>> > the Subject and Observer interfaces are defined as C++ abstract base
>> > classes (i.e. provide only pure virtual functions and no members), the
>> > ConcreteSubject is [probably] in C++, and ConcreteObserver in Ada with
>> > an Ada main procedure.
>> 
>> As I understand it, ConcreteSubject.notify() will end up calling
>> ConcreteObserver.update() for registered observers, which will then know
>> to get subjectState from the ConcreteSubject. Perhaps subjectState needs
>> to be publicly visible for this to work? or there are unstated public
>> operations?
>> 
>> Is Subject abstract? I'd expect there to be some implementation of those
>> operations somewhere, in Subject would be natural.
>
> Thanks Simon, but I think you might be reading too much into that - it
> was only to give an idea of the sort of thing I was looking for.

My Observer implementation sent a copy of the new data to each concrete
Observer, which would (in your context) only require there to be C++ and
Ada representations of the actual data type.

The version I described above, on the other hand, would require the
concrete subject, in C++, to provide a getSubjectState interface that
would have to have an Ada binding.

I thought that would be more complicated.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-03 13:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-24 16:50 Please - has anyone got a mixed Ada/C++ sample project they could share? john
2017-02-24 17:34 ` joakimds
2017-03-03 13:08   ` john
2017-02-24 22:33 ` Simon Wright
2017-03-03 13:03   ` john
2017-03-03 13:40     ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox