mirror of
https://github.com/zeldaret/ss
synced 2026-05-24 07:10:53 -04:00
36 lines
919 B
C++
36 lines
919 B
C++
#ifndef S_FSTATE_VIRTUAL_ID_H
|
|
#define S_FSTATE_VIRTUAL_ID_H
|
|
|
|
#include "s/s_FStateID.hpp"
|
|
#include "s/s_StateID.hpp"
|
|
|
|
template <typename T>
|
|
class sFStateVirtualID_c : public sFStateID_c<T> {
|
|
public:
|
|
typedef void (T::*stateFunc)();
|
|
sFStateVirtualID_c(
|
|
const sStateIDIf_c *superState, const char *name, stateFunc initialize, stateFunc execute, stateFunc finalize
|
|
)
|
|
: sFStateID_c<T>(name, initialize, execute, finalize), mpSuperState(superState) {}
|
|
|
|
virtual unsigned int number() const {
|
|
return superID()->numberBase();
|
|
}
|
|
|
|
const sFStateVirtualID_c<T> *superID() const {
|
|
if (!mpSuperState->isNull()) {
|
|
return static_cast<const sFStateVirtualID_c<T> *>(mpSuperState)->superID();
|
|
}
|
|
return this;
|
|
}
|
|
|
|
unsigned int numberBase() const {
|
|
return sStateID_c::number();
|
|
}
|
|
|
|
private:
|
|
const sStateIDIf_c *mpSuperState;
|
|
};
|
|
|
|
#endif
|