CppELib 1.7.0
Loading...
Searching...
No Matches
OSWrapper Namespace Reference

OSWrapper provides abstract C++ interface of common RTOS: thread, mutex, event flag, message queue, memory pool, etc. More...

Classes

class  EventFlag
 Abstract class that has functions of common RTOS's event flag. More...
 
class  EventFlagFactory
 
class  FixedMemoryPool
 Abstract class that has functions of common RTOS's fixed-size memory pool. More...
 
class  FixedMemoryPoolFactory
 
class  LockGuard
 RAII wrapper of Mutex. More...
 
class  MessageQueue
 Class template of message queue. More...
 
class  Mutex
 Abstract class that has functions of common RTOS's mutex. More...
 
class  MutexFactory
 
class  OneShotTimer
 Abstract class that has functions of common RTOS's one-shot timer. More...
 
class  OneShotTimerFactory
 
class  PeriodicTimer
 Abstract class that has functions of common RTOS's periodic timer. More...
 
class  PeriodicTimerFactory
 
class  Runnable
 Interface for implementing an active class. More...
 
class  Thread
 Abstract class that has functions of common RTOS's thread. More...
 
class  ThreadFactory
 
class  ThreadPool
 Class of thread pool pattern. More...
 
class  Timeout
 Value object for the timeout. More...
 
class  VariableMemoryPool
 Abstract class that has functions of common RTOS's variable-size memory pool. More...
 
class  VariableMemoryPoolFactory
 

Enumerations

enum  Error {
  OK , TimedOut , CalledByNonThread , InvalidParameter ,
  NotLocked , OtherError
}
 Kinds of errors of the OS objects. More...
 

Functions

void registerEventFlagFactory (EventFlagFactory *factory)
 Register the EventFlagFactory.
 
void registerFixedMemoryPoolFactory (FixedMemoryPoolFactory *factory)
 Register the FixedMemoryPoolFactory.
 
void registerMutexFactory (MutexFactory *factory)
 Register the MutexFactory.
 
void registerOneShotTimerFactory (OneShotTimerFactory *factory)
 Register the OneShotTimerFactory.
 
void registerPeriodicTimerFactory (PeriodicTimerFactory *factory)
 Register the PeriodicTimerFactory.
 
void registerThreadFactory (ThreadFactory *factory)
 Register the ThreadFactory.
 
void registerVariableMemoryPoolFactory (VariableMemoryPoolFactory *factory)
 Register the VariableMemoryPoolFactory.
 

Detailed Description

OSWrapper provides abstract C++ interface of common RTOS: thread, mutex, event flag, message queue, memory pool, etc.

This class diagram shows the mechanism that isolates the client code from the code depended on the real RTOS.

Factories of OSWrapper are the mechanism to call static methods (create(), destroy(), etc) as virtual methods. Concrete factories are created as static objects and registered when the application is initialized.

All the OS objects (Thread, Mutex, EventFlag, etc) are generated by create() static method and released by destroy() static method. The OS objects can be accessed with the pointer returned by create(). They can not be generated as stack objects by constructor.

You can implement concrete classes for your OS platform like classes of ItronOSWrapper.

Enumeration Type Documentation

◆ Error

Kinds of errors of the OS objects.

Enumerator
OK 
TimedOut 
CalledByNonThread 
InvalidParameter 
NotLocked 
OtherError 

Function Documentation

◆ registerEventFlagFactory()

void OSWrapper::registerEventFlagFactory ( EventFlagFactory factory)

Register the EventFlagFactory.

Parameters
factoryPointer of the object of the concrete class derived from EventFlagFactory
Note
You need to call this function only one time when the application is initialized.

◆ registerFixedMemoryPoolFactory()

void OSWrapper::registerFixedMemoryPoolFactory ( FixedMemoryPoolFactory factory)

Register the FixedMemoryPoolFactory.

Parameters
factoryPointer of the object of the concrete class derived from FixedMemoryPoolFactory
Note
You need to call this function only one time when the application is initialized.

◆ registerMutexFactory()

void OSWrapper::registerMutexFactory ( MutexFactory factory)

Register the MutexFactory.

Parameters
factoryPointer of the object of the concrete class derived from MutexFactory
Note
You need to call this function only one time when the application is initialized.

◆ registerOneShotTimerFactory()

void OSWrapper::registerOneShotTimerFactory ( OneShotTimerFactory factory)

Register the OneShotTimerFactory.

Parameters
factoryPointer of the object of the concrete class derived from OneShotTimerFactory
Note
You need to call this function only one time when the application is initialized.

◆ registerPeriodicTimerFactory()

void OSWrapper::registerPeriodicTimerFactory ( PeriodicTimerFactory factory)

Register the PeriodicTimerFactory.

Parameters
factoryPointer of the object of the concrete class derived from PeriodicTimerFactory
Note
You need to call this function only one time when the application is initialized.

◆ registerThreadFactory()

void OSWrapper::registerThreadFactory ( ThreadFactory factory)

Register the ThreadFactory.

Parameters
factoryPointer of the object of the concrete class derived from ThreadFactory
Note
You need to call this function only one time when the application is initialized.

◆ registerVariableMemoryPoolFactory()

void OSWrapper::registerVariableMemoryPoolFactory ( VariableMemoryPoolFactory factory)

Register the VariableMemoryPoolFactory.

Parameters
factoryPointer of the object of the concrete class derived from VariableMemoryPoolFactory
Note
You need to call this function only one time when the application is initialized.