00001 //--------------------------------------------------------------------------
00002 // Copyright (C) 2016-2017 Cisco and/or its affiliates. All rights reserved.
00003 //
00004 // This program is free software; you can redistribute it and/or modify it
00005 // under the terms of the GNU General Public License Version 2 as published
00006 // by the Free Software Foundation. You may not use, modify or distribute
00007 // this program under any other version of the GNU General Public License.
00008 //
00009 // This program is distributed in the hope that it will be useful, but
00010 // WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License along
00015 // with this program; if not, write to the Free Software Foundation, Inc.,
00016 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017 //--------------------------------------------------------------------------
00018 // analyzer_command.h author Michael Altizer <mialtize@cisco.com>
00019
00020 #ifndef ANALYZER_COMMANDS_H
00021 #define ANALYZER_COMMANDS_H
00022
00023 class Analyzer;
00024 class Swapper;
00025
00026 class AnalyzerCommand
00027 {
00028 public:
00029 virtual ~AnalyzerCommand() = default;
00030 virtual void execute(Analyzer&) = 0;
00031 virtual const char* stringify() = 0;
00032 unsigned get() { return ++ref_count; }
00033 unsigned put() { return --ref_count; }
00034 private:
00035 unsigned ref_count = 0;
00036 };
00037
00038 class ACGetStats : public AnalyzerCommand
00039 {
00040 public:
00041 void execute(Analyzer&) override;
00042 const char* stringify() override { return "GET_STATS"; }
00043 ~ACGetStats() override;
00044 };
00045
00046 class ACPause : public AnalyzerCommand
00047 {
00048 public:
00049 void execute(Analyzer&) override;
00050 const char* stringify() override { return "PAUSE"; }
00051 };
00052
00053 class ACResume : public AnalyzerCommand
00054 {
00055 public:
00056 void execute(Analyzer&) override;
00057 const char* stringify() override { return "RESUME"; }
00058 };
00059
00060 class ACRotate : public AnalyzerCommand
00061 {
00062 public:
00063 void execute(Analyzer&) override;
00064 const char* stringify() override { return "ROTATE"; }
00065 };
00066
00067 class ACRun : public AnalyzerCommand
00068 {
00069 public:
00070 ACRun() = delete;
00071 ACRun(bool is_paused = false ) { paused = is_paused; }
00072 void execute(Analyzer&) override;
00073 const char* stringify() override { return "RUN"; }
00074 private:
00075 bool paused = false;
00076 };
00077
00078 class ACStart : public AnalyzerCommand
00079 {
00080 public:
00081 void execute(Analyzer&) override;
00082 const char* stringify() override { return "START"; }
00083 };
00084
00085 class ACStop : public AnalyzerCommand
00086 {
00087 public:
00088 void execute(Analyzer&) override;
00089 const char* stringify() override { return "STOP"; }
00090 };
00091
00092 class ACSwap : public AnalyzerCommand
00093 {
00094 public:
00095 ACSwap() = delete;
00096 ACSwap(Swapper* ps);
00097 void execute(Analyzer&) override;
00098 const char* stringify() override { return "SWAP"; }
00099 ~ACSwap() override;
00100 private:
00101 Swapper *ps;
00102 };
00103
00104 class ACDAQSwap : public AnalyzerCommand
00105 {
00106 public:
00107 void execute(Analyzer&) override;
00108 const char* stringify() override { return "DAQ_SWAP"; }
00109 ~ACDAQSwap() override;
00110 };
00111
00112 #endif
00113
END OF CODE