Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5206 in orxonox.OLD for trunk/src/lib/shell/shell_buffer.cc


Ignore:
Timestamp:
Sep 19, 2005, 12:31:56 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Shell no more singleton, and ShellInput is now derive from Text correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell_buffer.cc

    r5183 r5206  
    3333{
    3434  ShellBuffer::singletonRef = this;
     35  this->shell = NULL;
    3536
    3637  this->lineCount = 0;
     
    5051ShellBuffer::~ShellBuffer ()
    5152{
    52   if (Shell::isInstanciated())
    53     delete Shell::getInstance();
     53  if (this->shell != NULL)
     54    delete this->shell;
    5455
    5556  this->flushBuffers();
     
    5859
    5960  ShellBuffer::singletonRef = NULL;
     61}
     62
     63/**
     64 * registers the Shell to the Buffer
     65 * @param shell the Shell to register.
     66 */
     67void ShellBuffer::registerShell(Shell* shell)
     68{
     69  if (this->shell == NULL)
     70    this->shell = shell;
     71  else
     72    PRINTF(1)("already registered a Shell to the ShellBuffer\n");
     73}
     74
     75/**
     76 * unregisters the Shell from the Buffer
     77 * @param shell the Shell to unregister.
     78 */
     79void ShellBuffer::unregisterShell(Shell* shell)
     80{
     81  if (this->shell == shell)
     82    this->shell = NULL;
     83  else
     84    PRINTF(1)("cannot unregister shell, because it is not registered to the ShellBuffer\n");
    6085}
    6186
     
    150175    this->lineCount++;
    151176    this->buffer->add(addLine);
    152     if (Shell::isInstanciated() && Shell::getInstance()->isActive())
    153       Shell::getInstance()->printToDisplayBuffer(addLine);
     177    if (likely (this->shell != NULL) && unlikely (this->shell->isActive()))
     178      this->shell->printToDisplayBuffer(addLine);
    154179
    155180    if (this->buffer->getSize() > this->bufferSize)
Note: See TracChangeset for help on using the changeset viewer.