Пример #1
0
//------------------------------------------------------------------------------
// updateData() -- Update non-time critical (background) stuff here
//------------------------------------------------------------------------------
void Component::updateData(const LCreal dt)
{
    // Update all my children
    PairStream* subcomponents = getComponents();
    if (subcomponents != 0) {
        if (selection != 0) {
            // When we've selected only one
            if (selected != 0) selected->updateData(dt);
        }
        else {
            // When we should update them all
            List::Item* item = subcomponents->getFirstItem();
            while (item != 0) {
                Pair* pair = (Pair*)(item->getValue());
                Component* obj = (Component*)( pair->object() );
                if (obj != 0) obj->updateData(dt);
                item = item->getNext();
            }
        }
        subcomponents->unref();
        subcomponents = 0;
    }
    
    // Update our log file
    if (elog0 != 0) {
        elog0->updateData(dt);
    }
}
Пример #2
0
//------------------------------------------------------------------------------
// reset() -- Reset parameters
//------------------------------------------------------------------------------
void Component::reset()
{
   PairStream* subcomponents = getComponents();
   if (subcomponents != 0) {
        if (selection != 0) {
            // When we've selected only one
            if (selected != 0) selected->reset();
        }
        else {
            // When we should reset them all
            List::Item* item = subcomponents->getFirstItem();
            while (item != 0) {
                Pair* pair = (Pair*)(item->getValue());
                Component* obj = (Component*)( pair->object() );
                if (obj != 0) obj->reset();
                item = item->getNext();
            }
        }
        subcomponents->unref();
        subcomponents = 0;
    }
    
    // Reset the log file
    if (elog0 != 0) {
        elog0->reset();
    }
}
Пример #3
0
//------------------------------------------------------------------------------
// shutdownNotification() -- Default shutdown
//------------------------------------------------------------------------------
bool Component::shutdownNotification()
{
   // Tell all of our components
   PairStream* subcomponents = getComponents();
   if (subcomponents != nullptr) {
      List::Item* item = subcomponents->getFirstItem();
      while (item != nullptr) {
         const auto pair = static_cast<Pair*>(item->getValue());
         const auto p = static_cast<Component*>(pair->object());
         p->event(SHUTDOWN_EVENT);
         item = item->getNext();
      }
      subcomponents->unref();
      subcomponents = nullptr;
   }

   shutdown = true;
   return shutdown;
}
Пример #4
0
//------------------------------------------------------------------------------
// shutdownNotification() -- Default shutdown
//------------------------------------------------------------------------------
bool Component::shutdownNotification()
{
   // Tell all of our components
   PairStream* subcomponents = getComponents();
   if (subcomponents != 0) {
      List::Item* item = subcomponents->getFirstItem();
      while (item != 0) {
         Pair* pair = (Pair*)(item->getValue());
         Component* p = (Component*) pair->object();
         p->event(SHUTDOWN_EVENT);
         item = item->getNext();
      }
      subcomponents->unref();
      subcomponents = 0;
   }

   shutdown = true;
   return shutdown;
}
Пример #5
0
//------------------------------------------------------------------------------
// reset() -- Reset parameters
//------------------------------------------------------------------------------
void Component::reset()
{
   PairStream* subcomponents = getComponents();
   if (subcomponents != nullptr) {
        if (selection != nullptr) {
            // When we've selected only one
            if (selected != nullptr) selected->reset();
        }
        else {
            // When we should reset them all
            List::Item* item = subcomponents->getFirstItem();
            while (item != nullptr) {
                const auto pair = static_cast<Pair*>(item->getValue());
                const auto obj = static_cast<Component*>(pair->object());
                obj->reset();
                item = item->getNext();
            }
        }
        subcomponents->unref();
        subcomponents = nullptr;
    }
}
Пример #6
0
//------------------------------------------------------------------------------
// updateTC() -- Update time critical stuff here
//------------------------------------------------------------------------------
void Component::updateTC(const double dt)
{
    // Update all my children
    PairStream* subcomponents = getComponents();
    if (subcomponents != nullptr) {
        if (selection != nullptr) {
            // When we've selected only one
            if (selected != nullptr) selected->tcFrame(dt);
        }
        else {
            // When we should update them all
            List::Item* item = subcomponents->getFirstItem();
            while (item != nullptr) {
                const auto pair = static_cast<Pair*>(item->getValue());
                const auto obj = static_cast<Component*>( pair->object() );
                obj->tcFrame(dt);
                item = item->getNext();
            }
        }
        subcomponents->unref();
        subcomponents = nullptr;
    }
}