core/interfaces/IShareSys.h
changeset 211 4c77142eaf36
parent 140 2c25d4131b38
child 215 6fbad23e773e
     1.1 --- a/core/interfaces/IShareSys.h	Wed Dec 13 11:19:46 2006 +0000
     1.2 +++ b/core/interfaces/IShareSys.h	Fri Dec 15 13:38:04 2006 +0000
     1.3 @@ -1,8 +1,11 @@
     1.4  #ifndef _INCLUDE_SOURCEMOD_IFACE_SHARE_SYS_H_
     1.5  #define _INCLUDE_SOURCEMOD_IFACE_SHARE_SYS_H_
     1.6  
     1.7 +#include <sp_vm_types.h>
     1.8 +
     1.9  namespace SourceMod
    1.10  {
    1.11 +	typedef unsigned int		IdentityToken_t;
    1.12  	/**
    1.13  	 * @brief Defines the base functionality required by a shared interface.
    1.14  	 */
    1.15 @@ -37,48 +40,6 @@
    1.16  		}
    1.17  	};
    1.18  
    1.19 -	enum UnloadableParentType
    1.20 -	{
    1.21 -		ParentType_Module,
    1.22 -		ParentType_Plugin
    1.23 -	};
    1.24 -
    1.25 -	/**
    1.26 -	 * @brief Denotes a top-level unloadable object.
    1.27 -	 */
    1.28 -	class IUnloadableParent
    1.29 -	{
    1.30 -	public:
    1.31 -		virtual UnloadableParentType GetParentType() =0;
    1.32 -
    1.33 -		virtual void *GetParentToken() =0;
    1.34 -	
    1.35 -		/**
    1.36 -		 * @brief Called when an interface this object has requested is removed.
    1.37 -		 *
    1.38 -		 * @param pIface		Interface being removed.
    1.39 -		 */
    1.40 -		virtual void OnInterfaceUnlink(SMInterface *pIface) =0;
    1.41 -	protected:
    1.42 -		void *m_parent_token;
    1.43 -	};
    1.44 -
    1.45 -	/**
    1.46 -	 * @brief Listens for unlinked objects.
    1.47 -	 */
    1.48 -	class IUnlinkListener
    1.49 -	{
    1.50 -	public:
    1.51 -		/**
    1.52 -		 * @brief Called when a parent object is unloaded.
    1.53 -		 *
    1.54 -		 * @param parent		The parent object which is dying.
    1.55 -		 */
    1.56 -		virtual void OnParentUnlink(IUnloadableParent *parent)
    1.57 -		{
    1.58 -		}
    1.59 -	};
    1.60 -
    1.61  	/**
    1.62  	 * @brief Tracks dependencies and fires dependency listeners.
    1.63  	 */
    1.64 @@ -89,9 +50,9 @@
    1.65  		 * @brief Adds an interface to the global interface system
    1.66  		 *
    1.67  		 * @param iface			Interface pointer (must be unique).
    1.68 -		 * @param parent		Parent unloadable token given to the module/interface.
    1.69 +		 * @param token			Parent token of the module/interface.
    1.70  		 */
    1.71 -		virtual bool AddInterface(SMInterface *iface, IUnloadableParent *parent) =0;
    1.72 +		virtual bool AddInterface(SMInterface *iface, IdentityToken_t token) =0;
    1.73  
    1.74  		/**
    1.75  		 * @brief Requests an interface from the global interface system.
    1.76 @@ -99,36 +60,21 @@
    1.77  		 *
    1.78  		 * @param iface_name	Interface name.
    1.79  		 * @param iface_vers	Interface version to attempt to match.
    1.80 -		 * @param me			Object requesting this interface, in order to track dependencies.
    1.81 +		 * @param token			Object requesting this interface, in order to track dependencies.
    1.82  		 * @param pIface		Pointer to store the return value in.
    1.83  		 */
    1.84  		virtual bool RequestInterface(const char *iface_name, 
    1.85 -										unsigned int iface_vers, 
    1.86 -										IUnloadableParent *me,
    1.87 +										unsigned int iface_vers,
    1.88 +										IdentityToken_t token,
    1.89  										void **pIface) =0;
    1.90  
    1.91  		/**
    1.92 -		 * @brief Unloads an interface.
    1.93 -		 *
    1.94 -		 * @param iface			Interface pointer.
    1.95 -		 * @param parent		Security token, trivial measure to prevent accidental unloads.
    1.96 -		 *                      This token must match the one used with AddInterface().
    1.97 +		 * @brief Adds a list of natives to the global native pool.
    1.98 +		 * 
    1.99 +		 * @param token			Identity token of parent object.
   1.100 +		 * @param natives		Array of natives to add, NULL terminated.
   1.101  		 */
   1.102 -		virtual void RemoveInterface(SMInterface *iface, IUnloadableParent *parent) =0;
   1.103 -
   1.104 -		/**
   1.105 -		 * @brief Adds an unlink listener.
   1.106 -		 *
   1.107 -		 * @param pListener		Listener pointer.
   1.108 -		 */
   1.109 -		virtual void AddUnlinkListener(IUnlinkListener *pListener) =0;
   1.110 -
   1.111 -		/**
   1.112 -		 * @brief Removes an unlink listener.
   1.113 -		 *
   1.114 -		 * @param pListener		Listener pointer.
   1.115 -		 */
   1.116 -		virtual void RemoveUnlinkListener(IUnlinkListener *pListener) =0;
   1.117 +		virtual void AddNatives(IdentityToken_t token, const sp_nativeinfo_t *natives[]) =0;
   1.118  	};
   1.119  };
   1.120