| 1 | /* ***** BEGIN LICENSE BLOCK *****
|
|---|
| 2 | * Version: CDDL 1.0/LGPL 2.1
|
|---|
| 3 | *
|
|---|
| 4 | * The contents of this file are subject to the COMMON DEVELOPMENT AND
|
|---|
| 5 | * DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
|
|---|
| 6 | * this file except in compliance with the License. You may obtain a copy of
|
|---|
| 7 | * the License at http://www.sun.com/cddl/
|
|---|
| 8 | *
|
|---|
| 9 | * Software distributed under the License is distributed on an "AS IS" basis,
|
|---|
| 10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|---|
| 11 | * for the specific language governing rights and limitations under the
|
|---|
| 12 | * License.
|
|---|
| 13 | *
|
|---|
| 14 | * The Original Code is "NOM" Netlabs Object Model
|
|---|
| 15 | *
|
|---|
| 16 | * The Initial Developer of the Original Code is
|
|---|
| 17 | * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
|
|---|
| 18 | * Portions created by the Initial Developer are Copyright (C) 2005-2006
|
|---|
| 19 | * the Initial Developer. All Rights Reserved.
|
|---|
| 20 | *
|
|---|
| 21 | * Contributor(s):
|
|---|
| 22 | *
|
|---|
| 23 | * Alternatively, the contents of this file may be used under the terms of
|
|---|
| 24 | * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
|
|---|
| 25 | * case the provisions of the LGPL are applicable instead of those above. If
|
|---|
| 26 | * you wish to allow use of your version of this file only under the terms of
|
|---|
| 27 | * the LGPL, and not to allow others to use your version of this file under
|
|---|
| 28 | * the terms of the CDDL, indicate your decision by deleting the provisions
|
|---|
| 29 | * above and replace them with the notice and other provisions required by the
|
|---|
| 30 | * LGPL. If you do not delete the provisions above, a recipient may use your
|
|---|
| 31 | * version of this file under the terms of any one of the CDDL or the LGPL.
|
|---|
| 32 | *
|
|---|
| 33 | * ***** END LICENSE BLOCK ***** */
|
|---|
| 34 | /** \file nomcls.idl
|
|---|
| 35 |
|
|---|
| 36 | Class definition file for NOM class NOMClass the root metaclass.
|
|---|
| 37 | */
|
|---|
| 38 | #ifndef NOMCLS_IDL_INCLUDED
|
|---|
| 39 | #define NOMCLS_IDL_INCLUDED
|
|---|
| 40 |
|
|---|
| 41 | #include "nomobj.idl"
|
|---|
| 42 |
|
|---|
| 43 | //NOMCLASSNAME(NOMClass);
|
|---|
| 44 |
|
|---|
| 45 | /** \interface NOMClass
|
|---|
| 46 |
|
|---|
| 47 | This is the root class for metaclasses.
|
|---|
| 48 |
|
|---|
| 49 | */
|
|---|
| 50 | interface NOMClass:NOMObject
|
|---|
| 51 | {
|
|---|
| 52 |
|
|---|
| 53 | NOMCLASSVERSION(1, 0 );
|
|---|
| 54 |
|
|---|
| 55 | /**
|
|---|
| 56 | This method is called to create an object of the class this metaclass
|
|---|
| 57 | is the class object for.
|
|---|
| 58 | The method uses nomAllocate() to get the amount of storage necessary to
|
|---|
| 59 | hold one instance of the object to be built. When successful nomRenew()
|
|---|
| 60 | is called with the allocated storage block to initalize the object.
|
|---|
| 61 |
|
|---|
| 62 | \sa nomRenew(), nomRenewNoInit(), impl_NOMClass_nomNew()
|
|---|
| 63 | */
|
|---|
| 64 | PNOMObject nomNew();
|
|---|
| 65 |
|
|---|
| 66 | /**
|
|---|
| 67 | This method returns the name of the class this class object is the meta class of. This
|
|---|
| 68 | means the returned string is the name of the class the metaclass creates instances of.
|
|---|
| 69 |
|
|---|
| 70 | \remarks This method used to be called nomGetName().
|
|---|
| 71 |
|
|---|
| 72 | \par How to override:
|
|---|
| 73 | This method is usually not overriden.
|
|---|
| 74 |
|
|---|
| 75 | \sa nomGetClassName()
|
|---|
| 76 | */
|
|---|
| 77 | string nomGetCreatedClassName();
|
|---|
| 78 |
|
|---|
| 79 | /**
|
|---|
| 80 | This method is called for example by nomNew() when creating a new object. It may be
|
|---|
| 81 | used to create an object from a given memory block. If doing so be sure the storage
|
|---|
| 82 | area is big enough to hold an objects instance.
|
|---|
| 83 |
|
|---|
| 84 | The method first calls nomRenewNoInit() to set important object info on the memory block
|
|---|
| 85 | and then calls nomInit() on the newly created object.
|
|---|
| 86 |
|
|---|
| 87 | \par How to override:
|
|---|
| 88 | This method is usually not overriden.
|
|---|
| 89 |
|
|---|
| 90 | \sa nomNew, nomRenewNoInit(), impl_NOMClass_nomRenew()
|
|---|
| 91 | */
|
|---|
| 92 | PNOMObject nomRenew(in gpointer nomObj);
|
|---|
| 93 |
|
|---|
| 94 | /**
|
|---|
| 95 | Most of object creation is done in this method which is indirectly called by nomNew().
|
|---|
| 96 | The block of storage given to the method is set to zero first. Setting the pointer to the
|
|---|
| 97 | mtab actually makes an object from the memory.
|
|---|
| 98 | If the class this object is an instance of (or any of the parent classes) did override
|
|---|
| 99 | nomUnInit() the object is registered for finalization with the garbage collector. By doing
|
|---|
| 100 | so it is ensured that nomUnInit() is called on the object when it's collected eventually.
|
|---|
| 101 |
|
|---|
| 102 | This method can be used to create an object from any block of memory. It may be faster
|
|---|
| 103 | creating numerous objects from one huge memory area than calling nomNew() for every single
|
|---|
| 104 | object.
|
|---|
| 105 |
|
|---|
| 106 | \remark This method does not call nomInit() on the new object. It is guaranteed that this
|
|---|
| 107 | method is always called during object creation.
|
|---|
| 108 |
|
|---|
| 109 | \par How to override:
|
|---|
| 110 | This method can be overriden to track the creation of objects. When doing so
|
|---|
| 111 | the parent should be called first.
|
|---|
| 112 |
|
|---|
| 113 | \sa nomNew, nomRenew(), impl_NOMClass_nomRenewNoInit()
|
|---|
| 114 | */
|
|---|
| 115 | PNOMObject nomRenewNoInit(in gpointer nomObj);
|
|---|
| 116 |
|
|---|
| 117 | /**
|
|---|
| 118 | Allocate size bytes for using when creating objects.
|
|---|
| 119 |
|
|---|
| 120 | This method uses NOMMalloc() to allocate the memory. Because NOMMalloc() is just a wrapper
|
|---|
| 121 | around g_malloc() which is replaced by a garbage collected memory allocation routine the returned block of
|
|---|
| 122 | memory is zeroed similar to using NOMCalloc().
|
|---|
| 123 |
|
|---|
| 124 | \par How to override:
|
|---|
| 125 | This method is usually not overriden.
|
|---|
| 126 |
|
|---|
| 127 | \sa impl_NOMClass_nomAllocate()
|
|---|
| 128 | */
|
|---|
| 129 | gpointer nomAllocate(in long size);
|
|---|
| 130 |
|
|---|
| 131 | /**
|
|---|
| 132 | Free a block of memory allocated using nomAllocate(). Because NOM is using a garbage collector
|
|---|
| 133 | this method does nothing. It's for compatibility with ported code.
|
|---|
| 134 |
|
|---|
| 135 | \par How to override:
|
|---|
| 136 | This method is usually not overriden.
|
|---|
| 137 |
|
|---|
| 138 | \sa impl_NOMClass_nomDeallocate()
|
|---|
| 139 | */
|
|---|
| 140 | void nomDeallocate(in gpointer memptr);
|
|---|
| 141 | void nomSetObjectCreateInfo(in gpointer ncpObject);
|
|---|
| 142 |
|
|---|
| 143 | /**
|
|---|
| 144 | \remarks
|
|---|
| 145 | The return type may change.
|
|---|
| 146 | */
|
|---|
| 147 | gpointer nomGetObjectCreateInfo();
|
|---|
| 148 |
|
|---|
| 149 | /**
|
|---|
| 150 | This method is called after the class object is built. It registers the new
|
|---|
| 151 | class with the NOMClassMgrObj.
|
|---|
| 152 | In addition to registering the class object the class this metaclass can create will
|
|---|
| 153 | also be registered.
|
|---|
| 154 |
|
|---|
| 155 | \remarks This method is only called by the system during class creation.
|
|---|
| 156 |
|
|---|
| 157 | \par How to override:
|
|---|
| 158 | This method is usually not overriden.
|
|---|
| 159 |
|
|---|
| 160 | \sa impl_NOMClass_nomClassReady()
|
|---|
| 161 | */
|
|---|
| 162 | void nomClassReady();
|
|---|
| 163 |
|
|---|
| 164 | /**
|
|---|
| 165 | \warning
|
|---|
| 166 | The type of this variable will change!
|
|---|
| 167 | */
|
|---|
| 168 | NOMINSTANCEVAR(string ncpObject); //NOMClassPriv structure holding info about the object this class can create
|
|---|
| 169 | NOMOVERRIDE(nomInit);
|
|---|
| 170 |
|
|---|
| 171 | };
|
|---|
| 172 |
|
|---|
| 173 | #endif /* NOMCLS_IDL_INCLUDED */
|
|---|