本文整理汇总了C++中GetResult函数的典型用法代码示例。如果您正苦于以下问题:C++ GetResult函数的具体用法?C++ GetResult怎么用?C++ GetResult使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetResult函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Open
bool Open(V4V_CONTEXT& ctx, domid_t partner, uint32_t port)
{
ATLTRACE(__FUNCTION__ " Entry\n");
DWORD error(0);
DWORD bytes(0);
OVERLAPPED ov = { 0 };
ov.hEvent = ::CreateEvent(0, true, false, 0);
::memset(&ctx, 0, sizeof(V4V_CONTEXT));
ctx.flags = V4V_FLAG_OVERLAPPED;
ATLTRACE(__FUNCTION__ " V4vOpen\n");
if (!V4vOpen(&ctx, RingSize, &ov))
{
error = ::GetLastError();
}
else
{
error = GetResult(ctx, &ov, bytes);
}
if (error)
{
ATLTRACE(__FUNCTION__ " V4vOpen Error:%d\n", error);
}
else
{
v4v_ring_id_t v4vid = { 0 };
v4vid.addr.domain = V4V_DOMID_NONE;
v4vid.addr.port = port;
v4vid.partner = partner;
ATLTRACE(__FUNCTION__ " V4vBind\n");
if (!V4vBind(&ctx, &v4vid, &ov))
{
error = ::GetLastError();
}
else
{
error = GetResult(ctx, &ov, bytes);
}
if (error)
{
ATLTRACE(__FUNCTION__ " V4vBind Error:%d\n", error);
}
}
::CloseHandle(ov.hEvent);
ATLTRACE(__FUNCTION__ " Exit Result:%d\n", error);
return (0 == error);
}
示例2: main
/**
* Lists all iam policies
*/
int main(int argc, char** argv)
{
Aws::SDKOptions options;
Aws::InitAPI(options);
{
Aws::IAM::IAMClient iam;
Aws::IAM::Model::ListPoliciesRequest request;
bool done = false;
bool header = false;
while (!done)
{
auto outcome = iam.ListPolicies(request);
if (!outcome.IsSuccess())
{
std::cout << "Failed to list iam policies: " <<
outcome.GetError().GetMessage() << std::endl;
break;
}
if (!header)
{
std::cout << std::left << std::setw(55) << "Name" <<
std::setw(30) << "ID" << std::setw(80) << "Arn" <<
std::setw(64) << "Description" << std::setw(12) <<
"CreateDate" << std::endl;
header = true;
}
const auto &policies = outcome.GetResult().GetPolicies();
for (const auto &policy : policies)
{
std::cout << std::left << std::setw(55) <<
policy.GetPolicyName() << std::setw(30) <<
policy.GetPolicyId() << std::setw(80) << policy.GetArn() <<
std::setw(64) << policy.GetDescription() << std::setw(12) <<
policy.GetCreateDate().ToGmtString(DATE_FORMAT) <<
std::endl;
}
if (outcome.GetResult().GetIsTruncated())
{
request.SetMarker(outcome.GetResult().GetMarker());
}
else
{
done = true;
}
}
}
Aws::ShutdownAPI(options);
return 0;
}
示例3: handleIterateFinished
void GraffitiTab::handleIterateFinished ()
{
auto recIterator = qobject_cast<RecIterator*> (sender ());
recIterator->deleteLater ();
const auto& files = recIterator->GetResult ();
FilesWatcher_->AddFiles (files);
FilesModel_->AddFiles (files);
auto resolver = LMPProxy_->GetTagResolver ();
auto worker = [resolver, files] () -> QList<MediaInfo>
{
QList<MediaInfo> infos;
for (const auto& file : files)
try
{
infos << resolver->ResolveInfo (file.absoluteFilePath ());
}
catch (const std::exception& e)
{
qWarning () << Q_FUNC_INFO
<< e.what ();
}
return infos;
};
auto scanWatcher = new QFutureWatcher<QList<MediaInfo>> ();
connect (scanWatcher,
SIGNAL (finished ()),
this,
SLOT (handleScanFinished ()));
scanWatcher->setProperty ("LMP/Graffiti/Filename", recIterator->property ("LMP/Graffiti/Filename"));
scanWatcher->setFuture (QtConcurrent::run (std::function<QList<MediaInfo> ()> (worker)));
}
示例4: AllocateAndAssociateAddress
void AllocateAndAssociateAddress(const Aws::String& instance_id)
{
Aws::EC2::EC2Client ec2;
Aws::EC2::Model::AllocateAddressRequest request;
request.SetDomain(Aws::EC2::Model::DomainType::vpc);
auto outcome = ec2.AllocateAddress(request);
if(!outcome.IsSuccess()) {
std::cout << "Failed to allocate elastic ip address:" <<
outcome.GetError().GetMessage() << std::endl;
return;
}
Aws::String allocation_id = outcome.GetResult().GetAllocationId();
Aws::EC2::Model::AssociateAddressRequest associate_request;
associate_request.SetInstanceId(instance_id);
associate_request.SetAllocationId(allocation_id);
auto associate_outcome = ec2.AssociateAddress(associate_request);
if(!associate_outcome.IsSuccess()) {
std::cout << "Failed to associate elastic ip address" << allocation_id
<< " with instance " << instance_id << ":" <<
associate_outcome.GetError().GetMessage() << std::endl;
return;
}
std::cout << "Successfully associated elastic ip address " << allocation_id
<< " with instance " << instance_id << std::endl;
}
示例5: TEST
/// @brief 添加一个TestCase到一个TestSuite\n
/// TEST(TestICalc, ExceptionData)将测试所有异常的数据
TEST(TestICalc, ExceptionData)
{
for (int i=0; i<8; i++)
{
EXPECT_EQ( ExceptionResult[i], GetResult(ExceptionData[i]) ) << "Error at index :" << i;
}
}
示例6: nstring
//-----------------------------------------------------------------------------
C_NStrOutf::operator nstring () const
{
bool bFormat = false;
nstring szResult;
nstring szFormat;
std::vector<nstring>::size_type Pos = 0;
for(const nstring::value_type &Itor : m_szFormat)
{
if(Itor == __T('{'))
{
bFormat = true;
continue;
}//if
if(Itor == __T('}'))
{
bFormat = false;
szResult += GetResult(szFormat, m_Data.size() > Pos ? m_Data[Pos] : __T(''));
szFormat.clear();
++Pos;
continue;
}//if
if(bFormat)
szFormat += Itor;
else
szResult += Itor;
}//for
return szResult;
}
示例7: Load
bool ResourceShader::Load( ResourceMemoryAllocator &inAllocator, ResourceDirectory &inDir ) {
allocator = &inAllocator;
auto res = ResourceDirectory::instance->Open(GetLocation(), ResourceDirectory::PERMISSION_ReadOnly);
auto resIo = res.GetResult();
if(!resIo) return false;
Int size = 0;
Int realSize = 0;
Int bytesRead;
const Int increment = 1024;
do {
size += increment;
string = (char*)allocator->Reallocate(string, size+1);
bytesRead = resIo->Read(string+size-increment, increment).GetResult();
realSize += bytesRead;
if(bytesRead < increment) break;
} while(true);
string = (char*)allocator->Reallocate(string, realSize+1);
string[realSize] = 0;
return true;
}
示例8: MakeCallback
void MakeCallback(uv_work_t* req) {
Nan::HandleScope scope;
Nan::TryCatch try_catch;
sass_context_wrapper* ctx_w = static_cast<sass_context_wrapper*>(req->data);
struct Sass_Context* ctx;
if (ctx_w->dctx) {
ctx = sass_data_context_get_context(ctx_w->dctx);
}
else {
ctx = sass_file_context_get_context(ctx_w->fctx);
}
int status = GetResult(ctx_w, ctx);
if (status == 0 && ctx_w->success_callback) {
// if no error, do callback(null, result)
ctx_w->success_callback->Call(0, 0);
}
else if (ctx_w->error_callback) {
// if error, do callback(error)
const char* err = sass_context_get_error_json(ctx);
v8::Local<v8::Value> argv[] = {
Nan::New<v8::String>(err).ToLocalChecked()
};
ctx_w->error_callback->Call(1, argv);
}
if (try_catch.HasCaught()) {
Nan::FatalException(try_catch);
}
sass_free_context_wrapper(ctx_w);
}
示例9: pageIds
void ExecuteCommandDialog::handleCurrentChanged (int id)
{
if (!dynamic_cast<WaitPage*> (currentPage ()))
return;
const auto& ids = pageIds ();
const int pos = ids.indexOf (id);
if (pos <= 0)
return;
const auto prevPage = page (ids.at (pos - 1));
if (dynamic_cast<CommandsListPage*> (prevPage))
{
const AdHocCommand& cmd = dynamic_cast<CommandsListPage*> (prevPage)->GetSelectedCommand ();
if (cmd.GetName ().isEmpty ())
deleteLater ();
else
ExecuteCommand (cmd);
}
else if (dynamic_cast<CommandResultPage*> (prevPage))
{
const auto crp = dynamic_cast<CommandResultPage*> (prevPage);
const auto& action = crp->GetSelectedAction ();
if (action.isEmpty ())
return;
auto result = crp->GetResult ();
result.SetDataForm (crp->GetForm ());
ProceedExecuting (result, action);
}
}
示例10: SetPyException
void SetPyException(const std::exception& ex)
{
const char* message = ex.what();
if (dynamic_cast<const MI::TypeConversionException*>(&ex))
{
PyErr_SetString(PyExc_TypeError, message);
}
else
{
PyObject* d = PyDict_New();
PyObject* pyEx = nullptr;
if (dynamic_cast<const MI::MITimeoutException*>(&ex))
{
pyEx = PyMITimeoutError;
}
else
{
pyEx = PyMIError;
}
if (dynamic_cast<const MI::MIException*>(&ex))
{
auto miex = static_cast<const MI::MIException*>(&ex);
PyDict_SetItemString(d, "error_code", PyLong_FromUnsignedLong(miex->GetErrorCode()));
PyDict_SetItemString(d, "mi_result", PyLong_FromUnsignedLong(miex->GetResult()));
}
PyDict_SetItemString(d, "message", PyUnicode_FromString(message));
PyErr_SetObject(pyEx, d);
Py_DECREF(d);
}
}
示例11: rangeObject
void rangeObject(ClientPtrType client, String bucketName, String key, String path, size_t min, size_t max)
{
String base = "=== Range Object [" + bucketName + "/" + key;
std::cout << base << "]: Start ===\n";
std::cout << "Reading from " << path << "\n";
String range(("byte=" + std::to_string(min) + "-" + std::to_string(max)).c_str());
auto inpData = Aws::MakeShared<Aws::FStream>("GetObjectInputStream",
path.c_str(), std::ios_base::in | std::ios_base::binary);
auto objReq = Aws::S3::Model::GetObjectRequest();
objReq.WithBucket(bucketName).WithKey(key).WithRange(range);
auto objRes = client->GetObject(objReq);
if (!objRes.IsSuccess())
{
std::cout << base << "]: Client Side failure ===\n";
std::cout << objRes.GetError().GetExceptionName() << "\t" <<
objRes.GetError().GetMessage() << "\n";
std::cout << base << "]: Failed ===\n";
}
else
{
Aws::IOStream& file = objRes.GetResult().GetBody();
if (!doFilesMatch(inpData.get(), file, min, max))
{
std::cout << base << "]: Content not equal ===\n";
}
}
std::cout << base << "]: End ===\n\n";
}
示例12: GetResult
void CExampleTest::TestCase02()
{
char *input[] = {"10 10 10 10 10 10 9 xiaoyuanwang","0 0 0 0 0 0 0 beast"};
char result[100] = {0};
GetResult(input, 2, result);
CPPUNIT_ASSERT(0 == strcmp(result, "xiaoyuanwang 10.00\nbeast 0.00") );
}
示例13: main
int main()
{
char input[20] = {0};
int len = 0;
int res = 0;
int i = 0;
int j = 0;
ElementType infix[20] = {0};
ElementType suffix[20] = {0};
//StackNode* infix_head;
//StackNode* top;
fgets(input,20,stdin);
len = ArrayToInfix(input,infix);
//PrintFormula(infix, len);
len = InfixToSuffix(infix,suffix,len);
//PrintFormula(suffix, len);
res = GetResult(suffix,len);
printf("= %d\n", res);
//PrintInfix(infix,len);
/*InitStack(&infix_head, &top);
for (i = 0; i < len; ++i)
{
StackPush(infix_head,&top,infix[i]);
}
PrintStack(infix_head);*/
}
示例14: SendLibraNum
// Виконааня команди cmd з параметрами params
int XLibraLP::DoCmd(unsigned char cmd, char *params)
{
SendLibraNum();
Write(&cmd, 1);
switch (cmd)
{
case 0x82:
Write(params, 83);
break;
case 0x8a:
Write(params, 9);
break;
case 0x8d:
Write(params, 4);
break;
case 0x81:
Write(params, 4);
unsigned char ch;
for (int i(0); i < 100; i++)
Read(&ch, 1);
break;
};
Listen();
return GetResult()->error;
}
示例15: PackWebRsp
/****************************************************************
** 功 能:应答报文组包
** 输入参数:
** ptApp app结构指针
** 输出参数:
** szRspBuf 交易应答报文
** 返 回 值:
** >0 报文长度
** FAIL 失败
** 作 者:
** fengwei
** 日 期:
** 2012/12/18
** 调用说明:
**
** 修改日志:
****************************************************************/
int PackWebRsp(T_App *ptApp, char *szRspBuf)
{
int iIndex; /* buf索引 */
int iMsgCount; /* 短信记录数 */
int iRetDescLen; /* 响应信息长度 */
iIndex = 0;
/* 交易代码 */
memcpy(szRspBuf+iIndex, ptApp->szTransCode, 8);
iIndex += 8;
/* 响应码 */
memcpy(szRspBuf+iIndex, ptApp->szRetCode, 2);
iIndex += 2;
/* 根据返回码取返回信息 */
if(strlen(ptApp->szRetDesc) == 0)
{
GetResult(ptApp->szRetCode, ptApp->szRetDesc);
}
/* 响应信息长度 */
iRetDescLen = strlen(ptApp->szRetDesc);
szRspBuf[iIndex] = iRetDescLen;
iIndex += 1;
/* 响应信息 */
memcpy(szRspBuf+iIndex, ptApp->szRetDesc, iRetDescLen);
iIndex += iRetDescLen;
return iIndex;
}