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