Changeset 219 for trunk/nom


Ignore:
Timestamp:
Feb 3, 2007, 6:59:37 PM (19 years ago)
Author:
cinc
Message:

Added doxygen tags. Some minor changes to NOMClass.

Location:
trunk/nom
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/nom/Makefile

    r158 r219  
    5353TSTHFILES       =       $(CLASSINC)/nomobj.h $(CLASSINC)/nomcls.h
    5454
    55 IHFILES         =       $(CLASSINC)/nomobj.ih $(CLASSINC)/nomcls.ih \
     55IHFILES         =       $(CLASSINC)/nomobj.ih \
     56                        $(CLASSINC)/nomcls.ih \
    5657                        $(CLASSINC)/nomclassmanager.ih
    5758
     
    7273
    7374
    74 $(BINDIR)/nobjtk.dll:    $(OBJDIR)/o.dep $(NOMOBJECTS) $(OBJECTS) $(GCLIB) ./exports.def
     75$(BINDIR)/nobjtk.dll:    $(OBJDIR)/o.dep $(IHFILES) $(NOMOBJECTS) $(OBJECTS) $(GCLIB) ./exports.def
    7576        @echo "[33;1;mLinking "$@"...[0;m"
    7677        cmd.exe /C create_vobjtk_def $(OBJDIR)/nobjtk.def
     
    101102 
    102103
    103 $(OBJDIR)/%.o:  $(CLASSCDIR)/%.c $(CLASSINC)/%.ih $(NOMINCLUDES)
     104$(OBJDIR)/%.o:  $(CLASSCDIR)/%.c $(NOMINCLUDES)
    104105        $(CC) -I $(INC) $(GCCFLAGS)  -o$@ $<
    105106
     
    138139        cp $(GCPATH)/.libs/gc.a $(GCLIB)
    139140
     141dox:
     142        doxygen nom.dox
     143
    140144clean:
    141145        @cd $(OBJDIR) && rm *
  • trunk/nom/class_c/nomcls.c

    r210 r219  
    6666}
    6767
    68 NOM_Scope CORBA_Object NOMLINK impl_NOMClass_nomNew(NOMClass* nomSelf, CORBA_Environment *ev)
     68/**
     69   \brief Function which implements the nomNew() method of NOMClass.
     70 */
     71NOM_Scope PNOMObject NOMLINK impl_NOMClass_nomNew(NOMClass* nomSelf, CORBA_Environment *ev)
    6972{
    7073  NOMClassData* nomThis=NOMClassGetData(nomSelf);
     
    8790}
    8891
    89 NOM_Scope CORBA_Object NOMLINK impl_NOMClass_nomRenewNoInit(NOMClass* nomSelf,
    90                                                             const CORBA_Object nomObj,
    91                                                             CORBA_Environment *ev)
     92/**
     93   \brief Function which implements the nomRenewNoInit() method of NOMClass.
     94 */
     95NOM_Scope PNOMObject NOMLINK impl_NOMClass_nomRenewNoInit(NOMClass* nomSelf,
     96                                                          const gpointer nomObj,
     97                                                          CORBA_Environment *ev)
    9298{
    9399  NOMClassPriv *ncp;
     
    116122}
    117123
    118 NOM_Scope CORBA_Object NOMLINK impl_NOMClass_nomRenew(NOMClass* nomSelf, const CORBA_Object nomObj,
    119                                                       CORBA_Environment *ev)
     124/**
     125   \brief Function which implements the nomRenew() method of NOMClass.
     126 */
     127NOM_Scope PNOMObject NOMLINK impl_NOMClass_nomRenew(NOMClass* nomSelf, const gpointer nomObj,
     128                                                    CORBA_Environment *ev)
    120129{
    121130  _nomRenewNoInit(nomSelf, nomObj, NULLHANDLE);
     
    128137
    129138
    130 NOM_Scope CORBA_string NOMLINK impl_NOMClass_nomAllocate(NOMClass* nomSelf, const CORBA_long ulSize,
     139/**
     140   \brief Function which implements the nomAllocate() method of NOMClass.
     141 */
     142NOM_Scope gpointer NOMLINK impl_NOMClass_nomAllocate(NOMClass* nomSelf, const CORBA_long ulSize,
    131143                                                         CORBA_Environment *ev)
    132144{
     
    136148}
    137149
     150/**
     151   Function which implements the nomGetName() method of NOMClass.
     152*/
    138153NOM_Scope CORBA_string NOMLINK impl_NOMClass_nomGetName(NOMClass* nomSelf, CORBA_Environment *ev)
    139154{
     
    142157
    143158
    144 NOM_Scope void NOMLINK impl_NOMClass_nomDeallocate(NOMClass* nomSelf, const CORBA_char * memptr, CORBA_Environment *ev)
     159/**
     160   \brief Function which implements the nomDeallocate() method of NOMClass.
     161 */
     162NOM_Scope void NOMLINK impl_NOMClass_nomDeallocate(NOMClass* nomSelf, const gpointer memptr, CORBA_Environment *ev)
    145163{
    146164  NOMFree((nomToken)memptr);
     
    148166
    149167
     168/**
     169   \brief Function which implements the nomSetObjectCreateInfo() method of NOMClass.
     170 */
    150171NOM_Scope void NOMLINK impl_NOMClass_nomSetObjectCreateInfo(NOMClass* nomSelf, const gpointer ncpObject,
    151172                                                            CORBA_Environment *ev)
     
    159180}
    160181
     182/**
     183   \brief Function which implements the nomGetObjectCreateInfo() method of NOMClass.
     184 */
    161185NOM_Scope gpointer NOMLINK impl_NOMClass_nomGetObjectCreateInfo(NOMClass* nomSelf, CORBA_Environment *ev)
    162186{
     
    166190}
    167191
     192/**
     193   \brief Function which implements the nomClassReady() method of NOMClass.
     194 */
    168195NOM_Scope void NOMLINK impl_NOMClass_nomClassReady(NOMClass* nomSelf, CORBA_Environment *ev)
    169196{
  • trunk/nom/class_c/nomobj.c

    r210 r219  
    4646#include "nomobj.ih"
    4747
     48/**
    4849
     50    \brief This function implements the method nomInit() of class NOMObject.
     51 */
    4952NOM_Scope void  NOMLINK impl_NOMObject_nomInit(NOMObject *nomSelf, CORBA_Environment *ev)
    5053
     
    5356}
    5457
     58/**
     59
     60    \brief This function implements the method nomUnInit() of class NOMObject.
     61 */
    5562NOM_Scope void  NOMLINK impl_NOMObject_nomUnInit(NOMObject *nomSelf, CORBA_Environment *ev)
    5663{
     
    6168}
    6269
     70/**
     71
     72    \brief This function implements the method nomGetSize() of class NOMObject.
     73 */
    6374NOM_Scope CORBA_long NOMLINK impl_NOMObject_nomGetSize(NOMObject* nomSelf, CORBA_Environment *ev)
    6475{
     
    7384}
    7485
     86/**
     87
     88    \brief This function implements the method delete() of class NOMObject.
     89
     90    It calls nomUnInit() to give the object a chance of freeing system resources. Afterwards
     91    the memory occupied by the object is given back to the system and the object is not
     92    accessible anymore.
     93 */
    7594NOM_Scope void NOMLINK impl_NOMObject_delete(NOMObject* nomSelf, CORBA_Environment *ev)
    7695{
     
    88107}
    89108
    90 /*
    91   Gets the class object of this object.
    92 */
     109/**
     110
     111    \brief This function implements the method nomGetClass() of class NOMObject.
     112    It returns a pointer to the class object of this object.
     113
     114    \param nomSelf The pointer to the object.
     115    \param ev      Environment pointer or NULL.
     116    \retval PNOMClass A pointer to the class object for this object. This can never be NULL.
     117 */
    93118NOM_Scope PNOMClass NOMLINK impl_NOMObject_nomGetClass(NOMObject* nomSelf, CORBA_Environment *ev)
    94119{
     
    98123}
    99124
    100 /*
    101   Create a new class of the kind the caller is. This method ensures that subclasses
    102   are properly handled without the need to override this method in every subclass.
     125/**
     126
     127   \brief This function implements the method new() of class NOMObject.
     128
     129  Create a new class of the kind the caller is. This method ensures that subclassing
     130  is properly handled without the need to override this method in every subclass.
     131 
     132  This method will get the class object of nomSelf () which may be any subclass
     133  of NOMObject) and call nomNew() on it creating
     134  a new object which has exactly the same class hierarchy as nomSelf.
    103135 */
    104136NOM_Scope PNOMObject NOMLINK impl_NOMObject_new(NOMObject* nomSelf, CORBA_Environment *ev)
  • trunk/nom/exports.def

    r195 r219  
    44
    55EXPORTS 
    6         nomTkInit               @1
    7         NOMMalloc             @2
    8         NOMCalloc               @3
     6        nomTkInit
     7        nomTkUnInit
     8
     9        NOMMalloc
     10        NOMCalloc
    911        NOMFree         
     12
    1013        nomIsObj               
    1114
     
    2730;        _NOMClassMgrObject     
    2831
    29         nomEnvironmentNew     
     32        nomEnvironmentNew
     33        nomEnvironmentEnd
     34
    3035        nomBuildClass           
    3136
  • trunk/nom/idl/nomcls.idl

    r179 r219  
    4444  NOMCLASSVERSION(1, 0 );
    4545
    46   Object nomNew();
     46  /**
     47    This method is called to create an object of the class this metaclass
     48    is the class object for.
     49    The method uses nomAllocate() to get the amount of storage necessary to
     50    hold one instance of the object to be built. When successful nomRenew()
     51    is called with the allocated storage block to initalize the object.
     52
     53    \sa nomRenew(), nomRenewNoInit(), impl_NOMClass_nomNew()
     54   */
     55  PNOMObject nomNew();
     56
     57  /**
     58     This method returns the name of the class this class object is an instance of.
     59
     60     \par How to override
     61     This method is usually not overriden.
     62
     63     \sa impl_NOMClass_nomGetName()
     64   */
    4765  string nomGetName();
    48   Object nomRenew(in Object nomObj);
    49   Object nomRenewNoInit(in Object nomObj);
    5066
    51   string nomAllocate(in long size);
    52   void nomDeallocate(in string memptr);
     67  /**
     68     This method is called for example by nomNew() when creating a new object. It may be
     69     used to create an object from a given memory block. If doing so be sure the storage
     70     area is big enough to hold an objects instance.
     71 
     72     The method first calls nomRenewNoInit() to set important object info on the memory block
     73     and then calls nomInit() on the newly created object.
     74
     75     \par How to override
     76     This method is usually not overriden.
     77     
     78     \sa nomNew, nomRenewNoInit(), impl_NOMClass_nomRenew()
     79   */
     80  PNOMObject nomRenew(in gpointer nomObj);
     81
     82  /**
     83     Most of object creation is done in this method which is indirectly called by nomNew().
     84     The block of storage given to the method is set to zero first. Setting the pointer to the
     85     mtab actually makes an object from the memory.
     86     If the class this object is an instance of (or any of the parent classes) did override
     87     nomUnInit() the object is registered for finalization with the garbage collector. By doing
     88     so it is ensured that nomUnInit() is called on the object when it's collected eventually.
     89
     90     This method can be used to create an object from any block of memory. It may be faster
     91     creating numerous objects from one huge memory area than calling nomNew() for every single
     92     object.
     93
     94     \remark This method does not call nomInit() on the new object. It is guaranteed that this
     95     method is always called during object creation.
     96
     97     \par How to override
     98     This method can be overriden to track the creation of objects. When doing so
     99     the parent should be called first.
     100
     101     \sa nomNew, nomRenew(), impl_NOMClass_nomRenewNoInit()
     102   */
     103  PNOMObject nomRenewNoInit(in gpointer nomObj);
     104
     105  /**
     106     Allocate size bytes for using when creating objects.
     107
     108     This method uses NOMMalloc() to allocate the memory. Because NOMMalloc() is just a wrapper
     109     around g_malloc() which is replaced by a garbage collected memory allocation routine the returned block of
     110     memory is zeroed similar to using NOMCalloc().
     111
     112     \par How to override
     113     This method is usually not overriden.
     114     
     115     \sa impl_NOMClass_nomAllocate()
     116   */
     117  gpointer nomAllocate(in long size);
     118
     119  /**
     120     Free a block of memory allocated using nomAllocate(). Because NOM is using a garbage collector
     121     this method does nothing. It's for compatibility with ported code.
     122
     123     \par How to override
     124     This method is usually not overriden.
     125 
     126     \sa impl_NOMClass_nomDeallocate()
     127   */
     128  void nomDeallocate(in gpointer memptr);
    53129  void nomSetObjectCreateInfo(in gpointer ncpObject);
    54130  gpointer nomGetObjectCreateInfo();
     131
     132  /**
     133     This method is called after the class object is built. It registers the new
     134     class with the NOMClassMagrObj.
     135     In addition to registering the class object the class this metaclass can create will
     136     also be registered.
     137
     138     \sa impl_NOMClass_nomClassReady()
     139   */
    55140  void nomClassReady();
    56141
  • trunk/nom/idl/nomobj.idl

    r210 r219  
    4444  NOMCLASSVERSION(1, 0 );
    4545
     46  /**
     47     This method is intended to be overriden by classes which need some initialization.
     48
     49     \par How to override
     50     The parent class must always be called first when overriden.
     51
     52     \sa impl_NOMObject_nomInit()
     53   */
    4654  void nomInit();
     55
     56  /**
     57     This method is intended to be overriden by classes which need some uninitialization.
     58     Note that when overriding the method the garbage collector will add the object
     59     to the list of objects with a finalizer. The finalizer will be run when the object is
     60     collected and calls nomUnInit() to give the object a chance for cleanup.
     61
     62     \note It's not necessary to free memory in nomUnInit(). This is the job of the garbage collector.
     63     Only system resources like file handles etc. must be explicitely freed.
     64
     65     \par How to override
     66     The parent method must be called after doing the own processing.
     67
     68     \sa impl_NOMObject_nomUnInit()
     69   */
    4770  void nomUnInit();
    48   /* Return the size of the object. That is sizeof(mTab*)+sizeof(all instance vars) */
     71
     72  /**
     73     Return the size of the object. That is sizeof(mTab*)+sizeof(all instance vars)
     74
     75     \par How to override
     76     This method is usually not overriden.
     77
     78     \sa impl_NOMObject_nomGetSize()
     79  */
    4980  long nomGetSize();
     81
     82  /**
     83     This method calls nomUnInit() to give the object a chance of freeing system resources.
     84     Afterwards the memory occupied by the object is given back to the system and the
     85     object is not accessible anymore.
     86
     87     \sa impl_NOMObject_delete()
     88   */
    5089  void delete();
     90
     91  /**
     92     This method returns a pointer to the class object of this object.
     93
     94     \par How to override
     95     This method is usually not overriden.
     96
     97     \return Pointer to the class object
     98
     99     \sa impl_NOMObject_nomGetClass()
     100   */
    51101  PNOMClass nomGetClass();
     102
     103  /**
     104     Create a new class of the kind the caller is. This method ensures that subclasses
     105     are properly handled without the need to override this method in every subclass.
     106
     107     This method will get the class object of nomSelf and call nomNew() on it creating
     108     a new object which has exactly the same class hierarchy of nomSelf.
     109
     110     \par How to override
     111     This method is usually not overriden.
     112
     113     \return Pointer to a new object of the same kind as nomSelf. Note that this won't
     114     create an exact copy but a completely new objecct.
     115
     116     \sa impl_NOMObject_new()
     117   */
    52118  PNOMObject new();
    53 #if 0
    54         NOMOVERRIDE(wpEchoString);
    55         NOMINSTANCEVAR(long theLong);
    56 #endif
    57119};
    58120
  • trunk/nom/src/nomtkinit.c

    r195 r219  
    1616* The Initial Developer of the Original Code is
    1717* netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
    18 * Portions created by the Initial Developer are Copyright (C) 2005-2006
     18* Portions created by the Initial Developer are Copyright (C) 2005-2007
    1919* the Initial Developer. All Rights Reserved.
    2020*
     
    100100
    101101
     102NOMEXTERN PNOM_ENV NOMLINK nomTkInit(void)
     103{
     104  PVOID memPtr;
     105
     106  if(pGlobalNomEnv)
     107    return pGlobalNomEnv; /* Already done */
     108
     109  nomPrintf("Entering %s...\n", __FUNCTION__);
     110
     111  memPtr=g_malloc(sizeof(NOM_ENV)); /* g_malloc() can't fail... */
     112
     113  nomPrintf("%s: Got root memory: %x\n", __FUNCTION__, memPtr);
     114
     115  /* Now init the structure */
     116  /* GC memory is zeroed... */
     117  ((PNOM_ENV)memPtr)->cbSize=sizeof(NOM_ENV);
     118  pGlobalNomEnv=(PNOM_ENV)memPtr;
     119
     120  return (PNOM_ENV)memPtr;
     121}
     122
    102123
    103124/*
     
    117138#endif
    118139
     140
    119141#ifdef DEBUG_NOMENVNEW
    120142  nomPrintf("Entering %s to initialize NOM runtime.\n\n", __FUNCTION__);
    121143  nomPrintf("**** Building NOMObject class...\n");
    122144#endif
     145  nomTkInit();
     146
    123147  nomCls=NOMObjectNewClass(NOMObject_MajorVersion, NOMObject_MinorVersion);
    124148
     
    142166
    143167  /* Now register the classes we already have */
    144   //  _nomRegisterClass(NOMClassMgrObject,   pGlobalNomEnv->defaultMetaClass->mtab, NULLHANDLE); //NOMClass
    145168  _nomClassReady(pGlobalNomEnv->defaultMetaClass, NULLHANDLE); //NOMClass
    146   //_nomRegisterClass(NOMClassMgrObject,   NOMClassMgrObject->mtab, NULLHANDLE); //NOMClassMgr
    147169  _nomClassReady(  _NOMClassMgr, NULLHANDLE); //NOMClassMgr
    148170  ncPriv=(NOMClassPriv*)pGlobalNomEnv->nomObjectMetaClass->mtab->nomClsInfo;
     
    150172  /* Do not register the NOMObject metaclass here. It's already registered because it's
    151173     NOMClass in fact. */
    152   //_nomRegisterClass(NOMClassMgrObject, pGlobalNomEnv->nomObjectMetaClass->mtab, NULLHANDLE); //NOMObject
    153174  _nomClassReady(_NOMObject, NULLHANDLE); //NOMObject
    154175
     
    180201
    181202
    182 NOMEXTERN PNOM_ENV NOMLINK nomTkInit(void)
    183 {
    184   PVOID memPtr;
    185   //PVOID memPool;
    186 
    187   nomPrintf("Entering %s...\n", __FUNCTION__);
    188 
    189   memPtr=g_malloc(sizeof(NOM_ENV)); /* g_malloc() can't fail... */
    190 
    191   nomPrintf("%s: Got root memory: %x\n", __FUNCTION__, memPtr);
    192 
    193   /* Now init the structure */
    194   /* GC memory is zeroed... */
    195   ((PNOM_ENV)memPtr)->cbSize=sizeof(NOM_ENV);
    196   pGlobalNomEnv=(PNOM_ENV)memPtr;
    197 
    198 #if 0
    199   if(NO_ERROR!=DosCreateMutexSem(NULL, &((PNOM_ENV)memPtr)->hmtx, DC_SEM_SHARED, FALSE))
    200     {
    201       g_free(memPtr);
    202       return NULL;
    203     }
    204 #endif
    205 
    206   return (PNOM_ENV)memPtr;
    207 }
    208 
    209 
    210 
    211 
    212 
    213 
    214 
    215 
    216 
    217 
    218 
     203NOMEXTERN void NOMLINK nomTkUnInit(gpointer pReserved)
     204{
     205  /* Nothing yet...*/
     206}
     207
     208NOMEXTERN void NOMLINK nomEnvironmentEnd (void)
     209{
     210  nomTkUnInit(NULL);
     211}
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
Note: See TracChangeset for help on using the changeset viewer.