~brandontschaefer/nux/xim-tests

« back to all changes in this revision

Viewing changes to NuxCore/Object.h

  • Committer: Brandon Schaefer
  • Date: 2012-10-19 00:23:27 UTC
  • mfrom: (637.2.55 trunk)
  • Revision ID: brandon.schaefer@canonical.com-20121019002327-60e88jn3k8chi7gt
* Merged trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#ifndef NUXCORE_OBJECT_H
25
25
#define NUXCORE_OBJECT_H
26
26
 
 
27
#include <string>
 
28
 
27
29
#include <sigc++/trackable.h>
28
30
#include <sigc++/signal.h>
 
31
#include <boost/utility.hpp>
29
32
#include "ObjectType.h"
30
33
#include "Property.h"
31
34
#include "PropertyTraits.h"
63
66
      Trackable does not implement reference counting. It only defines the API. It is up
64
67
      to the class that inherit from Trackable to implement the reference counting.
65
68
  */
66
 
  class Trackable: public nux::Introspectable, public sigc::trackable
 
69
  class Trackable: public nux::Introspectable, public sigc::trackable, public boost::noncopyable
67
70
  {
68
71
  public:
69
72
    NUX_DECLARE_ROOT_OBJECT_TYPE (Trackable);
158
161
    int _heap_allocated;
159
162
 
160
163
  private:
161
 
    // Trackable objects are not copyable.
162
 
    Trackable (const Trackable &);
163
 
    Trackable &operator= (const Trackable &);
164
 
 
165
164
    static std::new_handler _new_current_handler;
166
165
 
167
166
    bool _owns_the_reference;
208
207
    /*!
209
208
        @return The reference count of this object.
210
209
    */
211
 
    int GetReferenceCount () const;
 
210
    int GetReferenceCount() const;
 
211
 
 
212
    //! Get the number of ObjectPtr holding this object.
 
213
    /*!
 
214
        @return The number of ObjectPtr holding this object.
 
215
    */
 
216
    int ObjectPtrCount() const;
212
217
 
213
218
    //! Signal emitted immediately before the object is destroyed.
214
219
    sigc::signal <void, Object *> object_destroyed;
215
220
 
216
 
    std::string GetAllocationLoation() const;
 
221
    std::string GetAllocationLocation() const;
 
222
    std::string GetTypeName() const;
217
223
 
218
224
  protected:
219
225
    //! Private destructor.
231
237
    Object (const Object &);
232
238
    Object &operator = (const Object &);
233
239
 
234
 
    const char* allocation_file_name_;
235
 
    int allocation_line_number_;
236
 
 
237
240
    NThreadSafeCounter* reference_count_;
238
241
    //!< Number of ObjectPtr hosting the object.
239
242
    NThreadSafeCounter* objectptr_count_;
240
243
 
 
244
    std::string allocation_location_;
 
245
    std::string allocation_stacktrace_;
 
246
 
241
247
    template <typename T>
242
248
    friend class ObjectPtr;
243
249