/[escript]/branches/arrexp_2137_win/escript/src/DataAbstract.cpp
ViewVC logotype

Diff of /branches/arrexp_2137_win/escript/src/DataAbstract.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2211 by jfenwick, Fri Jan 9 01:28:32 2009 UTC revision 2212 by jfenwick, Wed Jan 14 00:15:00 2009 UTC
# Line 20  using namespace std; Line 20  using namespace std;
20    
21  namespace escript {  namespace escript {
22    
 /**  
 \brief Returns smart pointer which is managing this object.  
 If one does not exist yet it creates one.  
   
 Note: This is _not_ equivalent to weak_ptr::lock.  
 */  
23  DataAbstract_ptr DataAbstract::getPtr()  DataAbstract_ptr DataAbstract::getPtr()
24  {  {
25    if (_internal_weak_this.expired())    if (_internal_weak_this.expired())
# Line 50  const_DataAbstract_ptr DataAbstract::get Line 44  const_DataAbstract_ptr DataAbstract::get
44    }    }
45  }  }
46    
47    
48    // Warning - this method uses .use_count() which the boost doco labels inefficient.
49    // If this method needs to be called in debug contexts, we may need to do some
50    // timing experiments to determine how inefficient and possibly switch over to
51    // invasive pointers which can answer these questions faster
52    bool DataAbstract::checkNoSharing() const
53    {
54      if (_internal_weak_this.expired())    // there is no shared_ptr for this object yet
55      {
56        return true;
57      }
58      if (shared_from_this().use_count()==2)    // shared_from_this will increase the ref count
59      {                     // which is the reason .unique is no use.
60        return true;
61      }
62      return false;
63    }
64    
65  bool  bool
66  DataAbstract::isLazy() const  DataAbstract::isLazy() const
67  {  {

Legend:
Removed from v.2211  
changed lines
  Added in v.2212

  ViewVC Help
Powered by ViewVC 1.1.26