/*protected virtual */void ASDDeviceTransceiver::update(ptr_type device) { DataRec data; tgs::TGSError error; boost::upgrade_lock<boost::shared_mutex> ulock(_mutex); data = _data; if ((error = device->getFrequencySender(&data.frequencySender)) == tgs::TGSERROR_NO_RESULT) { data.frequencySender = -1; } else if (error != tgs::TGSERROR_OK) { artsatd::getInstance().log(LOG_WARNING, "TGSTransceiverInterface getFrequencySender error [%s]", error.print().c_str()); } if ((error = device->getFrequencyReceiver(&data.frequencyReceiver)) == tgs::TGSERROR_NO_RESULT) { data.frequencyReceiver = -1; } else if (error != tgs::TGSERROR_OK) { artsatd::getInstance().log(LOG_WARNING, "TGSTransceiverInterface getFrequencyReceiver error [%s]", error.print().c_str()); } if (data.frequencySender != _data.frequencySender || data.frequencyReceiver != _data.frequencyReceiver) { boost::upgrade_to_unique_lock<boost::shared_mutex> wlock(ulock); _data = data; } return; }
void operator()(ptr_type p) { if (_prev) { _prev->next(p); p->previous(_prev); } _prev = p; }
inline /* static */ object_helper:: ptr_type object_helper:: get_checked_disp_( ptr_type disp, char const* message /* = NULL */ ) /* const */ { check_disp_(disp.get(), message); return disp; }
static ptr_type offset(ptr_type ptr, index_type i) { switch (ptr.format()) { case array: return ptr_type(ptr.template as<array>() + i); case interleaved_complex: return ptr_type(ptr.template as<interleaved_complex>() + 2*i); case split_complex: { std::pair<T*,T*> p = ptr.template as<split_complex>(); return ptr_type(p.first + i, p.second + i); } default: assert(0); } }
promise_base( std::allocator_arg_t, Allocator alloc) { typedef detail::shared_state_object< R, Allocator > object_type; typedef std::allocator_traits< typename object_type::allocator_type > traits_type; typedef pointer_traits< typename traits_type::pointer > ptrait_type; typename object_type::allocator_type a{ alloc }; typename traits_type::pointer ptr{ traits_type::allocate( a, 1) }; typename ptrait_type::element_type* p = ptrait_type::to_address(ptr); try { traits_type::construct( a, p, a); } catch (...) { traits_type::deallocate( a, ptr, 1); throw; } future_.reset(p); }
/*protected virtual */void ASDDeviceRotator::update(ptr_type device) { DataRec data; tgs::TGSError error; boost::upgrade_lock<boost::shared_mutex> ulock(_mutex); data = _data; if ((error = device->getAngle(&data.azimuth, &data.elevation)) != tgs::TGSERROR_OK) { artsatd::getInstance().log(LOG_WARNING, "TGSRotatorInterface getAngle error [%s]", error.print().c_str()); } if (data.azimuth != _data.azimuth || data.elevation != _data.elevation) { boost::upgrade_to_unique_lock<boost::shared_mutex> wlock(ulock); _data = data; } return; }
static void put(ptr_type ptr, index_type i, value_type v) { switch (ptr.format()) { case array: *ptr.template as<array>() = v; break; case interleaved_complex: *reinterpret_cast<value_type*>(ptr.template as<interleaved_complex>()) = v; break; case split_complex: { std::pair<T const*,T const*> p = ptr.template as<split_complex>(); p.first = v.real(); p.second = v.imag(); break; } default: assert(0); } }
explicit packaged_task( std::allocator_arg_t, Allocator const& alloc, Fn && fn) { typedef detail::task_object< typename std::decay< Fn >::type, Allocator, R, Args ... > object_type; typedef std::allocator_traits< typename object_type::allocator_type > traits_type; typedef pointer_traits< typename traits_type::pointer > ptrait_type; typename object_type::allocator_type a{ alloc }; typename traits_type::pointer ptr{ traits_type::allocate( a, 1) }; typename ptrait_type::element_type* p = boost::to_address(ptr); try { traits_type::construct( a, p, a, std::forward< Fn >( fn) ); } catch (...) { traits_type::deallocate( a, ptr, 1); throw; } task_.reset(p); }
void OnDestroy(void) { if (ptr)ptr->OnDestroy(); }
void swap( packaged_task & other) noexcept { std::swap( obtained_, other.obtained_); task_.swap( other.task_); }
~packaged_task() { if ( task_) { task_->owner_destroyed(); } }
void operator()( Args ... args) { if ( BOOST_UNLIKELY( ! valid() ) ) { throw packaged_task_uninitialized{}; } task_->run( std::forward< Args >( args) ... ); }
Base* get_ptr() const { return ptr_.get(); }
bool valid() const noexcept { return nullptr != task_.get(); }
polymorphic_holder& operator=(Derived const& rhs) { ptr_.reset(boost::make_shared<Derived>(rhs)); return *this; }
CNode::CNode( ptr_type first, ptr_type second ) { left() = first; right() = second; weight_m = first->getWeight() + second->getWeight(); }
~promise_base() { if ( future_) { future_->owner_destroyed(); } }
void set_exception( std::exception_ptr p) { if ( BOOST_UNLIKELY( ! future_) ) { throw promise_uninitialized{}; } future_->set_exception( p); }
void swap( promise_base & other) noexcept { std::swap( obtained_, other.obtained_); future_.swap( other.future_); }
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ void XMLConfigurationElement::addChild(ptr_type _pChild) { m_children.insert(children_pair_type(_pChild->getName(), _pChild)); }
T* get() const { return ptr.get(); }
void push(ptr_type& vec) { if(var.which() != empty_t) vec->push_back(*this); }
~promise_base() { if ( future_ && obtained_) { future_->owner_destroyed(); } }