/usr/include/polybori/common/CWeakPtr.h is in libbrial-dev 1.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | // -*- c++ -*-
//*****************************************************************************
/** @file CWeakPtr.h
*
* @author Alexander Dreyer
* @date 2011-06-14
*
* This file includes the definition of the class @c CWeakPtr.
*
* @par Copyright:
* (c) by The PolyBoRi Team
*
**/
//*****************************************************************************
#ifndef polybori_CWeakPtr_h_
#define polybori_CWeakPtr_h_
// include basic definitions
#include <polybori/pbori_defs.h>
#include "CWeakPtrFacade.h"
BEGIN_NAMESPACE_PBORI
/** @class CWeakPtr
* @brief This class defines CWeakPtr.
*
**/
template <class ValueType>
class CWeakPtr {
typedef CWeakPtr self;
public:
typedef ValueType value_type;
typedef value_type* data_type;
typedef std::shared_ptr<data_type> ptr_type;
/// Construct from something, which supports weak pointers
explicit CWeakPtr(const CWeakPtrFacade<ValueType>& val):
m_data(val.m_data) { PBORI_ASSERT(m_data);}
/// Copy constructor
CWeakPtr(const self& rhs): m_data(rhs.m_data) {}
/// Destructor
~CWeakPtr() {}
/// Dereferencing generates strong-referenced instance
const value_type& operator*() const {
return *(operator->());
}
/// Dereferencing generates strong-referenced instance
value_type* operator->() const {
if (!*m_data)
throw std::runtime_error("Outdated weak pointer dereferenced.");
return (*m_data);
}
/// Validity test
operator bool() const { return *m_data; }
private:
ptr_type m_data;
};
END_NAMESPACE_PBORI
#endif /* polybori_CWeakPtr_h_ */
|