#include <loader.h>
Inheritance diagram for Loader:
Public Member Functions | |
Loader () | |
~Loader () | |
int | find_all_files (const Filename &filename, const DSearchPath &search_path, Results &results) const |
Searches along the given search path for the given file name, and fills up the results list with all possible matches and their associated types, in order. | |
PointerTo< PandaNode > | load_sync (const Filename &filename, bool search=true) const |
uint | request_load (const string &event_name, const Filename &filename, bool search=true) |
Requests an asynchronous load of a file. | |
bool | check_load (uint id) |
Returns true if the indicated load-request has completed and not yet been fetched, false otherwise. | |
PointerTo< PandaNode > | fetch_load (uint id) |
Returns the Node associated with the indicated id number (returned by a previous call to request_load), or NULL if the request has not yet completed. | |
void | set_frequency (float frequency) |
Fraction of a second. | |
float | get_frequency (void) const |
void | create_thread (void) |
Protected Member Functions | |
void | destroy_thread (void) |
void | callback (void) |
This is the main body of the sub-thread. | |
void | nap (void) const |
Static Protected Member Functions | |
void * | st_callback (void *arg) |
This is a static wrapper around the callback() method, below. | |
Protected Attributes | |
int | _next_token |
bool | _shutdown |
bool | _threaded |
float | _frequency |
bool | _threads_enabled |
Private Types | |
typedef TokenBoard< LoaderToken > | LoaderTokenBoard |
Private Member Functions | |
virtual bool | process_request (void) |
Serves any requests on the token board, moving them to the done queue. | |
PointerTo< PandaNode > | load_file (const Filename &filename, bool search) const |
Loads a single scene graph file, if possible. | |
Static Private Member Functions | |
void | load_file_types () |
Loads up all of the dynamic libraries named in a load-file-type Configure variable. | |
Private Attributes | |
LoaderTokenBoard * | _token_board |
Static Private Attributes | |
bool | _file_types_loaded = false |
Definition at line 46 of file loader.h.
|
|
|
Definition at line 81 of file loader.cxx. References _token_board, and AsyncUtility::destroy_thread(). |
|
Definition at line 93 of file loader.cxx. References _file_types_loaded, Filename::get_extension(), LoaderFileTypeRegistry::get_ptr(), LoaderFileTypeRegistry::get_type_from_extension(), Filename::is_local(), load_file_types(), and NULL. |
|
This is the main body of the sub-thread. It waits forever for a request to show up, and then serves it. Definition at line 160 of file asyncUtility.cxx. |
|
Returns true if the indicated load-request has completed and not yet been fetched, false otherwise.
Definition at line 314 of file loader.cxx. References load_file_type, and NULL. |
|
Definition at line 80 of file asyncUtility.cxx. References AsyncUtility::_shutdown, and AsyncUtility::_threaded. |
|
Definition at line 99 of file asyncUtility.cxx. Referenced by Loader(). |
|
Returns the Node associated with the indicated id number (returned by a previous call to request_load), or NULL if the request has not yet completed.
Definition at line 331 of file loader.cxx. References TokenBoard< LoaderToken >::_done, _token_board, TokenBoard< LoaderToken >::_waiting, CircBuffer< PointerTo< LoaderToken >, MAX_TOKENBOARD_REQUESTS >::empty(), CircBuffer< PointerTo< LoaderToken >, MAX_TOKENBOARD_REQUESTS >::front(), load_file(), NULL, CircBuffer< PointerTo< LoaderToken >, MAX_TOKENBOARD_REQUESTS >::pop_front(), PT, and CircBuffer< PointerTo< LoaderToken >, MAX_TOKENBOARD_REQUESTS >::push_back(). |
|
Searches along the given search path for the given file name, and fills up the results list with all possible matches and their associated types, in order.
Definition at line 113 of file loader.cxx. Referenced by process_request(). |
|
Definition at line 43 of file asyncUtility.I. |
|
Loads a single scene graph file, if possible. Returns the Node that is the root of the file, or NULL if the file cannot be loaded. If search is true, the file is searched for along the model path; otherwise, only the exact filename is loaded. Definition at line 445 of file loader.cxx. Referenced by fetch_load(), and Loader::Results::get_file_type(). |
|
Loads up all of the dynamic libraries named in a load-file-type Configure variable. Presumably this will make the various file types available for runtime loading. Definition at line 357 of file loader.cxx. Referenced by Loader::Results::get_file_type(), and ~Loader(). |
|
Referenced by get_models(). |
|
Definition at line 179 of file asyncUtility.cxx. |
|
Serves any requests on the token board, moving them to the done queue.
Implements AsyncUtility. Definition at line 387 of file loader.cxx. References find_all_files(), and get_model_path(). |
|
Requests an asynchronous load of a file. The request will be queued and served by the asynchronous thread. If event_name is nonempty, it is the name of the event that will be thrown (with the uint id as its single parameter) when the loading is completed later. The return value is an integer which can be used to identify this particular request later to fetch_load(), or 0 if there has been an error. If search is true, the file is searched for along the model path; otherwise, only the exact filename is loaded. Definition at line 241 of file loader.cxx. References _token_board. |
|
Fraction of a second.
Definition at line 31 of file asyncUtility.I. References AsyncUtility::_frequency, and INLINE. |
|
This is a static wrapper around the callback() method, below. It's static just so we can pass it to the thread-creation function. In addition, the function has a void* return type even though we don't actually return anything. This is necessary because ipc assumes a function that does not return anything indicates that the associated thread should be created as unjoinable (detached). Definition at line 141 of file asyncUtility.cxx. Referenced by AsyncUtility::~AsyncUtility(). |
|
Definition at line 43 of file loader.cxx. Referenced by ~Loader(). |
|
Definition at line 68 of file asyncUtility.h. Referenced by AsyncUtility::set_frequency(). |
|
Definition at line 65 of file asyncUtility.h. |
|
Definition at line 66 of file asyncUtility.h. Referenced by AsyncUtility::create_thread(). |
|
Definition at line 67 of file asyncUtility.h. Referenced by AsyncUtility::create_thread(), and AsyncUtility::~AsyncUtility(). |
|
Definition at line 69 of file asyncUtility.h. Referenced by AsyncUtility::~AsyncUtility(). |
|
Definition at line 95 of file loader.h. Referenced by fetch_load(), Loader(), and request_load(). |