本文整理汇总了C++中Floor::GetInterfaceCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Floor::GetInterfaceCount方法的具体用法?C++ Floor::GetInterfaceCount怎么用?C++ Floor::GetInterfaceCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floor
的用法示例。
在下文中一共展示了Floor::GetInterfaceCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
void Person::Initialize(Environment &env) {
env.RegisterEventHandler("UpDownButton::Decide", this, &Person::HandleDecide);
env.RegisterEventHandler("Elevator::Opened", this, &Person::HandleOpened);
env.RegisterEventHandler("Elevator::Beeping", this, &Person::HandleBeeping);
env.RegisterEventHandler("Elevator::Beeped", this, &Person::HandleBeeped);
env.RegisterEventHandler("Person::Entered", this, &Person::HandleEntered);
env.RegisterEventHandler("Person::Exiting", this, &Person::HandleExiting);
env.RegisterEventHandler("Person::Exited", this, &Person::HandleExited);
env.RegisterEventHandler("Elevator::Closed", this, &Person::HandleClosed);
env.RegisterEventHandler("Elevator::Moving", this, &Person::HandleMoving);
env.RegisterEventHandler("Elevator::Fixed", this, &Person::HandleFixed);
env.RegisterEventHandler("Elevator::Malfunction", this, &Person::HandleMalfunction);
env.RegisterEventHandler("Interface::Notify", this, &Person::HandleNotify);
env.RegisterEventHandler("Elevator::Closing", this, &Person::HandleClosing);
std::list<Floor*> init;
init.push_front(current_);
std::list<std::list<Floor*>> paths;
paths.push_front(init);
do {
std::list<Floor*> path = paths.front();
Floor *current = path.back();
paths.pop_front();
if (current == final_) {
path.pop_front();
path_ = path;
break;
}
for (int i = 0; i < current->GetInterfaceCount(); ++i) {
Interface *interf = current->GetInterface(i);
Elevator *ele = static_cast<Elevator*>(interf->GetLoadable(0));
for (int j = 0; j < ele->GetInterfaceCount(); ++j) {
Interface *binterf = ele->GetInterface(j);
Floor *floor = static_cast<Floor*>(binterf->GetLoadable(0));
if (floor != current) {
path.push_back(floor);
paths.push_back(path);
path.pop_back();
}
}
}
} while (true);
std::cout << "Path for " << GetName() << " is ";
for (Floor *floor : path_) {
std::cout << "Floor " << floor->GetId() << " ";
}
std::cout << std::endl;
RequestElevator(env, start_);
}