Fixed compiler errors

This commit is contained in:
CarlWachter
2023-09-22 19:56:19 +02:00
parent 7981931155
commit 118a829420
12 changed files with 55 additions and 32 deletions

View File

@@ -48,27 +48,13 @@ namespace sta
void func() override;
private:
class CGuard
{
public:
~CGuard()
{
if( NULL != Manager::_instance )
{
delete Manager::_instance;
Manager::_instance = NULL;
}
}
};
static Manager* _instance;
private:
Manager();
Manager(const Manager&);
~Manager() {}
//~Manager();
void updateThreads();
@@ -77,6 +63,19 @@ namespace sta
void stopThreads(uint16_t state);
std::set<TacosThread> threads_[STA_TACOS_NUM_STATES];
class CGuard
{
public:
~CGuard()
{
if( NULL != Manager::_instance )
{
delete Manager::_instance;
Manager::_instance = NULL;
}
}
};
};
} // namespace tacos
} // namespace sta

View File

@@ -25,6 +25,8 @@ namespace sta
*/
TacosThread(const char* name, osPriority_t prio);
TacosThread();
virtual ~TacosThread();
/**
@@ -62,7 +64,9 @@ namespace sta
* @brief The body of the thread's loop. Has to be implemented by the user.
*/
virtual void func();
private:
/**
* @brief Static function to pass to RTOS to run as a thread. Calls the loop function implemented here.
*/

View File

@@ -93,6 +93,10 @@ namespace sta
}
//Manager::~Manager(){}
Manager* Manager::_instance = nullptr;
} // namespace tacos
} // namespace sta

View File

@@ -11,6 +11,8 @@ namespace sta
{
namespace tacos
{
Statemachine::Statemachine(){}
void Statemachine::init()
{
@@ -25,6 +27,9 @@ namespace sta
{
return currentState_;
}
Statemachine* Statemachine::_instance = nullptr;
} // namespace tacos
} // namespace sta

View File

@@ -20,11 +20,13 @@ namespace sta
TacosThread::TacosThread(const char* name, osPriority_t prio)
: RtosThread(RtosHandle<osThreadId_t>(Handle::Deferred(&instance_))),
attribs_{ .name = name, .priority = prio }
{
{}
}
TacosThread::TacosThread()
: RtosThread(RtosHandle<osThreadId_t>(Handle::Deferred(&instance_)))
{}
static void entry_point(void* arg)
void TacosThread::entry_point(void* arg)
{
STA_ASSERT(arg != nullptr);
@@ -81,6 +83,12 @@ namespace sta
{
return std::strcmp(this->getName(), other.getName()) < 0;
}
void TacosThread::init(){}
void TacosThread::func(){}
TacosThread::~TacosThread(){}
} // namespace tacos
} // namespace sta