| 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 | /** \interface NOMClass
|
|---|
| 44 |
|
|---|
| 45 | This is the root class for metaclasses.
|
|---|
| 46 |
|
|---|
| 47 | */
|
|---|
| 48 | interface NOMClass:NOMObject
|
|---|
| 49 | {
|
|---|
| 50 | #ifdef __NOM_IDL_COMPILER__
|
|---|
| 51 | filestem=nomcls;
|
|---|
| 52 | #endif
|
|---|
| 53 |
|
|---|
| 54 | NOMCLASSVERSION(1, 0 );
|
|---|
| 55 |
|
|---|
| 56 | /**
|
|---|
| 57 | This method is called to create an object of the class this metaclass
|
|---|
| 58 | is the class object for.
|
|---|
| 59 | The method uses nomAllocate() to get the amount of storage necessary to
|
|---|
| 60 | hold one instance of the object to be built. When successful nomRenew()
|
|---|
| 61 | is called with the allocated storage block to initalize the object.
|
|---|
| 62 |
|
|---|
| 63 | \sa nomRenew(), nomRenewNoInit(), impl_NOMClass_nomNew()
|
|---|
| 64 | */
|
|---|
| 65 | PNOMObject nomNew();
|
|---|
| 66 |
|
|---|
| 67 | /**
|
|---|
| 68 | This method returns the name of the class this class object is the meta class of. This
|
|---|
| 69 | means the returned string is the name of the class the metaclass creates instances of.
|
|---|
| 70 |
|
|---|
| 71 | \remarks This method used to be called nomGetName().
|
|---|
| 72 |
|
|---|
| 73 | \par How to override:
|
|---|
| 74 | This method is usually not overriden.
|
|---|
| 75 |
|
|---|
| 76 | \sa nomQueryClassName()
|
|---|
| 77 | */
|
|---|
| 78 | string nomQueryCreatedClassName();
|
|---|
| 79 |
|
|---|
| 80 | /**
|
|---|
| 81 | This method is called for example by nomNew() when creating a new object. It may be
|
|---|
| 82 | used to create an object from a given memory block. If doing so be sure the storage
|
|---|
| 83 | area is big enough to hold an objects instance.
|
|---|
| 84 |
|
|---|
| 85 | The method first calls nomRenewNoInit() to set important object info on the memory block
|
|---|
| 86 | and then calls nomInit() on the newly created object.
|
|---|
| 87 |
|
|---|
| 88 | \par How to override:
|
|---|
| 89 | This method is usually not overriden.
|
|---|
| 90 |
|
|---|
| 91 | \sa nomNew, nomRenewNoInit(), impl_NOMClass_nomRenew()
|
|---|
| 92 | */
|
|---|
| 93 | PNOMObject nomRenew(in gpointer nomObj);
|
|---|
| 94 |
|
|---|
| 95 | /**
|
|---|
| 96 | Most of object creation is done in this method which is indirectly called by nomNew().
|
|---|
| 97 | The block of storage given to the method is set to zero first. Setting the pointer to the
|
|---|
| 98 | mtab actually makes an object from the memory.
|
|---|
| 99 | If the class this object is an instance of (or any of the parent classes) did override
|
|---|
| 100 | nomUnInit() the object is registered for finalization with the garbage collector. By doing
|
|---|
| 101 | so it is ensured that nomUnInit() is called on the object when it's collected eventually.
|
|---|
| 102 |
|
|---|
| 103 | This method can be used to create an object from any block of memory. It may be faster
|
|---|
| 104 | creating numerous objects from one huge memory area than calling nomNew() for every single
|
|---|
| 105 | object.
|
|---|
| 106 |
|
|---|
| 107 | \remark This method does not call nomInit() on the new object. It is guaranteed that this
|
|---|
| 108 | method is always called during object creation.
|
|---|
| 109 |
|
|---|
| 110 | \par How to override:
|
|---|
| 111 | This method can be overriden to track the creation of objects. When doing so
|
|---|
| 112 | the parent should be called first.
|
|---|
| 113 |
|
|---|
| 114 | \sa nomNew, nomRenew(), impl_NOMClass_nomRenewNoInit()
|
|---|
| 115 | */
|
|---|
| 116 | PNOMObject nomRenewNoInit(in gpointer nomObj);
|
|---|
| 117 |
|
|---|
| 118 | /**
|
|---|
| 119 | Allocate size bytes for using when creating objects.
|
|---|
| 120 |
|
|---|
| 121 | This method uses NOMMalloc() to allocate the memory. Because NOMMalloc() is just a wrapper
|
|---|
| 122 | around g_malloc() which is replaced by a garbage collected memory allocation routine the returned block of
|
|---|
| 123 | memory is zeroed similar to using NOMCalloc().
|
|---|
| 124 |
|
|---|
| 125 | \par How to override:
|
|---|
| 126 | This method is usually not overriden.
|
|---|
| 127 |
|
|---|
| 128 | \sa impl_NOMClass_nomAllocate()
|
|---|
| 129 | */
|
|---|
| 130 | gpointer nomAllocate(in long size);
|
|---|
| 131 |
|
|---|
| 132 | /**
|
|---|
| 133 | Free a block of memory allocated using nomAllocate(). Because NOM is using a garbage collector
|
|---|
| 134 | this method does nothing. It's for compatibility with ported code.
|
|---|
| 135 |
|
|---|
| 136 | \par How to override:
|
|---|
| 137 | This method is usually not overriden.
|
|---|
| 138 |
|
|---|
| 139 | \sa impl_NOMClass_nomDeallocate()
|
|---|
| 140 | */
|
|---|
| 141 | void nomDeallocate(in gpointer memptr);
|
|---|
| 142 | void nomSetObjectCreateInfo(in gpointer ncpObject);
|
|---|
| 143 |
|
|---|
| 144 | /**
|
|---|
| 145 | Query the structure holding all the info needed for creating new objects.
|
|---|
| 146 |
|
|---|
| 147 | \remarks
|
|---|
| 148 | You should know what you're doing if you want to use the structure returned by this method...
|
|---|
| 149 | The return type may change.
|
|---|
| 150 | */
|
|---|
| 151 | gpointer nomGetObjectCreateInfo();
|
|---|
| 152 |
|
|---|
| 153 | /**
|
|---|
| 154 | This method is called after the class object is built. It registers the new
|
|---|
| 155 | class with the NOMClassMgrObj.
|
|---|
| 156 | In addition to registering the class object the class this metaclass can create will
|
|---|
| 157 | also be registered.
|
|---|
| 158 |
|
|---|
| 159 | \remarks This method is only called by the system during class creation.
|
|---|
| 160 |
|
|---|
| 161 | \par How to override:
|
|---|
| 162 | This method is usually not overriden.
|
|---|
| 163 |
|
|---|
| 164 | \sa impl_NOMClass_nomClassReady()
|
|---|
| 165 | */
|
|---|
| 166 | void nomClassReady();
|
|---|
| 167 |
|
|---|
| 168 | /**
|
|---|
| 169 | \warning
|
|---|
| 170 | The type of this variable will change!
|
|---|
| 171 | */
|
|---|
| 172 | NOMINSTANCEVAR(gpointer ncpObject); //NOMClassPriv structure holding info about the object this class can create
|
|---|
| 173 | NOMOVERRIDE(nomInit);
|
|---|
| 174 |
|
|---|
| 175 | };
|
|---|
| 176 |
|
|---|
| 177 | #endif /* NOMCLS_IDL_INCLUDED */
|
|---|