diff options
| author | Jacob Palecki <[email protected]> | 2020-08-11 21:16:50 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-11 21:16:50 -0700 |
| commit | 319eb45dee5b805eee976d7c2d6be0a9d090d3ed (patch) | |
| tree | d164cf52ce420c2c51aee2e9c0fe67c5fe5b56c5 /common/accel-base.hpp | |
| parent | Further comments (diff) | |
| parent | Merge pull request #13 from a1xd/write-cd (diff) | |
| download | rawaccel-319eb45dee5b805eee976d7c2d6be0a9d090d3ed.tar.xz rawaccel-319eb45dee5b805eee976d7c2d6be0a9d090d3ed.zip | |
Merge branch 'master' into GainCap
Diffstat (limited to 'common/accel-base.hpp')
| -rw-r--r-- | common/accel-base.hpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/common/accel-base.hpp b/common/accel-base.hpp index da2c96b..91510a4 100644 --- a/common/accel-base.hpp +++ b/common/accel-base.hpp @@ -2,13 +2,20 @@ #include "vec2.h" -namespace rawaccel { +void bad_arg(const char*); + +#ifndef _KERNEL_MODE - // Error throwing calls std libraries which are unavailable in kernel mode. - void error(const char* s); +#include "rawaccel-error.hpp" - using milliseconds = double; +inline void bad_arg(const char* s) { + throw rawaccel::invalid_argument(s); +} +#endif + +namespace rawaccel { + /// <summary> Struct to hold arguments for an acceleration function. </summary> struct accel_args { double offset = 0; @@ -60,7 +67,7 @@ namespace rawaccel { /// </summary> /// <param name="args">Arguments to verified.</param> void verify(const accel_args& args) const { - if (args.accel < 0) error("accel can not be negative, use a negative weight to compensate"); + if (args.accel < 0) bad_arg("accel can not be negative, use a negative weight to compensate"); } accel_base() = default; |