You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1004 B
65 lines
1004 B
14 years ago
|
#ifndef __SLOTLIST_H__
|
||
|
#define __SLOTLIST_H__
|
||
|
|
||
|
|
||
|
#include <vector>
|
||
|
|
||
|
namespace act
|
||
|
{
|
||
|
class ISlot;
|
||
|
class IToken;
|
||
|
}
|
||
|
|
||
|
class SlotEntry
|
||
|
{
|
||
|
public:
|
||
|
SlotEntry();
|
||
|
SlotEntry(const SlotEntry& old_entry);
|
||
|
|
||
|
void init(act::ISlot* slot_blueprint);
|
||
|
~SlotEntry();
|
||
|
|
||
|
void invalidate_token();
|
||
|
void preload_token();
|
||
|
|
||
|
inline act::ISlot* getSlot() const { return m_slot; }
|
||
|
act::IToken* getToken();
|
||
|
|
||
|
private:
|
||
|
|
||
|
void cleanup();
|
||
|
|
||
|
act::ISlot* m_slot;
|
||
|
act::IToken* m_token;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
* Holds a list of the present slots in the system
|
||
|
* TODO: Slot addition/removal detection
|
||
|
*/
|
||
|
class SlotList
|
||
|
{
|
||
|
public:
|
||
|
typedef std::vector<SlotEntry> slot_list_t;
|
||
|
|
||
|
SlotList();
|
||
|
SlotList(size_t expected_size);
|
||
|
~SlotList();
|
||
|
|
||
|
void reserve(size_t expected_size);
|
||
|
void addSlot(act::ISlot* slot);
|
||
|
void removeSlot(act::ISlot* slot);
|
||
|
void clear();
|
||
|
|
||
|
act::ISlot* getSlot(size_t index);
|
||
|
act::IToken* getToken(size_t index);
|
||
|
|
||
|
inline size_t getNumSlots() { return m_slot_list.size(); }
|
||
|
|
||
|
private:
|
||
|
slot_list_t m_slot_list;
|
||
|
};
|
||
|
|
||
|
#endif
|
||
|
|