1 /**
2 * Copyright (C) ARM Limited 2013-2014. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
9 #ifndef COUNTER_H
10 #define COUNTER_H
12 #include <string.h>
14 class Driver;
16 class Counter {
17 public:
18 static const size_t MAX_STRING_LEN = 80;
19 static const size_t MAX_DESCRIPTION_LEN = 400;
21 Counter () {
22 clear();
23 }
25 void clear () {
26 mType[0] = '\0';
27 mEnabled = false;
28 mEvent = -1;
29 mCount = 0;
30 mKey = 0;
31 mDriver = NULL;
32 }
34 void setType(const char *const type) { strncpy(mType, type, sizeof(mType)); mType[sizeof(mType) - 1] = '\0'; }
35 void setEnabled(const bool enabled) { mEnabled = enabled; }
36 void setEvent(const int event) { mEvent = event; }
37 void setCount(const int count) { mCount = count; }
38 void setKey(const int key) { mKey = key; }
39 void setDriver(Driver *const driver) { mDriver = driver; }
41 const char *getType() const { return mType;}
42 bool isEnabled() const { return mEnabled; }
43 int getEvent() const { return mEvent; }
44 int getCount() const { return mCount; }
45 int getKey() const { return mKey; }
46 Driver *getDriver() const { return mDriver; }
48 private:
49 // Intentionally unimplemented
50 Counter(const Counter &);
51 Counter & operator=(const Counter &);
53 char mType[MAX_STRING_LEN];
54 bool mEnabled;
55 int mEvent;
56 int mCount;
57 int mKey;
58 Driver *mDriver;
59 };
61 #endif // COUNTER_H