{
public:
Widget();
- Widget(const Widget &other);
- Widget& operator =(const Widget &other);
- ~Widget();
static Widget fromPlyFile(const String &file_name);
class Impl;
Impl *impl_;
friend struct WidgetAccessor;
-
- void create();
- void release();
};
/////////////////////////////////////////////////////////////////////////////
{
public:
vtkSmartPointer<vtkProp> prop;
- int ref_counter;
Impl() : prop(0) {}
};
-cv::viz::Widget::Widget() : impl_(0)
-{
- create();
-}
-
-cv::viz::Widget::Widget(const Widget &other) : impl_(other.impl_)
-{
- if (impl_) CV_XADD(&impl_->ref_counter, 1);
-}
-
-cv::viz::Widget& cv::viz::Widget::operator=(const Widget &other)
-{
- if (this != &other)
- {
- release();
- impl_ = other.impl_;
- if (impl_) CV_XADD(&impl_->ref_counter, 1);
- }
- return *this;
-}
-
-cv::viz::Widget::~Widget()
-{
- release();
-}
-
-void cv::viz::Widget::create()
-{
- if (impl_) release();
- impl_ = new Impl();
- impl_->ref_counter = 1;
-}
-
-void cv::viz::Widget::release()
-{
- if (impl_ && CV_XADD(&impl_->ref_counter, -1) == 1)
- {
- delete impl_;
- impl_ = 0;
- }
-}
+cv::viz::Widget::Widget() : impl_( new Impl() ) { }
cv::viz::Widget cv::viz::Widget::fromPlyFile(const String &file_name)
{