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


Java IntByReference类代码示例

本文整理汇总了Java中com.sun.jna.ptr.IntByReference的典型用法代码示例。如果您正苦于以下问题:Java IntByReference类的具体用法?Java IntByReference怎么用?Java IntByReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IntByReference类属于com.sun.jna.ptr包,在下文中一共展示了IntByReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sdaiAppend

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
/**
 * Adds an attribute value at the end of an attribute list.
 * 
 * @param list
 * @param valueType
 * @param value
 */
public void sdaiAppend(int list, SdaiTypes valueType, Object value) {
	switch (valueType) {
	case INTEGER:
	case BOOLEAN:
	case LOGICAL:
		IntByReference iVal = new IntByReference((Integer) value);
		engine.sdaiAppend(list, valueType.ordinal(), iVal);
		break;
	case REAL:
		DoubleByReference dVal = new DoubleByReference((Double) value);
		engine.sdaiAppend(list, valueType.ordinal(), dVal);
		break;
	case STRING:
		engine.sdaiAppend(list, valueType.ordinal(), (String) value);
		break;
	default:
		engine.sdaiAppend(list, valueType.ordinal(), (Pointer) value);
		break;
	}
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:28,代码来源:IfcEngine.java

示例2: setTimesForExchangeItem

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
/**
 * Sets all times for a scalar time series parameter.
 *
 * @param parameterNumber
 * @param locationNumber
 * @param times
 */
public void setTimesForExchangeItem(int parameterNumber, int locationNumber, double[] times) {
    int timesCount = times.length;
    // correct for reference date
    double[] myTimes = new double[timesCount];

    for (int i = 0; i < myTimes.length; i++) {
        myTimes[i] = times[i] - referenceDateInMjd;
    }

    int retVal = nativeDLL.m_openda_wrapper_set_times_for_ei_(
            new IntByReference(myModelInstanceId),
            new IntByReference(parameterNumber),
            new IntByReference(locationNumber),
            new IntByReference(timesCount),
            myTimes);
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.SET_TIMES_FOR_EI call, retVal= " + retVal);
    }
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:28,代码来源:EfdcDLL.java

示例3: setValues

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
/**
 * Sets selected values for a scalar time series parameter.
 *
 * @param parameterNumber
 * @param values
 * @param locationNumber
 * @param layerNumber
 * @param startTime
 * @param endTime
 */
public void setValues(int parameterNumber, double[] values, int locationNumber, int layerNumber, ITime startTime, ITime endTime) {
    int valuesCount = getValuesCount(parameterNumber, locationNumber, startTime, endTime);
    if (valuesCount != values.length) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid number of values in setValues(exchangeItemId=" +
                parameterNumber + "). #Values=" + values.length + ", #expected=" + valuesCount);
    }
    int retVal = nativeDLL.m_openda_wrapper_set_values_for_time_span_(
            new IntByReference(myModelInstanceId),
            new IntByReference(parameterNumber), new IntByReference(locationNumber), new IntByReference(layerNumber),
            new DoubleByReference(startTime.getMJD() - referenceDateInMjd),
            new DoubleByReference(endTime.getMJD() - referenceDateInMjd),
            new IntByReference(valuesCount), values);
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.SET_VALUES_FOR_TIME_SPAN call, retVal= " + retVal);
    }
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:29,代码来源:EfdcDLL.java

示例4: getEndDate

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
/**
 * Note: this method throws an exception if there is no data available for the given dataSetNumber. So it is needed to check if there is data before calling this method.
 */
