/**
  * Register a component as part of the current page
  *
  * @param __IComponent $component The component to register to
  */
 public function registerComponent(__IComponent &$component)
 {
     if ($component instanceof __IPoolable && $component->getPersist()) {
         $names_array =& $this->_component_names;
     } else {
         $names_array =& $this->_non_poolable_component_names;
     }
     if ($component->getIndex() !== null) {
         if (!key_exists($component->getName(), $names_array)) {
             $names_array[$component->getName()] = array();
         } else {
             if (!is_array($names_array[$component->getName()])) {
                 throw __ExceptionFactory::getInstance()->createException('ERR_INDEX_NOT_EXPECTED_FOR_COMPONENT', array($component->getIndex(), $component->getName()));
             }
         }
         $names_array[$component->getName()][$component->getIndex()] = $component->getId();
     } else {
         $names_array[$component->getName()] = $component->getId();
     }
     //set the view code:
     $component->setViewCode($this->_view_code);
     //pool the component:
     __ComponentPool::getInstance()->registerComponent($component);
 }