@@ -293,9 +293,9 @@ Subscription::Subscription(Subscription&& other) noexcept = default;
293
293
294
294
Subscription& Subscription::operator =(Subscription&& other) noexcept = default ;
295
295
296
- ChangeCollection::ChangeCollection (const std::string& xpath, std::shared_ptr<sr_session_ctx_s> sess)
296
+ ChangeCollection::ChangeCollection (const std::string& xpath, Session sess)
297
297
: m_xpath(xpath)
298
- , m_sess(sess)
298
+ , m_sess(std::move( sess) )
299
299
{
300
300
}
301
301
@@ -305,9 +305,9 @@ ChangeCollection::ChangeCollection(const std::string& xpath, std::shared_ptr<sr_
305
305
ChangeIterator ChangeCollection::begin () const
306
306
{
307
307
sr_change_iter_t * iter;
308
- auto res = sr_get_changes_iter (m_sess.get (), m_xpath.c_str (), &iter);
308
+ auto res = sr_get_changes_iter (m_sess.m_sess . get (), m_xpath.c_str (), &iter);
309
309
310
- throwIfError (res, " Couldn't create an iterator for changes" , m_sess.get ());
310
+ throwIfError (res, " Couldn't create an iterator for changes" , m_sess.m_sess . get ());
311
311
312
312
return ChangeIterator{iter, m_sess};
313
313
}
@@ -323,17 +323,17 @@ ChangeIterator ChangeCollection::end() const
323
323
/* *
324
324
* Wraps `sr_change_iter_s`.
325
325
*/
326
- ChangeIterator::ChangeIterator (sr_change_iter_s* iter, std::shared_ptr<sr_session_ctx_s> sess)
326
+ ChangeIterator::ChangeIterator (sr_change_iter_s* iter, Session sess)
327
327
: m_iter(iter, sr_free_change_iter)
328
- , m_sess(sess)
328
+ , m_sess(std::move( sess) )
329
329
{
330
330
operator ++();
331
331
}
332
332
333
333
ChangeIterator::ChangeIterator (const iterator_end_tag)
334
334
: m_current(std::nullopt)
335
335
, m_iter(nullptr )
336
- , m_sess(nullptr )
336
+ , m_sess(std::nullopt )
337
337
{
338
338
}
339
339
@@ -347,14 +347,14 @@ ChangeIterator& ChangeIterator::operator++()
347
347
const char * prevValue;
348
348
const char * prevList;
349
349
int prevDefault;
350
- auto ret = sr_get_change_tree_next (m_sess.get (), m_iter.get (), &operation, &node, &prevValue, &prevList, &prevDefault);
350
+ auto ret = sr_get_change_tree_next (m_sess-> m_sess .get (), m_iter.get (), &operation, &node, &prevValue, &prevList, &prevDefault);
351
351
352
352
if (ret == SR_ERR_NOT_FOUND) {
353
353
m_current = std::nullopt;
354
354
return *this ;
355
355
}
356
356
357
- throwIfError (ret, " Could not iterate to the next change" , m_sess.get ());
357
+ throwIfError (ret, " Could not iterate to the next change" , m_sess-> m_sess .get ());
358
358
359
359
// I can safely "dereference" the change here, because last change is handled by the condition above.
360
360
m_current.emplace (Change{
0 commit comments