public int[] getEndDate(int wdmFileNumber, int dataSetNumber) {
    int[] startDate = new int[6];
    int[] endDate = new int[6];
    Arrays.fill(startDate, 0);
    Arrays.fill(endDate, 0);

    IntByReference returnCode = new IntByReference(-1);
    nativeDLL.wdatim_(new IntByReference(wdmFileNumber), new IntByReference(dataSetNumber),
            startDate, endDate, new IntByReference(), new IntByReference(), returnCode);
    if (returnCode.getValue() != 0) {
        throw new RuntimeException("WdmDll: Invalid result from call to subroutine dll.wdatim_ , returnCode = " + returnCode.getValue());
    }

    return endDate;
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:19,代码来源:WdmDll.java

示例5: setStateValues

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
public static void setStateValues(double[] values) {
	int retVal;
	if (platform == D3dFlowModelConfig.DllType.win32_ifort) {
		retVal = winIfortDll.SE_SET_INSTANCE_CORE_STATE(values,new IntByReference(values.length) );
		if (retVal != 0){
			throw new RuntimeException("setStateValues: failed to set statevalues");
		}
	}else if (platform == D3dFlowModelConfig.DllType.linux64_gnu) {
		retVal = linuxGnuDll.se_set_instance_core_state_(values,new IntByReference(values.length) );
		if (retVal != 0){
			throw new RuntimeException("setStateValues: failed to set statevalues");
		}
	} else {
		throw new RuntimeException("setStateValues: DLL/so type not known for model");
	}
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:17,代码来源:D3dFlowDll.java

示例6: getBoundaryExchangeItemID

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
public static int getBoundaryExchangeItemID(String boundaryId, int boundaryType) {
	int retVal;
	if (platform == D3dFlowModelConfig.DllType.win32_ifort) {
		retVal = winIfortDll.SE_GET_EXCHANGE_ITEM_ID_CI(
				boundaryId, new IntByReference(boundaryType), boundaryId.length());
	} else if (platform == D3dFlowModelConfig.DllType.linux64_gnu) {
		retVal = linuxGnuDll.se_get_exchange_item_id_ci_(
				boundaryId, new IntByReference(boundaryType), boundaryId.length());
	} else {
		throw new RuntimeException("getBoundaryExchangeItemID: DLL/so type not known for model");
	}
	if (retVal < 0) {
		throw new RuntimeException("Error in D3dFlowDll.getBoundaryExchangeItemID, retVal " + retVal);
	}
	return retVal;
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:17,代码来源:D3dFlowDll.java

示例7: getValues

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
public double[] getValues(int exchangeItemId, int startIndex, int endIndex) {
    int valuesCount = getValuesCount(exchangeItemId);
    double[] values = new double[valuesCount];
    startModelInstanceAccess();
    int retVal = nativeDLL.m_simple_model_mp_get_values_(
            new IntByReference(myModelInstanceId),
            new IntByReference(exchangeItemId),
            new IntByReference(startIndex + 1), new IntByReference(endIndex + 1),
            values);
    endModelInstanceAccess();
    if (retVal != 0) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_VALUES call, retVal= " + retVal);
    }
    return values;
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:17,代码来源:SimpleModelDLL.java

示例8: setValues

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
public void setValues(int exchangeItemId, double[] values, int locationIndex, ITime startTime, ITime endTime) {
    int valuesCount = getValuesCount(exchangeItemId, locationIndex, startTime, endTime);
    if (valuesCount != values.length) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid #values in setValues(exchangeItemId=" +
                exchangeItemId + "). #Values=" + values.length + ", #expected=" + valuesCount);
    }
    startModelInstanceAccess();
    int retVal = nativeDLL.m_simple_model_mp_set_values_for_time_span_(
            new IntByReference(myModelInstanceId),
            new IntByReference(exchangeItemId), new IntByReference(locationIndex),
            new DoubleByReference(startTime.getMJD()), new DoubleByReference(endTime.getMJD()),
            new IntByReference(valuesCount), values);
    endModelInstanceAccess();
    if (retVal != 0) {
        nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.SET_VALUES call, retVal= " + retVal);
    }
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:20,代码来源:SimpleModelDLL.java

示例9: isProcessActive

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
/**
 * @see NativeCalls#isProcessActive(int)
 */
@Override
public boolean isProcessActive(final int processId) {
  try {
    final Pointer procHandle =
        Kernel32.OpenProcess(Kernel32.PROCESS_QUERY_INFORMATION, false, processId);
    final long hval;
    if (procHandle == null
        || (hval = Pointer.nativeValue(procHandle)) == Kernel32.INVALID_HANDLE || hval == 0) {
      return false;
    } else {
      final IntByReference status = new IntByReference();
      final boolean result = Kernel32.GetExitCodeProcess(procHandle, status) && status != null
          && status.getValue() == Kernel32.STILL_ACTIVE;
      Kernel32.CloseHandle(procHandle);
      return result;
    }
  } catch (LastErrorException le) {
    // some problem in getting process status
    return false;
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:25,代码来源:NativeCallsJNAImpl.java

示例10: getValues

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
/**
 * Returns selected values for a scalar time series parameter.
 *
 * @param parameterNumber
 * @param locationNumber
 * @param layerNumber
 * @param startTime
 * @param endTime
 * @return values
 */
public double[] getValues(int parameterNumber, int locationNumber, int layerNumber, ITime startTime, ITime endTime) {
    int valuesCount = getValuesCount(parameterNumber, locationNumber, startTime, endTime);
    double[] values = new double[valuesCount];
    int retVal = nativeDLL.m_openda_wrapper_get_values_for_time_span_(
            new IntByReference(myModelInstanceId),
            new IntByReference(parameterNumber), new IntByReference(locationNumber), new IntByReference(layerNumber),
            new DoubleByReference(startTime.getMJD() - referenceDateInMjd ),
            new DoubleByReference(endTime.getMJD() - referenceDateInMjd),
            new IntByReference(valuesCount), values);
    if (retVal != 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_VALUES_FOR_TIME_SPAN call, retVal= " + retVal);
    }
    return values;
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:26,代码来源:EfdcDLL.java

示例11: getTimeSeriesCount

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
/**
 * Returns timeseriesCount for a scalar time series parameter.
 *
 * @param parameterNumber
 * @return timeseriesCount
 */
public int getTimeSeriesCount(int parameterNumber) {
    int timeSeriesCount = nativeDLL.m_openda_wrapper_get_time_series_count_(new IntByReference(myModelInstanceId), new IntByReference(parameterNumber));
    if (timeSeriesCount < 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
        throw new RuntimeException("Invalid result from dll.GET_TIME_SERIES_COUNT call, timeSeriesCount= " + timeSeriesCount);
    }
    return timeSeriesCount;
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:15,代码来源:EfdcDLL.java

示例12: engiGetAggrElement

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
/**
 * Returns a data field in the actual aggregate element.
 * 
 * @param aggregate
 *            Existing aggregation
 * @param elementIndex
 *            Position in the existing aggregation, first position is 0
 * @param valueType
 *            Type of output value
 * @return Value of the specific element in the aggregation
 */
public Object engiGetAggrElement(Pointer aggregate, int elementIndex, SdaiTypes valueType) {
	Object returnValue = null;
	switch (valueType) {
	case INTEGER:
		IntByReference intRef = new IntByReference();
		engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), intRef);
		returnValue = new Integer(intRef.getValue());
		break;
	case REAL:
		DoubleByReference dblRef = new DoubleByReference();
		engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), dblRef);
		returnValue = new Double(dblRef.getValue());
		break;
	case STRING:
		PointerByReference strRef = new PointerByReference();
		engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), strRef);
		Pointer strPtr = strRef.getValue();
		if (strPtr != null)
			returnValue = strPtr.getString(0);
		break;
	default:
		PointerByReference ptrRef = new PointerByReference();
		engine.engiGetAggrElement(aggregate, elementIndex, valueType.ordinal(), ptrRef);
		returnValue = ptrRef.getValue();
		break;
	}
	return returnValue;
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:40,代码来源:IfcEngine.java

示例13: getTimesCount

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
/**
 * Returns timeCount for a scalar time series parameter.
 *
 * @param parameterNumber
 * @param locationNumber
 * @return timeCount
 */
private int getTimesCount(int parameterNumber, int locationNumber) {
    int cellCount = nativeDLL.m_openda_wrapper_get_times_count_for_location_(
            new IntByReference(myModelInstanceId),
            new IntByReference(parameterNumber),
            new IntByReference(locationNumber));
    if (cellCount < 0) {
        nativeDLL.m_openda_wrapper_finish_(new IntByReference(myModelInstanceId));
        throw new RuntimeException("Invalid result from dll.GET_TIMES_COUNT_FOR_LOCATION call, cellCount= " + cellCount);
    }
    return cellCount;
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:19,代码来源:EfdcDLL.java

示例14: sdaiGetAggrByIterator

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
/**
 * Implementation postponed till version 1.10
 * 
 * @param iterator
 *            Existing iterator
 * @param valueType
 *            Type of output value
 * @return
 */
public Object sdaiGetAggrByIterator(Pointer iterator, SdaiTypes valueType) {
	Object returnValue = null;

	switch (valueType) {
	case REAL:
		DoubleByReference dVal = new DoubleByReference();
		engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), dVal);
		returnValue = new Double(dVal.getValue());
		break;
	case INTEGER:
	case BOOLEAN:
	case LOGICAL:
		IntByReference iVal = new IntByReference();
		engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), iVal);
		returnValue = new Integer(iVal.getValue());
		break;
	case STRING:
		PointerByReference sVal = new PointerByReference();
		engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), sVal);
		returnValue = (String) sVal.getValue().getString(0);
		break;
	default:
		PointerByReference ptr = new PointerByReference();
		engine.sdaiGetAggrByIterator(iterator, valueType.ordinal(), ptr);
		returnValue = ptr.getValue();
		break;
	}
	return returnValue;
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:39,代码来源:IfcEngine.java

