APIReservationChangeHandlerProc
요소 예약 변경사항들을 처리하기 위한 사용자 제공 콜백 프로시저입니다.
typedef GSErrCode APIReservationChangeHandlerProc (
const GS::HashTable<API_Guid, short>& reserved,
const GS::HashSet<API_Guid>& released,
const GS::HashSet<API_Guid>& deleted
);
파라미터
- reserved
- [in] 최근 예약된 요소들의 리스트입니다. 해시 테이블 내 해시 키(hash key)는 요소 guid입니다. 페어 키(paired key)는 요소를 예약한 멤버의 팀워크 소유자 식별자입니다.
- released
- [in] 최근 예약 해제된 요소들의 리스트입니다.
- deleted
- [in] 최근 팀워크 동작들을 하는 동안 제거된 요소들의 리스트입니다. 요소들을 제거한 멤버가 BIM 서버로 변경사항들을 전송할 때, 요소 삭제들이 보고됩니다.
리턴 값
NoError- 함수가 성공적으로 완료되었습니다.
다른 공통 API 오류들에 대해서는 API 오류 문서를 보십시오.
설명
요소 예약 변경사항들에 대한 알림들을 받기 위해서는 이 콜백 함수를 구현하고 ACAPI_Notify_CatchElementReservationChange와 함께 세트되어야 합니다.
당신은 APIEnv_ProjectSharingID 환경 함수와 함께 멤버들의 정보를 가져올 수 있습니다. 핸들러 함수가 현재 팀 멤버에 의해 영향을 받는 예약 변경사항들도 받는다는 것을 참고하십시오. 현재 팀 멤버를 식별하려면 APIEnv_UserWorkspaceID를 사용하십시오.
예약 변경 핸들러에서 가급적 데이터베이스를 변경할 수 있는 함수들을 호출하지 않도록 하십시오.
예제
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
GSErrCode __ACENV_CALL ElementReservationChangeHandler (const GS::HashTable<API_Guid, short>& reserved,
const GS::HashSet<API_Guid>& /*released*/,
const GS::HashSet<API_Guid>& /*deleted*/)
{
GS::HashTable<API_ElemTypeID,Int32> reservedStat;
for (GS::HashTable<API_Guid, short>::ConstPairIterator it = reserved.EnumeratePairs (); it != NULL; ++it) {
API_Elem_Head elemHead;
BNZeroMemory (&elemHead, sizeof (API_Elem_Head));
elemHead.guid = *(it->key);
if (ACAPI_Element_GetHeader (&elemHead) == NoError)
++(reservedStat.Retrieve (elemHead.typeID, 0)); // 동일한 타입의 요소들을 셈
}
if (!reservedStat.IsEmpty ()) { // 예약된 요소들의 통계를 프린트함
GS::UniString reportString ("= Recently reserved elements: ");
for (GS::HashTable<API_ElemTypeID,Int32>::PairIterator it = reservedStat.EnumeratePairs (); it != NULL; ++it) {
GS::UniString elemTypeName;
ACAPI_Goodies (APIAny_GetElemTypeNameID, (void*) *(it->key), &elemTypeName);
GS::UniString elemCountStr = GS::UniString::Printf (" %T:%d", elemTypeName.ToPrintf (), *(it->value));
reportString.Append (elemCountStr);
}
ACAPI_WriteReport (reportString.ToCStr ().Get (), false);
}
return NoError;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void CatchElementReservationChanges (bool enableNotifications)
{
if (enableNotifications)
ACAPI_Notify_CatchElementReservationChange (ElementReservationChangeHandler);
else
ACAPI_Notify_CatchElementReservationChange (NULL);
}
요구사항
- 버전: API 15 또는 이후
- 헤더: APIdefs_Callback.h
참고사항
ACAPI_Notify_CatchElementReservationChange
팀워크 제어
알림 관리자
API 함수