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


C++ safassert函数代码示例

本文整理汇总了C++中safassert函数的典型用法代码示例。如果您正苦于以下问题:C++ safassert函数的具体用法?C++ safassert怎么用?C++ safassert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: saNtfStateChangeNotificationAllocate_01

void saNtfStateChangeNotificationAllocate_01(void) {
	SaNtfStateChangeNotificationT  myNotification;
	saNotificationAllocationParamsT myNotificationAllocationParams;
	saNotificationFilterAllocationParamsT myNotificationFilterAllocationParams;
	saNotificationParamsT myNotificationParams;

	fillInDefaultValues(&myNotificationAllocationParams,
			&myNotificationFilterAllocationParams, &myNotificationParams);

	safassert(saNtfInitialize(&ntfHandle, &ntfSendCallbacks, &ntfVersion), SA_AIS_OK);

	rc = saNtfStateChangeNotificationAllocate(
					ntfHandle, /* handle to Notification Service instance */
					&myNotification,
					/* number of correlated notifications */
					myNotificationAllocationParams.numCorrelatedNotifications,
					/* length of additional text */
					myNotificationAllocationParams.lengthAdditionalText,
					/* number of additional info items*/
					myNotificationAllocationParams.numAdditionalInfo,
					/* number of state changes */
					myNotificationAllocationParams.numAttributes,
					/* use default allocation size */
					myNotificationAllocationParams.variableDataSize);

	safassert(saNtfNotificationFree(myNotification.notificationHandle) , SA_AIS_OK);
	safassert(saNtfFinalize(ntfHandle) , SA_AIS_OK);
	test_validate(rc, SA_AIS_OK);
}
开发者ID:kenzaburo,项目名称:OpenSaf-FrameWork,代码行数:29,代码来源:tet_saNtfStateChangeNotificationAllocate.c

示例2: saImmOiFinalize_02

