comp.lang.ada
 help / color / mirror / Atom feed
* OO-Code for a state machine
@ 2000-12-19 12:15 Vincent Smeets
  2000-12-21  2:51 ` Charles Rapp
  0 siblings, 1 reply; 4+ messages in thread
From: Vincent Smeets @ 2000-12-19 12:15 UTC (permalink / raw)


Hallo,

For a long time, I have seen a posting from somebody who had a state
machine programmed with OO technics. It was a base which you could
extend with you own code to create you own state machine. Does somebody
know where I can find it?

Thanks,
Vincent

-- Vincent Smeets                 Competence Center Informatik GmbH
-- Tel. : +49-5931-805461         Postfach 1225
-- Fax  : +49-5931-805175         49702 Meppen, Germany
-- EMail: Vincent.Smeets@CCI.de   http://www.CCI.de/
-- PGP fingerprint: 53 1C 3B 6F B6 9A EB 83  B4 7E 25 08 78 BD 5C 2C



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

* Re: OO-Code for a state machine
@ 2000-12-19 14:28 Christoph Grein
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Grein @ 2000-12-19 14:28 UTC (permalink / raw)
  To: comp.lang.ada

This is perhaps not what you've asked for, but I've developed a finite state 
machine editor which might fit your needs:

htt://home.T-Online.de/home/Christ-Usch.Grein/Ada/FSM.html





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

* Re: OO-Code for a state machine
  2000-12-19 12:15 Vincent Smeets
@ 2000-12-21  2:51 ` Charles Rapp
  2000-12-24 20:45   ` David Kristola
  0 siblings, 1 reply; 4+ messages in thread
From: Charles Rapp @ 2000-12-21  2:51 UTC (permalink / raw)


Vincent,

There is SMC - The State Machine Compiler at http://smc.sourceforge.com.
It takes a state machine description and generates either C++, Java or
Tcl code which is based on the State pattern (for more on the State
pattern, see the book "Design Patterns" by Gamma, Helm, Johnson and
Vlissides, p. 310). However, SMC does not generate Ada code.

Vincent Smeets wrote:
> 
> Hallo,
> 
> For a long time, I have seen a posting from somebody who had a state
> machine programmed with OO technics. It was a base which you could
> extend with you own code to create you own state machine. Does somebody
> know where I can find it?
> 
> Thanks,
> Vincent
> 
> -- Vincent Smeets                 Competence Center Informatik GmbH
> -- Tel. : +49-5931-805461         Postfach 1225
> -- Fax  : +49-5931-805175         49702 Meppen, Germany
> -- EMail: Vincent.Smeets@CCI.de   http://www.CCI.de/
> -- PGP fingerprint: 53 1C 3B 6F B6 9A EB 83  B4 7E 25 08 78 BD 5C 2C

-- 
Charles Rapp
rapp@acm.org



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

* Re: OO-Code for a state machine
  2000-12-21  2:51 ` Charles Rapp
@ 2000-12-24 20:45   ` David Kristola
  0 siblings, 0 replies; 4+ messages in thread
From: David Kristola @ 2000-12-24 20:45 UTC (permalink / raw)


On Wed, 20 Dec 2000 18:51:46 -0800, Charles Rapp wrote
(in message <3A416FD9.C659BD5C@acm.org>):

> Vincent,
> 
> There is SMC - The State Machine Compiler at http://smc.sourceforge.com.
> It takes a state machine description and generates either C++, Java or
> Tcl code which is based on the State pattern (for more on the State
> pattern, see the book "Design Patterns" by Gamma, Helm, Johnson and
> Vlissides, p. 310). However, SMC does not generate Ada code.
> 
> Vincent Smeets wrote:
>> 
>> Hallo,
>> 
>> For a long time, I have seen a posting from somebody who had a state
>> machine programmed with OO technics. It was a base which you could
>> extend with you own code to create you own state machine. Does somebody
>> know where I can find it?
>> 
>> Thanks,
>> Vincent
>> 
>> -- Vincent Smeets                 Competence Center Informatik GmbH
>> -- Tel. : +49-5931-805461         Postfach 1225
>> -- Fax  : +49-5931-805175         49702 Meppen, Germany
>> -- EMail: Vincent.Smeets@CCI.de   http://www.CCI.de/
>> -- PGP fingerprint: 53 1C 3B 6F B6 9A EB 83  B4 7E 25 08 78 BD 5C 2C
> 
> 

Vincent,

Below is the state class from one of my projects.  It is basically following
the "Design Patterns" State pattern mentioned by Charles.  I don't know if
this is what you are looking for, but pehaps it will help.  In this 
particular case, the session manager takes user input from sockets and 
dispatches that input to the appropriate Parse_Input routine.  Each session 
has a number of standard states to deal with establishing someone's identity, 
but then the user can (i should say "will be able to" since this part is not 
coded yet) select from a list of registered <fill in blank>.  Each one will 
have it's own parser state (to deal with the unique features).  Each one will 
register itself with a central entity during elaboration, providing an 
example object of that class, and some means of recognition.  That way, the 
new states can be used without recoding old states to transition to new ones.

   type State_Type is abstract new Ada.Finalization.Controlled with private;
   type State_Access_Type is access all State_Type'CLASS;

   procedure Parse_Input
      (State      : in out State_Type;
       Session    : in     Session_Access_Type;
       User_Input : in     String) is abstract;

   procedure Destroy
      (State : access State_Type) is abstract;

   procedure Create
      (Based_On : in     State_Type;
       Session  : in     Session_Access_Type;
       State    :    out State_Access_Type) is abstract;



-- 
--djk, keeper of arcane lore & trivial fluff
Home: David95036 plus 1 at america on-line
Spam: goto.hades@welovespam.com




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

end of thread, other threads:[~2000-12-24 20:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-19 14:28 OO-Code for a state machine Christoph Grein
  -- strict thread matches above, loose matches on Subject: below --
2000-12-19 12:15 Vincent Smeets
2000-12-21  2:51 ` Charles Rapp
2000-12-24 20:45   ` David Kristola

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