void SensorResult(SensorData * data){ short index = 1; LElement * elem; bool got_in = false; printf("GOT ONE RESULT!!! \n"); switch(data->type){ case ENTRY: FOR_EACH(elem,cached_data){ if (((SensorData *)elem->data)->type == ENTRY){ ((SensorData *)elem->data)->entrances = ((SensorData *)elem->data)->entrances + data->entrances; got_in = true; break; } } if (!got_in){ SensorData * entry = (SensorData *) malloc(sizeof(SensorData)); memcpy(entry, data, sizeof(SensorData)); got_in = true; AddToList(entry, &cached_data); } break; case COUNT: FOR_EACH(elem,cached_data){ if (((SensorData *)elem->data)->type == COUNT){ ((SensorData *)elem->data)->people = data->people; got_in = true; break; } } if (!got_in){ SensorData * entry = (SensorData *) malloc(sizeof(SensorData)); memcpy(entry, data, sizeof(SensorData)); got_in = true; AddToList(entry, &cached_data); } break; case RSS: FOR_EACH(elem,cached_data){ if (((SensorData *)elem->data)->type == RSS){ pthread_mutex_lock(&dataToSend); DelFromList(index, &cached_data); pthread_mutex_unlock(&dataToSend); } } break; } if (!got_in){ pthread_mutex_lock(&dataToSend); AddToList(data,&cached_data); pthread_mutex_unlock(&dataToSend); } }
/*! \b parameters: \arg \b pSu Pointer to a new surface object \b Operation: This function returns 1 (true) if the parameter surface object exists and it is satisfactory deleted from the manager. */ bool IND_SurfaceManager::Delete (IND_Surface *pSu) { Debug->Header ("Freeing surface", 5); if (!mOk || !pSu) { WriteMessage (); return 0; } // Search object bool mIs = 0; list <IND_Surface*>::iterator mSurfaceListIter; for (mSurfaceListIter = mListSurfaces->begin(); mSurfaceListIter != mListSurfaces->end(); mSurfaceListIter++) { if ((*mSurfaceListIter) == pSu) { mIs = 1; break; } } if (!mIs) { WriteMessage (); return 0; } // ----- Free object ----- Debug->Header ("Name:", 3); Debug->DataInt ((int) &pSu->mSurface, 1); // Quit from list DelFromList (pSu); pSu->mSurface.mAttributes.mIsHaveSurface = 0; // Free textures for (int i = 0; i < pSu->GetNumTextures(); i++) pSu->mSurface.mTexturesArray [i].mTexture->Release (); // Free vertex buffer DisposeArray (pSu->mSurface.mVertexArray); Debug->Header ("Ok", 6); return 1; }
/*! \b Parameters: \arg \b pFo Pointer to font object type 1 \b Operation: This function returns 1 (true) if the font object type 1 passed as a parameter exists and it is deleted from the manager successfully */ bool IND_FontManager::Delete (IND_Font *pFo) { Debug->Header ("Freeing font", 5); if (!mOk) { WriteMessage (); return 0; } // Search object bool mIs = 0; list <IND_Font*>::iterator mFontListIter; for (mFontListIter = mListFonts->begin(); mFontListIter != mListFonts->end(); mFontListIter++) { if ((*mFontListIter) == pFo) { mIs = 1; break; } } // Not found if (!mIs) { WriteMessage (); return 0; } // ----- Free object ----- Debug->Header ("File name:", 3); Debug->DataChar (pFo->GetFileName (), 1); // Quit from list DelFromList (pFo); // Free bitmap IND_Surface mSurfaceManager->Delete (pFo->GetSurface()); // Free letter array DisposeArray (pFo->mFont.mLetters); Debug->Header ("Ok", 6); return 1; }