<commit_before>/*$Id$
 *
 * This source file is a part of the Berlin Project.
 * Copyright (C) 2000 <NAME> <<EMAIL>> 
 * http://www.berlin-consortium.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
 * MA 02139, USA.
 */

#ifndef _Console_hh
#define _Console_hh

#include <Warsaw/config.hh>
#include <Warsaw/Types.hh>
#include <Warsaw/Input.hh>
#include <Warsaw/Drawable.hh>
#include <Warsaw/Raster.hh>
#include <Berlin/config.hh>
#include <stdexcept>
#include <iosfwd>
#include <vector>

//. This is an abstraction of the underlying graphics libraries Berlin uses.
//. The DrawingKits call the methods of this object.
class Console
{
public:
  class Drawable;
  //. Extensions are a means to provide special APIs
  //. that are not supported on all Consoles
  class Extension
  {
  public:
    virtual ~Extension(){}
  };
private:
  typedef std::vector<Extension *> elist_t;
  //. Deletes this Console in its Destrcuctor.
  struct Reaper
  {
    ~Reaper();
  };
  friend struct Reaper;

public:
  class Pointer;

  //. A helperclass to get the Console-module into memory.
  class Loader
  {
  public:
    virtual ~Loader() {}
    virtual Console *load(int &, char **) = 0;
  };
  template <typename T>
  class LoaderT : public Loader
  {
  public:
    virtual T *load(int &argc, char **argv) { return new T(argc, argv);}
  };


  //. Sets up the graphics library. It gets passed the commandline arguments
  //. of the server (argc and argv), checks them for any console-related options and
  //. afterwards passes them on to the graphic's library. Finally you need to pass
  //. the POA to this method.
  static int open(const std::string &, int argc, char **argv, PortableServer::POA_ptr)
    throw(std::runtime_error);

  //. Get the active instance of the Console.
  static Console *instance();

  //. Get a pointerobject to use on this Console.
  virtual Pointer *pointer(Warsaw::Raster_ptr) = 0;

  //. Get the 'root-drawable' used by this Console. That's the chunk of video
  //. memory covering the whole screen.
  virtual Drawable *drawable() = 0;
  //. Creates a new Drawable of the given size (x, y) and depth.
  virtual Drawable *create_drawable(Warsaw::PixelCoord, //.< Requested x size.
				    Warsaw::PixelCoord, //.< Requested y size.
				    Warsaw::PixelCoord) = 0; //.< Requested color depth.

  //. Activates a given drawable: After activation it can recieve requests via CORBA.
  Warsaw::Drawable_ptr activate_drawable(Drawable *);
  //. FIXME: Missing documentation!
  PortableServer::Servant reference_to_servant(Warsaw::Drawable_ptr);

  //. FIXME: Missing documentation!
  virtual void device_info(std::ostream &) = 0;
  //. FIXME: Missing documentation!
  virtual Warsaw::Input::Event *next_event() = 0;
  //. FIXME: Missing documentation!
  virtual void wakeup() = 0;
  //. FIXME: Missing documentation!
  virtual void activate_autoplay() = 0;
#ifdef RMDEBUG
  //. Highlight the specified region to aid debugging.
  //. You can set the color of the highlight by passing a
  //. red, green and blue betwenn 0.0 and 1.0. If
  //. you do not pass a color it defaults to red.
  virtual void highlight_screen(Warsaw::Coord, Warsaw::Coord,
				Warsaw::Coord, Warsaw::Coord,
				float red = 1.0,
				float green = 0.0,
				float blue = 0.0) = 0;
#endif

