registers[] = new BSRegister(); return end(self::SharedInstance()->registers); } // ################################################################### /** * Returns the array of all the registers * * @return array The array of all the registers */ public static function GetAllRegisters() { return self::SharedInstance()->registers; } // ################################################################### /** * Sets the main register * * @param object New main register */ public static function SetRegister($register) { if (get_class($register) != 'BSRegister') { throw new Exception('BSLoader::SetRegister() was not passed a BSRegister object'); } self::SharedInstance()->main = $register; } // ################################################################### /** * Gets the main register if no argument is passed, or an arbitrary * one if the index of a register is passed. * * @param integer Register index * * @return object Specified register */ public static function &GetRegister($index = null) { if (is_null($index)) { if (!isset(self::SharedInstance()->main)) { throw new Exception('Cannot fetch the main register because it has not been set with BSLoader::SetRegister()'); } return self::SharedInstance()->main; } else { if (!isset(self::SharedInstance()->registers["$index"])) { throw new Exception('Invalid register index passed to BSLoader::GetRegister()'); } return self::SharedInstance()->registers["$index"]; } } // ################################################################### /** * Loads the specified module. * * @param string Module name * * @return object Instantiated module */ public static function LoadModule($name) { if (!file_exists("ISSO/$name.php")) { throw new Exception('Specified module does not exist'); } require_once("ISSO/$name.php"); $class = "BS$name"; if (!class_exists($class)) { throw new Exception('Specifed module does not conform to the ISSO specification, or the class is missing'); } return new $class; } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>