///
/// The base manager
///

#ifndef __MANAGER_H__
#define __MANAGER_H__

#include "GameObjectList.h"
#include "Event.h"

#define MAX_EVENTS 100		          /// maximum number of events

class Manager {

 protected:
  string _event[MAX_EVENTS];               /// names of events
  GameObjectList obj_list[MAX_EVENTS];    /// objects in list
  int event_list_count;		          /// count of event lists

  /// If this event is allowed by the manager, return 1 else 0
  /// (this is virtual and can be overwritten by child classes).
  virtual bool isValid(string event_name){
	  return true;
  }
  
 public:
  Manager();
  virtual ~Manager();
  
  /// Send event to all interested objects
  void onEvent(Event *p_event);

  /// Indicate interest in event.
  /// Return 0 if ok, else -1.
  int registerInterest(GameObject *p_go, string event_name);

  /// Indicate no longer interest in event
  /// Return 0 if ok, else -1.
  int unregisterInterest(GameObject *p_go, string event_name);

  /// Startup the Manager.
  /// Return 0 if ok, else negative number
  virtual int startUp();

  /// Shutdown the Manager.
  virtual void shutDown();

  int addEvent(string event_name);
};

#endif /// __MANAGER_H__


