MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
device.h
Go to the documentation of this file.
1 // © Copyright 2010 - 2014 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _inputdevice_h
41 #define _inputdevice_h
42 
43 #include "Input/sequencecontainer.h"
44 
45 /// @file
46 /// @brief The declaration of the User input Device class.
47 
48 namespace Mezzanine
49 {
50  namespace Input
51  {
52  ///////////////////////////////////////////////////////////////////////////////
53  /// @brief This is a base class for all input devices.
54  /// @details
55  ///////////////////////////////////////
57  {
58  protected:
59  SequenceContainer Sequences;
60  /// @internal
61  /// @brief Provides the device specific logic for filtering code sequences.
62  /// @param Sequence The MetaCode sequence to be verified.
63  virtual void VerifySequenceImpl(const MetaCodeContainer& Sequence) const = 0;
64  public:
65  /// @brief Class constructor.
66  Device();
67  /// @brief Class destructor.
68  virtual ~Device();
69 
70  ///////////////////////////////////////////////////////////////////////////////
71  // Query Methods
72 
73  /// @brief Gets the device index of this controller.
74  /// @return Returns a UInt16 representing the device index for this controller.
75  virtual UInt16 GetDeviceIndex() const = 0;
76 
77  ///////////////////////////////////////////////////////////////////////////////
78  // Sequenced Input Management
79 
80  /// @copydoc SequenceContainer::AddInputSequence(const MetaCodeContainer& Codes, const Int32& SequenceID)
81  void AddInputSequence(const MetaCodeContainer& Codes, const Int32& SequenceID);
82  /// @copydoc SequenceContainer::InputSequenceExists(const MetaCodeContainer& Codes)
83  bool InputSequenceExists(const MetaCodeContainer& Codes);
84  /// @copydoc SequenceContainer::GetIDofInputSequence(const MetaCodeContainer& Codes)
85  Int32 GetIDofInputSequence(const MetaCodeContainer& Codes);
86  /// @copydoc SequenceContainer::RemoveInputSequence(const MetaCodeContainer& Codes)
87  void RemoveInputSequence(const MetaCodeContainer& Codes);
88  /// @copydoc SequenceContainer::RemoveAllInputSequences()
89  void RemoveAllInputSequences();
90 
91  ///////////////////////////////////////////////////////////////////////////////
92  // Internal Methods
93 
94  /// @internal
95  /// @brief Updates this device with the newest data.
96  /// @param DeltaCodes A vector of the codes to process and update this device with.
97  /// @param GeneratedCodes A vector to which generated codes (sequence or otherwise) will be added.
98  virtual void _Update(const MetaCodeContainer& DeltaCodes, MetaCodeContainer& GeneratedCodes) = 0;
99  };//Device
100  }//Input
101 }//Mezzanine
102 
103 #endif