示例15: sdaiGetAttr

import com.sun.jna.ptr.IntByReference; //导入依赖的package包/类
/**
 * Returns the data value of the specified attribute in the actual instance.
 * The actual instance is specified by a numeric instanceID that uniquely
 * identifies an instance.
 * 
 * @param instance
 *            A numeric instanceID that uniquely identifies an instance.
 * @param attribute
 *            A numeric attributerID that uniquely identifies an attribute
 *            definition instance.
 * @param valueType
 *            Type of output value.
 * @return Output value of the specific element in the aggregation.
 */
public Object sdaiGetAttr(Pointer instance, int attribute, SdaiTypes valueType) {
	Object returnValue = null;

	switch (valueType) {
	case REAL:
		DoubleByReference dVal = new DoubleByReference();
		engine.sdaiGetAggrByIterator(instance, valueType.ordinal(), dVal);
		returnValue = new Double(dVal.getValue());
		break;
	case INTEGER:
	case BOOLEAN:
	case LOGICAL:
		IntByReference iVal = new IntByReference();
		engine.sdaiGetAggrByIterator(instance, valueType.ordinal(), iVal);
		returnValue = new Integer(iVal.getValue());
		break;
	case STRING:
		PointerByReference sVal = new PointerByReference();
		engine.sdaiGetAggrByIterator(instance, valueType.ordinal(), sVal);
		returnValue = (String) sVal.getValue().getString(0);
		break;
	default:
		PointerByReference ptr = new PointerByReference();
		engine.sdaiGetAggrByIterator(instance, valueType.ordinal(), ptr);
		returnValue = ptr.getValue();
		break;
	}
	return returnValue;
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:44,代码来源:IfcEngine.java


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