Changeset 179 for trunk/nom


Ignore:
Timestamp:
Jan 7, 2007, 5:25:48 PM (19 years ago)
Author:
cinc
Message:

Added nomGetClass()/new() methods to NOMObject. Header file fixes to resolve build issues.

Location:
trunk/nom
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/nom/class_c/nomobj.c

    r177 r179  
    3838#include <gtk/gtk.h>
    3939
    40 
    4140#include "nom.h"
    4241#include "nomtk.h"
    4342
    4443#include "nomobj.ih"
    45 
    4644
    4745
     
    8785}
    8886
     87NOM_Scope PNOMClass NOMLINK impl_NOMObject_nomGetClass(NOMObject* nomSelf, CORBA_Environment *ev)
     88{
     89/* NOMObjectData* nomThis=NOMObjectGetData(nomSelf); */
    8990
     91  return nomSelf->mtab->nomClassObject;
     92}
     93
     94/*
     95  Create a new class of the kind the caller is. This method ensures that subclasses
     96  are properly handled without the need to override this class in every subclass.
     97 */
     98NOM_Scope PNOMObject NOMLINK impl_NOMObject_new(NOMObject* nomSelf, CORBA_Environment *ev)
     99{
     100/* NOMObjectData* nomThis=NOMObjectGetData(nomSelf); */
     101  PNOMObject nomRetval;
     102  NOMClass* nomCls;
     103
     104  /* We don't know which class we're actually. So we can't just create a new object using
     105     <CkassName>New() here.
     106     It is possible that we are called by a subclass. So get the class object and let the
     107     class object create the correct class. */
     108  nomCls=NOMObject_nomGetClass(nomSelf, NULLHANDLE);
     109  return NOMClass_nomNew(nomCls, NULLHANDLE);
     110}
     111
     112
     113
  • trunk/nom/idl/nombase.idl

    r174 r179  
    6464
    6565/* Native types we want to use in the IDL */
     66native PNOMObject;
     67native PNOMClass;
     68
    6669native  gint;
    6770native  gulong;
  • trunk/nom/idl/nomcls.idl

    r94 r179  
    3737#include "nomobj.idl"
    3838
     39//NOMCLASSNAME(NOMClass);
     40
    3941interface NOMClass:NOMObject
    4042{
  • trunk/nom/idl/nomobj.idl

    r120 r179  
    3737#include "nombase.idl"
    3838
     39//NOMCLASSNAME(NOMObject);
     40
    3941interface NOMObject
    4042{
    4143
    42         NOMCLASSVERSION(1, 0 );
     44  NOMCLASSVERSION(1, 0 );
    4345
    44         void nomInit();
    45         void nomUninit();
    46         /* Return the size of the object. That is sizeof(mTab*)+sizeof(all instance vars) */
    47         long nomGetSize();
     46  void nomInit();
     47  void nomUninit();
     48  /* Return the size of the object. That is sizeof(mTab*)+sizeof(all instance vars) */
     49  long nomGetSize();
    4850  void delete();
     51  PNOMClass nomGetClass();
     52  PNOMObject new();
    4953#if 0
    5054        NOMOVERRIDE(wpEchoString);
  • trunk/nom/include/nom.h

    r174 r179  
    129129
    130130
    131 #define NOMObject NOMAnyObj
    132 #define NOMClass NOMAnyObj
     131#ifndef NOMClass
     132typedef struct NOMClass_struct {
     133  struct nomMethodTabStruct  *mtab;
     134  gulong body[1];
     135} NOMClassObj;
     136#define NOMClass NOMClassObj
     137typedef NOMClass *PNOMClass;
     138#endif
     139
     140#ifndef NOMObject
     141typedef struct NOMObject_struct {
     142  struct nomMethodTabStruct  *mtab;
     143  gulong body[1];
     144} NOMObjectObj;
     145#define NOMObject NOMObjectObj
     146typedef NOMObject *PNOMObject;
     147#endif
     148
     149//#define NOMObject NOMAnyObj
    133150#define NOMClassMgr NOMAnyObj
    134151
Note: See TracChangeset for help on using the changeset viewer.