本文整理汇总了C++中CHECK_RC函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_RC函数的具体用法?C++ CHECK_RC怎么用?C++ CHECK_RC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHECK_RC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CHECK_RC
/**
* @param fileName 要发送的文件路径.
* @return 结果代码.
*
* 将模型文件发送至服务器.
* 接收服务器返回的结果.
* 当中任何一个步骤出现错误则直接返回对应的结果代码,
* 全部成功返回OK.
*/
RC Client::SendModelFile(LPCWSTR fileName)
{
RC rc;
CHECK_RC(m_Socket.SendCommand(CC::SEND_MODEL_FILE_COMMAND));
RC _rc = m_Socket.SendFile(fileName);
if (OK == _rc)
{
CHECK_RC(m_Socket.RecvRC(_rc));
if (OK == _rc)
{
wstring datFileName = fileName;
datFileName += TEXT(".dat");
CHECK_RC(m_Socket.RecvFile(datFileName.c_str()));
}
}
return _rc;
}
示例2: configKinect
int configKinect(){
XnStatus rc = XN_STATUS_OK;
xn::EnumerationErrors errors;
// Initialize OpenNI
rc = g_Context.InitFromXmlFile(SAMPLE_XML_PATH, g_ScriptNode, &errors);
CHECK_ERRORS(rc, errors, "InitFromXmlFile");
CHECK_RC(rc, "InitFromXmlFile");
rc = g_Context.FindExistingNode(XN_NODE_TYPE_DEPTH, g_DepthGenerator);
CHECK_RC(rc, "Find depth generator");
rc = g_Context.FindExistingNode(XN_NODE_TYPE_GESTURE, g_GestureGenerator);
CHECK_RC(rc, "Find gesture generator");
XnCallbackHandle hGestureIntermediateStageCompleted, hGestureProgress, hGestureReadyForNextIntermediateStage;
g_GestureGenerator.RegisterToGestureIntermediateStageCompleted(GestureIntermediateStageCompletedHandler, NULL, hGestureIntermediateStageCompleted);
g_GestureGenerator.RegisterToGestureReadyForNextIntermediateStage(GestureReadyForNextIntermediateStageHandler, NULL, hGestureReadyForNextIntermediateStage);
g_GestureGenerator.RegisterGestureCallbacks(NULL, GestureProgressHandler, NULL, hGestureProgress);
// Create NITE objects
g_pSessionManager = new XnVSessionManager;
rc = g_pSessionManager->Initialize(&g_Context, "Click,Wave", "RaiseHand");
CHECK_RC(rc, "SessionManager::Initialize");
g_pSessionManager->RegisterSession(NULL, SessionStarting, SessionEnding, FocusProgress);
pointHandler = new PointHandler(20, g_DepthGenerator);
g_pFlowRouter = new XnVFlowRouter;
g_pFlowRouter->SetActive(pointHandler);
g_pSessionManager->AddListener(g_pFlowRouter);
pointHandler->RegisterNoPoints(NULL, NoHands);
// Initialization done. Start generating
rc = g_Context.StartGeneratingAll();
CHECK_RC(rc, "StartGenerating");
return rc;
}
示例3: init_mc
int init_mc(struct ctx *p_ctx, res_hndl_t *res_hndl)
{
int rc;
__u64 chunks=16;
__u64 actual_size=0;
rc = mc_init();
CHECK_RC(rc, "mc_init failed");
debug("mc_init success :%d\n",rc);
rc = ctx_init(p_ctx);
CHECK_RC(rc, "Context init failed");
rc = create_res(p_ctx);
CHECK_RC(rc, "opening res_hndl");
rc = mc_size1(p_ctx,chunks, &actual_size);
CHECK_RC(rc, "mc_size");
*res_hndl = p_ctx->res_hndl;
rc = create_res(p_ctx);
CHECK_RC(rc, "opening res_hndl");
rc = mc_size1(p_ctx, chunks, &actual_size);
CHECK_RC(rc, "mc_size");
return 0;
}
示例4: create_ctx_process
int create_ctx_process(char *dev, dev64_t devno, __u64 chunk)
{
int rc;
struct ctx my_ctx;
struct ctx *p_ctx = &my_ctx;
g_error=0;
pid = getpid();
pthread_t threads[MAX_RES_HANDLE];
pthread_t intr_thread;
//__u64 flags;
int i;
rc = ctx_init2(p_ctx, dev, DK_AF_ASSIGN_AFU, devno);
CHECK_RC(rc, "Context init failed");
// interrupt handler per context
rc = pthread_create(&intr_thread, NULL, ctx_rrq_rx, p_ctx);
p_ctx ->lun_size = chunk * p_ctx->chunk_size;
for (i = 0; i <MAX_RES_HANDLE; i++)
{
if ( MAX_RES_HANDLE == i+1 && imLastContext == 1 )
{ // this is last resource of last context
debug("%d:create_ctx_process: last res ==> %d of last contxt \n", pid,i+1);
p_ctx ->lun_size = ( chunk + chunkRemain )*p_ctx->chunk_size;
}
rc = pthread_create(&threads[i], NULL, res_thread, p_ctx);
CHECK_RC(rc, "pthread_create failed");
}
//wait all threads to get complete
for (i = 0; i <MAX_RES_HANDLE; i++)
{
pthread_join(threads[i], NULL);
}
pthread_cancel(intr_thread);
rc = g_error;
g_error = 0;
return rc;
}
示例5: CHECK_RC
/*private*/ inline void UserManager::broadcastJointPositions(XnUserID currentUserId, XnSkeletonJoint jointEnum, int jointId) {
XnSkeletonJointPosition jointPosition;
// TODO strange, this is how it should be ... :-/
// this->skeletonCapability.GetSkeletonJointPosition(currentUserId, jointEnum, jointPosition);
CHECK_RC(this->skeletonCapability.GetSkeletonJointPosition(currentUserId, jointEnum, jointPosition), "Get joint position failed");
if(jointPosition.fConfidence < 0.5) { return; }
for(int i=0, n = this->listeners.size(); i < n; i++) {
this->listeners.at(i)->onJointPositionChanged(currentUserId, jointId, jointPosition);
}
}
示例6: get_peerProfileById
bool get_peerProfileById(const char *uid, char **nick_name, char **group_name, int *sex, int *age, char **introduction, char **head_image_path, int *server_id, char **server_uid, char **last_ip, int *tcp_port, int *udp_port)
{
int nrows,ncols; //nrows:记录返回数据库表的行数,ncols:记录返回表的列数
char *errmsg=0;//记录返回的错误信息。
char **results;//记录返回的查询结果
sqlite3 *db=0; //记录返回的数据库句柄
if(!open_db(&db, PEERSINFO_DBFILE_NAME))
return false;
//下述函数进行查询数据库操作
char *szBaseSql = "select * from peers_profile where uid='";
char *szSql = v6strcat(3, szBaseSql, uid, "';");
int rc=sqlite3_get_table(db,szSql,&results,&nrows,&ncols,&errmsg);
release_db_data((void **)&szSql);
CHECK_RC(rc,errmsg,db);
bool success = true;
if(nrows > 0)
{
int buf_size = strlen(results[PEERSINFO_DB_ROWS+1])+1;
*nick_name = (char*)malloc(buf_size);
memcpy(*nick_name, results[PEERSINFO_DB_ROWS+1], buf_size);
buf_size = strlen(results[PEERSINFO_DB_ROWS+2])+1;
*group_name = (char*)malloc(buf_size);
memcpy(*group_name, results[PEERSINFO_DB_ROWS+2], buf_size);
*sex = atoi(results[PEERSINFO_DB_ROWS+3]);
*age = atoi(results[PEERSINFO_DB_ROWS+4]);
buf_size = strlen(results[PEERSINFO_DB_ROWS+5])+1;
*introduction = (char*)malloc(buf_size);
memcpy(*introduction, results[PEERSINFO_DB_ROWS+5], buf_size);
buf_size = strlen(results[PEERSINFO_DB_ROWS+6])+1;
*head_image_path = (char*)malloc(buf_size);
memcpy(*head_image_path, results[PEERSINFO_DB_ROWS+6], buf_size);
*server_id = atoi(results[PEERSINFO_DB_ROWS+7]);
buf_size = strlen(results[PEERSINFO_DB_ROWS+8])+1;
*server_uid = (char*)malloc(buf_size);
memcpy(*server_uid, results[PEERSINFO_DB_ROWS+8], buf_size);
buf_size = strlen(results[PEERSINFO_DB_ROWS+9])+1;
*last_ip = (char*)malloc(buf_size);
memcpy(*last_ip, results[PEERSINFO_DB_ROWS+9], buf_size);
*tcp_port = atoi(results[PEERSINFO_DB_ROWS+10]);
*udp_port = atoi(results[PEERSINFO_DB_ROWS+11]);
}
else
success = false;
sqlite3_free_table(results);
sqlite3_close(db);
return success;
}
示例7: test_spio_direct_virtual
int test_spio_direct_virtual()
{
int rc=0;
int j;
int cfdisk = 0;
struct flash_disk fldisks[MAX_FDISK];
//__u64 chunk;
int count = 1;
int procces=10;
int index = 0; //to switch flash disks for VLUN & PLUN IO
char *str = getenv("LONG_RUN");
if (str != NULL)
{
printf("LONG_RUN enabled...\n");
count = 10;
}
cfdisk = get_flash_disks(fldisks, FDISKS_ALL);
if (cfdisk < 2)
{
fprintf(stderr,"Must have 2 flash disks..\n");
return -1;
}
while (count-- >0)
{
if (0 == fork())
{
rc = test_spio_lun(fldisks[index].dev,
fldisks[index].devno[0],LUN_DIRECT,0);
exit(rc);
}
//create atleast 10 chunks on each on PLUN
index = (index+1)%2;
for (j=0; j < procces; j++)
{
if (0 == fork()) //child process
{
//here you can change the path ids later
rc = test_spio_lun(fldisks[index].dev, fldisks[index].devno[0],
LUN_VIRTUAL,chunks[j]);
exit(rc);
}
}
rc = wait4all();
CHECK_RC(rc, "wait4all failed");
printf("%d loop remain................\n",count);
}
return rc;
}
示例8: test_cfdisk_ctxs_diff_devno
// 7.1.217 : create two context for same flash disks shared between 2 adapters
int test_cfdisk_ctxs_diff_devno()
{
int nDisk;
int rc=0;
struct flash_disk cfDisk[2];
struct ctx myctx1, myctx2;
struct ctx *p_ctx1 = &myctx1;
struct ctx *p_ctx2 = &myctx2;
pid = getpid();
nDisk = get_flash_disks(cfDisk, FDISKS_DIFF_ADPTR);
if (nDisk < 2)
{
fprintf(stderr,"Failed to find 2 flash disks from diff adapter..\n");
return -1;
}
// On AIX both dev will have same name
// On Linux both dev will have diff name
rc = ctx_init2(p_ctx1, cfDisk[0].dev, DK_AF_ASSIGN_AFU, cfDisk[0].devno[0]);
CHECK_RC(rc, "p_ctx1 Context init failed");
rc = ctx_init2(p_ctx2, cfDisk[1].dev, DK_AF_ASSIGN_AFU, cfDisk[1].devno[0]);
CHECK_RC(rc, "p_ctx2 Context init failed");
rc = create_resource(p_ctx1, 0, DK_UDF_ASSIGN_PATH, LUN_DIRECT);
CHECK_RC(rc, "create LUN_DIRECT for p_ctx1 failed");
rc = create_resource(p_ctx2, 0, DK_UDF_ASSIGN_PATH, LUN_DIRECT);
CHECK_RC(rc, "create LUN_DIRECT for p_ctx2 failed");
cleanup(p_ctx1, -1);
cleanup(p_ctx2, -1);
return 0;
}
示例9: getDepthGenerator
bool ofxOpenNIContext::unregisterViewport() {
// get refs to depth generator
xn::DepthGenerator depth_generator;
getDepthGenerator(&depth_generator);
// Unregister view point from (image) any map
if (depth_generator.IsCapabilitySupported(XN_CAPABILITY_ALTERNATIVE_VIEW_POINT)) {
XnStatus result = depth_generator.GetAlternativeViewPointCap().ResetViewPoint();
CHECK_RC(result, "Unregister viewport");
} else return false;
return true;
}
示例10: CHECK_RC
// Barebones setup
bool CinderOpenNISkeleton::setup()
{
XnStatus nRetVal = XN_STATUS_OK;
xn::EnumerationErrors errors;
// Init
nRetVal = mContext.Init();
CHECK_RC(nRetVal, "Init", true);
nRetVal = xnFPSInit(&xnFPS, 180);
CHECK_RC(nRetVal, "FPS Init", true);
worldOffset.x = -160;
worldOffset.y = -200;
worldOffset.z = -2784;
// Output device production nodes (user, depth, etc)
debugOutputNodeTypes();
_allUsers.clear();
for(int i = 0; i < maxUsers; i++) {
UserSkeleton emptySkeleton;
emptySkeleton.isValid = false;
emptySkeleton.id = currentUsers[i];
// Create a bunch of spots to contain our vectors
emptySkeleton.projectedPositions.clear();
for( int j = 0; j <= XN_SKEL_RIGHT_FOOT+1; ++j) {
emptySkeleton.projectedPositions.push_back( ci::Vec3f::zero() );
}
_allUsers.push_back( emptySkeleton );
}
return true;
}
示例11: max_vlun_on_a_ctx
int max_vlun_on_a_ctx()
{
int i;
int rc;
struct ctx myctx;
struct ctx *p_ctx=&myctx;
pid = getpid();
rc=ctx_init(p_ctx);
__u64 vluns[MAX_VLUNS];
for (i=0;i<MAX_VLUNS;i++)
{
rc = create_resource(p_ctx,p_ctx->chunk_size,0,LUN_VIRTUAL);
CHECK_RC(rc, "create_resource Failed\n");
vluns[i]=p_ctx->rsrc_handle;
}
for (i=0;i<MAX_VLUNS;i++)
{
p_ctx->rsrc_handle=vluns[i];
rc=close_res(p_ctx);
CHECK_RC(rc, "close_res failed\n");
}
rc = ctx_close(p_ctx);
return rc;
}
示例12: CHECK_RC
RC AlgorithmDataFile::RemoveAlgorithm(wstring name)
{
RC rc;
if (m_Lines.find(name) == m_Lines.end())
{
return RC::ALGORITHM_REMOVE_ERROR;
}
m_Lines.erase(name);
CHECK_RC(Save());
return rc;
}
示例13: clear_peersProfile
bool clear_peersProfile()
{
char *errmsg=0;//记录返回的错误信息。
sqlite3 *db=0; //记录返回的数据库句柄
if(!open_db(&db, PEERSINFO_DBFILE_NAME))
return false;
//下述函数进行数据库添加操作
char *szSql = "delete from peers_profile";
int rc=sqlite3_exec(db,szSql,0,0,&errmsg);
CHECK_RC(rc,errmsg,db);
sqlite3_close(db);
return true;
}
示例14: delete_peerProfile
bool delete_peerProfile(const char *uid)
{
char *errmsg=0;//记录返回的错误信息。
sqlite3 *db=0; //记录返回的数据库句柄
if(!open_db(&db, PEERSINFO_DBFILE_NAME))
return false;
//下述函数进行数据库添加操作
char *szSql = v6strcat(2, "delete from peers_profile where uid = ", uid);
int rc=sqlite3_exec(db,szSql,0,0,&errmsg);
CHECK_RC(rc,errmsg,db);
sqlite3_close(db);
return true;
}
示例15: clear_serversInformation
bool clear_serversInformation()
{
char *errmsg=0;//记录返回的错误信息。
sqlite3 *db=0; //记录返回的数据库句柄
if(!open_db(&db, SERVERSINFO_DBFILE_NAME))
return false;
//下述函数进行数据库添加操作
char *szSql = "delete * from server_information";
int rc=sqlite3_exec(db,szSql,0,0,&errmsg);
CHECK_RC(rc,errmsg,db);
sqlite3_close(db);
return true;
}