Ferreteria/v0.5/classloader: Difference between revisions
< Ferreteria | v0.5
Jump to navigation
Jump to search
(Created page with "The ClassLoader handles loading of all other classes in Ferreteria. It is (of necessity) written so it can be used without any other part of Ferreteria. ==Class Structure== *...") |
m (Woozle moved page Ferreteria/v0.5/ClassLoader to Ferreteria/v0.5/classloader: lowercasing everything to prevent bad links) |
(No difference)
|
Revision as of 17:28, 9 March 2022
The ClassLoader handles loading of all other classes in Ferreteria. It is (of necessity) written so it can be used without any other part of Ferreteria.
Class Structure
- the csLoader class is just to encapsulate the top-level module/class registry and autoloading
- a caLibrary object:
- is a named set of Modules which are only loaded by explicit request from the application
- has a BasePath, to which all Module files are relative; defaults to csLoader's BasePath
- invokes a specific index file which loads the rest of the Library via its Module object
- ...which may itself invoke other index files via caModule->IncludeIndex()
- ...the format of which is defined by cModule descendants
- The index file is only processed when its Library is requested
- a caModule object:
- contains zero or more registered classes
- maps to a single directly-executable code file
Process
- When an application requests a Library (via
csLoader::LoadLibrary()
), the master index for that Library is executed (which may load other index files) -- but the code files are not loaded/executed yet. - When a class-autoload request comes in to
csLoader::_LoadClass()
, csLoader checks the class list (which it maintains) to see which code-file needs to finally be loaded, and loads/executes it.