<commit_before>/*************** <auto-copyright.pl BEGIN do not edit this line> **************
 *
 * VR Juggler is (C) Copyright 1998-2005 by Iowa State University
 *
 * Original Authors:
 *   <NAME>, <NAME>,
 *   <NAME>, <NAME>,
 *   <NAME>, <NAME>
 *
 * 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., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * -----------------------------------------------------------------
 * File:          $RCSfile$
 * Date modified: $Date$
 * Version:       $Revision$
 * -----------------------------------------------------------------
 *
 *************** <auto-copyright.pl END do not edit this line> ***************/

#ifndef _GADGET_EVENT_H_
#define _GADGET_EVENT_H_

#include <gadget/gadgetConfig.h>
#include <vpr/IO/SerializableObject.h>

namespace gadget
{

/** Possible event types. */
enum EventType
{
   NoEvent                 = 0,  /**< No event */
   KeyPressEvent           = 1,  /**< Key press event */
   KeyReleaseEvent         = 2,  /**< Key release event */
   MouseButtonPressEvent   = 3,  /**< Mouse button press event */
   MouseButtonReleaseEvent = 4,  /**< Mouse button release event */
   MouseMoveEvent          = 5   /**< Mouse move event */
};

/** \class Event Event.h gadget/Type/KeyboardMouse/Event.h
 *
 * Base event type that an event source may generate.  This class cannot be
 * instantiated directly, and instead, subclasses must be used.
 */
class GADGET_CLASS_API Event : public vpr::SerializableObject
{
public:
   /**
    * Returns the type of this event.  This can be used for dynamic casting
    * to more specific event types.
    */
   const EventType& type() const
   {
      return mType;
   }

   /**
    * Sets the type of this event.  This is needed because, while using an
    * object reader to de-serialize an Event object, we cannot set the type 
    * during construction. We must set the event type after creating
    * this event using the EventFactory. This could later be removed if
    * the EventFactory is chaged to take care of this.
    */
   void setType(const EventType& type)
   {
      mType = type;
   }

   /**
    * Returns the time at which the event occurred.
    */
   const unsigned long& time() const
   {
      return mTime;
   }

   virtual ~Event() throw ()
   {
   }

   /** Serializes this object. */
   virtual void writeObject(vpr::ObjectWriter* writer)
      throw (vpr::IOException);

   /** De-serializes this object. */
   virtual void readObject(vpr::ObjectReader* reader) throw (vpr::IOException);

protected:
   /**
    * Initializes data members.
    *
    * @param type The type of this event from the Event::Type enumeration.
    * @param time The time at which this event occurred.  This should be as
    *             accurate as possible,  preferabbly acquired from the
    *             operating system or windowing system event data structure.
    *             The time at which the event was processed is not an
    *             acceptable value.
    */
   Event(const EventType& type, const unsigned long& time)
      : mType(type), mTime(time)
   {
   }

   EventType     mType; /**< The event type. */
   unsigned long mTime; /**< Time at which the event occurred. */
};

}


#endif /* _GADGET_EVENT_H_ */
<commit_msg>Include the declaration for gadget::EventPtr so that client code does not have to include both headers.<commit_after>/*************** <auto-copyright.pl BEGIN do not edit this line> **************
 *
 * VR Juggler is (C) Copyright 1998-2005 by Iowa State University
 *
 * Original Authors:
 *   <NAME>, <NAME>,
 *   <NAME>, <NAME>,
 *   <NAME>, <NAME>
 *
 * 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., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * -----------------------------------------------------------------
 * File:          $RCSfile$
 * Date modified: $Date$
 * Version:       $Revision$
 * -----------------------------------------------------------------
 *
 *************** <auto-copyright.pl END do not edit this line> ***************/

#ifndef _GADGET_EVENT_H_
#define _GADGET_EVENT_H_

#include <gadget/gadgetConfig.h>
#include <vpr/IO/SerializableObject.h>

#include <gadget/Type/KeyboardMouse/EventPtr.h>

namespace gadget
{

/** Possible event types. */
enum EventType
{
   NoEvent                 = 0,  /**< No event */
   KeyPressEvent           = 1,  /**< Key press event */
   KeyReleaseEvent         = 2,  /**< Key release event */
   MouseButtonPressEvent   = 3,  /**< Mouse button press event */
   MouseButtonReleaseEvent = 4,  /**< Mouse button release event */
   MouseMoveEvent          = 5   /**< Mouse move event */
};

/** \class Event Event.h gadget/Type/KeyboardMouse/Event.h
 *
 * Base event type that an event source may generate.  This class cannot be
 * instantiated directly, and instead, subclasses must be used.
 */
class GADGET_CLASS_API Event : public vpr::SerializableObject
{
public:
   /**
    * Returns the type of this event.  This can be used for dynamic casting
    * to more specific event types.
    */
   const EventType& type() const
   {
      return mType;
   }

   /**
    * Sets the type of this event.  This is needed because, while using an
    * object reader to de-serialize an Event object, we cannot set the type 
    * during construction. We must set the event type after creating
    * this event using the EventFactory. This could later be removed if
    * the EventFactory is chaged to take care of this.
    */
   void setType(const EventType& type)
   {
      mType = type;
   }

   /**
    * Returns the time at which the event occurred.
    */
   const unsigned long& time() const
   {
      return mTime;
   }

   virtual ~Event() throw ()
   {
   }

   /** Serializes this object. */
   virtual void writeObject(vpr::ObjectWriter* writer)
      throw (vpr::IOException);

   /** De-serializes this object. */
   virtual void readObject(vpr::ObjectReader* reader) throw (vpr::IOException);

protected:
   /**
    * Initializes data members.
    *
    * @param type The type of this event from the Event::Type enumeration.
    * @param time The time at which this event occurred.  This should be as
    *             accurate as possible,  preferabbly acquired from the
    *             operating system or windowing system event data structure.
    *             The time at which the event was processed is not an
    *             acceptable value.
    */
   Event(const EventType& type, const unsigned long& time)
      : mType(type), mTime(time)
   {
   }

   EventType     mType; /**< The event type. */
   unsigned long mTime; /**< Time at which the event occurred. */
};

}


#endif /* _GADGET_EVENT_H_ */

{'fraction_non_alphanumeric': 0.13445801334508373, 'fraction_numerical': 0.0073020269419614755, 'mean_word_length': 2.43598615916955, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6737889', 'n_tokens_mistral': 2200, 'n_tokens_neox': 2141, 'n_words': 891}