head	1.9;
access;
symbols
	tonic_4:1.9
	tonic_3:1.9
	tonic_2:1.9
	demo:1.9.0.2
	design_report:1.9
	oral_presentation_freeze:1.2.0.2;
locks; strict;
comment	@ * @;


1.9
date	95.12.11.21.09.40;	author daveg;	state Exp;
branches;
next	1.8;

1.8
date	95.12.09.23.48.04;	author rgmisra;	state Exp;
branches;
next	1.7;

1.7
date	95.12.09.19.53.44;	author hartmans;	state Exp;
branches;
next	1.6;

1.6
date	95.12.05.10.45.53;	author hartmans;	state Exp;
branches;
next	1.5;

1.5
date	95.12.04.03.26.54;	author daveg;	state Exp;
branches;
next	1.4;

1.4
date	95.12.03.05.00.45;	author hartmans;	state Exp;
branches;
next	1.3;

1.3
date	95.12.02.12.05.10;	author daveg;	state Exp;
branches;
next	1.2;

1.2
date	95.11.30.04.33.33;	author hartmans;	state Exp;
branches;
next	1.1;

1.1
date	95.11.28.08.20.32;	author hartmans;	state Exp;
branches;
next	;


desc
@Header for top level web_node--the one on our root
@


1.9
log
@it compiles
@
text
@// This is -*- c++ -*- code
// $Header: /mit/6.170/groups/se01/.cvsroot/src/include/top_node.h,v 1.8 1995/12/09 23:48:04 rgmisra Exp $




#ifndef __TOP_NODE_H__
#define __TOP_NODE_H__

#include <6170.h>

// This file defines a subclass of dir_node that handles certain
// top-level requests internally instead of having children.  This is
// necessary to deal with top level requests, because they will be of
// the form /foo?bar not/foo/?bar

#include <6170.h>
#include <ps5/dir_node.h>
#include <game.h>


class top_node: public dir_node {

  public:
    
    // Constructors:
    top_node(string uri, string image_base);
    // Effects: creates an empty top node with a base URI of uri that
    // finds images and other static documents under image_base, a
    // full URI.
    // Requires: both URIs include trailing slashes

    // Methods:

    void add_to_detached(game *g, int player_num);
    // Requires: that the specified player is associated with a game.
    // Modifies: this
    // Effects: Adds the given game to the list of detached games.
    
    void remove_from_detached(game *g);
    // Modifies: this
    // Effects: Removes the given game from list of detached games

    virtual http_response * get(string request, extensions *ext);
    // Effects: processes top-level protocol requests as specified in Section \tex{\ref{p:top}}

    virtual http_response *get_self(string query_args, extensions *);

  private:
    top_node(const top_node &);
    void operator = (const top_node &);

    // Abstraction function: open_games is an array of games that are
    // open; kids of this are games that exist in some state.

    // Rep invarient: open_games contains a game at most once; games
    // in open_games also appear in descendents.
    struct open {
	game *g;
	int pn;			// Player number of detached player
    };
    
    map <string, open> *open_games;
    int randomizing_mask; // Mask used to make numbers not repeat between runs
    string image_uri;
    http_response * welcome( extensions *ext) ;
    // Effects: returns the welcome page.

    http_response *new_game(string query_args, extensions *ext);
    // Effects: handles new game request.

    http_response *incomplete_games( extensions *ext) ;
    // Effects: returns page of incomplete games.

    http_response *ref_new_game(string query_args, extensions *ext);
    // Effects: handles new game request, as specified for refereed games.

};

#endif // __TOP_NODE_H__
@


1.8
log
@added method incomplete_games
@
text
@d2 1
a2 1
// $Header: /afs/athena.mit.edu/course/6/6.170/groups/se01/.cvsroot/src/include/top_node.h,v 1.7 1995/12/09 19:53:44 hartmans Exp $
d72 5
a76 2
  http_response *incomplete_games( extensions *ext) ;
  // Effects: returns page of incomplete games.
@


1.7
log
@Clear up some specs.  Add new struct for internal top_node use.
@
text
@d2 1
a2 1
// $Header: /mit/6.170/groups/se01/.cvsroot/src/include/top_node.h,v 1.6 1995/12/05 10:45:53 hartmans Exp $
d72 2
a73 1
    
@


1.6
log
@Template fixups
@
text
@d2 1
a2 1
// $Header: /mit/6.170/groups/se01/.cvsroot/src/include/top_node.h,v 1.5 1995/12/04 03:26:54 daveg Exp $
d58 6
a63 2

    map <string, game *> *open_games;
@


1.5
log
@bug fixes
@
text
@d2 1
a2 1
// $Header: /mit/6.170/groups/se01/.cvsroot/src/include/top_node.h,v 1.4 1995/12/03 05:00:45 hartmans Exp $
d35 1
a35 1
    add_to_detached(game *g, int player_num);
d40 1
a40 1
    remove_from_detached(game *g);
d62 1
a62 1
    http_response * welcome() ;
@


1.4
log
@Tidy up human_player,
implement machine_player::get

clarify associate specs.
@
text
@d2 1
a2 1
// $Header: /mit/6.170/groups/se01/.cvsroot/src/include/top_node.h,v 1.3 1995/12/02 12:05:10 daveg Exp $
d40 1
a40 1
    removed_from_detached(game *g);
@


1.3
log
@added add_to_detached and remove_from_detached
@
text
@d2 1
a2 1
// $Header: /mit/6.170/groups/se01/.cvsroot/src/web/top_node.h,v 1.2 1995/11/30 04:33:33 hartmans Exp $
d27 5
a31 2
    top_node(string uri);
    // Effects: creates an empty top node with a base URI of uri
d61 1
d71 2
@


1.2
log
@Implement top_node::new_game
and related methods
@
text
@d2 1
a2 1
// $Header: /mit/6.170/groups/se01/.cvsroot/src/web/top_node.h,v 1.1 1995/11/28 08:20:32 hartmans Exp $
d7 1
a7 1
#ifndef __TOP_NODE_H__#define __TOP_NODE_H__
d24 16
a39 4
    public
top_node(string uri);
// Effects: creates an empty top node with a base URI of uri

a40 1
    
d44 4
a47 4
    
virtual http_response *get_self(string query_args, extensions *);
private:
top_node(const top_node &);
@


1.1
log
@Partial implementation of a top level root node
@
text
@d2 1
a2 1
// $Header$
d25 2
a26 2
top_node();
    // Effects: creates a new top web node.
d28 1
d46 1
a46 1

d52 1
@
