本文整理汇总了C++中CheckInput函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckInput函数的具体用法?C++ CheckInput怎么用?C++ CheckInput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckInput函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DoCCallBack_LPSTR_OutByRef
extern "C" DLL_EXPORT DLL_EXPORT void _cdecl DoCCallBack_LPSTR_OutByRef(CCallBackOutByRef callback)
{
int len = 10;
LPSTR pStr = (LPSTR)CoTaskMemAlloc(len);
if(!CheckInput(callback(&pStr)))
{
ReportFailure("DoCCallBack_LPSTR_OutByRef:NativeSide,the first Check");
}
if(!CheckInput(pStr))
{
ReportFailure("DoCCallBack_LPSTR_OutByRef:NativeSide,the Second Check");
}
CoTaskMemFree(pStr);
}
开发者ID:0-wiz-0,项目名称:coreclr,代码行数:15,代码来源:BestFitMappingNative.cpp
示例2: DoSCallBack_LPSTR_OutByRef
extern "C" DLL_EXPORT void __cdecl DoSCallBack_LPSTR_OutByRef(SCallBackOutByRef callback)
{
size_t len = 10;
LPSTR pStr = (LPSTR)CoreClrAlloc(len);
if (!CheckInput(callback(&pStr)))
{
ReportFailure("DoSCallBack_LPSTR_OutByRef:NativeSide,the first check");
}
if (!CheckInput(pStr))
{
ReportFailure("DoSCallBack_LPSTR_OutByRef:NativeSide,the second Check");
}
CoreClrFree(pStr);
}
开发者ID:vcsjones,项目名称:coreclr,代码行数:15,代码来源:BestFitMappingNative.cpp
示例3: main
int
main(void)
{
int h;
// initialize a flag
bool flag = false;
// keep asking for input until it's vaild
do
{
// ask for the height
printf("height: ");
// record users' input
h = GetInt();
// check the input
flag = CheckInput(h);
}
while (flag == false);
// draw the chart
DrawChart(h);
return 0;
}
开发者ID:yzzjohn,项目名称:CS50x-for-2015,代码行数:27,代码来源:mario.c
示例4: Convert
int IdConverter::Convert(std::string & id_in, std::string & id_out)
{
// sanity check
if(int rc = CheckInput(id_in))
{
return rc;
}
// convert
id_out = "";
for(size_t ipos = 0; ipos < id_in.size(); )
{
if(id_in[ipos + 2] != delimr)
{
// one-token group
if(id_in.compare(ipos, 2, "Z9") == 0)
{
id_out += "A1-A1";
}
else
{
// increment token
char token[8];
IncrementToken(id_in, ipos, token);
id_out += token;
}
ipos += 2;
}
else
{
// two-token group
if(id_in.compare(ipos, 5, "Z9-Z9") == 0)
{
// can not be incremented more
return 3;
}
if(id_in.compare(ipos + 3, 2, "Z9") == 0)
{
// first token should be incremented
char token[8];
IncrementToken(id_in, ipos, token);
id_out += token;
// second token will be "A1"
id_out += "-A1";
}
else
{
// increment second token only
char token[8];
IncrementToken(id_in, ipos + 3, token);
id_out += id_in.substr(ipos, 3);
id_out += token;
}
ipos += 5;
}
}
return 0;
}
开发者ID:kukthevery,项目名称:idconverter,代码行数:60,代码来源:idconverter.cpp
示例5: if
void CMainMenu::Update(const SUIInput& a_rInput)
{
if (m_GoingIntoGame)
{
float half = CPostEffects::GameStartTime / 2.0f;
m_CurrentTime += twTime->GetDeltaTime();
float value = m_CurrentTime / half;
((triebWerk::CUIDrawable*)(m_pBackground->GetDrawable()))->m_Material.m_ConstantBuffer.SetValueInBuffer(4, &value);
if (m_CurrentTime >= half)
{
twSceneManager->SetActiveScene("Game");
m_GoingIntoGame = false;
m_CurrentTime = 0.0f;
}
return;
}
else if (m_LerpToExtras) LerpToExtras();
else if (m_LerpFromExtras) LerpFromExtras();
if (CGameInfo::Instance().m_Menu == EMenus::Main)
{
((triebWerk::CFontDrawable*)m_pTextExtras->GetDrawable())->m_pText->SetText("Extras");
CheckInput(a_rInput);
}
UpdateGraphics();
}
开发者ID:Chylix,项目名称:triebWerk,代码行数:31,代码来源:CMainMenu.cpp
示例6: CheckInput
void Example::prepare(float dt)
{
CheckInput();
DeltaTime = dt;
ModelSky->m_RotateY+=(SPEED*DeltaTime);
const float ROTSPEED = 50.0f;
if(rotate)
m_rotationAngle += ROTSPEED * dt;
if (m_rotationAngle > 360.0f)
m_rotationAngle -= 360.0f;
m_angle += 2.0f * dt;
if (m_angle > 360.0f)
m_angle -= 360.0f;
const float LIGHT_SPEED = 0.0005f;
m_lightPosZ += LIGHT_SPEED;
m_GLSLProgram->sendUniform("time", timer);
}
开发者ID:drsoxen,项目名称:Heavy-Machine,代码行数:25,代码来源:example.cpp
示例7: onStart
void auto_smzdm::onStart()
{
if (!CheckInput())
{
return;
}
UpdateData();
control_status = true;
ui.lineEdit_msg->setText(QStringLiteral("运行中"));
QString msg = QStringLiteral("运行中");
int count = 0;
while( control_status )
{
QString temp = msg;
smzdm_run();
count ++;
QString temp2;
temp2.setNum(count);
ui.lineEdit_msg->setText(temp + temp2);
QElapsedTimer t;
t.start();
while(t.elapsed()<1000)
QCoreApplication::processEvents();
}
}
开发者ID:blacksjt,项目名称:autobots,代码行数:35,代码来源:auto_smzdm_dz.cpp
示例8: OpenShop
// Open the Shop
NamedScript KeyBind void OpenShop(bool OpenLocker)
{
// If you're dead, return
if (GetActorProperty(0, APROP_Health) <= 0) return;
// If you're in an Outpost menu, return
if (Player.OutpostMenu > 0) return;
// If you're in any minigames, return
if (Player.InMinigame) return;
// If you're looking inside a crate, return
if (Player.CrateOpen) return;
// Close the main menu if it's open
Player.InMenu = false;
// Sanity check for pressing use while the shop is open in front of the counter in the Outpost
if (Player.InShop && CheckInput(BT_USE, KEY_HELD, false, PlayerNumber())) return;
if (Player.InShop)
{
ActivatorSound("menu/leave", 127);
SetPlayerProperty(0, 0, PROP_TOTALLYFROZEN);
Player.InShop = false;
}
else
{
ActivatorSound("menu/shop", 127);
Player.InShop = true;
if (OpenLocker)
Player.LockerMode = true;
}
}
开发者ID:Silentdarkness12,项目名称:DoomRPG,代码行数:35,代码来源:Shop.c
示例9: mexFunction
void mexFunction(int nlhs, mxArray *plhs[], int nrhs,const mxArray *prhs[])
{
double tau, rownorm;
double *W, *W_thresh, *nz;
long p, K, ik, ip, pK;
CheckInput(nlhs, plhs, nrhs, prhs);
p=mxGetM(prhs[0]); /* # row */
K=mxGetN(prhs[0]); /* # col */
W=mxGetPr(prhs[0]); /* pointer to the input array */
tau=mxGetScalar(prhs[1]);
plhs[0]=mxCreateDoubleMatrix(p,K,mxREAL); /* output p x K array */
W_thresh=mxGetPr(plhs[0]); /* pointer to the data W_thresh*/
pK=p*K;
for (ip=0; ip<p; ip++) {
/* compute the 2-norm of the ip-th row */
for (ik=0, rownorm=0.0; ik<K; ik++)
rownorm+=W[ip+p*ik]*W[ip+p*ik]; /* W(ip+1,ik+1)=W[ip + p*ik], ip=0,...,p, ik=0,...,K */
rownorm=sqrt(rownorm);
/* perform row-wise group-thresholding */
if (rownorm > tau){
for (ik=0; ik<K; ik++)
W_thresh[ip+p*ik]=W[ip+p*ik]*(1-tau/rownorm); /* W(ip+1,ik+1)=W[ip + p*ik], ip=0,...,p, ik=0,...,K */
}
else {
for (ik=0; ik<K; ik++)
W_thresh[ip+p*ik]=0; /* W(ip+1,ik+1)=W[ip + p*ik], ip=0,...,p, ik=0,...,K */
}
}
}
开发者ID:wtak23,项目名称:Schiz_multi,代码行数:35,代码来源:tsoftvec.c
示例10: CheckUp
// This is called every 4096 nodes to check if we have run out of time
// or if we have been interrupted by the GUI
static void CheckUp(searchinfo_t *sinfo)
{
if(sinfo->infinite == false && GetTime() >= sinfo->stopTime){
sinfo->stop = true;
}
CheckInput(sinfo);
}
开发者ID:Cubitect,项目名称:cep,代码行数:9,代码来源:search.c
示例11: CheckInput
void BiasAdderNet::Execute() {
CheckInput();
const Blob* const input = this->input_blobs(0);
const Blob* const bias = this->params(0);
Blob* const output = this->output_blobs(0);
int channels = bias->channels();
CHECK_EQ(channels, input->channels());
int height = input->height();
int width = input->width();
int num = input->num();
LOG(DEBUG) << "input blob: (" << num << "," << input->channels() << ","
<< height << "," << width << ")";
LOG(DEBUG) << "bias blob: (" << bias->num() << "," << bias->channels()
<< "," << bias->height() << "," << bias->width() << ")";
float* const dst_head = new float[num*channels*height*width];
int size = height * width;
for (int n = 0, offset = 0; n < num; ++n) {
for (int ichannel = 0; ichannel < channels; ++ichannel) {
for(int i = 0; i < size; ++i, ++offset) {
dst_head[offset] = (*input)[offset] + (*bias)[ichannel];
}
}
}
output->CopyData(num, channels, height, width, dst_head);
delete []dst_head;
CheckOutput();
}
开发者ID:Johnny-Martin,项目名称:toys,代码行数:34,代码来源:bias_adder_net.cpp
示例12: DoCCallBack_LPSTR_Out
extern "C" DLL_EXPORT void __cdecl DoCCallBack_LPSTR_Out(CCallBackOut callback)
{
size_t len = 10;
LPSTR pStr = (LPSTR)CoreClrAlloc(len);
//Check the return value
if (!CheckInput(callback(pStr)))
{
ReportFailure("DoCCallBack_LPSTR_Out:NativeSide,the first check");
}
if (!CheckInput(pStr))
{
ReportFailure("DoCCallBack_LPSTR_Out:NativeSide,the Second Check");
}
CoreClrFree(pStr);
}
开发者ID:vcsjones,项目名称:coreclr,代码行数:16,代码来源:BestFitMappingNative.cpp
示例13: main
/**
*
* Main function of this program.
*
*/
int main()
{
float input;
float input_cents;
do
{
// Get the user input
printf("O hai! How much change is owed?\n");
input = GetFloat();
// Validate the user input
if(CheckInput(input) == FALSE)
{
continue;
}
}while(input < 0.0);
// Convert to cents
input_cents = (float)round(input * 100);
// Lets Start
int number_of_coins = 0;
while(input_cents > 0.0)
{
//printf("input_cents=%f\n",input_cents);
if(input_cents >= QUATAR)
{
// This means the input is can be subtracted by a QUATAR
input_cents = input_cents - QUATAR;
number_of_coins++;
}
else if(input_cents < QUATAR && input_cents >= DIME)
{
// This means the input is can be subtracted by a DIME
input_cents = input_cents - DIME;
number_of_coins++;
}
else if(input_cents < DIME && input_cents >= NICKEL)
{
// This means the input is can be subtracted by a NICKEL
input_cents = input_cents - NICKEL;
number_of_coins++;
}
else
{
// This means remaining are PENNIES. So just add as many number of pennies.
number_of_coins = number_of_coins + input_cents;
input_cents = 0;
}
}
printf("%d\n", number_of_coins);
// Good Bye
return 0;
}
开发者ID:prasannabe2004,项目名称:Harvard,代码行数:64,代码来源:greedy.c
示例14: on_btnOK_clicked
void InputDialog::on_btnOK_clicked()
{
if(CheckInput())
{
strResult = ui->lnInput->text();
done(QDialog::Accepted);
}
}
开发者ID:sweng2013team4,项目名称:shredder,代码行数:8,代码来源:inputdialog.cpp
示例15: DoSCallBack_LPSTR_InOut
extern "C" DLL_EXPORT DLL_EXPORT void _cdecl DoSCallBack_LPSTR_InOut(SCallBackInOut callback)
{
const char* pTemp = "AAAA";
int len = strlen(pTemp)+1;
LPSTR pStr = (LPSTR)CoTaskMemAlloc(len);
strncpy(pStr,pTemp,len);
if(!CheckInput(callback(pStr)))
{
ReportFailure("DoSCallBack_LPSTR_InOut:NativeSide,the first check");
}
if(!CheckInput(pStr))
{
ReportFailure("DoSCallBack_LPSTR_InOut:NativeSide,the second Check");
}
CoTaskMemFree(pStr);
}
开发者ID:0-wiz-0,项目名称:coreclr,代码行数:17,代码来源:BestFitMappingNative.cpp
示例16: DoSCallBack_LPSTR_InOutByRef
extern "C" DLL_EXPORT void __cdecl DoSCallBack_LPSTR_InOutByRef(SCallBackInOutByRef callback)
{
const char* pTemp = "AAAA";
size_t len = strlen(pTemp) + 1;
LPSTR pStr = (LPSTR)CoreClrAlloc(len);
strncpy(pStr, pTemp, len);
if (!CheckInput(callback(&pStr)))
{
ReportFailure("DoSCallBack_LPSTR_InOutByRef:NativeSide,the first check");
}
if (!CheckInput(pStr))
{
ReportFailure("DoSCallBack_LPSTR_InOutByRef:NativeSide,the second Check");
}
CoreClrFree(pStr);
}
开发者ID:vcsjones,项目名称:coreclr,代码行数:17,代码来源:BestFitMappingNative.cpp
示例17: CheckInput
void MaxPoolingNet::Execute() {
// *** Argument *** //
const float MIN_THRESHOLD = 0.0f;
// *** //
CheckInput();
const Blob* const input = this->input_blobs(0);
Blob* const output = this->output_blobs(0);
int src_h = input->height();
int src_w = input->width();
int num = input->num();
int channels = input->channels();
int dst_h = static_cast<int>(ceil(static_cast<float>(
src_h - kernel_h_) / stride_h_)) + 1;
int dst_w = static_cast<int>(ceil(static_cast<float>(
src_w - kernel_w_) / stride_w_)) + 1;
int dst_count = num * channels * dst_h * dst_w;
float* const dst_head = new float[dst_count];
const float* src_data = input->data().get();
float* dst_data = dst_head;
int src_channel_off = src_h * src_w;
int dst_channel_off = dst_h * dst_w;
for (int n = 0; n < num; ++n) {
for (int c = 0; c < channels; ++c) {
for (int dh = 0, hstart = 0; dh < dst_h;
++dh, hstart += stride_h_) {
int hend = std::min(hstart + kernel_h_, src_h);
for (int dw = 0, wstart = 0; dw < dst_w;
++dw, wstart += stride_w_) {
int wend = std::min(wstart + kernel_w_, src_w);
int didx = dh * dst_w + dw;
float max_val = MIN_THRESHOLD;
for (int sh = hstart; sh < hend; ++sh) {
for (int sw = wstart; sw < wend; ++sw) {
int sidx = sh * src_w + sw;
if (src_data[sidx] > max_val) {
max_val = src_data[sidx];
}
} // for sw
} // for sh
dst_data[didx] = max_val;
} // for dw
} // for dh
src_data += src_channel_off;
dst_data += dst_channel_off;
} // for c
} // for n
output->CopyData(num, channels, dst_h, dst_w, dst_head);
delete[] dst_head;
CheckOutput();
}
开发者ID:Johnny-Martin,项目名称:toys,代码行数:58,代码来源:max_pooling_net.cpp
示例18: PushCallStack
inline void
LocalTrrkKernel
( UpperOrLower uplo,
Orientation orientationOfA,
Orientation orientationOfB,
T alpha, const DistMatrix<T,STAR,MC >& A,
const DistMatrix<T,MR, STAR>& B,
T beta, DistMatrix<T,MC, MR >& C )
{
#ifndef RELEASE
PushCallStack("LocalTrrkKernel");
CheckInput( orientationOfA, orientationOfB, A, B, C );
#endif
const Grid& g = C.Grid();
DistMatrix<T,STAR,MC> AL(g), AR(g);
DistMatrix<T,MR,STAR> BT(g),
BB(g);
DistMatrix<T,MC,MR> CTL(g), CTR(g),
CBL(g), CBR(g);
DistMatrix<T,MC,MR> DTL(g), DBR(g);
const int half = C.Height()/2;
ScaleTrapezoid( beta, LEFT, uplo, 0, C );
LockedPartitionRight( A, AL, AR, half );
LockedPartitionDown
( B, BT,
BB, half );
PartitionDownDiagonal
( C, CTL, CTR,
CBL, CBR, half );
DTL.AlignWith( CTL );
DBR.AlignWith( CBR );
DTL.ResizeTo( CTL.Height(), CTL.Width() );
DBR.ResizeTo( CBR.Height(), CBR.Width() );
//------------------------------------------------------------------------//
if( uplo == LOWER )
internal::LocalGemm
( orientationOfA, orientationOfB, alpha, AR, BT, T(1), CBL );
else
internal::LocalGemm
( orientationOfA, orientationOfB, alpha, AL, BB, T(1), CTR );
internal::LocalGemm
( orientationOfA, orientationOfB, alpha, AL, BT, T(0), DTL );
AxpyTriangle( uplo, T(1), DTL, CTL );
internal::LocalGemm
( orientationOfA, orientationOfB, alpha, AR, BB, T(0), DBR );
AxpyTriangle( uplo, T(1), DBR, CBR );
//------------------------------------------------------------------------//
#ifndef RELEASE
PopCallStack();
#endif
}
开发者ID:certik,项目名称:Elemental,代码行数:56,代码来源:Local.hpp
示例19: GetWindowText
void CHSNumEdit::OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
{
if( !isdigit(nChar) && nChar != 8 && nChar != '.' && nChar != '-' && nChar != '+' )
return;
CString strWin;
GetWindowText(strWin);
CEdit::OnChar(nChar,nRepCnt,nFlags);
CString strCurText;
GetWindowText(strCurText);
if( !CheckInput(strCurText) )
{
SetWindowText(strWin);
}
/*
if( isdigit(nChar) && CheckInput(nChar) )
CEdit::OnChar(nChar,nRepCnt,nFlags);
else
{
CString txt;
GetWindowText(txt);
switch (nChar)
{
case '+' : // set to absolute value
{
double x = (double) atof(txt);
if (x > 0)
break; // only break if we already >0, else do "case -"
}
case '-' : // change sign.
{
double x = (double) atof(txt);
// if(x == 0)
// {
// ::MessageBeep(MB_ICONQUESTION);
// break;
// }
x = -x;
SetValue(x);
break;
}
case '.' :
if ( txt.Find('.') == -1 && CheckInput(nChar))
CEdit::OnChar(nChar, nRepCnt, nFlags);
break;
case VK_BACK:
CEdit::OnChar(nChar, nRepCnt, nFlags);
break;
}
}
*/
}
开发者ID:hefen1,项目名称:XCaimi,代码行数:55,代码来源:HSNumEdit.cpp
示例20: CheckInput
void DialogInputFileNameForm::ApplyButtonPressed()
{
//Check the input
bool inputOk = CheckInput();
//If the input is ok cloase the dialog with accedpted
if(inputOk)
{
QDialog::accept();
}
}
开发者ID:Mauxx91,项目名称:XML-Editor,代码行数:11,代码来源:DialogInputFileNameForm.cpp
注:本文中的CheckInput函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论