summaryrefslogtreecommitdiffstats
path: root/src/Object.h
blob: 588a0dacb7be908bfe2e2b895e03dc50d4471301 (plain)
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
#ifndef __PY_OBJECT_H_
#define __PY_OBJECT_H_

#include <glib-object.h>
#include "Pointer.h"

namespace PY {

class Object {
protected:
    template <typename T>
    Object (T *p) : m_p ((GObject *)p) {
        g_assert (get <GObject *>() != NULL);
    }

    operator GObject * (void) const {
        return m_p;
    }

    template <typename T>
    T * get (void) const {
        return (T *) (GObject *) m_p;
    }

private:
    Pointer<GObject> m_p;
};

};

#endif