migrate fully to freeRTOS
This commit is contained in:
@@ -17,11 +17,11 @@
|
||||
|
||||
unordered_map<string, SPITObject*> SPITObject::s_SPITObjects;
|
||||
unordered_map<string, SPITObject*> SPITObject::s_SPITObjectsRemote;
|
||||
recursive_mutex SPITObject::s_MutexSPITObject;
|
||||
fos::Mutex SPITObject::s_MutexSPITObject;
|
||||
|
||||
SPITObject* SPITObject::getSPITObject(string p_ID) {
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
auto i = s_SPITObjects.find(p_ID);
|
||||
if (i == s_SPITObjects.end()) {
|
||||
return NULL;
|
||||
@@ -37,7 +37,7 @@
|
||||
*/
|
||||
const SPITObject& SPITObject::getSPITObjectRef(string p_ID) {
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
auto i = s_SPITObjects.find(p_ID);
|
||||
if (i == s_SPITObjects.end()) {
|
||||
throw "SPITObject no SPITObject with given id";
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
SPITObject* SPITObject::getSPITObjectRemote(string p_ID) {
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
auto i = s_SPITObjectsRemote.find(p_ID);
|
||||
if (i == s_SPITObjectsRemote.end()) {
|
||||
return NULL;
|
||||
@@ -64,7 +64,7 @@
|
||||
*/
|
||||
const SPITObject& SPITObject::getSPITObjectRemoteRef(string p_ID) {
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
auto i = s_SPITObjectsRemote.find(p_ID);
|
||||
if (i == s_SPITObjectsRemote.end()) {
|
||||
throw "Remote SPITObject no SPITObject with given id";
|
||||
@@ -76,7 +76,7 @@
|
||||
bool SPITObject::addSPITObject(SPITObject* p_ptrSPITObject) {
|
||||
if (p_ptrSPITObject == NULL) return false;
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
s_SPITObjects[p_ptrSPITObject->getID()] = p_ptrSPITObject;
|
||||
return true;
|
||||
}
|
||||
@@ -84,7 +84,7 @@
|
||||
bool SPITObject::addSPITObjectRemote(SPITObject* p_ptrSPITObject) {
|
||||
if (p_ptrSPITObject == NULL) return false;
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
s_SPITObjectsRemote[p_ptrSPITObject->getID()] = p_ptrSPITObject;
|
||||
return true;
|
||||
}
|
||||
@@ -92,7 +92,7 @@
|
||||
bool SPITObject::removeSPITObject(SPITObject* p_ptrSPITObject) {
|
||||
if (p_ptrSPITObject == NULL) return false;
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
auto i = s_SPITObjects.find(p_ptrSPITObject->getID());
|
||||
if (i == s_SPITObjects.end()) {
|
||||
return false;
|
||||
@@ -104,7 +104,7 @@
|
||||
bool SPITObject::removeSPITObjectRemote(SPITObject* p_ptrSPITObject) {
|
||||
if (p_ptrSPITObject == NULL) return false;
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
auto i = s_SPITObjectsRemote.find(p_ptrSPITObject->getID());
|
||||
if (i == s_SPITObjectsRemote.end()) {
|
||||
return false;
|
||||
@@ -123,7 +123,7 @@
|
||||
SPITObject* SPITObject::getSPITObject(int p_Index) {
|
||||
SPITObject* ptrSPITObject = NULL;
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
if (p_Index >= 0 && p_Index < s_SPITObjects.size()) {
|
||||
unordered_map<string, SPITObject*>::iterator i = next(s_SPITObjects.begin(), p_Index);
|
||||
ptrSPITObject = i->second;
|
||||
@@ -143,7 +143,7 @@
|
||||
const SPITObject& SPITObject::getSPITObjectRef(int p_Index) {
|
||||
SPITObject* ptrSPITObject = NULL;
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
if (p_Index >= 0 && p_Index < s_SPITObjects.size()) {
|
||||
unordered_map<string, SPITObject*>::iterator i = next(s_SPITObjects.begin(), p_Index);
|
||||
ptrSPITObject = i->second;
|
||||
@@ -157,7 +157,7 @@
|
||||
SPITObject* SPITObject::getSPITObjectRemote(int p_Index) {
|
||||
SPITObject* ptrSPITObject = NULL;
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
if (p_Index >= 0 && p_Index < s_SPITObjectsRemote.size()) {
|
||||
unordered_map<string, SPITObject*>::iterator i = next(s_SPITObjectsRemote.begin(), p_Index);
|
||||
ptrSPITObject = i->second;
|
||||
@@ -177,7 +177,7 @@
|
||||
const SPITObject& SPITObject::getSPITObjectRemoteRef(int p_Index) {
|
||||
SPITObject* ptrSPITObject = NULL;
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
if (p_Index >= 0 && p_Index < s_SPITObjectsRemote.size()) {
|
||||
unordered_map<string, SPITObject*>::iterator i = next(s_SPITObjectsRemote.begin(), p_Index);
|
||||
ptrSPITObject = i->second;
|
||||
@@ -192,7 +192,7 @@
|
||||
void SPITObject::clearSPITObjects() {
|
||||
SPITObject* ptrSPITObject;
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
for (auto i = s_SPITObjects.begin(); i != s_SPITObjects.end(); i++) {
|
||||
ptrSPITObject = i->second;
|
||||
i = s_SPITObjects.erase(i);
|
||||
@@ -206,7 +206,7 @@
|
||||
void SPITObject::clearSPITObjectsRemote() {
|
||||
SPITObject* ptrSPITObject;
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
for (auto i = s_SPITObjectsRemote.begin(); i != s_SPITObjectsRemote.end(); i++) {
|
||||
ptrSPITObject = i->second;
|
||||
i = s_SPITObjectsRemote.erase(i);
|
||||
@@ -227,7 +227,7 @@
|
||||
void SPITObject::setConfirmedFalse() {
|
||||
SPITObject* ptrSPITObject;
|
||||
{
|
||||
unique_lock<recursive_mutex> o_LockObject(s_MutexSPITObject);
|
||||
fos::MutexGuard o_LockObject(s_MutexSPITObject);
|
||||
for (auto i = s_SPITObjects.begin(); i != s_SPITObjects.end(); i++) {
|
||||
ptrSPITObject = i->second;
|
||||
ptrSPITObject->setConfirmed(false);
|
||||
|
||||
Reference in New Issue
Block a user