2007-10-11 01:35:22 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2007, Ingo Weinhold, bonefish@users.sf.net.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _DISK_SYSTEM_ADD_ON_MANAGER_H
|
|
|
|
#define _DISK_SYSTEM_ADD_ON_MANAGER_H
|
|
|
|
|
2007-10-14 03:17:44 +04:00
|
|
|
#include <FindDirectory.h>
|
2007-10-11 01:35:22 +04:00
|
|
|
#include <List.h>
|
|
|
|
#include <Locker.h>
|
|
|
|
|
|
|
|
|
|
|
|
class BDiskSystemAddOn;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
|
|
|
|
|
|
|
|
class DiskSystemAddOnManager {
|
|
|
|
public:
|
|
|
|
static DiskSystemAddOnManager* Default();
|
|
|
|
|
|
|
|
bool Lock();
|
|
|
|
void Unlock();
|
|
|
|
|
|
|
|
// load/unload all disk system add-ons
|
2007-10-14 03:17:44 +04:00
|
|
|
status_t LoadDiskSystems();
|
2007-10-11 01:35:22 +04:00
|
|
|
void UnloadDiskSystems();
|
|
|
|
|
|
|
|
// manager must be locked
|
|
|
|
int32 CountAddOns() const;
|
|
|
|
BDiskSystemAddOn* AddOnAt(int32 index) const;
|
|
|
|
|
|
|
|
// manager will be locked
|
|
|
|
BDiskSystemAddOn* GetAddOn(const char* name);
|
|
|
|
void PutAddOn(BDiskSystemAddOn* addOn);
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct AddOnImage;
|
|
|
|
struct AddOn;
|
2007-10-14 03:17:44 +04:00
|
|
|
struct StringSet;
|
2007-10-11 01:35:22 +04:00
|
|
|
|
|
|
|
DiskSystemAddOnManager();
|
|
|
|
|
2009-11-30 19:33:41 +03:00
|
|
|
static void _InitSingleton();
|
|
|
|
|
2007-10-11 01:35:22 +04:00
|
|
|
AddOn* _AddOnAt(int32 index) const;
|
2007-10-14 03:17:44 +04:00
|
|
|
void _PutAddOn(int32 index);
|
|
|
|
|
|
|
|
status_t _LoadAddOns(StringSet& alreadyLoaded,
|
|
|
|
directory_which directory);
|
2007-10-11 01:35:22 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
mutable BLocker fLock;
|
|
|
|
BList fAddOns;
|
2007-10-14 03:17:44 +04:00
|
|
|
BList fAddOnsToBeUnloaded;
|
2007-10-11 01:35:22 +04:00
|
|
|
int32 fLoadCount;
|
|
|
|
|
|
|
|
static DiskSystemAddOnManager* sManager;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BPrivate
|
|
|
|
|
|
|
|
using BPrivate::DiskSystemAddOnManager;
|
|
|
|
|
|
|
|
#endif // _DISK_SYSTEM_ADD_ON_MANAGER_H
|