33 UpdateValues(arTopicStates);
39 mStateStore = arPreviousState.mStateStore;
40 UpdateValues(arTopicStates);
41 mStateVersion = arPreviousState.mStateVersion + 1;
44 void StateSnapshot::UpdateValues(
const std::list< ptr::shared_ptr<const TopicState> >& arTopicStates)
49 typedef std::list< ptr::shared_ptr<const TopicState> >::const_iterator TopicStatePointerIterator;
50 for (TopicStatePointerIterator tDataIt = arTopicStates.begin();
51 tDataIt != arTopicStates.end();
54 const ptr::shared_ptr<const TopicState> tpTopicState = *tDataIt;
67 if (tpTopicState->GetId() == previousTopicStateID)
70 DG_LOG(
"!!!!!!!!!!!! Duplicate Detected (GetId = %d, previousTopicStateID = %d, Topic %s)",
71 (
int)tpTopicState->GetId(), (int)previousTopicStateID, tpTopicState->GetName());
78 previousTopicStateID = tpTopicState->GetId();
81 mStateStore[tpTopicState->GetId()] = tpTopicState;
92 if (mStateStore.count(aId) > 0)
94 return mStateStore.at(aId);
97 return ptr::shared_ptr<const TopicState>();
102 typedef std::map< TopicStateIdType, ptr::shared_ptr<const TopicState> >::const_iterator StateStoreIterator;
103 for (StateStoreIterator stateIt = mStateStore.begin();
104 stateIt != mStateStore.end();
107 aOutTopicStateList.push_back(stateIt->second);
113 return mStateStore.size();
118 return mStateVersion;
void GetTopicStates(std::list< ptr::shared_ptr< const TopicState > > &aOutTopicStateList) const
Gets TopicStates stored in this snapshot.
StateSnapshot()
T=0 Constructor.
unsigned int GetStateVersion() const
Returns the version of this snapshot.
~StateSnapshot()
Destructor.
void DG_LOG(const char *aLogString,...)
The collection of TopicStates that represents the graph state so far.
ptr::shared_ptr< const T > GetState() const
Returns the specific TopicState for a given its type.
size_t GetMapSize() const
Returns the number of TopicStates in the Snapshot.