Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame^] | 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 | */ |
| 8 | |
| 9 | #ifndef DRIVER_H |
| 10 | #define DRIVER_H |
| 11 | |
| 12 | #include "mxml/mxml.h" |
| 13 | |
| 14 | class Counter; |
| 15 | |
| 16 | class Driver { |
| 17 | public: |
| 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 |
| 32 | virtual void writeEvents(mxml_node_t *root) const {} |
| 33 | |
| 34 | Driver *getNext() const { return next; } |
| 35 | |
| 36 | protected: |
| 37 | Driver (); |
| 38 | |
| 39 | private: |
| 40 | static Driver *head; |
| 41 | Driver *next; |
| 42 | }; |
| 43 | |
| 44 | #endif // DRIVER_H |