blob: f3a932f852cb089a9cb970a8b5a10fdf6e21da5c [file] [log] [blame]
Jon Medhurstaaf37a32013-06-11 12:10:56 +01001/**
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 */
8
9#ifndef DRIVER_H
10#define DRIVER_H
11
12#include "mxml/mxml.h"
13
14class Counter;
15
16class Driver {
17public:
18 static Driver *getHead() { return head; }
19
20 virtual ~Driver() {}
21
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;
28
29 // Emits available counters
30 virtual void writeCounters(mxml_node_t *root) const = 0;
31 // Emits possible dynamically generated events/counters
Jon Medhurst0025d2e2013-12-19 09:23:06 +000032 virtual void writeEvents(mxml_node_t *) const {}
Jon Medhurstaaf37a32013-06-11 12:10:56 +010033
34 Driver *getNext() const { return next; }
35
36protected:
37 Driver ();
38
39private:
40 static Driver *head;
41 Driver *next;
Jon Medhurst0025d2e2013-12-19 09:23:06 +000042
43 // Intentionally unimplemented
44 Driver(const Driver &);
45 Driver &operator=(const Driver &);
Jon Medhurstaaf37a32013-06-11 12:10:56 +010046};
47
48#endif // DRIVER_H