| 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 |
|
|---|
| 35 | #ifndef nomcm_idl
|
|---|
| 36 | #define nomcm_idl
|
|---|
| 37 |
|
|---|
| 38 | #include <nomobj.idl>
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | interface NOMClassMgr : NOMObject
|
|---|
| 42 | {
|
|---|
| 43 |
|
|---|
| 44 | NOMCLASSVERSION(1, 0 );
|
|---|
| 45 |
|
|---|
| 46 | /**
|
|---|
| 47 | Find the class with the given nomId in the internal class list managed by the
|
|---|
| 48 | class manager.
|
|---|
| 49 |
|
|---|
| 50 | \remark This method is only a stub for now.
|
|---|
| 51 |
|
|---|
| 52 | \par How to override
|
|---|
| 53 | This method is usually not overriden.
|
|---|
| 54 |
|
|---|
| 55 | \param classId The id of the class to be found.
|
|---|
| 56 | \param ulMajorVersion This parameter is not used at the moment and should be set to 0.
|
|---|
| 57 | \param ulMinorVersion This parameter is not used at the moment and should be set to 0.
|
|---|
| 58 | \return
|
|---|
| 59 | The class with the given name or NULL if not found.
|
|---|
| 60 | */
|
|---|
| 61 | Object nomFindClassFromId(in long classId,
|
|---|
| 62 | in long ulMajorVersion,
|
|---|
| 63 | in long ulMinorVersion);
|
|---|
| 64 |
|
|---|
| 65 | /**
|
|---|
| 66 | Find the class with the given name in the internal class list managed by the
|
|---|
| 67 | class manager.
|
|---|
| 68 |
|
|---|
| 69 | \remark
|
|---|
| 70 | This method will return classes and metaclasses.
|
|---|
| 71 |
|
|---|
| 72 | \par How to override
|
|---|
| 73 | This method is usually not overriden.
|
|---|
| 74 |
|
|---|
| 75 | \param className The name of the class to be found as a C string.
|
|---|
| 76 | \param ulMajorVersion This parameter is not used at the moment and should be set to 0.
|
|---|
| 77 | \param ulMinorVersion This parameter is not used at the moment and should be set to 0.
|
|---|
| 78 | \return
|
|---|
| 79 | The class with the given name or NULL if not found.
|
|---|
| 80 | */
|
|---|
| 81 | PNOMObject nomFindClassFromName(in string className,
|
|---|
| 82 | in long ulMajorVersion,
|
|---|
| 83 | in long ulNinorVersion);
|
|---|
| 84 |
|
|---|
| 85 | /**
|
|---|
| 86 | Register a given class in the internal list of classes.
|
|---|
| 87 |
|
|---|
| 88 | We register mtabs as unique pointers to classes. It's possible to get every
|
|---|
| 89 | information from an mtab. We don't use the class name because in case of
|
|---|
| 90 | meta classes several different meta classes for creating different objects
|
|---|
| 91 | may have the same name because the default meta class is always NOMClass.
|
|---|
| 92 | The mtab of each of this meta classes is different.
|
|---|
| 93 |
|
|---|
| 94 | In addition to maintaining a list of registered classes we also register the
|
|---|
| 95 | mtab in a balanced binary tree for fast retrieval. The data in this tree is
|
|---|
| 96 | used by nomIsObject() to check if a block of memory is actually an object by
|
|---|
| 97 | checking the memories mtab pointer against the registered list of mtabs.
|
|---|
| 98 |
|
|---|
| 99 | \remark Classes are registered usually from within nomClassReady().
|
|---|
| 100 |
|
|---|
| 101 | \par How to override
|
|---|
| 102 | This method is usually not overriden.
|
|---|
| 103 |
|
|---|
| 104 | \param classMtab The mtab of the class to be registered.
|
|---|
| 105 | */
|
|---|
| 106 | void nomRegisterClass(in gpointer classMtab);
|
|---|
| 107 |
|
|---|
| 108 | /**
|
|---|
| 109 | Get the internal list of classes.
|
|---|
| 110 |
|
|---|
| 111 | \par How to override
|
|---|
| 112 | This method is usually not overriden.
|
|---|
| 113 |
|
|---|
| 114 | \return
|
|---|
| 115 | A pointer on the head of a GData list. Note that this is not a copy.
|
|---|
| 116 |
|
|---|
| 117 | */
|
|---|
| 118 | PGData nomGetClassList();
|
|---|
| 119 |
|
|---|
| 120 | /**
|
|---|
| 121 |
|
|---|
| 122 | \par How to override
|
|---|
| 123 | This method is usually not overriden.
|
|---|
| 124 |
|
|---|
| 125 | \param className The class name as a C string.
|
|---|
| 126 | \return A nomClsInfo pointer for the given class. This structure is private and only used
|
|---|
| 127 | internally.
|
|---|
| 128 | */
|
|---|
| 129 | gpointer nomGetClassInfoPtrFromName(in string className);
|
|---|
| 130 |
|
|---|
| 131 | /**
|
|---|
| 132 | Register a method with the class manager. The data is used to find the class
|
|---|
| 133 | implementing a method from the method name.
|
|---|
| 134 |
|
|---|
| 135 | \param classMtab The mtab of a class.
|
|---|
| 136 | \param chrMethodName Method to be registered.
|
|---|
| 137 | */
|
|---|
| 138 | void nomRegisterMethod(in gpointer classMtab, in string chrMethodName);
|
|---|
| 139 |
|
|---|
| 140 | /**
|
|---|
| 141 | Method to check if the given object is indeed an object or just arbitrary
|
|---|
| 142 | storage. This is done by checking the mtab in the given object against a registered
|
|---|
| 143 | list of mtabs.
|
|---|
| 144 |
|
|---|
| 145 | \par How to override
|
|---|
| 146 | This method is usually not overriden.
|
|---|
| 147 |
|
|---|
| 148 | \param nomObject The object to be checked.
|
|---|
| 149 | \return
|
|---|
| 150 | True if the given object is a NOMObject.
|
|---|
| 151 | */
|
|---|
| 152 | boolean nomIsObject(in PNOMObject nomObject);
|
|---|
| 153 |
|
|---|
| 154 | /**
|
|---|
| 155 | Override of nomInit(). The list of methods and the list of classes are initialized
|
|---|
| 156 | in that method. In addition the balanced binary tree for registering mtabs is created.
|
|---|
| 157 | */
|
|---|
| 158 | NOMOVERRIDE(nomInit);
|
|---|
| 159 |
|
|---|
| 160 | /**
|
|---|
| 161 | The list of registered classes. Normal classes and metaclasses are registered.
|
|---|
| 162 | */
|
|---|
| 163 | NOMINSTANCEVAR(PGData gdataClassList);
|
|---|
| 164 |
|
|---|
| 165 | /**
|
|---|
| 166 | The list of registered methods.
|
|---|
| 167 | */
|
|---|
| 168 | NOMINSTANCEVAR(PGData gdataMethodList);
|
|---|
| 169 | /**
|
|---|
| 170 | Balanced binary tree holding the mtabs of all known classes.
|
|---|
| 171 | */
|
|---|
| 172 | NOMINSTANCEVAR(PGTree pClassListTree);
|
|---|
| 173 | /* nomInit : override;*/
|
|---|
| 174 |
|
|---|
| 175 | };
|
|---|
| 176 |
|
|---|
| 177 | #endif /* nomcm_idl */
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
|
|---|
| 187 |
|
|---|