当前位置: 首页>>代码示例>>C++>>正文


C++ JPType::asHostObject方法代码示例

本文整理汇总了C++中JPType::asHostObject方法的典型用法代码示例。如果您正苦于以下问题:C++ JPType::asHostObject方法的具体用法?C++ JPType::asHostObject怎么用?C++ JPType::asHostObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JPType的用法示例。


在下文中一共展示了JPType::asHostObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getInstanceValue

HostRef* JPObjectType::getInstanceValue(jobject c, jfieldID fid, JPTypeName& tgtType) 
{
	TRACE_IN("JPObjectType::getInstanceValue");
	JPCleaner cleaner;
	jobject r = JPEnv::getJava()->GetObjectField(c, fid);
	cleaner.addLocal(r);

	jvalue v;
	v.l = r;
	
	JPTypeName name = JPJni::getClassName(v.l);
	JPType* type = JPTypeManager::getType(name);
	return type->asHostObject(v);

	TRACE_OUT;
}
开发者ID:Kcrong,项目名称:speech_analysis,代码行数:16,代码来源:jp_objecttypes.cpp

示例2: invokeStatic

HostRef* JPObjectType::invokeStatic(jclass claz, jmethodID mth, jvalue* val)
{
	TRACE_IN("JPObjectType::invokeStatic");
	JPCleaner cleaner;
	
	jobject res = JPEnv::getJava()->CallStaticObjectMethodA(claz, mth, val);
	cleaner.addLocal(res);

	jvalue v;
	v.l = res;

	JPTypeName name = JPJni::getClassName(v.l);
	JPType* type = JPTypeManager::getType(name);
	return type->asHostObject(v);

	TRACE_OUT;
}
开发者ID:Kcrong,项目名称:speech_analysis,代码行数:17,代码来源:jp_objecttypes.cpp

示例3: asHostObject

HostRef* JPClass::asHostObject(jvalue obj) 
{
	TRACE_IN("JPClass::asPyObject");
	if (obj.l == NULL)
	{
		return JPEnv::getHost()->getNone();
	}

	JPTypeName name = JPJni::getClassName(obj.l);
	if (name.getType() ==JPTypeName::_array)
	{
		JPType* arrayType = JPTypeManager::getType(name);
		return arrayType->asHostObject(obj);
	}
	
	return JPEnv::getHost()->newObject(new JPObject(name, obj.l));
	TRACE_OUT;
}
开发者ID:Kcrong,项目名称:speech_analysis,代码行数:18,代码来源:jp_class.cpp

示例4: invoke

HostRef* JPObjectType::invoke(jobject claz, jclass clazz, jmethodID mth, jvalue* val)
{
	TRACE_IN("JPObjectType::invoke");
	JPCleaner cleaner;

	jobject res = JPEnv::getJava()->CallNonvirtualObjectMethodA(claz, clazz, mth, val);
	cleaner.addLocal(res);

	jvalue v;
	v.l = res;

	JPTypeName name = JPJni::getClassName(v.l);
	JPType* type = JPTypeManager::getType(name);
	HostRef* ref = type->asHostObject(v);
	TRACE1("Successfulyl converted to host reference");
	return ref;
	
	TRACE_OUT;
}
开发者ID:Kcrong,项目名称:speech_analysis,代码行数:19,代码来源:jp_objecttypes.cpp

示例5: getArrayItem

HostRef* JPObjectType::getArrayItem(jarray a, int ndx)
{
	TRACE_IN("JPObjectType::getArrayItem");
	jobjectArray array = (jobjectArray)a;	
	JPCleaner cleaner;
	
	jobject obj = JPEnv::getJava()->GetObjectArrayElement(array, ndx);
	cleaner.addLocal(obj);
	
	if (obj == NULL)
	{
		return JPEnv::getHost()->getNone();
	}
	
	jvalue v;
	v.l = obj;

	JPTypeName name = JPJni::getClassName(v.l);
	JPType* t = JPTypeManager::getType(name);
	
	return t->asHostObject(v);
	TRACE_OUT;
}
开发者ID:Kcrong,项目名称:speech_analysis,代码行数:23,代码来源:jp_objecttypes.cpp

示例6:

vector<HostRef*> JPObjectType::getArrayRange(jarray a, int start, int length)
{
	jobjectArray array = (jobjectArray)a;	
	JPCleaner cleaner;
	
	vector<HostRef*> res;
	
	jvalue v;
	for (int i = 0; i < length; i++)
	{
		v.l = JPEnv::getJava()->GetObjectArrayElement(array, i+start);
		cleaner.addLocal(v.l);

		JPTypeName name = JPJni::getClassName(v.l);
		JPType* t = JPTypeManager::getType(name);
		
		HostRef* pv = t->asHostObject(v);		

		res.push_back(pv);
	}
	
	return res;  
}
开发者ID:Kcrong,项目名称:speech_analysis,代码行数:23,代码来源:jp_objecttypes.cpp


注:本文中的JPType::asHostObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。