本文整理汇总了C++中TA_INTERNAL_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ TA_INTERNAL_ERROR函数的具体用法?C++ TA_INTERNAL_ERROR怎么用?C++ TA_INTERNAL_ERROR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TA_INTERNAL_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TA_FuncTableFree
TA_RetCode TA_FuncTableFree( TA_StringTable *table )
{
TA_StringTablePriv *stringTablePriv;
if( table )
{
stringTablePriv = (TA_StringTablePriv *)table->hiddenData;
if( !stringTablePriv )
{
return TA_INTERNAL_ERROR(3);
}
if( stringTablePriv->magicNumber != TA_STRING_TABLE_FUNC_MAGIC_NB )
{
return TA_BAD_OBJECT;
}
if( table->string )
TA_Free( (void *)table->string );
TA_Free( table );
}
return TA_SUCCESS;
}
示例2: TA_FuncTableFree
TA_RetCode TA_FuncTableFree( TA_StringTable *table )
{
TA_StringTableFuncHidden *stringTableHidden;
TA_Libc *libHandle;
if( table )
{
stringTableHidden = (TA_StringTableFuncHidden *)table->hiddenData;
if( !stringTableHidden )
return TA_INTERNAL_ERROR(3);
if( stringTableHidden->magicNb != TA_STRING_TABLE_FUNC_MAGIC_NB )
return TA_BAD_OBJECT;
libHandle = stringTableHidden->libHandle;
TA_Free( libHandle, stringTableHidden );
if( table->string )
TA_Free( libHandle, (void *)table->string );
TA_Free( libHandle, table );
}
return TA_SUCCESS;
}
示例3: rangeTestFunction
/* rangeTestFunction is a different way to call any of
* the TA function.
*
* This is called by doRangeTest found in test_util.c
*
* The doRangeTest verifies behavior that should be common
* for ALL TA functions. It detects bugs like:
* - outBegIdx, outNbElement and lookback inconsistency.
* - off-by-one writes to output.
* - output inconsistency for different start/end index.
* - ... many other limit cases...
*
* In the case of candlestick, the output is integer and
* should be put in outputBufferInt, and outputBuffer is
* ignored.
*/
static TA_RetCode rangeTestFunction( TA_Integer startIdx,
TA_Integer endIdx,
TA_Real *outputBuffer,
TA_Integer *outputBufferInt,
TA_Integer *outBegIdx,
TA_Integer *outNbElement,
TA_Integer *lookback,
void *opaqueData,
unsigned int outputNb,
unsigned int *isOutputInteger )
{
TA_RangeTestParam *testParam1;
const TA_Test *testParam2;
ErrorNumber errNb;
TA_RetCode retCode;
(void)outputBuffer;
(void)outputNb;
testParam1 = (TA_RangeTestParam *)opaqueData;
testParam2 = (const TA_Test *)testParam1->test;
*isOutputInteger = 1; /* Must be != 0 */
retCode = TA_INTERNAL_ERROR(166);
/* Call the TA function by name */
errNb = callCandlestick( &testParam1->paramHolder,
testParam2->name,
startIdx, endIdx,
testParam1->open,
testParam1->high,
testParam1->low,
testParam1->close,
testParam2->params,
outBegIdx,
outNbElement,
outputBufferInt,
lookback,
&retCode );
if( errNb != TA_TEST_PASS )
retCode = TA_INTERNAL_ERROR(168);
return retCode;
}
示例4: TA_GetOptInputParameterInfo
TA_RetCode TA_GetOptInputParameterInfo( const TA_FuncHandle *handle,
unsigned int paramIndex,
const TA_OptInputParameterInfo **info )
{
const TA_FuncDef *funcDef;
const TA_FuncInfo *funcInfo;
const TA_OptInputParameterInfo **inputTable;
if( (handle == NULL) || (info == NULL) )
{
return TA_BAD_PARAM;
}
*info = NULL;
/* Validate that this is a valid funcHandle. */
funcDef = (const TA_FuncDef *)handle;
if( funcDef->magicNumber != TA_FUNC_DEF_MAGIC_NB )
{
return TA_INVALID_HANDLE;
}
funcInfo = funcDef->funcInfo;
if( !funcInfo )
return TA_INVALID_HANDLE;
if( paramIndex >= funcInfo->nbOptInput )
{
return TA_BAD_PARAM;
}
inputTable = (const TA_OptInputParameterInfo **)funcDef->optInput;
if( !inputTable )
return TA_INTERNAL_ERROR(3);
*info = inputTable[paramIndex];
if( !(*info) )
return TA_INTERNAL_ERROR(4);
return TA_SUCCESS;
}
示例5: rangeTestFunction
/**** Local functions definitions. ****/
static TA_RetCode rangeTestFunction( TA_Integer startIdx,
TA_Integer endIdx,
TA_Real *outputBuffer,
TA_Integer *outputBufferInt,
TA_Integer *outBegIdx,
TA_Integer *outNbElement,
TA_Integer *lookback,
void *opaqueData,
unsigned int outputNb,
unsigned int *isOutputInteger )
{
TA_RetCode retCode;
TA_RangeTestParam *testParam;
(void)outputNb;
(void)outputBufferInt;
*isOutputInteger = 0;
testParam = (TA_RangeTestParam *)opaqueData;
switch( testParam->test->theFunction )
{
case TA_BOP_TEST:
retCode = TA_BOP( startIdx,
endIdx,
testParam->open,
testParam->high,
testParam->low,
testParam->close,
outBegIdx,
outNbElement,
outputBuffer );
*lookback = TA_BOP_Lookback();
break;
case TA_AVGPRICE_TEST:
retCode = TA_AVGPRICE( startIdx,
endIdx,
testParam->open,
testParam->high,
testParam->low,
testParam->close,
outBegIdx,
outNbElement,
outputBuffer );
*lookback = TA_AVGPRICE_Lookback();
break;
default:
retCode = TA_INTERNAL_ERROR(171);
}
return retCode;
}
示例6: getGroupSize
static TA_RetCode getGroupSize( TA_GroupId groupId, unsigned int *groupSize )
{
#ifdef TA_GEN_CODE
/* Code used only when compiled with gen_code. */
unsigned int i, j;
const TA_FuncDef **funcDefTable;
const TA_FuncDef *funcDef;
unsigned int tableSize;
unsigned int nbFuncFound;
if( groupId >= TA_NB_GROUP_ID ) return TA_INTERNAL_ERROR(2);
if( !groupSize ) return TA_INTERNAL_ERROR(2);
nbFuncFound = 0;
for( i=0; i < 26; i++ )
{
funcDefTable = TA_DEF_Tables[i];
tableSize = *(TA_DEF_TablesSize[i]);
for( j=0; j < tableSize; j++ )
{
funcDef = funcDefTable[j];
if( funcDef && (funcDef->groupId == groupId) )
nbFuncFound++;
}
}
*groupSize = nbFuncFound;
return TA_SUCCESS;
#else
/* Optimized code in the final library. */
*groupSize = TA_PerGroupSize[groupId];
return TA_SUCCESS;
#endif
}
示例7: TA_SetInputParamIntegerPtr
TA_RetCode TA_SetInputParamIntegerPtr( TA_ParamHolder *param,
unsigned int paramIndex,
const TA_Integer *value )
{
TA_ParamHolderPriv *paramHolderPriv;
const TA_InputParameterInfo *paramInfo;
const TA_FuncInfo *funcInfo;
if( (param == NULL) || (value == NULL) )
{
return TA_BAD_PARAM;
}
paramHolderPriv = (TA_ParamHolderPriv *)(param->hiddenData);
if( paramHolderPriv->magicNumber != TA_PARAM_HOLDER_PRIV_MAGIC_NB )
{
return TA_INVALID_PARAM_HOLDER;
}
/* Make sure this index really exist. */
funcInfo = paramHolderPriv->funcInfo;
if( !funcInfo ) return TA_INVALID_HANDLE;
if( paramIndex >= funcInfo->nbInput )
{
return TA_BAD_PARAM;
}
/* Verify the type of the parameter. */
paramInfo = paramHolderPriv->in[paramIndex].inputInfo;
if( !paramInfo ) return TA_INTERNAL_ERROR(2);
if( paramInfo->type != TA_Input_Integer )
{
return TA_INVALID_PARAM_HOLDER_TYPE;
}
/* keep a copy of the provided parameter. */
paramHolderPriv->in[paramIndex].data.inInteger = value;
/* This parameter is now initialized, clear the corresponding bit. */
paramHolderPriv->inBitmap &= ~(1<<paramIndex);
return TA_SUCCESS;
}
示例8: TA_SetOptInputParamReal
TA_RetCode TA_SetOptInputParamReal( TA_ParamHolder *param,
unsigned int paramIndex,
TA_Real value )
{
TA_ParamHolderPriv *paramHolderPriv;
const TA_OptInputParameterInfo *paramInfo;
const TA_FuncInfo *funcInfo;
if( param == NULL )
{
return TA_BAD_PARAM;
}
paramHolderPriv = (TA_ParamHolderPriv *)(param->hiddenData);
if( paramHolderPriv->magicNumber != TA_PARAM_HOLDER_PRIV_MAGIC_NB )
{
return TA_INVALID_PARAM_HOLDER;
}
/* Make sure this index really exist. */
funcInfo = paramHolderPriv->funcInfo;
if( !funcInfo ) return TA_INVALID_HANDLE;
if( paramIndex >= funcInfo->nbOptInput )
{
return TA_BAD_PARAM;
}
/* Verify the type of the parameter. */
paramInfo = paramHolderPriv->optIn[paramIndex].optInputInfo;
if( !paramInfo ) return TA_INTERNAL_ERROR(2);
if( (paramInfo->type != TA_OptInput_RealRange) &&
(paramInfo->type != TA_OptInput_RealList) )
{
return TA_INVALID_PARAM_HOLDER_TYPE;
}
/* keep a copy of the provided parameter. */
paramHolderPriv->optIn[paramIndex].data.optInReal = value;
return TA_SUCCESS;
}
示例9: TA_GroupTableFree
TA_RetCode TA_GroupTableFree( TA_StringTable *table )
{
TA_StringTablePriv *stringTablePriv;
if( table )
{
stringTablePriv = (TA_StringTablePriv *)table->hiddenData;
if( !stringTablePriv )
{
return TA_INTERNAL_ERROR(1);
}
if( stringTablePriv->magicNumber != TA_STRING_TABLE_GROUP_MAGIC_NB )
{
return TA_BAD_OBJECT;
}
TA_Free( table );
}
return TA_SUCCESS;
}
示例10: TA_GroupTableFree
TA_RetCode TA_GroupTableFree( TA_StringTable *table )
{
TA_StringTableGroupHidden *stringTableHidden;
TA_Libc *libHandle;
if( table )
{
stringTableHidden = (TA_StringTableGroupHidden *)table->hiddenData;
if( !stringTableHidden )
return TA_INTERNAL_ERROR(1);
if( stringTableHidden->magicNb != TA_STRING_TABLE_GROUP_MAGIC_NB )
return TA_BAD_OBJECT;
libHandle = stringTableHidden->libHandle;
TA_Free( libHandle, stringTableHidden );
TA_Free( libHandle, table );
}
return TA_SUCCESS;
}
示例11: TA_SetInputParamPricePtr
TA_RetCode TA_SetInputParamPricePtr( TA_ParamHolder *param,
unsigned int paramIndex,
const TA_Real *open,
const TA_Real *high,
const TA_Real *low,
const TA_Real *close,
const TA_Real *volume,
const TA_Real *openInterest )
{
TA_ParamHolderPriv *paramHolderPriv;
const TA_InputParameterInfo *paramInfo;
const TA_FuncInfo *funcInfo;
if( param == NULL )
{
return TA_BAD_PARAM;
}
paramHolderPriv = (TA_ParamHolderPriv *)(param->hiddenData);
if( paramHolderPriv->magicNumber != TA_PARAM_HOLDER_PRIV_MAGIC_NB )
{
return TA_INVALID_PARAM_HOLDER;
}
/* Make sure this index really exist. */
funcInfo = paramHolderPriv->funcInfo;
if( !funcInfo ) return TA_INVALID_HANDLE;
if( paramIndex >= funcInfo->nbInput )
{
return TA_BAD_PARAM;
}
/* Verify the type of the parameter. */
paramInfo = paramHolderPriv->in[paramIndex].inputInfo;
if( !paramInfo ) return TA_INTERNAL_ERROR(2);
if( paramInfo->type != TA_Input_Price )
{
return TA_INVALID_PARAM_HOLDER_TYPE;
}
/* keep a copy of the provided parameter. */
#define SET_PARAM_INFO(lowerParam,upperParam) \
{ \
if( paramInfo->flags & TA_IN_PRICE_##upperParam ) \
{ \
if( lowerParam == NULL ) \
{ \
return TA_BAD_PARAM; \
} \
paramHolderPriv->in[paramIndex].data.inPrice.lowerParam = lowerParam; \
} \
}
SET_PARAM_INFO(open, OPEN );
SET_PARAM_INFO(high, HIGH );
SET_PARAM_INFO(low, LOW );
SET_PARAM_INFO(close, CLOSE );
SET_PARAM_INFO(volume, VOLUME );
SET_PARAM_INFO(openInterest, OPENINTEREST );
#undef SET_PARAM_INFO
/* This parameter is now initialized, clear the corresponding bit. */
paramHolderPriv->inBitmap &= ~(1<<paramIndex);
return TA_SUCCESS;
}
示例12: TA_ParamHolderAlloc
TA_RetCode TA_ParamHolderAlloc( const TA_FuncHandle *handle,
TA_ParamHolder **allocatedParams )
{
TA_FuncDef *funcDef;
unsigned int allocSize, i;
TA_ParamHolderInput *input;
TA_ParamHolderOptInput *optInput;
TA_ParamHolderOutput *output;
const TA_FuncInfo *funcInfo;
TA_ParamHolder *newParams;
TA_ParamHolderPriv *newParamsPriv;
const TA_InputParameterInfo **inputInfo;
const TA_OptInputParameterInfo **optInputInfo;
const TA_OutputParameterInfo **outputInfo;
/* Validate the parameters. */
if( !handle || !allocatedParams)
{
return TA_BAD_PARAM;
}
/* Validate that this is a valid funcHandle. */
funcDef = (TA_FuncDef *)handle;
if( funcDef->magicNumber != TA_FUNC_DEF_MAGIC_NB )
{
*allocatedParams = NULL;
return TA_INVALID_HANDLE;
}
/* Get the TA_FuncInfo. */
funcInfo = funcDef->funcInfo;
if( !funcInfo ) return TA_INVALID_HANDLE;
/* Allocate the TA_ParamHolder. */
newParams = (TA_ParamHolder *)TA_Malloc( sizeof(TA_ParamHolder) + sizeof(TA_ParamHolderPriv));
if( !newParams )
{
*allocatedParams = NULL;
return TA_ALLOC_ERR;
}
memset( newParams, 0, sizeof(TA_ParamHolder) + sizeof(TA_ParamHolderPriv) );
newParamsPriv = (TA_ParamHolderPriv *)(((char *)newParams)+sizeof(TA_ParamHolder));
newParamsPriv->magicNumber = TA_PARAM_HOLDER_PRIV_MAGIC_NB;
newParams->hiddenData = newParamsPriv;
/* From this point, TA_ParamHolderFree can be safely called. */
/* Allocate the array of structure holding the info
* for each parameter.
*/
if( funcInfo->nbInput == 0 ) return TA_INTERNAL_ERROR(2);
allocSize = (funcInfo->nbInput) * sizeof(TA_ParamHolderInput);
input = (TA_ParamHolderInput *)TA_Malloc( allocSize );
if( !input )
{
TA_ParamHolderFree( newParams );
*allocatedParams = NULL;
return TA_ALLOC_ERR;
}
memset( input, 0, allocSize );
newParamsPriv->in = input;
if( funcInfo->nbOptInput == 0 )
optInput = NULL;
else
{
allocSize = (funcInfo->nbOptInput) * sizeof(TA_ParamHolderOptInput);
optInput = (TA_ParamHolderOptInput *)TA_Malloc( allocSize );
if( !optInput )
{
TA_ParamHolderFree( newParams );
*allocatedParams = NULL;
return TA_ALLOC_ERR;
}
memset( optInput, 0, allocSize );
}
newParamsPriv->optIn = optInput;
allocSize = (funcInfo->nbOutput) * sizeof(TA_ParamHolderOutput);
output = (TA_ParamHolderOutput *)TA_Malloc( allocSize );
if( !output )
{
TA_ParamHolderFree( newParams );
*allocatedParams = NULL;
return TA_ALLOC_ERR;
}
memset( output, 0, allocSize );
newParamsPriv->out = output;
newParamsPriv->funcInfo = funcInfo;
inputInfo = (const TA_InputParameterInfo **)funcDef->input;
optInputInfo = (const TA_OptInputParameterInfo **)funcDef->optInput;
//.........这里部分代码省略.........
示例13: TA_GetFuncHandle
TA_RetCode TA_GetFuncHandle( const char *name, const TA_FuncHandle **handle )
{
char firstChar, tmp;
const TA_FuncDef **funcDefTable;
const TA_FuncDef *funcDef;
const TA_FuncInfo *funcInfo;
unsigned int i, funcDefTableSize;
/* A TA_FuncHandle is internally a TA_FuncDef. Let's find it
* by using the alphabetical tables.
*/
if( (name == NULL) || (handle == NULL) )
{
return TA_BAD_PARAM;
}
*handle = NULL;
firstChar = name[0];
if( firstChar == '\0' )
{
return TA_BAD_PARAM;
}
tmp = (char)tolower( firstChar );
if( (tmp < 'a') || (tmp > 'z') )
{
return TA_FUNC_NOT_FOUND;
}
/* Identify the table. */
tmp -= (char)'a';
funcDefTable = TA_DEF_Tables[(int)tmp];
/* Identify the table size. */
funcDefTableSize = *TA_DEF_TablesSize[(int)tmp];
if( funcDefTableSize < 1 )
{
return TA_FUNC_NOT_FOUND;
}
/* Iterate all entries of the table and return as soon as found. */
for( i=0; i < funcDefTableSize; i++ )
{
funcDef = funcDefTable[i];
if( !funcDef || !funcDef->funcInfo )
return TA_INTERNAL_ERROR(3);
funcInfo = funcDef->funcInfo;
if( !funcInfo )
return TA_INTERNAL_ERROR(4);
if( strcmp( funcInfo->name, name ) == 0 )
{
*handle = (TA_FuncHandle *)funcDef;
return TA_SUCCESS;
}
}
return TA_FUNC_NOT_FOUND;
}
示例14: rangeTestFunction
/**** Local functions definitions. ****/
static TA_RetCode rangeTestFunction( TA_Integer startIdx,
TA_Integer endIdx,
TA_Real *outputBuffer,
TA_Integer *outputBufferInt,
TA_Integer *outBegIdx,
TA_Integer *outNbElement,
TA_Integer *lookback,
void *opaqueData,
unsigned int outputNb,
unsigned int *isOutputInteger )
{
TA_RetCode retCode;
TA_RangeTestParam *testParam;
(void)outputNb;
(void)outputBufferInt;
*isOutputInteger = 0;
testParam = (TA_RangeTestParam *)opaqueData;
switch( testParam->test->theFunction )
{
case TA_MFI_TEST:
retCode = TA_MFI( startIdx,
endIdx,
testParam->high,
testParam->low,
testParam->close,
testParam->volume,
testParam->test->optInTimePeriod,
outBegIdx,
outNbElement,
outputBuffer );
*lookback = TA_MFI_Lookback( testParam->test->optInTimePeriod );
break;
case TA_AD_TEST:
retCode = TA_AD( startIdx,
endIdx,
testParam->high,
testParam->low,
testParam->close,
testParam->volume,
outBegIdx,
outNbElement,
outputBuffer );
*lookback = TA_AD_Lookback();
break;
case TA_ADOSC_3_10_TEST:
retCode = TA_ADOSC( startIdx,
endIdx,
testParam->high,
testParam->low,
testParam->close,
testParam->volume,
3, 10,
outBegIdx,
outNbElement,
outputBuffer );
*lookback = TA_ADOSC_Lookback(3,10);
break;
case TA_ADOSC_5_2_TEST:
retCode = TA_ADOSC( startIdx,
endIdx,
testParam->high,
testParam->low,
testParam->close,
testParam->volume,
5, 2,
outBegIdx,
outNbElement,
outputBuffer );
*lookback = TA_ADOSC_Lookback(5,2);
break;
default:
retCode = TA_INTERNAL_ERROR(132);
}
return retCode;
}
示例15: do_test
static ErrorNumber do_test( const TA_History *history,
const TA_Test *test )
{
TA_RetCode retCode;
ErrorNumber errNb;
TA_Integer outBegIdx;
TA_Integer outNbElement;
TA_RangeTestParam testParam;
/* Set to NAN all the elements of the gBuffers. */
clearAllBuffers();
/* Build the input. */
setInputBuffer( 0, history->high, history->nbBars );
setInputBuffer( 1, history->low, history->nbBars );
setInputBuffer( 2, history->close, history->nbBars );
/* Clear the unstable periods from previous tests. */
retCode = TA_SetUnstablePeriod( TA_FUNC_UNST_MFI, 0 );
if( retCode != TA_SUCCESS )
return TA_TEST_TFRR_SETUNSTABLE_PERIOD_FAIL;
/* Make a simple first call. */
switch( test->theFunction )
{
case TA_MFI_TEST:
retCode = TA_MFI( test->startIdx,
test->endIdx,
gBuffer[0].in,
gBuffer[1].in,
gBuffer[2].in,
history->volume,
test->optInTimePeriod,
&outBegIdx,
&outNbElement,
gBuffer[0].out0 );
break;
case TA_AD_TEST:
retCode = TA_AD( test->startIdx,
test->endIdx,
gBuffer[0].in,
gBuffer[1].in,
gBuffer[2].in,
history->volume,
&outBegIdx,
&outNbElement,
gBuffer[0].out0 );
break;
case TA_ADOSC_3_10_TEST:
retCode = TA_ADOSC( test->startIdx,
test->endIdx,
gBuffer[0].in,
gBuffer[1].in,
gBuffer[2].in,
history->volume,
3, 10,
&outBegIdx,
&outNbElement,
gBuffer[0].out0 );
break;
case TA_ADOSC_5_2_TEST:
retCode = TA_ADOSC( test->startIdx,
test->endIdx,
gBuffer[0].in,
gBuffer[1].in,
gBuffer[2].in,
history->volume,
5, 2,
&outBegIdx,
&outNbElement,
gBuffer[0].out0 );
break;
default:
retCode = TA_INTERNAL_ERROR(133);
}
/* Check that the input were preserved. */
errNb = checkDataSame( gBuffer[0].in, history->high,history->nbBars );
if( errNb != TA_TEST_PASS )
return errNb;
errNb = checkDataSame( gBuffer[1].in, history->low, history->nbBars );
if( errNb != TA_TEST_PASS )
return errNb;
errNb = checkDataSame( gBuffer[2].in, history->close,history->nbBars );
if( errNb != TA_TEST_PASS )
return errNb;
CHECK_EXPECTED_VALUE( gBuffer[0].out0, 0 );
outBegIdx = outNbElement = 0;
/* Make another call where the input and the output are the
* same buffer.
*/
switch( test->theFunction )
{
case TA_MFI_TEST:
retCode = TA_MFI( test->startIdx,
//.........这里部分代码省略.........