void saImmOiFinalize_02(void)
{
    safassert(saImmOiInitialize_2(&immOiHandle, &immOiCallbacks, &immVersion), SA_AIS_OK);
    rc = saImmOiFinalize(-1);
    test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
    safassert(saImmOiFinalize(immOiHandle), SA_AIS_OK);
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:7,代码来源:test_saImmOiFinalize.c

示例3: saNtfArrayAllocateTest_05

/**
 * Provoke a SA_AIS_ERR_INVALID_PARAM reply
 */
void saNtfArrayAllocateTest_05(void)
{
    SaStringT *arrayPtr;
	SaNtfAlarmNotificationT myAlarmNotification;

    safassert(saNtfInitialize(&ntfHandle, &ntfSendCallbacks, &ntfVersion) , SA_AIS_OK);

	safassert(saNtfAlarmNotificationAllocate(
			ntfHandle,
			&myAlarmNotification,
			0,
			0,
			0,
			0,
			0,
			2,
			SA_NTF_ALLOC_SYSTEM_LIMIT), SA_AIS_OK);

    myAlarmNotification.proposedRepairActions[0].actionValueType = SA_NTF_VALUE_ARRAY;
    rc = saNtfArrayValAllocate(
    		myAlarmNotification.notificationHandle,
    		(SaUint16T)5,
    		(SaUint16T)(strlen(DEFAULT_ADDITIONAL_TEXT) + 1),
    		(void**) &arrayPtr,
    		NULL);

    safassert(saNtfNotificationFree(myAlarmNotification.notificationHandle) , SA_AIS_OK);

    safassert(saNtfFinalize(ntfHandle), SA_AIS_OK);

    test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:35,代码来源:tet_saNtfArrayValAllocate.c

示例4: saNtfPtrAllocateTest_03

/**
 * Provoke a SA_AIS_ERR_BAD_HANDLE reply
 */
void saNtfPtrAllocateTest_03(void)
{
    SaStringT *destPtr;
    SaNtfAlarmNotificationT myAlarmNotification;

    safassert(saNtfInitialize(&ntfHandle, &ntfSendCallbacks, &ntfVersion) , SA_AIS_OK);

    safassert(saNtfAlarmNotificationAllocate(
                  ntfHandle,
                  &myAlarmNotification,
                  0,
                  0,
                  0,
                  0,
                  0,
                  2,
                  SA_NTF_ALLOC_SYSTEM_LIMIT), SA_AIS_OK);

    myAlarmNotification.proposedRepairActions[0].actionValueType = SA_NTF_VALUE_STRING;

    safassert(saNtfNotificationFree(myAlarmNotification.notificationHandle) , SA_AIS_OK);

    rc = saNtfPtrValAllocate(
             myAlarmNotification.notificationHandle,
             (SaUint16T)(strlen(DEFAULT_ADDITIONAL_TEXT) + 1),
             (void**) &destPtr,
             &(myAlarmNotification.proposedRepairActions[0].actionValue));

    safassert(saNtfFinalize(ntfHandle), SA_AIS_OK);

    test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:35,代码来源:tet_saNtfPtrValAllocate.c

示例5: saImmOmSearchInitialize_2_10

void saImmOmSearchInitialize_2_10(void)
{
	SaImmSearchHandleT searchHandle;
	char *value;
	char *env;
	int i;

	env = value = getenv("IMMA_MAX_OPEN_SEARCHES_PER_HANDLE");
	if(!value)
		value = "100";

	setenv("IMMA_MAX_OPEN_SEARCHES_PER_HANDLE", "200", 1);	/* Increase number of open search handles to 200 */
	safassert(saImmOmInitialize(&immOmHandle, &immOmCallbacks, &immVersion), SA_AIS_OK);
	setenv("IMMA_MAX_OPEN_SEARCHES_PER_HANDLE", value, 1);	/* Reset to default value */

	if(!env)
		unsetenv("IMMA_MAX_OPEN_SEARCHES_PER_HANDLE");

	for(i=0; i<200; i++)
		safassert(saImmOmSearchInitialize_2(immOmHandle, NULL, SA_IMM_SUBTREE,
				SA_IMM_SEARCH_ONE_ATTR | SA_IMM_SEARCH_GET_NO_ATTR, NULL, NULL, &searchHandle), SA_AIS_OK);
	rc = saImmOmSearchInitialize_2(immOmHandle, NULL, SA_IMM_SUBTREE,		/* Test maxSearchHandle + 1 */
			SA_IMM_SEARCH_ONE_ATTR | SA_IMM_SEARCH_GET_NO_ATTR, NULL, NULL, &searchHandle);
	test_validate(rc, SA_AIS_ERR_NO_RESOURCES);
	safassert(saImmOmSearchFinalize(searchHandle), SA_AIS_OK);
	safassert(saImmOmFinalize(immOmHandle), SA_AIS_OK);
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:27,代码来源:test_saImmOmSearchInitialize_2.c

示例6: saLogWriteLogAsync_03

void saLogWriteLogAsync_03(void)
{
    SaInvocationT invocation = 0;
    SaLogRecordT ntfLogRecord;
    SaNtfIdentifierT notificationId = random();
    SaNtfClassIdT notificationClassId;

    ntfLogRecord.logBuffer = &notificationStreamBuffer;
    strcpy((char*)ntfLogRecord.logBuffer->logBuf, __FUNCTION__);
    ntfLogRecord.logBuffer->logBufSize = strlen(__FUNCTION__);

    notificationClassId.vendorId = 193;
    notificationClassId.majorId  = 1;
    notificationClassId.minorId  = 2;
    ntfLogRecord.logTimeStamp = getSaTimeT();
    ntfLogRecord.logHdrType = SA_LOG_NTF_HEADER;
    ntfLogRecord.logHeader.ntfHdr.notificationId = notificationId;
    ntfLogRecord.logHeader.ntfHdr.eventType = SA_NTF_ALARM_QOS;
    ntfLogRecord.logHeader.ntfHdr.notificationObject = &notificationObject;
    ntfLogRecord.logHeader.ntfHdr.notifyingObject = &notifyingObject;
    ntfLogRecord.logHeader.ntfHdr.notificationClassId = &notificationClassId;
    ntfLogRecord.logHeader.ntfHdr.eventTime = getSaTimeT();

    safassert(saLogInitialize(&logHandle, &logCallbacks, &logVersion), SA_AIS_OK);
    safassert(saLogStreamOpen_2(logHandle, &notificationStreamName, NULL, 0,
                             SA_TIME_ONE_SECOND, &logStreamHandle), SA_AIS_OK);
    rc = saLogWriteLogAsync(logStreamHandle, invocation, 0, &ntfLogRecord);
    safassert(saLogFinalize(logHandle), SA_AIS_OK);

    test_validate(rc, SA_AIS_OK);
}
开发者ID:kenzaburo,项目名称:OpenSaf-FrameWork,代码行数:31,代码来源:tet_saLogWriteLogAsync.c

示例7: saImmOiSelectionObjectGet_01

void saImmOiSelectionObjectGet_01(void)
{
    safassert(saImmOiInitialize_2(&immOiHandle, &immOiCallbacks, &immVersion), SA_AIS_OK);
    rc = saImmOiSelectionObjectGet(immOiHandle, &selectionObject);
    test_validate(rc, SA_AIS_OK);
    safassert(saImmOiFinalize(immOiHandle), SA_AIS_OK);
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:7,代码来源:test_saImmOiSelectionObjectGet.c

示例8: saImmOmCcbObjectModify_2_02

void saImmOmCcbObjectModify_2_02(void)
{
    const SaImmAdminOwnerNameT adminOwnerName = (SaImmAdminOwnerNameT) __FUNCTION__;
    SaImmAdminOwnerHandleT ownerHandle;
    SaImmCcbHandleT ccbHandle;
    const SaNameT *objectNames[] = {&rootObj, NULL};
    SaUint32T  int1Value1 = __LINE__;
    SaUint32T* int1Values[] = {&int1Value1};
    SaImmAttrValuesT_2 v1 = {"attr1", SA_IMM_ATTR_SAUINT32T, 1, (void**)int1Values};
    SaImmAttrModificationT_2 attrMod = {SA_IMM_ATTR_VALUES_REPLACE, v1};
    const SaImmAttrModificationT_2 *attrMods[] = {&attrMod, NULL};

    safassert(saImmOmInitialize(&immOmHandle, NULL, &immVersion), SA_AIS_OK);
    safassert(saImmOmAdminOwnerInitialize(immOmHandle, adminOwnerName, SA_TRUE, &ownerHandle), SA_AIS_OK);
    safassert(saImmOmAdminOwnerSet(ownerHandle, objectNames, SA_IMM_ONE), SA_AIS_OK);
    safassert(config_object_create(immOmHandle, ownerHandle, &rootObj), SA_AIS_OK);
    safassert(saImmOmAdminOwnerSet(ownerHandle, dnObjs, SA_IMM_ONE), SA_AIS_OK);

    /* invalid handle */
    if ((rc = saImmOmCcbObjectModify_2(-1, &dnObj1, attrMods)) != SA_AIS_ERR_BAD_HANDLE)
        goto done;

    /* already finalized handle */
    safassert(saImmOmCcbInitialize(ownerHandle, 0, &ccbHandle), SA_AIS_OK);
    safassert(saImmOmCcbFinalize(ccbHandle), SA_AIS_OK);
    rc = saImmOmCcbObjectModify_2(ccbHandle, &dnObj1, attrMods);

done:
    safassert(config_object_delete(immOmHandle, ownerHandle), SA_AIS_OK);
    safassert(saImmOmAdminOwnerFinalize(ownerHandle), SA_AIS_OK);
    safassert(saImmOmFinalize(immOmHandle), SA_AIS_OK);
    test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:33,代码来源:test_saImmOmCcbObjectModify_2.c

示例9: saNtfObjectCreateDeleteNotificationAllocate_03

/**
 * Test that the return value SA_AIS_ERR_INVALID_PARAM works
 *
 * Strategy:
 */
void saNtfObjectCreateDeleteNotificationAllocate_03(void)
{
    saNotificationAllocationParamsT myNotificationAllocationParams;
    saNotificationFilterAllocationParamsT myNotificationFilterAllocationParams;
    saNotificationParamsT myNotificationParams;

    fillInDefaultValues(&myNotificationAllocationParams,
                        &myNotificationFilterAllocationParams,
                        &myNotificationParams);

    safassert(saNtfInitialize(&ntfHandle, &ntfCallbacks, &ntfVersion), SA_AIS_OK);
    rc = saNtfObjectCreateDeleteNotificationAllocate(
        ntfHandle, /* handle to Notification Service instance */
        NULL,
        /* number of correlated notifications */
        myNotificationAllocationParams.numCorrelatedNotifications,
        /* length of additional text */
        myNotificationAllocationParams.lengthAdditionalText,
         /* number of additional info items*/
        myNotificationAllocationParams.numAdditionalInfo,
        /* number of state changes */
        myNotificationAllocationParams.numObjectAttributes,
        /* use default allocation size */
        myNotificationAllocationParams.variableDataSize);

    free(myNotificationParams.additionalText);
    safassert(saNtfFinalize(ntfHandle), SA_AIS_OK);
    test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:34,代码来源:tet_saNtfObjectCreateDeleteNotificationAllocate.c

示例10: saImmOmCcbObjectModify_2_09

void saImmOmCcbObjectModify_2_09(void)
{
    const SaImmAdminOwnerNameT adminOwnerName = (SaImmAdminOwnerNameT) __FUNCTION__;
    SaImmAdminOwnerHandleT ownerHandle;
    SaImmCcbHandleT ccbHandle;
    const SaNameT *objectNames[] = {&rootObj, NULL};
    SaStringT strValue = "Sch\366ne";
    SaStringT* strValues[] = {&strValue};
    SaImmAttrValuesT_2 v1 = {"attr4", SA_IMM_ATTR_SASTRINGT, 1, (void**)strValues};
    SaImmAttrModificationT_2 attrMod = {SA_IMM_ATTR_VALUES_REPLACE, v1};
    const SaImmAttrModificationT_2 *attrMods[] = {&attrMod, NULL};

    safassert(saImmOmInitialize(&immOmHandle, NULL, &immVersion), SA_AIS_OK);
    safassert(saImmOmAdminOwnerInitialize(immOmHandle, adminOwnerName, SA_TRUE, &ownerHandle), SA_AIS_OK);
    safassert(saImmOmAdminOwnerSet(ownerHandle, objectNames, SA_IMM_ONE), SA_AIS_OK);
    safassert(config_object_create(immOmHandle, ownerHandle, &rootObj), SA_AIS_OK);
    safassert(saImmOmAdminOwnerSet(ownerHandle, dnObjs, SA_IMM_ONE), SA_AIS_OK);
    safassert(saImmOmCcbInitialize(ownerHandle, 0, &ccbHandle), SA_AIS_OK);

    test_validate(saImmOmCcbObjectModify_2(ccbHandle, &dnObj1, attrMods), SA_AIS_ERR_INVALID_PARAM);

    safassert(saImmOmCcbFinalize(ccbHandle), SA_AIS_OK);
    safassert(config_object_delete(immOmHandle, ownerHandle), SA_AIS_OK);
    safassert(saImmOmAdminOwnerFinalize(ownerHandle), SA_AIS_OK);
    safassert(saImmOmFinalize(immOmHandle), SA_AIS_OK);
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:26,代码来源:test_saImmOmCcbObjectModify_2.c

示例11: saNtfNotificationSubscribe_03

/* Test all filter handles set to NULL */
void saNtfNotificationSubscribe_03(void)
{
    SaNtfHandleT ntfHandle;
    SaNtfNotificationTypeFilterHandlesT myNotificationFilterHandles;

    saNotificationAllocationParamsT        myNotificationAllocationParams;
    saNotificationFilterAllocationParamsT  myNotificationFilterAllocationParams;
    saNotificationParamsT                  myNotificationParams;

    fillInDefaultValues(&myNotificationAllocationParams,
                        &myNotificationFilterAllocationParams,
                        &myNotificationParams);

    safassert(saNtfInitialize(&ntfHandle, &ntfCallbacks, &ntfVersion), SA_AIS_OK);

    /* Initialize filter handles */
    myNotificationFilterHandles.alarmFilterHandle = 0;
    myNotificationFilterHandles.attributeChangeFilterHandle = 0;
    myNotificationFilterHandles.objectCreateDeleteFilterHandle = 0;
    myNotificationFilterHandles.securityAlarmFilterHandle = 0;
    myNotificationFilterHandles.stateChangeFilterHandle = 0;

    rc = saNtfNotificationSubscribe(&myNotificationFilterHandles, 4);
    safassert(saNtfNotificationUnsubscribe(4), SA_AIS_ERR_NOT_EXIST);

    safassert(saNtfFinalize(ntfHandle), SA_AIS_OK);
    free(myNotificationParams.additionalText); /* allocated in fillInDefaultValues */
    test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
}
开发者ID:kenzaburo,项目名称:OpenSaf-FrameWork,代码行数:30,代码来源:tet_saNtfNotificationSubscribe.c

示例12: saNtfNotificationReadInitialize_04

void saNtfNotificationReadInitialize_04(void) {
	SaNtfHandleT ntfHandle;
	SaNtfSearchCriteriaT searchCriteria;
	SaNtfAlarmNotificationFilterT myAlarmFilter;
	SaNtfObjectCreateDeleteNotificationFilterT myObjCrDeFilter;
	SaNtfNotificationTypeFilterHandlesT myNotificationFilterHandles;
	SaNtfReadHandleT readHandle;

	searchCriteria.searchMode = SA_NTF_SEARCH_AT_OR_AFTER_TIME;

	fillInDefaultValues(&myNotificationAllocationParams,
			&myNotificationFilterAllocationParams, &myNotificationParams);

	safassert(saNtfInitialize(&ntfHandle, &ntfCallbacks, &ntfVersion),SA_AIS_OK);

	safassert(saNtfAlarmNotificationFilterAllocate(
					ntfHandle, /* handle to Notification Service instance */
					&myAlarmFilter, /* put filter here */
					/* number of event types */
					myNotificationFilterAllocationParams.numEventTypes,
					/* number of notification objects */
					myNotificationFilterAllocationParams.numNotificationObjects,
					/* number of notifying objects */
					myNotificationFilterAllocationParams.numNotifyingObjects,
					/* number of notification class ids */
					myNotificationFilterAllocationParams.numNotificationClassIds,
					/* number of probable causes */
					myNotificationFilterAllocationParams.numProbableCauses,
					/* number of perceived severities */
					myNotificationFilterAllocationParams.numPerceivedSeverities,
					/* number of trend indications */
					myNotificationFilterAllocationParams.numTrends), SA_AIS_OK);

	safassert(saNtfObjectCreateDeleteNotificationFilterAllocate(
					ntfHandle, /* handle to Notification Service instance */
					&myObjCrDeFilter, /* put filter here */
					/* number of event types */
					myNotificationFilterAllocationParams.numEventTypes,
					/* number of notification objects */
					myNotificationFilterAllocationParams.numNotificationObjects,
					/* number of notifying objects */
					myNotificationFilterAllocationParams.numNotifyingObjects,
					/* number of notification class ids */
					myNotificationFilterAllocationParams.numNotificationClassIds,
					/* number of source indicators */
					0), SA_AIS_OK);

	myNotificationFilterHandles.alarmFilterHandle
			= myAlarmFilter.notificationFilterHandle;

	myNotificationFilterHandles.alarmFilterHandle
			= myObjCrDeFilter.notificationFilterHandle;

	rc = saNtfNotificationReadInitialize(searchCriteria,
			&myNotificationFilterHandles, &readHandle);

	safassert(saNtfFinalize(ntfHandle), SA_AIS_OK);
	free(myNotificationParams.additionalText);
	test_validate(rc, SA_AIS_OK);
}
开发者ID:kenzaburo,项目名称:OpenSaf-FrameWork,代码行数:60,代码来源:tet_saNtfNotificationReadInitialize.c

示例13: saClmFinalize_03

void saClmFinalize_03(void)
{
    safassert(saClmInitialize(&clmHandle, &clmCallbacks_1, &clmVersion_1), SA_AIS_OK);
    safassert(saClmFinalize(clmHandle), SA_AIS_OK);
    rc = saClmFinalize(clmHandle);
    test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:7,代码来源:tet_saClmFinalize.c

示例14: saLogStreamOpen_2_04

void saLogStreamOpen_2_04(void)
{
    safassert(saLogInitialize(&logHandle, &logCallbacks, &logVersion), SA_AIS_OK);
    rc = saLogStreamOpen_2(logHandle, &app1StreamName, &appStream1LogFileCreateAttributes,
                           SA_LOG_STREAM_CREATE, SA_TIME_ONE_SECOND, &logStreamHandle);
    safassert(saLogFinalize(logHandle), SA_AIS_OK);
    test_validate(rc, SA_AIS_OK);
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:8,代码来源:tet_saLogStreamOpen_2.c

示例15: saLogStreamOpen_2_03

void saLogStreamOpen_2_03(void)
{
    safassert(saLogInitialize(&logHandle, &logCallbacks, &logVersion), SA_AIS_OK);
    rc = saLogStreamOpen_2(logHandle, &alarmStreamName, NULL, 0,
                           SA_TIME_ONE_SECOND, &logStreamHandle);
    safassert(saLogFinalize(logHandle), SA_AIS_OK);
    test_validate(rc, SA_AIS_OK);
}
开发者ID:helioloureiro,项目名称:opensaf-fork,代码行数:8,代码来源:tet_saLogStreamOpen_2.c


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