2012年2月7日火曜日

What Is Plain Text?

what is plain text?

Regarding callback registering for OpenNI in middleware framework

Basically I am trying to pack OpenNI Kinect into RT-middleware framework.
The OpenNI Kinect uses callback and has to be registered.

To do this, I could declare the callback functions and relevant variables in global without problem.

    // -----------------------------------------------     // Global     // ----------------------------------------------     // Declare OpenNI nodes     xn::Context g_Context;     xn::ScriptNode g_scriptNode;     xn::DepthGenerator g_DepthGenerator;     xn::UserGenerator g_UserGenerator;     // ... more codes          // Define callback functions     // Callback: New user was detected     void User_NewUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie)     {     	// ... some codes     	if (g_bNeedPose)     	{     		g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId);     	}     	// ... some codes     }          // Callback: An existing user was lost     void User_LostUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie)     {     	// ... some codes     }          // -----------------------------------------------     // Member     // ----------------------------------------------     // Register callback functioins in the RT-middleware class (OOP)     RTC::ReturnCode_t rtc_kinect::onActivated(RTC::UniqueId ec_id)     {     	// ... some codes     	nRetVal = g_UserGenerator.RegisterUserCallbacks(User_NewUser, User_LostUser, NULL, hUserCallbacks);     	// ...
Legal Writing in Plain English: A Text With Exercises
Learn more
Bryan A. Garner
some codes }

The above worked. However, using global variables and functions, I was told, is inappropriate.

I tried to move the callback functions and related variables as member of the middleware class, however been unsuccessful. The codes are:


The Message of A Course In Miracles: A Translation of the Text in Plain Language
Learn more
Elizabeth A. Cronkhite
    // ----------------------------------------     // private members     // ----------------------------------------     // Declare OpenNI nodes as member variables     xn::Context g_Context;     xn::ScriptNode g_scriptNode;     xn::DepthGenerator g_DepthGenerator;     xn::UserGenerator g_UserGenerator;     // ... more codes          // Define callback functions as member function     // Callback: New user was detected     void XN_CALLBACK_TYPE rtc_kinect::User_NewUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie)     {     	// ... some codes     	if (g_bNeedPose)     	{     		g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId);     	}     	else     	{     		g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);     	}     }          // Callback: An existing user was lost     void XN_CALLBACK_TYPE rtc_kinect::User_LostUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie)     {     	// ... some codes     }          // Register callback functioins in the RT-middleware class     RTC::ReturnCode_t rtc_kinect::onActivated(RTC::UniqueId ec_id)     {     	// ... some codes     	nRetVal = g_UserGenerator.RegisterUserCallbacks(&rtc_kinect::User_NewUser, &rtc_kinect::User_LostUser, NULL, hUserCallbacks);     	// ... some codes     }


The following errors were reported by the compiler:
error C2664: 'xn::UserGenerator::RegisterUserCallbacks' : cannot convert parameter 1 from 'void (__stdcall rtc_kinect::* )(xn::UserGenerator &,XnUserID,void *)' to 'xn::UserGenerator::UserHandler' error C2664: 'xn::PoseDetectionCapability::RegisterToPoseDetected' : cannot convert parameter 1 from 'void (__stdcall rtc_kinect::* )(xn::PoseDetectionCapability &,const XnChar *,XnUserID,void *)' to 'xn::PoseDetectionCapability::PoseDetection'     .... and many more

This is one example of the definition of the callback registration function:
inline XnStatus RegisterUserCallbacks(UserHandler NewUserCB, UserHandler LostUserCB, void* pCookie, XnCallbackHandle& hCallback)     {     	// ... some codes     }


This an example of the typedef of the parameter 1:
typedef void (XN_CALLBACK_TYPE* UserHandler)(UserGenerator& generator, XnUserID user, void* pCookie);



These are our most popular posts: what is plain text?

Infectious spam hijacks users who view the message

Plaintext. The search for simplicity. .... Plaintext: Here, Ill document the search for simplicity in: web design; crytography ... read more

Summary Text to only contain plain text

Network Security blog discusses network security, cyber attacks, security threats, mobile security, and much more. read more

Shortcut key on green laser pointer body

DetoClip is a multi-purpose clipboard manager for Windows that supports a wide range of file types, including TXT, RTF, HTML, BMP etc., allowing you to hold as. read more

Drive-by email malware alert: Plain text is just plain common sense ...

What that means is that this list of MD5 password hashes is nearly as good as if the passwords were just stored in plain ... read more

Related Posts



0 コメント:

コメントを投稿