Add methods {Add,Remove}AssociatedData()
Allows to associate untyped data with the model, which the model free()s upon destruction. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43213 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -648,6 +648,9 @@ Model::~Model()
|
|||||||
delete[] fEvents;
|
delete[] fEvents;
|
||||||
|
|
||||||
free(fEventData);
|
free(fEventData);
|
||||||
|
|
||||||
|
for (int32 i = 0; void* data = fAssociatedData.ItemAt(i); i++)
|
||||||
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -695,6 +698,20 @@ Model::ClosestEventIndex(nanotime_t eventTime) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
Model::AddAssociatedData(void* data)
|
||||||
|
{
|
||||||
|
return fAssociatedData.AddItem(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Model::RemoveAssociatedData(void* data)
|
||||||
|
{
|
||||||
|
fAssociatedData.RemoveItem(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::LoadingFinished()
|
Model::LoadingFinished()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ public:
|
|||||||
// time >= eventTime; may return
|
// time >= eventTime; may return
|
||||||
// CountEvents()
|
// CountEvents()
|
||||||
|
|
||||||
|
bool AddAssociatedData(void* data);
|
||||||
|
void RemoveAssociatedData(void* data);
|
||||||
|
|
||||||
void LoadingFinished();
|
void LoadingFinished();
|
||||||
|
|
||||||
inline nanotime_t BaseTime() const;
|
inline nanotime_t BaseTime() const;
|
||||||
@@ -160,6 +163,7 @@ private:
|
|||||||
WaitObjectGroupList fWaitObjectGroups;
|
WaitObjectGroupList fWaitObjectGroups;
|
||||||
IOSchedulerList fIOSchedulers;
|
IOSchedulerList fIOSchedulers;
|
||||||
SchedulingStateList fSchedulingStates;
|
SchedulingStateList fSchedulingStates;
|
||||||
|
BList fAssociatedData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user