trick/trick_source/sim_services/ExternalApplications/ExternalApplicationManager.cpp

48 lines
1.4 KiB
C++
Raw Permalink Normal View History

#include "trick/ExternalApplicationManager.hh"
#include "trick/ExternalApplication.hh"
2015-02-26 15:02:31 +00:00
#include <vector>
namespace Trick {
namespace {
std::vector<ExternalApplication *> externalApplications;
}
std::vector<ExternalApplication *> &get_external_applications() {
return externalApplications;
}
void add_external_application(ExternalApplication &externalApplication) {
for (std::vector<ExternalApplication *>::iterator i = externalApplications.begin();
i < externalApplications.end(); ++i) {
if (*i == &externalApplication) {
return;
}
}
externalApplications.push_back(&externalApplication);
}
void remove_external_application(ExternalApplication &externalApplication) {
for (std::vector<ExternalApplication *>::iterator i = externalApplications.begin();
i < externalApplications.end(); ++i) {
if (*i == &externalApplication) {
externalApplications.erase(i);
break;
}
}
}
void remove_all_external_applications() {
externalApplications.clear();
}
void launch_all_external_applications() {
for (std::vector<ExternalApplication *>::iterator i = externalApplications.begin();
i < externalApplications.end(); ++i) {
(*i)->launch();
}
}
}