Nicolas Capens | d946e0a | 2014-06-26 11:31:08 -0400 | [diff] [blame] | 1 | #ifndef sw_Routine_hpp
|
| 2 | #define sw_Routine_hpp
|
| 3 |
|
| 4 | namespace sw
|
| 5 | {
|
| 6 | class RoutineManager;
|
| 7 |
|
| 8 | class Routine
|
| 9 | {
|
| 10 | friend class RoutineManager;
|
| 11 |
|
| 12 | public:
|
| 13 | Routine(int bufferSize);
|
| 14 | Routine(void *memory, int bufferSize, int offset);
|
| 15 |
|
| 16 | ~Routine();
|
| 17 |
|
| 18 | void setFunctionSize(int functionSize);
|
| 19 |
|
| 20 | const void *getBuffer();
|
| 21 | const void *getEntry();
|
| 22 | int getBufferSize();
|
| 23 | int getFunctionSize(); // Includes constants before the entry point
|
| 24 | int getCodeSize(); // Executable code only
|
| 25 | bool isDynamic();
|
| 26 |
|
| 27 | void bind();
|
| 28 | void unbind();
|
| 29 |
|
| 30 | private:
|
| 31 | void *buffer;
|
| 32 | const void *entry;
|
| 33 | int bufferSize;
|
| 34 | int functionSize;
|
| 35 |
|
| 36 | volatile int bindCount;
|
| 37 | const bool dynamic; // Generated or precompiled
|
| 38 | };
|
| 39 | }
|
| 40 |
|
| 41 | #endif // sw_Routine_hpp
|