/* **************************************************************************** * * check - should Scope::check always return "OK"? */ TEST(Scope, check) { Scope scope; Scope scope1("", "value"); Scope scope2("type", ""); Scope scope3("type", "value"); std::string checked; std::string expected = "Empty type in restriction scope"; std::string expected1 = "Empty type in restriction scope"; std::string expected2 = "Empty value in restriction scope"; std::string expected3 = "OK"; utInit(); checked = scope.check(RegisterContext, XML, "", "", 0); EXPECT_STREQ(checked.c_str(), expected.c_str()); checked = scope1.check(RegisterContext, XML, "", "", 0); EXPECT_STREQ(checked.c_str(), expected1.c_str()); checked = scope2.check(RegisterContext, XML, "", "", 0); EXPECT_STREQ(checked.c_str(), expected2.c_str()); checked = scope3.check(RegisterContext, XML, "", "", 0); EXPECT_STREQ(checked.c_str(), expected3.c_str()); utExit(); }
/* **************************************************************************** * * getAndSize - */ TEST(ScopeVector, getAndSize) { ScopeVector sV; Scope scope0("Type", "Value0"); Scope scope1("Type", "Value1"); Scope scope2("Type", "Value2"); Scope* scopeP; utInit(); sV.push_back(&scope0); sV.push_back(&scope1); sV.push_back(&scope2); EXPECT_EQ(3, sV.size()); scopeP = sV[0]; EXPECT_STREQ("Value0", scopeP->value.c_str()); scopeP = sV[1]; EXPECT_STREQ("Value1", scopeP->value.c_str()); scopeP = sV[2]; EXPECT_STREQ("Value2", scopeP->value.c_str()); utExit(); }
int main() { scope1(); scope2(); scope3(); scope4(); scope5(); return 0; }
int main(int argc, char* argv[]) { orbManager = new ORBManager(argc, argv); string configFilename = "iviScope.ini"; //default ConfigFile configFile(configFilename); string logicalName = "IVI Scope"; if (!(configFile.getParameter("logicalName", logicalName))) cout << "Could not find logical name in config file." << endl; IVIScopeDevice scope1(orbManager, logicalName, configFilename); scope1.setSaveAttributesToFile(true); orbManager->run(); return 0; }
// reduce the size of tiles in order to hopefully use less memory overall bool RenderCache::ReduceTileSize() { if (maxTileSize.dx < 200 || maxTileSize.dy < 200) return false; ScopedCritSec scope1(&requestAccess); ScopedCritSec scope2(&cacheAccess); if (maxTileSize.dx > maxTileSize.dy) (int)maxTileSize.dx /= 2; else (int)maxTileSize.dy /= 2; // invalidate all rendered bitmaps and all requests while (cacheCount > 0) FreeForDisplayModel(cache[0]->dm); while (requestCount > 0) ClearQueueForDisplayModel(requests[0].dm); AbortCurrentRequest(); return true; }
/** Implement two different signatures: 1) throwable -> options -> format 2) throwable -> unit -> format */ vm_obj throwable_to_format(vm_obj const & _ex, vm_obj const & _opts) { throwable * ex = to_throwable(_ex); if (!ex) return to_obj(format("null-exception")); if (auto kex = dynamic_cast<ext_exception*>(ex)) { if (is_simple(_opts)) { io_state_stream ios = tout(); formatter fmt = ios.get_formatter(); return to_obj(kex->pp(fmt)); } else { options opts = to_options(_opts); scope_trace_env scope1(opts); io_state_stream ios = tout(); formatter fmt = ios.get_formatter(); return to_obj(kex->pp(fmt)); } } else if (auto fex = dynamic_cast<formatted_exception*>(ex)) { return to_obj(fex->pp()); } else { return to_obj(format(ex->what())); } }