void MainMenuWindow::fillModules()
	{
		MenuBase* modulesMenu = getMenu("MainMenu/Modules/Menu");

		ModuleMap modules = CoreSubsystem::getSingleton().getAllModules();
		mActiveModule = CoreSubsystem::getSingleton().getActiveAdventureModule();

		for(ModuleMap::iterator modIt = modules.begin();
			modIt != modules.end(); modIt++)
		{
			ContentModule* mod = (*modIt).second;

			if (!mod->isCommon())
			{
				if (mActiveModule == NULL)
					mActiveModule = mod;

				MenuItem* it = static_cast<MenuItem*>(
					CEGUI::WindowManager::getSingleton().createWindow("RastullahLook/MenuItem",
					getNamePrefix()+"MainMenu/Modules/" + mod->getId()));

				if (mod == mActiveModule)
					it->setText(mod->getName() + " *");
				else
					it->setText(mod->getName());
				modulesMenu->addItem(it);

				it->subscribeEvent(
					MenuItem::EventClicked,
					boost::bind(&MainMenuWindow::handleChooseModule, this, it, mod));
			}
		}
	}
int main(int argc, char** argv) {
    ros::init(argc, argv, "batteryInfo");
    nodeHandle = ros::NodeHandlePtr(new ros::NodeHandle("~"));
    getNamePrefix();
    ROS_INFO("Subscribing to /diagnostics ...");
    ros::Subscriber diagnosticsSub = nodeHandle->subscribe("/diagnostics", 1, diagnosticsCallback);
    ros::spin();
    return 0;
}
Beispiel #3
0
uint64_t
NamePrefixTableEntry::removeRoutingTableEntry(std::shared_ptr<RoutingTablePoolEntry>
                                              entryPtr)
{
  auto iterator = std::find(m_rteList.begin(), m_rteList.end(), entryPtr);

  if (iterator != m_rteList.end()) {
    (*iterator)->decrementUseCount();
    // Remove this NamePrefixEntry from the RoutingTablePoolEntry
    (*iterator)->namePrefixTableEntries.erase(getNamePrefix());
    m_rteList.erase(iterator);
  }
  else {
    NLSR_LOG_ERROR("Routing entry for: " << entryPtr->getDestination()
               << " not found in NPT entry: " << getNamePrefix());
  }
  return entryPtr->getUseCount();
}
void InGameMenuWindow::createMenu(MenuBase* menu)
{
	CEGUI::WindowManager* windowMan = CEGUI::WindowManager::getSingletonPtr();

	const ActionVector actions = ActionManager::getSingleton().getInGameGlobalActions();
	map<CeGuiString, PopupMenu*> menuGroups;

	for (ActionVector::const_iterator actIter = actions.begin(); actIter != actions.end(); actIter++)
	{
        Action* action = *actIter;
		ActionGroup* group = action->getGroup();
		if (group != NULL)
		{
			PopupMenu* menuGrp;
			map<CeGuiString, PopupMenu*>::iterator grpIter = menuGroups.find(group->getName());
			if (grpIter != menuGroups.end())
			{
				menuGrp = (*grpIter).second;
			}
			else
			{
				MenuItem* grpItem = static_cast<MenuItem*>(windowMan->createWindow("RastullahLook/MenuItem",
					getNamePrefix()+"IngameMenu/"+group->getName()));
				grpItem->setText(group->getName());
				menu->addChildWindow(grpItem);

				menuGrp = static_cast<PopupMenu*>(windowMan->createWindow("RastullahLook/PopupMenu",
					getNamePrefix()+"IngameMenu/Menu"+group->getName()));
				grpItem->addChildWindow(menuGrp);

				menuGroups[group->getName()] = menuGrp;
			}

			MenuItem* item = static_cast<MenuItem*>(windowMan->createWindow("RastullahLook/MenuItem",
				getNamePrefix()+"IngameMenu/"+group->getName()+"/"+action->getName()));
			item->setText(action->getDescription());
			menuGrp->addChildWindow(item);

			setAction(item, action);
		}
	}
}
Beispiel #5
0
int64_t ThriftServer::getLoad(const std::string& counter, bool check_custom) {
  if (check_custom && getLoad_) {
    return getLoad_(counter);
  }

  int reqload = 0;
  int connload = 0;
  int queueload = 0;
  if (maxRequests_ > 0) {
    reqload = (100*(activeRequests_ + getPendingCount()))
      / ((float)maxRequests_);
  }
  auto ioGroup = getIOGroupSafe();
  auto workerFactory = ioGroup != nullptr ?
    std::dynamic_pointer_cast<wangle::NamedThreadFactory>(
      ioGroup->getThreadFactory()) : nullptr;

  if (maxConnections_ > 0) {
    int32_t connections = 0;
    forEachWorker([&](wangle::Acceptor* acceptor) mutable {
      auto worker = dynamic_cast<Cpp2Worker*>(acceptor);
      connections += worker->getPendingCount();
    });

    connload = (100*connections) / (float)maxConnections_;
  }

  auto tm = getThreadManager();
  if (tm) {
    auto codel = tm->getCodel();
    if (codel) {
      queueload = codel->getLoad();
    }
  }

  if (VLOG_IS_ON(1) && workerFactory) {
    FB_LOG_EVERY_MS(INFO, 1000 * 10)
      << workerFactory->getNamePrefix() << " load is: "
      << reqload << "% requests, "
      << connload << "% connections, "
      << queueload << "% queue time, "
      << activeRequests_ << " active reqs, "
      << getPendingCount() << " pending reqs";
  }

  int load = std::max({reqload, connload, queueload});
  return load;
}
Beispiel #6
0
uint64_t
NamePrefixTableEntry::removeRoutingTableEntry(shared_ptr<RoutingTablePoolEntry>
                                              rtpePtr)
{
  auto rtpeItr = std::find(m_rteList.begin(), m_rteList.end(), rtpePtr);

  if (rtpeItr != m_rteList.end()) {
    (*rtpeItr)->decrementUseCount();
    m_rteList.erase(rtpeItr);
  }
  else {
    _LOG_ERROR("Routing entry for: " << rtpePtr->getDestination()
               << " not found in NPT entry: " << getNamePrefix());
  }
  return (*rtpeItr)->getUseCount();
}
Beispiel #7
0
std::string ThriftServer::getLoadInfo(int64_t load) const {
  auto ioGroup = getIOGroupSafe();
  auto workerFactory = ioGroup != nullptr
      ? std::dynamic_pointer_cast<folly::NamedThreadFactory>(
            ioGroup->getThreadFactory())
      : nullptr;

  if (!workerFactory) {
    return "";
  }

  std::stringstream stream;

  stream << workerFactory->getNamePrefix() << " load is: " << load
         << "% requests, " << getActiveRequests() << " active reqs";

  return stream.str();
}
Beispiel #8
0
std::string ThriftServer::getLoadInfo(int64_t reqload, int64_t connload, int64_t queueload) {
  auto ioGroup = getIOGroupSafe();
  auto workerFactory = ioGroup != nullptr ?
    std::dynamic_pointer_cast<wangle::NamedThreadFactory>(
      ioGroup->getThreadFactory()) : nullptr;

  if (!workerFactory) {
    return "";
  }

  std::stringstream stream;

  stream
    << workerFactory->getNamePrefix() << " load is: "
    << reqload << "% requests, "
    << connload << "% connections, "
    << queueload << "% queue time, "
    << activeRequests_ << " active reqs, "
    << getPendingCount() << " pending reqs";

  return stream.str();
}