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 DRIVER_H
10 #define DRIVER_H
12 #include "mxml/mxml.h"
14 class Counter;
16 class Driver {
17 public:
18 static Driver *getHead() { return head; }
20 virtual ~Driver() {}
22 // Returns true if this driver can manage the counter
23 virtual bool claimCounter(const Counter &counter) const = 0;
24 // Clears and disables all counters
25 virtual void resetCounters() = 0;
26 // Enables and prepares the counter for capture
27 virtual void setupCounter(Counter &counter) = 0;
29 // Emits available counters
30 virtual void writeCounters(mxml_node_t *root) const = 0;
31 // Emits possible dynamically generated events/counters
32 virtual void writeEvents(mxml_node_t *root) const {}
34 Driver *getNext() const { return next; }
36 protected:
37 Driver ();
39 private:
40 static Driver *head;
41 Driver *next;
42 };
44 #endif // DRIVER_H