本文整理汇总了C++中setHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ setHandle函数的具体用法?C++ setHandle怎么用?C++ setHandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setHandle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setHandle
int
SockDgram::doStart()
{
int ret = MW_SUCCESS;
if(getOpMode() == OSAL::OPMODE_ASYNC)
{
#ifdef OSAL_WIN32
OSAL_SOCKET os_sock_desc = this->getSD(_ACCEPT_USE_);
setHandle(pSysEventProcessor_->createHandleRequest());
OSAL_HANDLE os_handle = this->getHandle();
WSAEventSelect(os_sock_desc, os_handle, FD_READ);
#else
setHandle(this->getSD());
#endif
//TODO: Who will deallocate this allocated memory?
pSockAsyncOperation_ = new SockDgram_AsyncOpeartion(this);
ret = registerAsyncOperation(DevType_, os_handle, pSockAsyncOperation_, os_sock_desc);
}
else
{
//TODO: Who will deallocate this allocated memory?
pSockSyncOperation_ = new SockDgram_SyncOpeartion(this);
//TODO: When it comes to sync operation, its return handle shall be managed by concrete IO devices.
// so, I have to implement it.
ret=registerSyncOperation(pSockSyncOperation_);
}
return ret;
}
开发者ID:IICL,项目名称:K-Middleware,代码行数:30,代码来源:SockDgram.cpp
示例2: AbstractOverlappedEventNotifier
AbstractOverlappedEventNotifier(QSerialPortPrivate *d, Type type, bool manual, QObject *parent)
: QWinEventNotifier(parent), dptr(d), t(type) {
::memset(&o, 0, sizeof(o));
o.hEvent = ::CreateEvent(NULL, manual, FALSE, NULL);
setHandle(o.hEvent);
dptr->notifiers[o.hEvent] = this;
}
开发者ID:BjoernKellermann,项目名称:apm_planner,代码行数:7,代码来源:qserialport_win.cpp
示例3: killTimer
BOOL USplashWindow::onTimer(WPARAM wParam, LPARAM lParam)
{
killTimer(ID_SPLASH_TIMER);
destroy();
setHandle(NULL);
return FALSE;
}
开发者ID:Budskii,项目名称:ulib-win,代码行数:7,代码来源:usplashwnd.cpp
示例4: XGBoosterCreate
/*
* Class: org_dmlc_xgboost4j_wrapper_XgboostJNI
* Method: XGBoosterCreate
* Signature: ([J)J
*/
JNIEXPORT jint JNICALL Java_org_dmlc_xgboost4j_wrapper_XgboostJNI_XGBoosterCreate
(JNIEnv *jenv, jclass jcls, jlongArray jhandles, jlongArray jout) {
DMatrixHandle* handles;
bst_ulong len = 0;
jlong* cjhandles = 0;
BoosterHandle result;
if(jhandles) {
len = (bst_ulong)jenv->GetArrayLength(jhandles);
handles = new DMatrixHandle[len];
//put handle from jhandles to chandles
cjhandles = jenv->GetLongArrayElements(jhandles, 0);
for(bst_ulong i=0; i<len; i++) {
handles[i] = (DMatrixHandle) cjhandles[i];
}
}
int ret = XGBoosterCreate(handles, len, &result);
//release
if(jhandles) {
delete[] handles;
jenv->ReleaseLongArrayElements(jhandles, cjhandles, 0);
}
setHandle(jenv, jout, result);
return ret;
}
开发者ID:ChrisBarker-NOAA,项目名称:xgboost,代码行数:32,代码来源:xgboost4j_wrapper.cpp
示例5: newImageObject
/*
* Construct a new Java magick.MagickImage object and set the
* handle.
*
* Input:
* env Java VM environment
* image ImageMagick image handle
*
* Return:
* A new instance of magick.MagickImage object.
*
*/
jobject newImageObject(JNIEnv *env, Image* image)
{
jclass magickImageClass = 0;
jmethodID consMethodID = 0;
jobject newObj;
magickImageClass = (*env)->FindClass(env, "magick/MagickImage");
if (magickImageClass == 0) {
return NULL;
}
consMethodID = (*env)->GetMethodID(env, magickImageClass,
"<init>", "()V");
if (consMethodID == 0) {
return NULL;
}
newObj = (*env)->NewObject(env, magickImageClass, consMethodID);
if (newObj == NULL) {
return NULL;
}
if (!setHandle(env, newObj, "magickImageHandle", (void*) image, NULL)) {
#ifdef DIAGNOSTIC
fprintf(stderr, "newImageObject: Unable to set handle\n");
#endif
return NULL;
}
return newObj;
}
开发者ID:271845221,项目名称:Android-ImageMagick,代码行数:43,代码来源:jmagick.c
示例6: getHandle
/*
* Class: magick_MontageInfo
* Method: init
* Signature: (Lmagick/ImageInfo;)V
*/
JNIEXPORT void JNICALL Java_magick_MontageInfo_init
(JNIEnv *env, jobject self, jobject imageInfo)
{
ImageInfo *info;
MontageInfo *montageInfo;
/* Obtain the ImageInfo */
info = (ImageInfo*) getHandle(env, imageInfo, "imageInfoHandle", NULL);
if (info == NULL) {
throwMagickException(env, "Unable to obtain ImageInfo handle");
return;
}
/* Initialise the MontageInfo handle, allocating memory if required */
montageInfo =
(MontageInfo*) getHandle(env, self, "montageInfoHandle", NULL);
if (montageInfo == NULL) {
montageInfo = (MontageInfo*) AcquireMemory(sizeof(MontageInfo));
if (montageInfo == NULL) {
throwMagickException(env,
"Unable to allocate "
"memory for MontageInfo");
return;
}
}
GetMontageInfo(info, montageInfo);
setHandle(env, self, "montageInfoHandle", (void*) montageInfo, NULL);
}
开发者ID:Android-Apps,项目名称:Android-ImageMagick,代码行数:33,代码来源:magick_MontageInfo.c
示例7: mxWidget
mxRadioButton::mxRadioButton (mxWindow *parent, int x, int y, int w, int h, const char *label, int id, bool newGroup)
: mxWidget (parent, x, y, w, h, label)
{
if (!parent)
return;
DWORD dwStyle = WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON;
HWND hwndParent = (HWND) ((mxWidget *) parent)->getHandle ();
if (newGroup)
dwStyle |= WS_GROUP;
void *handle = (void *) CreateWindowEx (0, "BUTTON", label, dwStyle,
x, y, w, h, hwndParent,
(HMENU) id, (HINSTANCE) GetModuleHandle (NULL), NULL);
SendMessage ((HWND) handle, WM_SETFONT, (WPARAM) (HFONT) GetStockObject (ANSI_VAR_FONT), MAKELPARAM (TRUE, 0));
SetWindowLong ((HWND) handle, GWL_USERDATA, (LONG) this);
setHandle (handle);
setType (MX_RADIOBUTTON);
setParent (parent);
setId (id);
setChecked (newGroup);
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:26,代码来源:mxradiobutton.cpp
示例8: mxWidget
mxProgressBar::mxProgressBar (mxWindow *parent, int x, int y, int w, int h, int style)
: mxWidget (parent, x, y, w, h)
{
if (!parent)
return;
d_this = new mxProgressBar_i;
DWORD dwStyle = WS_VISIBLE | WS_CHILD;
HWND hwndParent = (HWND) ((mxWidget *) parent)->getHandle ();
if (style == Smooth)
dwStyle |= PBS_SMOOTH;
void *handle = (void *) CreateWindowEx (0, PROGRESS_CLASS, "", dwStyle,
x, y, w, h, hwndParent,
(HMENU) NULL, (HINSTANCE) GetModuleHandle (NULL), NULL);
SendMessage ((HWND) handle, WM_SETFONT, (WPARAM) (HFONT) GetStockObject (ANSI_VAR_FONT), MAKELPARAM (TRUE, 0));
setHandle (handle);
setType (MX_PROGRESSBAR);
setParent (parent);
parent->addWidget (this);
}
开发者ID:Hammermaps-DEV,项目名称:SOHL-V1.0-Refresh,代码行数:26,代码来源:mxProgressBar.cpp
示例9: setHandle
void
TDECModuleInfo::loadAll()
{
if( !_service ) /* We have a bogus service. All get functions will return empty/zero values */
return;
_allLoaded = true;
// library and factory
setHandle(_service->property("X-TDE-FactoryName", TQVariant::String).toString());
TQVariant tmp;
// read weight
tmp = _service->property( "X-TDE-Weight", TQVariant::Int );
setWeight( tmp.isValid() ? tmp.toInt() : 100 );
// does the module need super user privileges?
tmp = _service->property( "X-TDE-RootOnly", TQVariant::Bool );
setNeedsRootPrivileges( tmp.isValid() ? tmp.toBool() : false );
// does the module need to be shown to root only?
// Deprecated ! KDE 4
tmp = _service->property( "X-TDE-IsHiddenByDefault", TQVariant::Bool );
setIsHiddenByDefault( tmp.isValid() ? tmp.toBool() : false );
// get the documentation path
setDocPath( _service->property( "DocPath", TQVariant::String ).toString() );
tmp = _service->property( "X-TDE-Test-Module", TQVariant::Bool );
setNeedsTest( tmp.isValid() ? tmp.asBool() : false );
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:32,代码来源:tdecmoduleinfo.cpp
示例10: socket
int timeListener::start() {
int fd = socket(AF_INET, SOCK_STREAM, 0);
int ret = -1;
struct sockaddr_in servaddr;
if(fd < 0) {
perror("socket error!");
return -1;
}
setHandle(fd);
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(port_);
ret = inet_pton(AF_INET, ip_.c_str(), &servaddr.sin_addr);
if(ret < 0) {
perror("inet_pton error!");
return -1;
}
ret = bind(fd, (struct sockaddr*)&servaddr, sizeof(servaddr));
if(ret < 0) {
perror("bind error!");
return -1;
}
ret = listen(fd, 64);
if(ret < 0) {
perror("listen error!");
return -1;
}
std::cerr<<"time server is listening..."<<std::endl;
return 0;
}
开发者ID:dariuskylin,项目名称:network-programming,代码行数:30,代码来源:timeListener.cpp
示例11: glGenBuffers
////////////////////////////////////////////////////////////////////////////////
// create
//virtual
void RsVertexBufferGL::create()
{
// Generate buffers.
GLuint Handle;
glGenBuffers( 1, &Handle );
setHandle( Handle );
if( Handle != 0 )
{
// Increment fence, update will decrement it.
UpdateSyncFence_.increment();
// Update resource.
update();
// Destroy if there is a failure.
if ( glGetError() != GL_NO_ERROR )
{
destroy();
}
else
{
Created_ = BcTrue;
}
}
}
开发者ID:Dezzles,项目名称:Psybrus,代码行数:29,代码来源:RsVertexBufferGL.cpp
示例12: orb_publish
void PublicationBase::update(void *data)
{
if (_handle != nullptr) {
int ret = orb_publish(getMeta(), getHandle(), data);
if (ret != PX4_OK) { warnx("publish fail"); }
} else {
orb_advert_t handle;
if (_priority > 0) {
handle = orb_advertise_multi(
getMeta(), data,
&_instance, _priority);
} else {
handle = orb_advertise(getMeta(), data);
}
if (int64_t(handle) != PX4_ERROR) {
setHandle(handle);
} else {
warnx("advert fail");
}
}
}
开发者ID:2013-8-15,项目名称:Firmware,代码行数:27,代码来源:Publication.cpp
示例13: getHandle
/*
* Class: magick_ImageInfo
* Method: setFileName
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_magick_ImageInfo_setFileName
(JNIEnv *env, jobject obj, jstring fileName)
{
ImageInfo *imageInfo = NULL;
jfieldID handleFid = 0;
const char *cstr = NULL;
imageInfo = (ImageInfo*) getHandle(env, obj,
"imageInfoHandle", &handleFid);
if (imageInfo == NULL) {
imageInfo = (ImageInfo *) AcquireMemory(sizeof(ImageInfo));
if (imageInfo == NULL) {
throwMagickException(env, "Unable to allow memory for handle");
return;
}
GetImageInfo(imageInfo);
setHandle(env, obj, "imageInfoHandle", (void*) imageInfo, &handleFid);
}
cstr = (*env)->GetStringUTFChars(env, fileName, 0);
strcpy(imageInfo->filename, cstr);
(*env)->ReleaseStringUTFChars(env, fileName, cstr);
#ifdef DIAGNOSTIC
fprintf(stderr, "Set the file name in ImageInfo to %s\n",
imageInfo->filename);
#endif
}
开发者ID:VRDate,项目名称:jmagick,代码行数:34,代码来源:magick_ImageInfo.c
示例14: cdda_identify
/*
* Class: org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia
* Method: open
* Signature: (Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open
(JNIEnv *env, jobject obj, jstring strDevice)
{
int nReturn;
const char* cd_dev;
cdrom_drive* cdrom = NULL;
handle_t* pHandle;
int nParanoiaMode;
if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): begin\n"); }
cd_dev = (*env)->GetStringUTFChars(env, strDevice, NULL);
if (cd_dev == NULL)
{
if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): GetStringUTFChars() failed.\n"); }
return -1;
}
if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): device name: %s\n", cd_dev); }
cdrom = cdda_identify(cd_dev, 0, NULL);
if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): device name: %s\n", cd_dev); }
(*env)->ReleaseStringUTFChars(env, strDevice, cd_dev);
if (cdrom == NULL)
{
if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): cdda_identify() failed.\n"); }
return -1;
}
nReturn = cdda_open(cdrom);
if (nReturn < 0)
{
if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): cdda_open() failed.\n"); }
return -1;
}
if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): drive endianess: %d\n", cdrom->bigendianp); }
pHandle = (handle_t*) malloc(sizeof(handle_t));
if (pHandle == NULL)
{
if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): malloc() failed.\n"); }
cdda_close(cdrom);
return -1;
}
pHandle->drive = cdrom;
pHandle->paranoia = paranoia_init(pHandle->drive);
if (pHandle->paranoia == NULL)
{
if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): paranoia_init() failed.\n"); }
cdda_close(pHandle->drive);
free(pHandle);
return -1;
}
nParanoiaMode = getParanoiaMode();
if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): paranoia mode: %d\n", nParanoiaMode); }
paranoia_modeset(pHandle->paranoia, nParanoiaMode);
setHandle(env, obj, pHandle);
if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): end\n"); }
return 0;
}
开发者ID:gpeev,项目名称:Konsolenradio,代码行数:64,代码来源:org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia.c
示例15: setHandle
///析构函数
CwxAppHandler4UnixConn::~CwxAppHandler4UnixConn()
{
if (getHandle() != CWX_INVALID_HANDLE)
{
::close(getHandle());
setHandle(CWX_INVALID_HANDLE);
}
}
开发者ID:chenper,项目名称:cwinux,代码行数:9,代码来源:CwxAppHandler4UnixConn.cpp
示例16: DWTException
// Subclasses a dialog item inside a dialog, usually used in combination with Dialog resources.
void Widget::attach( unsigned id ) {
if ( !itsParent )
throw DWTException("Can't attach a Widget without a parent...");
HWND hWnd = ::GetDlgItem( itsParent->handle(), id );
if ( !hWnd )
throw Win32Exception("GetDlgItem failed.");
setHandle(hWnd);
}
开发者ID:BackupTheBerlios,项目名称:fdm-svn,代码行数:9,代码来源:Widget.cpp
示例17: T
Subscription<T>::Subscription(
List<SubscriptionBase *> * list,
const struct orb_metadata *meta, unsigned interval) :
T(), // initialize data structure to zero
SubscriptionBase(list, meta) {
setHandle(orb_subscribe(getMeta()));
orb_set_interval(getHandle(), interval);
}
开发者ID:maggi3wang,项目名称:AgileQuadNMPC,代码行数:8,代码来源:Subscription.cpp
示例18: mxWidget
mxMenu::mxMenu ()
: mxWidget (0, 0, 0, 0, 0)
{
void *handle = (void *) CreateMenu ();
setHandle (handle);
setType (MX_MENU);
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:8,代码来源:mxmenu.cpp
示例19: pOwnDevice_
SockDgram_AsyncOpeartion::SockDgram_AsyncOpeartion(SockDgram * pSockDgram): pOwnDevice_(pSockDgram)
{
setAOPType(OSAL::AOP_TYPE_USER_CALLBACK);
setHandle(pOwnDevice_->getHandle());
incomingMsg_.len_ = pOwnDevice_->bufferLen_;
incomingMsg_.pData_ = pOwnDevice_->pBuffer_;
}
开发者ID:IICL,项目名称:K-Middleware,代码行数:8,代码来源:SockDgram_AsyncOpeartion.cpp
示例20: clear
///析构函数
CwxAppHandler4Channel::~CwxAppHandler4Channel()
{
clear();
if (getHandle() != CWX_INVALID_HANDLE)
{
::close(getHandle());
setHandle(CWX_INVALID_HANDLE);
}
}
开发者ID:chenper,项目名称:cwinux,代码行数:10,代码来源:CwxAppHandler4Channel.cpp
注:本文中的setHandle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论