  template <typename T>
  T *get_extension(const std::string &id)
  {
    Extension *extension = create_extension(id);
    T *t = dynamic_cast<T *>(extension);
    if (!t)
      {
	delete extension;
	throw (std::runtime_error(id + ": no such extension"));
      }
    _extensions.push_back(extension);<commit_msg>Glitch. Fix build bustage. (I hope.)<commit_after>/*$Id$
 *
 * This source file is a part of the Berlin Project.
 * Copyright (C) 2000 <NAME> <<EMAIL>> 
 * http://www.berlin-consortium.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
 * MA 02139, USA.
 */

#ifndef _Console_hh
#define _Console_hh

#include <Warsaw/config.hh>
#include <Warsaw/Types.hh>
#include <Warsaw/Input.hh>
#include <Warsaw/Drawable.hh>
#include <Warsaw/Raster.hh>
#include <Berlin/config.hh>
#include <stdexcept>
#include <iosfwd>
#include <vector>

//. This is an abstraction of the underlying graphics libraries Berlin uses.
//. The DrawingKits call the methods of this object.
class Console
{
public:
  class Drawable;
  //. Extensions are a means to provide special APIs
  //. that are not supported on all Consoles
  class Extension
  {
  public:
    virtual ~Extension(){}
  };
private:
  typedef std::vector<Extension *> elist_t;
  //. Deletes this Console in its Destrcuctor.
  struct Reaper
  {
    ~Reaper();
  };
  friend struct Reaper;

public:
  class Pointer;

  //. A helperclass to get the Console-module into memory.
  class Loader
  {
  public:
    virtual ~Loader() {}
    virtual Console *load(int &, char **) = 0;
  };
  template <typename T>
  class LoaderT : public Loader
  {
  public:
    virtual T *load(int &argc, char **argv) { return new T(argc, argv);}
  };


  //. Sets up the graphics library. It gets passed the commandline arguments
  //. of the server (argc and argv), checks them for any console-related options and
  //. afterwards passes them on to the graphic's library. Finally you need to pass
  //. the POA to this method.
  static int open(const std::string &, int argc, char **argv, PortableServer::POA_ptr)
    throw(std::runtime_error);

  //. Get the active instance of the Console.
  static Console *instance();

  //. Get a pointerobject to use on this Console.
  virtual Pointer *pointer(Warsaw::Raster_ptr) = 0;

  //. Get the 'root-drawable' used by this Console. That's the chunk of video
  //. memory covering the whole screen.
  virtual Drawable *drawable() = 0;
  //. Creates a new Drawable of the given size (x, y) and depth.
  virtual Drawable *create_drawable(Warsaw::PixelCoord, //.< Requested x size.
				    Warsaw::PixelCoord, //.< Requested y size.
				    Warsaw::PixelCoord) = 0; //.< Requested color depth.

  //. Activates a given drawable: After activation it can recieve requests via CORBA.
  Warsaw::Drawable_ptr activate_drawable(Drawable *);
  //. FIXME: Missing documentation!
  PortableServer::Servant reference_to_servant(Warsaw::Drawable_ptr);

  //. FIXME: Missing documentation!
  virtual void device_info(std::ostream &) = 0;
  //. FIXME: Missing documentation!
  virtual Warsaw::Input::Event *next_event() = 0;
  //. FIXME: Missing documentation!
  virtual void wakeup() = 0;
  //. FIXME: Missing documentation!
  virtual void activate_autoplay() = 0;
  //. Highlight the specified region to aid debugging.
  //. You can set the color of the highlight by passing a
  //. red, green and blue betwenn 0.0 and 1.0. If
  //. you do not pass a color it defaults to red.
  virtual void highlight_screen(Warsaw::Coord, Warsaw::Coord,
				Warsaw::Coord, Warsaw::Coord) = 0;

  template <typename T>
  T *get_extension(const std::string &id)
  {
    Extension *extension = create_extension(id);
    T *t = dynamic_cast<T *>(extension);
    if (!t)
      {
	delete extension;
	throw (std::runtime_error(id + ": no such extension"));
      }
    _extensions.push_back(extension);
{'fraction_non_alphanumeric': 0.10735869178812656, 'fraction_numerical': 0.006872852233676976, 'mean_word_length': 3.4444444444444446, 'pattern_counts': {'":': 2, '<': 41, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3287826', 'n_tokens_mistral': 2644, 'n_tokens_neox': 2530, 'n_words': 994}