/****************************************************************************** * * * File: ComponentConfigurator.h * * * * Description: An abstract class for representing the dependencies between * * components. * * * * Project: 2K - Automatic Configuration * * Author: Fabio Kon (f-kon@cs.uiuc.edu) * * * ******************************************************************************* Revision Control Information $Revision: $ $Log: $ ******************************************************************************/ #if !defined (COMPONENT_CONFIGURATOR_H) #define COMPONENT_CONFIGURATOR_H #include "ComponentEvent.h" class ComponentConfigurator { public: /* Deletes the references to all internal data structures. */ virtual void destroyComponentConfigurator () = 0; /* Adds a hook to the configurator. * @param hookName the name of the hook to be added. */ virtual int addHook (const char *hookName) = 0; /* Deletes a hook from the configurator. * @param hookName the name of the hook to be deleted. */ virtual int deleteHook (const char *hookName) = 0; /* Attaches a ComponentConfigurator to the given hook. * @param hookName the name of the hook. * @param cc the ComponentConfigurator to be attached to the hook. */ virtual int hook (const char *hookName, ComponentConfigurator *cc) = 0; /* Detaches a ComponentConfigurator from the given hook. * @param hookName the name of the hook. * @param cc the ComponentConfigurator to be detached. */ virtual int unhook (const char *hookName) = 0; /* Adds a new component to the list of clients. * @param client the ComponentConfigurator representing the new client. * @param hookNameInClient the name of the hook to which * this component is attached. */ virtual int registerClient (ComponentConfigurator *client, const char *hookNameInClient) = 0; /* Removes a pair (client, hook) from the list of clients. * @param client the ComponentConfigurator representing the new client. * @param hookNameInClient the name of the hook to which * this component is attached. */ virtual int unregisterClient (ComponentConfigurator *client, const char *hookNameInClient) = 0; /* This implementation simply prints the event to the standard output. * @param hookedComponent the ComponentConfigurator that generated the event. * @param e the event that was generated. */ virtual void eventOnHookedComponent (const ComponentConfigurator *hookedComponent, const ComponentEvent *e) = 0; /* This implementation simply prints the event to the standard output. * @param client the ComponentConfigurator that generated the event. * @param e the event that was generated. */ virtual void eventOnClient (const ComponentConfigurator *client, const ComponentEvent *e) = 0; /* Accessor for the component name. * @return a string containing the component name. */ virtual const char *name () const = 0; /* Accessor for the component information string. * @return a string containing component information. */ virtual const char *info () const = 0; /* Provides a list of the hooks in this component. * @returns a list of DependencySpecifications. */ virtual const DependencyList *listHooks () = 0; /* Provides a list of the clients of this component. * @returns a vector of DependencySpecifications. */ virtual const DependencyList *listClients () = 0; /* Provides the number of clients of this component. * May be used for garbage collection. * @returns the size of the list of clients. */ virtual int numberOfClients () = 0; /* Sets the name of this component. */ virtual void name (const char *s) = 0; /* Sets the information string for this component. */ virtual void info (const char *s) = 0; }; #endif