本文整理汇总了C++中Procedure类的典型用法代码示例。如果您正苦于以下问题:C++ Procedure类的具体用法?C++ Procedure怎么用?C++ Procedure使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Procedure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateAssignments
void CPPClientStubGenerator::generateAssignments(Procedure &proc)
{
string assignment;
parameterNameList_t list = proc.GetParameters();
if(list.size() > 0)
{
for (parameterNameList_t::iterator it = list.begin(); it != list.end(); it++)
{
if(proc.GetParameterDeclarationType() == PARAMS_BY_NAME)
{
assignment = TEMPLATE_NAMED_ASSIGNMENT;
}
else
{
assignment = TEMPLATE_POSITION_ASSIGNMENT;
}
replaceAll2(assignment, "<paramname>", it->first);
cg.writeLine(assignment);
}
}
else
{
cg.writeLine("p = Json::nullValue;");
}
}
示例2: replaceAll2
void CPPClientStubGenerator::generateMethod(Procedure &proc)
{
string procsignature = TEMPLATE_CPPCLIENT_SIGMETHOD;
string returntype = CPPHelper::toCppType(proc.GetReturnType());
if (proc.GetProcedureType() == RPC_NOTIFICATION)
returntype = "void";
replaceAll2(procsignature, "<returntype>", returntype);
replaceAll2(procsignature, "<methodname>", CPPHelper::normalizeString(proc.GetProcedureName()));
replaceAll2(procsignature, "<parameters>", CPPHelper::generateParameterDeclarationList(proc));
cg.writeLine(procsignature);
cg.writeLine("{");
cg.increaseIndentation();
cg.writeLine("Json::Value p;");
generateAssignments(proc);
generateProcCall(proc);
cg.decreaseIndentation();
cg.writeLine("}");
}
示例3: ProcessRequest
void RpcProtocolServer::ProcessRequest(const Json::Value& request,
Json::Value& response)
{
Procedure* method = (*this->procedures)[request[KEY_REQUEST_METHODNAME].asString()];
Json::Value result;
if (method->GetProcedureType() == RPC_METHOD)
{
server->handleMethodCall(method, request[KEY_REQUEST_PARAMETERS],
result);
response[KEY_REQUEST_VERSION] = JSON_RPC_VERSION;
response[KEY_RESPONSE_RESULT] = result;
response[KEY_REQUEST_ID] = request[KEY_REQUEST_ID];
if (this->authManager != NULL)
{
this->authManager->ProcessAuthentication(
request[KEY_AUTHENTICATION],
response[KEY_AUTHENTICATION]);
}
}
else
{
server->handleNotificationCall(method, request[KEY_REQUEST_PARAMETERS]);
response = Json::Value::null;
}
}
示例4: generateToAir
void generateToAir(Procedure& procedure, Air::Code& code)
{
TimingScope timingScope("generateToAir");
// We don't require the incoming IR to have predecessors computed.
procedure.resetReachability();
if (shouldValidateIR())
validate(procedure);
// If we're doing super verbose dumping, the phase scope of any phase will already do a dump.
if (shouldDumpIR() && !shouldDumpIRAtEachPhase()) {
dataLog("Initial B3:\n");
dataLog(procedure);
}
reduceStrength(procedure);
// FIXME: Add more optimizations here.
// https://bugs.webkit.org/show_bug.cgi?id=150507
moveConstants(procedure);
if (shouldValidateIR())
validate(procedure);
// If we're doing super verbose dumping, the phase scope of any phase will already do a dump.
// Note that lowerToAir() acts like a phase in this regard.
if (shouldDumpIR() && !shouldDumpIRAtEachPhase()) {
dataLog("B3 after ", procedure.lastPhaseName(), ", before generation:\n");
dataLog(procedure);
}
lowerToAir(procedure, code);
}
示例5: RemoveProcedure
bool ProcedureController::RemoveProcedure(const ProcedureCacheKey &id, const Procedure &procedure)
{
if(procedure.IsTemplateProcedure() && !procedure.IsPureTemplateProcedure())
{
qint32 procedureId = procedure.GetProcedureId();
if(m_proceduresFromTemplate.count(procedureId) != 0)
{
std::set<qint32> &procedureSet = m_proceduresFromTemplate.at(procedureId);
procedureSet.erase(procedure.GetProjectProcedureId());
if(procedureSet.size() == 0)
{
m_proceduresFromTemplate.erase(procedureId);
// procedureSet is now invalid.
}
}
//else
//{
// // Should never happen.
//}
}
return m_cache.Remove(id);
}
示例6: throw
vector<Procedure> SpecificationParser::GetProceduresFromString(const string &content) throw(JsonRpcException)
{
Json::Reader reader;
Json::Value val;
if(!reader.parse(content,val))
{
throw JsonRpcException(Errors::ERROR_RPC_JSON_PARSE_ERROR, " specification file contains syntax errors");
}
if (!val.isArray())
{
throw JsonRpcException(Errors::ERROR_SERVER_PROCEDURE_SPECIFICATION_SYNTAX, " top level json value is not an array");
}
vector<Procedure> result;
map<string, Procedure> procnames;
for (unsigned int i = 0; i < val.size(); i++)
{
Procedure proc;
GetProcedure(val[i], proc);
if (procnames.find(proc.GetProcedureName()) != procnames.end())
{
throw JsonRpcException(Errors::ERROR_SERVER_PROCEDURE_SPECIFICATION_SYNTAX, "Procedurename not uniqe: " + proc.GetProcedureName());
}
procnames[proc.GetProcedureName()] = proc;
result.push_back(proc);
}
return result;
}
示例7: putAction
void IRParser::putAction(ActionTag* tag, Action* action){
if (tag->isEmpty()){
Procedure* body = action->getBody();
untaggedActions.insert(pair<Function*, Action*>(body->getFunction(), action));
} else {
actions.insert(pair<std::string, Action*>(tag->getIdentifier(), action));
}
}
示例8: generateToAir
void generateToAir(Procedure& procedure, unsigned optLevel)
{
TimingScope timingScope("generateToAir");
if (shouldDumpIR(B3Mode) && !shouldDumpIRAtEachPhase(B3Mode)) {
dataLog("Initial B3:\n");
dataLog(procedure);
}
// We don't require the incoming IR to have predecessors computed.
procedure.resetReachability();
if (shouldValidateIR())
validate(procedure);
if (optLevel >= 1) {
reduceDoubleToFloat(procedure);
reduceStrength(procedure);
eliminateCommonSubexpressions(procedure);
inferSwitches(procedure);
duplicateTails(procedure);
fixSSA(procedure);
foldPathConstants(procedure);
// FIXME: Add more optimizations here.
// https://bugs.webkit.org/show_bug.cgi?id=150507
}
lowerMacros(procedure);
if (optLevel >= 1) {
reduceStrength(procedure);
// FIXME: Add more optimizations here.
// https://bugs.webkit.org/show_bug.cgi?id=150507
}
lowerMacrosAfterOptimizations(procedure);
legalizeMemoryOffsets(procedure);
moveConstants(procedure);
// FIXME: We should run pureCSE here to clean up some platform specific changes from the previous phases.
// https://bugs.webkit.org/show_bug.cgi?id=164873
if (shouldValidateIR())
validate(procedure);
// If we're doing super verbose dumping, the phase scope of any phase will already do a dump.
// Note that lowerToAir() acts like a phase in this regard.
if (shouldDumpIR(B3Mode) && !shouldDumpIRAtEachPhase(B3Mode)) {
dataLog("B3 after ", procedure.lastPhaseName(), ", before generation:\n");
dataLog(procedure);
}
lowerToAir(procedure);
}
示例9: Procedure
map<string, Procedure*>* IRWriter::writeProcedures(map<string, Procedure*>* procs){
map<string, Procedure*>::iterator it;
map<string, Procedure*>* newProcs = new map<string, Procedure*>();
//Creation of procedure must be done in two times because function can call other functions
for (it = procs->begin(); it != procs->end(); ++it){
Procedure* proc = (*it).second;
Function* newFunction = NULL;
//Write declaration of the function
if (proc->isExternal()){
newFunction = writer->addFunctionProtosExternal(proc->getFunction());
}else{
newFunction = writer->addFunctionProtosInternal(proc->getFunction());
}
//Create a new procedure
Procedure* newProc = new Procedure(proc->getName(), proc->getExternal(), newFunction);
newProcs->insert(pair<string, Procedure*>(proc->getName(), newProc));
}
//Link body of the procedure
for (it = procs->begin(); it != procs->end(); ++it){
Procedure* proc = (*it).second;
writer->linkProcedureBody(proc->getFunction());
}
return newProcs;
}
示例10: ProcedureCacheKey
ProcedureController::ProcedureCacheKey ProcedureController::GetCacheKey(const Procedure &procedure)
{
if(!procedure.IsPureTemplateProcedure())
{
return ProcedureCacheKey(ProcedureType::PT_PROJECT, procedure.GetProjectProcedureId());
}
else
{
return ProcedureCacheKey(ProcedureType::PT_PROJECT_TYPE, procedure.GetProcedureId());
}
}
示例11: CPPUNIT_ASSERT_EQUAL
// method to test the assigning and retrieval of grades
void ProcTableTest::testInsertProc(){
// verify the insertion and return index is correct
myProcTable = new ProcTable;
proc1.setEndProgLine(30);
proc2.setEndProgLine(45);
CPPUNIT_ASSERT_EQUAL(1,myProcTable->insertProc(new Procedure(proc1)));
CPPUNIT_ASSERT_EQUAL(2,myProcTable->insertProc(new Procedure(proc2)));
//attempt to add a procedure with existing name
CPPUNIT_ASSERT_EQUAL(1,myProcTable->insertProc(new Procedure(proc1)));
}
示例12: locker
//! recreate html page if something changes
void MetadataItemPropertiesPanel::update()
{
Database* db = dynamic_cast<Database*>(objectM);
if (db && !db->isConnected())
{
objectM = 0;
if (MetadataItemPropertiesFrame* f = getParentFrame())
f->Close();
// MB: This code used to use:
//f->removePanel(this);
// which would allow us to mix property pages from different
// databases in the same Frame, but there are some mysterious
// reasons why it causes heap corruption with MSVC
return;
}
// if table or view columns change, we need to reattach
if (objectM->getType() == ntTable || objectM->getType() == ntView) // also observe columns
{
Relation* r = dynamic_cast<Relation*>(objectM);
if (!r)
return;
SubjectLocker locker(r);
r->ensureChildrenLoaded();
for (ColumnPtrs::iterator it = r->begin(); it != r->end(); ++it)
(*it)->attachObserver(this, false);
}
// if description of procedure params change, we need to reattach
if (objectM->getType() == ntProcedure)
{
Procedure* p = dynamic_cast<Procedure*>(objectM);
if (!p)
return;
SubjectLocker locker(p);
p->ensureChildrenLoaded();
for (ParameterPtrs::iterator it = p->begin(); it != p->end(); ++it)
(*it)->attachObserver(this, false);
}
// with this set to false updates to the same page do not show the
// "Please wait while the data is being loaded..." temporary page
// this results in less flicker, but may also seem less responsive
if (!htmlReloadRequestedM)
requestLoadPage(false);
}
示例13: GetDb
bool ProcedureController::UpdateProcedure(const Procedure &procedure)
{
QSqlQuery procedureUpdate = GetDb().CreateQuery();
procedureUpdate.prepare("UPDATE \"Procedure\" "
"SET \"Description\"=:description "
"WHERE \"ProcedureId\"=:procedureId;");
procedureUpdate.bindValue(":procedureId", procedure.GetProcedureId());
procedureUpdate.bindValue(":description", procedure.GetDescription());
if(!procedureUpdate.exec())
{
return false;
}
if(!procedure.IsTemplateProcedure())
{
QSqlQuery projectProcedureUpdate = GetDb().CreateQuery();
projectProcedureUpdate.prepare("UPDATE \"ProjectProcedure\" "
"SET \"IsDone\"=:isDone "
"WHERE \"ProjectProcedureId\"=:projectProcedureId;");
projectProcedureUpdate.bindValue(":projectProcedureId", procedure.GetProjectProcedureId());
projectProcedureUpdate.bindValue(":isDone", procedure.GetDoneState() ? 1 : 0);
if(!projectProcedureUpdate.exec())
{
return false;
}
emit sigProcedureModified(procedure);
}
// Update linked project procedures from template.
if(procedure.IsPureTemplateProcedure())
{
qint32 templateProcedureId = procedure.GetProcedureId();
if(m_proceduresFromTemplate.count(templateProcedureId) != 0)
{
std::set<qint32> &procedureSet = m_proceduresFromTemplate.at(templateProcedureId);
for(auto it = procedureSet.begin(); it != procedureSet.end(); it++)
{
qint32 projectProcedureId = *it;
ProcedureCacheKey key(ProcedureType::PT_PROJECT, projectProcedureId);
std::shared_ptr<Procedure> projectProcedure = m_cache.Lookup(key);
if(!projectProcedure)
{
continue;
}
projectProcedure->SetDescription(procedure.GetDescription());
emit sigProcedureModified(*projectProcedure);
}
}
emit sigProcedureModified(procedure);
}
return true;
}
示例14: prepareForGeneration
void prepareForGeneration(Procedure& procedure, unsigned optLevel)
{
TimingScope timingScope("prepareForGeneration");
generateToAir(procedure, optLevel);
Air::prepareForGeneration(procedure.code());
}
示例15: prepareForGeneration
void prepareForGeneration(Procedure& procedure)
{
TimingScope timingScope("prepareForGeneration");
generateToAir(procedure);
Air::prepareForGeneration(procedure.code());
}