AeAssetBase.h 2.35 KB
//
// AeAssetBase
//
// This class represents the database for audio assets.
//
// It stores references to all the assets either imported or
// created by the user.  Assets are stored in bins according
// to their type for easier access by editor clients.
//
// It also stores references to all registered clients of the
// database.  Clients are notified whenever a modification is
// made to asset data.  Note that since clients may have their
// own references to the assets they modify, clients are
// responsible for notifying the database of any data modification
// so that it can dispatch to all the other clients.
//

#ifndef __AeAssetBase__
#define __AeAssetBase__

#include "AeTypes.h"
#include "AeAsset.h"


template<class T> class GList;
class AeClient;
class AeAssetBin;
class AeAsset;


class AeAssetBase
{
public:
                                AeAssetBase (void);
    virtual			~AeAssetBase (void);

    int				GetNumBins (void);
    AeAssetBin *		GetIndexedBin (int index);
    GList<AeAssetBin *> *	GetBinList (void) { return fBinList; }

    void			AppendAsset (AeAsset *);
    void			AppendAssetList (GList<AeAsset *> *);

    void			DeleteAsset (AeAsset *);
    void			DeleteAllAssets (void);

    void			AppendClient (AeClient *);
    void			RemoveClient (AeClient *);

    void			NotifyCreate (AeAsset *);
    void			NotifyUpdate (AeAsset *);
    void			NotifyDelete (AeAsset *);
    void			NotifySelect (AeAsset *);
    void			NotifyOnline (AeAsset *);
    void			NotifySuspend (void);
    void			NotifyResume (void);

    Boolean			FindTypedBin (TAssetType, AeAssetBin* & bin);

private:
    void			createBins (void);
    void			appendAssetList (GList<AeAsset *> *);
    void			appendAssetRefs (AeAsset *);
    void			appendPrim (AeAsset *);
    void			deleteAssetRefs (AeAsset *);
    void			deletePrim (AeAsset *);

    GList<AeAssetBin *> *	fBinList;
    GList<AeClient *> *		fClientList;
    short			fNotifySuspended;

#ifndef NDEBUG
public:
    void 			MakeTestAssets (void);

private:
    void 			MakeBankFileAssets (void);
    void 			MakeBankAssets (class AeContainerAsset *, String);
    void 			MakeInstAssets (class AeBankAsset *, String);
    void 			MakeSoundAssets (class AeInstAsset *, String);
    AeEnvAsset *		MakeEnvAsset (String);
    AeKeymapAsset *		MakeKeymapAsset (String);
    AeWaveAsset *		MakeWaveAsset (String);
#endif

};




#endif __AeAssetBase__