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:
parent
e9e9c194f9
commit
e3bd3d8334
@ -648,6 +648,9 @@ Model::~Model()
|
||||
delete[] fEvents;
|
||||
|
||||
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
|
||||
Model::LoadingFinished()
|
||||
{
|
||||
|
@ -71,6 +71,9 @@ public:
|
||||
// time >= eventTime; may return
|
||||
// CountEvents()
|
||||
|
||||
bool AddAssociatedData(void* data);
|
||||
void RemoveAssociatedData(void* data);
|
||||
|
||||
void LoadingFinished();
|
||||
|
||||
inline nanotime_t BaseTime() const;
|
||||
@ -160,6 +163,7 @@ private:
|
||||
WaitObjectGroupList fWaitObjectGroups;
|
||||
IOSchedulerList fIOSchedulers;
|
||||
SchedulingStateList fSchedulingStates;
|
||||
BList fAssociatedData;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user