Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * SAFEARRAY* "before"...
- */
- void before() {
- CSafeArrayHolder saLinesArray;
- HRESULT hr;
- LONG idx;
- IUnknown* pUNK;
- _bstr_t b_str;
- LONG UBound = 0;
- saLinesArray.AttachSafeArray(spIMaster->GetLines());
- // Arrays are zero-based. No need to get LBound
- hr = SafeArrayGetUBound( saLinesArray, 1, &UBound);
- if (FAILED(hr))
- {
- b_str = L"SafeArrayGetUBound in GetLine failed";
- throw SyncMgrEx(b_str.GetBSTR());
- }
- // Currently only one line is supported
- if ((UBound + 1) != 1)
- {
- b_str = L"Only one line per Master is supported";
- throw SyncMgrEx(b_str.GetBSTR());
- }
- for (idx = 0; idx < (UBound + 1) ; idx++)
- {
- hr = SafeArrayGetElement( saLinesArray,
- &idx,
- reinterpret_cast<void*>(&pUNK));
- spILine = pUNK;
- if (spILine.GetInterfacePtr() == NULL)
- {
- b_str = L"Unexpected interface in GetLine";
- throw SyncMgrEx(b_str.GetBSTR());
- }
- }
- }
- /**
- * SafeArrayPtr "after"...
- */
- void after()
- {
- SafeArrayPtr<ILinePtr> lines = master->GetLines();
- if(lines.size() != 1) {
- ASSERT(false); //< We only support one line at the moment.
- return nullptr;
- }
- auto line = lines.at(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement