[Vala] memory management class struct




Hi:

Someone know how c++ manage the member in classes. I am asking this because in vala i know member funcions in classes are shared between all objects. This is important for me because if i want build engineering apps i use many entities of the same class. For example for the lidar point class i have to use 1 million of instances of the same class.

I see blender is 100% C source code in the kernel, but for example K-3D is C++ pure code with extensive use of STL. I know microstation kernel is C pure code because i have the header of all entities of the DGN format and itÅ› only C structs.

/* Our "Instance struct" defines all the data fields that make our object unique. */f typedef struct _SomeObject SomeObject;
struct _SomeObject
{
        GTypeInstance   gtype;

        gint            m_a;
        gchar*          m_b;
        gfloat          m_c;
};

/* Our "Class struct" defines all the method functions that our objects will share. */
typedef struct _SomeObjectClass SomeObjectClass;
struct _SomeObjectClass
{
        GTypeClass      gtypeclass;

        void            (*method1)      (SomeObject *self, gint);
        void            (*method2)      (SomeObject *self, gchar*);
};



Regards.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]