本文整理汇总了C++中Model::GetNumberFromChannelString方法的典型用法代码示例。如果您正苦于以下问题:C++ Model::GetNumberFromChannelString方法的具体用法?C++ Model::GetNumberFromChannelString怎么用?C++ Model::GetNumberFromChannelString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::GetNumberFromChannelString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetOutputs
void Falcon::SetOutputs(ModelManager* allmodels, OutputManager* outputManager, std::list<int>& selected, wxWindow* parent)
{
//ResetStringOutputs(); // this shouldnt be used normally
static log4cpp::Category &logger_base = log4cpp::Category::getInstance(std::string("log_base"));
logger_base.debug("Falcon Outputs Upload: Uploading to %s", (const char *)_ip.c_str());
// build a list of models on this controller
std::list<Model*> models;
std::list<std::string> protocolsused;
std::list<Model*> warnedmodels;
int maxport = 0;
// Get universes based on IP
std::list<Output*> outputs = outputManager->GetAllOutputs(_ip);
// get outputs based on selected
std::list<Output*> o2 = outputManager->GetAllOutputs(selected);
// now merge them together and eleminate the duplicates
outputs.merge(o2);
outputs.sort();
outputs.unique();
for (auto ito = outputs.begin(); ito != outputs.end(); ++ito)
{
// this universe is sent to the falcon
// find all the models in this range
for (auto it = allmodels->begin(); it != allmodels->end(); ++it)
{
if (it->second->GetDisplayAs() != "ModelGroup")
{
int modelstart = it->second->GetNumberFromChannelString(it->second->ModelStartChannel);
int modelend = modelstart + it->second->GetChanCount() - 1;
if ((modelstart >= (*ito)->GetStartChannel() && modelstart <= (*ito)->GetEndChannel()) ||
(modelend >= (*ito)->GetStartChannel() && modelend <= (*ito)->GetEndChannel()))
{
//logger_base.debug("Model %s start %d end %d found on controller %s output %d start %d end %d.",
// (const char *)it->first.c_str(), modelstart, modelend,
// (const char *)_ip.c_str(), node, currentcontrollerstartchannel, currentcontrollerendchannel);
if (!it->second->IsControllerConnectionValid())
{
// only warn if we have not already warned
if (std::find(warnedmodels.begin(), warnedmodels.end(), it->second) == warnedmodels.end())
{
warnedmodels.push_back(it->second);
logger_base.warn("Falcon Outputs Upload: Model %s on controller %s does not have its Controller Connection details completed: '%s'. Model ignored.", (const char *)it->first.c_str(), (const char *)_ip.c_str(), (const char *)it->second->GetControllerConnection().c_str());
wxMessageBox("Model " + it->first + " on controller " + _ip + " does not have its Contoller Connection details completed: '" + it->second->GetControllerConnection() + "'. Model ignored.", "Model Ignored");
}
}
else
{
// model uses channels in this universe
// check we dont already have this model in our list
if (std::find(models.begin(), models.end(), it->second) == models.end())
{
logger_base.debug("Falcon Outputs Upload: Uploading Model %s.", (const char *)it->first.c_str());
models.push_back(it->second);
if (std::find(protocolsused.begin(), protocolsused.end(), it->second->GetProtocol()) == protocolsused.end())
{
protocolsused.push_back(it->second->GetProtocol());
}
if (it->second->GetPort() > maxport)
{
maxport = it->second->GetPort();
}
}
}
}
}
}
}
// sort the models by start channel
models.sort(compare_startchannel);
// get the current config before I start
std::string strings = GetURL("/strings.xml");
if (strings == "")
{
logger_base.error("Falcon Outputs Upload: Falcon would not return strings.xml.");
wxMessageBox("Error occured trying to upload to Falcon.", "Error", wxOK, parent);
return;
}
// for each protocol
for (auto protocol = protocolsused.begin(); protocol != protocolsused.end(); ++protocol)
{
std::string sendmessage;
int count = 0;
bool portdone[100];
memset(&portdone, 0x00, sizeof(portdone)); // all false
// for each port ... this is the max of any port type but it should be ok
for (int i = 1; i <= maxport; i++)
{
// find the first and last
//.........这里部分代码省略.........