本文整理汇总了C++中Place::activate方法的典型用法代码示例。如果您正苦于以下问题:C++ Place::activate方法的具体用法?C++ Place::activate怎么用?C++ Place::activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place::activate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createPlace
void TreeCorrelator::createPlace(std::map<std::string, std::string>& params,
bool verbose) {
bool replace = false;
if (params["replace"] != "")
replace = strings::to_bool(params["replace"]);
vector<string> names = split_names(params["name"]);
for (vector<string>::iterator it = names.begin();
it != names.end();
++it) {
if (params["type"] != "") {
if (replace) {
if (places_.count((*it)) != 1) {
stringstream ss;
ss << "TreeCorrelator: cannot replace Place " << (*it)
<< ", it doesn't exist";
throw TreeCorrelatorException(ss.str());
}
delete places_[(*it)];
if (verbose) {
Messenger m;
stringstream ss;
ss << "Replacing place " << (*it);
m.detail(ss.str(), 1);
}
} else {
if (places_.count((*it)) == 1) {
stringstream ss;
ss << "TreeCorrelator: place" << (*it) << " already exists";
throw TreeCorrelatorException(ss.str());
}
if (verbose) {
Messenger m;
stringstream ss;
ss << "Creating place " << (*it);
m.detail(ss.str(), 1);
}
}
Place* current = builder.create(params, verbose);
places_[(*it)] = current;
if (strings::to_bool(params["init"]))
current->activate(0.0);
}
if (params["parent"] != "root") {
bool coincidence = strings::to_bool(params["coincidence"]);
addChild(params["parent"], (*it), coincidence, verbose);
}
}
}