| 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-2007
|
|---|
| 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 nomclassmanager.idl
|
|---|
| 35 |
|
|---|
| 36 | Class definition file for the NOM class NOMClassMgr
|
|---|
| 37 | */
|
|---|
| 38 |
|
|---|
| 39 | #ifndef nomcm_idl
|
|---|
| 40 | #define nomcm_idl
|
|---|
| 41 |
|
|---|
| 42 | #include "nomobj.idl"
|
|---|
| 43 | #include "nomcls.idl"
|
|---|
| 44 |
|
|---|
| 45 | /** \interface NOMClassMgr
|
|---|
| 46 |
|
|---|
| 47 | The NOMClassMgr class provides methods for managing the whole
|
|---|
| 48 | object system. One single instance is created and a pointer is to it is
|
|---|
| 49 | put into the global variable \i NOMClassMgrObject.
|
|---|
| 50 |
|
|---|
| 51 | */
|
|---|
| 52 |
|
|---|
| 53 | interface NOMClassMgr : NOMObject
|
|---|
| 54 | {
|
|---|
| 55 | #ifdef __NOM_IDL_COMPILER__
|
|---|
| 56 | filestem=nomclassmanager;
|
|---|
| 57 | #endif
|
|---|
| 58 | NOMCLASSVERSION(1, 0 );
|
|---|
| 59 |
|
|---|
| 60 | /**
|
|---|
| 61 | Find the class object for the class with the given nomId in the internal class list managed by the
|
|---|
| 62 | class manager.
|
|---|
| 63 |
|
|---|
| 64 | \remark This method is only a stub for now.
|
|---|
| 65 |
|
|---|
| 66 | \par How to override
|
|---|
| 67 | This method is usually not overriden.
|
|---|
| 68 |
|
|---|
| 69 | \param classId The id of the class to be found.
|
|---|
| 70 | \param ulMajorVersion This parameter is not used at the moment and should be set to 0.
|
|---|
| 71 | \param ulMinorVersion This parameter is not used at the moment and should be set to 0.
|
|---|
| 72 | \return
|
|---|
| 73 | The class object for the class with the given name or NULL if not found.
|
|---|
| 74 | */
|
|---|
| 75 | NOMClass* nomFindClassFromId(in gulong classId,
|
|---|
| 76 | in gulong ulMajorVersion,
|
|---|
| 77 | in gulong ulMinorVersion);
|
|---|
| 78 |
|
|---|
| 79 | /**
|
|---|
| 80 | Find the class object for the class with the given name in the internal class list managed by the
|
|---|
| 81 | class manager.
|
|---|
| 82 |
|
|---|
| 83 | \remark
|
|---|
| 84 | This method will return the metaclasses for the given class name.
|
|---|
| 85 |
|
|---|
| 86 | \par How to override
|
|---|
| 87 | This method is usually not overriden.
|
|---|
| 88 |
|
|---|
| 89 | \param className The name of the class as a C string.
|
|---|
| 90 | \param ulMajorVersion This parameter is not used at the moment and should be set to 0.
|
|---|
| 91 | \param ulMinorVersion This parameter is not used at the moment and should be set to 0.
|
|---|
| 92 | \return
|
|---|
| 93 | The class object for the class with the given name or NULL if not found.
|
|---|
| 94 | */
|
|---|
| 95 | NOMClass* nomFindClassFromName(in string className,
|
|---|
| 96 | in long ulMajorVersion,
|
|---|
| 97 | in long ulNinorVersion);
|
|---|
| 98 |
|
|---|
| 99 | /**
|
|---|
| 100 | Register a given class in the internal list of classes.
|
|---|
| 101 |
|
|---|
| 102 | We register mtabs as unique pointers to classes. It's possible to get every
|
|---|
| 103 | information from an mtab. We don't use the class name because in case of
|
|---|
| 104 | meta classes several different meta classes for creating different objects
|
|---|
| 105 | may have the same name because the default meta class is always NOMClass.
|
|---|
| 106 | The mtab of each of this meta classes is different.
|
|---|
| 107 |
|
|---|
| 108 | In addition to maintaining a list of registered classes we also register the
|
|---|
| 109 | mtab in a balanced binary tree for fast retrieval. The data in this tree is
|
|---|
| 110 | used by nomIsObject() to check if a block of memory is actually an object by
|
|---|
| 111 | checking the memories mtab pointer against the registered list of mtabs.
|
|---|
| 112 |
|
|---|
| 113 | \remarks Classes are registered usually from within nomClassReady().
|
|---|
| 114 |
|
|---|
| 115 | \par How to override
|
|---|
| 116 | This method is usually not overriden.
|
|---|
| 117 |
|
|---|
| 118 | \param classMtab The mtab of the class to be registered.
|
|---|
| 119 | */
|
|---|
| 120 | void nomRegisterClass(in gpointer classMtab);
|
|---|
| 121 |
|
|---|
| 122 | /**
|
|---|
| 123 | Get the internal list of classes.
|
|---|
| 124 |
|
|---|
| 125 | \remarks This method is only for NOM kernel implemeters. You can gather all
|
|---|
| 126 | information of this list by using provided methods.
|
|---|
| 127 |
|
|---|
| 128 | \par How to override:
|
|---|
| 129 | This method is usually not overriden.
|
|---|
| 130 |
|
|---|
| 131 | \return
|
|---|
| 132 | A pointer on the head of a GData list. Note that this is not a copy.
|
|---|
| 133 |
|
|---|
| 134 | */
|
|---|
| 135 | PGData nomGetClassList();
|
|---|
| 136 |
|
|---|
| 137 | /**
|
|---|
| 138 | This method returns a pointer to a class specific private structure holding additional
|
|---|
| 139 | information. The structure is only used by the NOM kernel.
|
|---|
| 140 |
|
|---|
| 141 | \remarks This method is only for NOM kernel implemeters.
|
|---|
| 142 |
|
|---|
| 143 | \par How to override:
|
|---|
| 144 | This method is usually not overriden.
|
|---|
| 145 |
|
|---|
| 146 | \param className The class name as a C string.
|
|---|
| 147 | \return A nomClsInfo pointer for the given class. This structure is private and only used
|
|---|
| 148 | internally.
|
|---|
| 149 | */
|
|---|
| 150 | gpointer nomGetClassInfoPtrFromName(in string className);
|
|---|
| 151 |
|
|---|
| 152 | /**
|
|---|
| 153 | Register a method with the class manager. The data is used to find the class
|
|---|
| 154 | implementing a method from the method name.
|
|---|
| 155 |
|
|---|
| 156 | \param classMtab The mtab of a class.
|
|---|
| 157 | \param chrMethodName Method to be registered.
|
|---|
| 158 | */
|
|---|
| 159 | void nomRegisterMethod(in gpointer classMtab, in string chrMethodName);
|
|---|
| 160 |
|
|---|
| 161 | /**
|
|---|
| 162 | Method to check if the given object is indeed an object or just arbitrary
|
|---|
| 163 | storage. This is done by checking the mtab in the given object against a registered
|
|---|
| 164 | list of mtabs.
|
|---|
| 165 |
|
|---|
| 166 | \remarks You probably want to use the function nomIsObj() instead which subsequently
|
|---|
| 167 | calls this method.
|
|---|
| 168 |
|
|---|
| 169 | \par How to override:
|
|---|
| 170 | This method is usually not overriden.
|
|---|
| 171 |
|
|---|
| 172 | \param nomObject The object to be checked.
|
|---|
| 173 |
|
|---|
| 174 | \returns True if the given object is a NOMObject.
|
|---|
| 175 | */
|
|---|
| 176 | boolean nomIsObject(in PNOMObject nomObject);
|
|---|
| 177 |
|
|---|
| 178 | /**
|
|---|
| 179 | This method substitutes \e oldClass with \e replacementClass. This means that after
|
|---|
| 180 | replacing whenever class \e oldClass is requested \e replacementClass is returned.
|
|---|
| 181 | \e oldClassNew() will create \e replacementClass objects etc.
|
|---|
| 182 |
|
|---|
| 183 | The class \e replacementClass must be a direct subclass of \e oldClass.
|
|---|
| 184 |
|
|---|
| 185 | \remark Both classes must already be registered with the class manager when calling this
|
|---|
| 186 | method.
|
|---|
| 187 |
|
|---|
| 188 | \par How to override:
|
|---|
| 189 | This method is usually not overriden.
|
|---|
| 190 |
|
|---|
| 191 | \param oldClass The class to be replaced
|
|---|
| 192 | \param replacementClass The class which will be used instead of \e oldClass
|
|---|
| 193 | \returns TRUE if replacement succeeded.
|
|---|
| 194 |
|
|---|
| 195 | \warning
|
|---|
| 196 | This method is not implemented yet.
|
|---|
| 197 |
|
|---|
| 198 | */
|
|---|
| 199 | boolean nomSubstituteClass(in string oldClass, in string replacementClass);
|
|---|
| 200 |
|
|---|
| 201 | /**
|
|---|
| 202 | Query the name of the DLL in which the class can be found. The name can be used to
|
|---|
| 203 | dynamically load the DLL get the class exports and finally create the class.
|
|---|
| 204 |
|
|---|
| 205 | \remark The returned path is in the system encoding.
|
|---|
| 206 |
|
|---|
| 207 | \warning
|
|---|
| 208 | This method is not implemented yet.
|
|---|
| 209 | */
|
|---|
| 210 | string nomQueryDLLForClass(in string chrClassName);
|
|---|
| 211 | /**
|
|---|
| 212 | Override of nomInit(). The list of methods and the list of classes are initialized
|
|---|
| 213 | in that method. In addition the balanced binary tree for registering mtabs is created.
|
|---|
| 214 | */
|
|---|
| 215 | //NOMOVERRIDE(nomInit);
|
|---|
| 216 | nomInit : override;
|
|---|
| 217 | /**
|
|---|
| 218 | The list of registered classes. Normal classes and metaclasses are registered.
|
|---|
| 219 | The method nomGetClassList() can be used to get it.
|
|---|
| 220 | If doing so be aware that it's the real thing no copy.
|
|---|
| 221 | */
|
|---|
| 222 | NOMINSTANCEVAR(PGData gdataClassList);
|
|---|
| 223 |
|
|---|
| 224 | /**
|
|---|
| 225 | The list of registered methods.
|
|---|
| 226 | */
|
|---|
| 227 | NOMINSTANCEVAR(PGData gdataMethodList);
|
|---|
| 228 |
|
|---|
| 229 | /**
|
|---|
| 230 | Balanced binary tree holding the mtabs of all known classes. You can't access
|
|---|
| 231 | this from the outside. It's entirely private to NOMClassMgr.
|
|---|
| 232 | */
|
|---|
| 233 | NOMINSTANCEVAR(PGTree pClassListTree);
|
|---|
| 234 | /* nomInit : override;*/
|
|---|
| 235 |
|
|---|
| 236 | };
|
|---|
| 237 |
|
|---|
| 238 | #endif /* nomcm_idl */
|
|---|
| 239 |
|
|---|
| 240 |
|
|---|
| 241 |
|
|---|
| 242 |
|
|---|
| 243 |
|
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
|
|---|