]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/arm-ds5-gator.git/blob - daemon/Counter.h
gator: Version 5.14
[android-sdk/arm-ds5-gator.git] / daemon / Counter.h
1 /**
2  * Copyright (C) ARM Limited 2013. 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                 mTitle[0] = '\0';
28                 mName[0] = '\0';
29                 mDescription[0] = '\0';
30                 mDisplay[0] = '\0';
31                 mUnits[0] = '\0';
32                 mModifier = 1;
33                 mEnabled = false;
34                 mEvent = 0;
35                 mCount = 0;
36                 mKey = 0;
37                 mPerCPU = false;
38                 mEBSCapable = false;
39                 mAverageSelection = false;
40                 mDriver = NULL;
41         }
43         void setType(const char *const type) { strncpy(mType, type, sizeof(mType)); mType[sizeof(mType) - 1] = '\0'; }
44         void setTitle(const char *const title) { strncpy(mTitle, title, sizeof(mTitle)); mTitle[sizeof(mTitle) - 1] = '\0'; }
45         void setName(const char *const name) { strncpy(mName, name, sizeof(mName)); mName[sizeof(mName) - 1] = '\0'; }
46         void setDescription(const char *const description) { strncpy(mDescription, description, sizeof(mDescription)); mDescription[sizeof(mDescription) - 1] = '\0'; }
47         void setDisplay(const char *const display) { strncpy(mDisplay, display, sizeof(mDisplay)); mDisplay[sizeof(mDisplay) - 1] = '\0'; }
48         void setUnits(const char *const units) { strncpy(mUnits, units, sizeof(mUnits)); mUnits[sizeof(mUnits) - 1] = '\0'; }
49         void setModifier(const int modifier) { mModifier = modifier; }
50         void setEnabled(const bool enabled) { mEnabled = enabled; }
51         void setEvent(const int event) { mEvent = event; }
52         void setCount(const int count) { mCount = count; }
53         void setKey(const int key) { mKey = key; }
54         void setPerCPU(const bool perCPU) { mPerCPU = perCPU; }
55         void setEBSCapable(const bool ebsCapable) { mEBSCapable = ebsCapable; }
56         void setAverageSelection(const bool averageSelection) { mAverageSelection = averageSelection; }
57         void setDriver(Driver *const driver) { mDriver = driver; }
59         const char *getType() const { return mType;}
60         const char *getTitle() const { return mTitle; }
61         const char *getName() const { return mName; }
62         const char *getDescription() const { return mDescription; }
63         const char *getDisplay() const { return mDisplay; }
64         const char *getUnits() const { return mUnits; }
65         int getModifier() const { return mModifier; }
66         bool isEnabled() const { return mEnabled; }
67         int getEvent() const { return mEvent; }
68         int getCount() const { return mCount; }
69         int getKey() const { return mKey; }
70         bool isPerCPU() const { return mPerCPU; }
71         bool isEBSCapable() const { return mEBSCapable; }
72         bool isAverageSelection() const { return mAverageSelection; }
73         Driver *getDriver() const { return mDriver; }
75 private:
76         // Intentionally unimplemented
77         Counter(const Counter &);
78         Counter & operator=(const Counter &);
80         char mType[MAX_STRING_LEN];
81         char mTitle[MAX_STRING_LEN];
82         char mName[MAX_STRING_LEN];
83         char mDescription[MAX_DESCRIPTION_LEN];
84         char mDisplay[MAX_STRING_LEN];
85         char mUnits[MAX_STRING_LEN];
86         int mModifier;
87         bool mEnabled;
88         int mEvent;
89         int mCount;
90         int mKey;
91         bool mPerCPU;
92         bool mEBSCapable;
93         bool mAverageSelection;
94         Driver *mDriver;
95 };
97 #endif // COUNTER_H