- // Contains a full update as it came in from the RTI
- struct Update {
- RTIIndexDataPairList _indexDataPairList;
- RTIData _tag;
- };
- // A bunch of updates for the same timestamp
- typedef std::list<Update> UpdateList;
- // The timestamp sorted list of updates
- typedef std::map<SGTimeStamp, UpdateList> UpdateListMap;
-
- // The timestamped updates sorted by timestamp
- UpdateListMap _updateListMap;
-
- // The pool of unused updates so that we do not need to malloc/free each time
- UpdateList _updateList;
-
- void getUpdateFromPool(UpdateList& updateList)
- {
- if (_updateList.empty())
- updateList.push_back(Update());
- else
- updateList.splice(updateList.end(), _updateList, _updateList.begin());
- }
- void putUpdateToPool(UpdateList& updateList)
- {
- for (UpdateList::iterator i = updateList.begin(); i != updateList.end(); ++i)
- putDataToPool(i->_indexDataPairList);
- _updateList.splice(_updateList.end(), updateList);
- }
-
- // Appends the updates in the list to the given timestamps updates
- void scheduleUpdates(const SGTimeStamp& timeStamp, UpdateList& updateList)
- {
- UpdateListMap::iterator i = _updateListMap.find(timeStamp);
- if (i == _updateListMap.end())
- i = _updateListMap.insert(UpdateListMap::value_type(timeStamp, UpdateList())).first;
- i->second.splice(i->second.end(), updateList);
- }