Panda3D
|
This stores all of the interrogate data and handles reading the data from a disk file when necessary. More...
#include "interrogateDatabase.h"
Public Member Functions | |
void | add_element (ElementIndex index, const InterrogateElement &element) |
Adds the indicated data element to the database at the given index number. | |
void | add_function (FunctionIndex index, InterrogateFunction *function) |
Adds the indicated function to the database at the given index number. | |
void | add_make_seq (MakeSeqIndex index, const InterrogateMakeSeq &make_seq) |
Adds the indicated make_seq to the database at the given index number. | |
void | add_manifest (ManifestIndex index, const InterrogateManifest &manifest) |
Adds the indicated manifest constant to the database at the given index number. | |
void | add_type (TypeIndex index, const InterrogateType &type) |
Adds the indicated type to the database at the given index number. | |
void | add_wrapper (FunctionWrapperIndex index, const InterrogateFunctionWrapper &wrapper) |
Adds the indicated function wrapper to the database at the given index number. | |
FunctionIndex | get_all_function (int n) |
Returns the index of the nth function known to the interrogate database. | |
TypeIndex | get_all_type (int n) |
Returns the index of the nth type known to the interrogate database. | |
const InterrogateElement & | get_element (ElementIndex element) |
Returns the data element associated with the given ElementIndex, if there is one. | |
bool | get_error_flag () |
Returns the global error flag. | |
void * | get_fptr (FunctionWrapperIndex wrapper) |
Returns the function pointer associated with the given function wrapper, if it has a pointer available. | |
const InterrogateFunction & | get_function (FunctionIndex function) |
Returns the function associated with the given FunctionIndex, if there is one. | |
ElementIndex | get_global_element (int n) |
Returns the index of the nth global data element known to the interrogate database. | |
FunctionIndex | get_global_function (int n) |
Returns the index of the nth global function known to the interrogate database. | |
ManifestIndex | get_global_manifest (int n) |
Returns the index of the nth global manifest constant known to the interrogate database. | |
TypeIndex | get_global_type (int n) |
Returns the index of the nth global type known to the interrogate database. | |
const InterrogateMakeSeq & | get_make_seq (MakeSeqIndex element) |
Returns the make_seq associated with the given MakeSeqIndex, if there is one. | |
const InterrogateManifest & | get_manifest (ManifestIndex manifest) |
Returns the manifest constant associated with the given ManifestIndex, if there is one. | |
int | get_next_index () |
Returns a new index number suitable for the next thing, that will not be shared with any other index numbers. | |
int | get_num_all_functions () |
Returns the total number of functions known to the interrogate database. | |
int | get_num_all_types () |
Returns the total number of types known to the interrogate database. | |
int | get_num_global_elements () |
Returns the total number of global data elements known to the interrogate database. | |
int | get_num_global_functions () |
Returns the total number of global functions known to the interrogate database. | |
int | get_num_global_manifests () |
Returns the total number of global manifest constants known to the interrogate database. | |
int | get_num_global_types () |
Returns the total number of "global" types known to the interrogate database. | |
const InterrogateType & | get_type (TypeIndex type) |
Returns the type associated with the given TypeIndex, if there is one. | |
const InterrogateFunctionWrapper & | get_wrapper (FunctionWrapperIndex wrapper) |
Returns the function wrapper associated with the given FunctionWrapperIndex, if there is one. | |
FunctionWrapperIndex | get_wrapper_by_unique_name (const string &unique_name) |
Looks up the function wrapper corresponding to the given unique name, if available. | |
ElementIndex | lookup_element_by_name (const string &name) |
Returns the ElementIndex associated with the first element found with the given name, or 0 if no element has this name. | |
ElementIndex | lookup_element_by_scoped_name (const string &name) |
Returns the ElementIndex associated with the first element found with the given scoped name, or 0 if no element has this name. | |
ManifestIndex | lookup_manifest_by_name (const string &name) |
Returns the ManifestIndex associated with the first manifest found with the given name, or 0 if no manifest has this name. | |
TypeIndex | lookup_type_by_name (const string &name) |
Returns the TypeIndex associated with the first type found with the given name, or 0 if no type has this name. | |
TypeIndex | lookup_type_by_scoped_name (const string &name) |
Returns the TypeIndex associated with the first type found with the given scoped name, or 0 if no type has this name. | |
TypeIndex | lookup_type_by_true_name (const string &name) |
Returns the TypeIndex associated with the first type found with the given true name, or 0 if no type has this name. | |
bool | read (istream &in, InterrogateModuleDef *def) |
Reads a database from the indicated stream, associated with the indicated module definition and merges it with any existing data in the database, according to the expected index numbers specified in the module def. | |
int | remap_indices (int first_index) |
Resequences all of the various index numbers so that all of the functions start at first_index and increment consecutively from there, and then all of the types follow. | |
int | remap_indices (int first_index, IndexRemapper &remap) |
This flavor of remap_indices() accepts a map that should be empty on initial call, and will be filled with the mapping of old index number to new index number. | |
void | remove_type (TypeIndex type) |
Erases the type from the database. | |
void | request_module (InterrogateModuleDef *def) |
Requests that the interrogate data for the given module be made available. | |
void | set_error_flag (bool error_flag) |
Sets the global error flag. | |
InterrogateElement & | update_element (ElementIndex element) |
Returns a non-const reference to the indicated data element, allowing the user to update it. | |
InterrogateFunction & | update_function (FunctionIndex function) |
Returns a non-const reference to the indicated function, allowing the user to update it. | |
InterrogateMakeSeq & | update_make_seq (MakeSeqIndex make_seq) |
Returns a non-const reference to the indicated make_seq, allowing the user to update it. | |
InterrogateManifest & | update_manifest (ManifestIndex manifest) |
Returns a non-const reference to the indicated manifest constant, allowing the user to update it. | |
InterrogateType & | update_type (TypeIndex type) |
Returns a non-const reference to the indicated type, allowing the user to update it. | |
InterrogateFunctionWrapper & | update_wrapper (FunctionWrapperIndex wrapper) |
Returns a non-const reference to the indicated function wrapper, allowing the user to update it. | |
void | write (ostream &out, InterrogateModuleDef *def) const |
Writes the database to the indicated stream for later reading. | |
Static Public Member Functions | |
static int | get_current_major_version () |
Returns the major version number currently expected in interrogate database files generated by this code base. | |
static int | get_current_minor_version () |
Returns the minor version number currently expected in interrogate database files generated by this code base. | |
static int | get_file_major_version () |
Returns the major version number of the interrogate database file currently being read. | |
static int | get_file_minor_version () |
Returns the minor version number of the interrogate database file currently being read. | |
static InterrogateDatabase * | get_ptr () |
Returns the global pointer to the one InterrogateDatabase. |
This stores all of the interrogate data and handles reading the data from a disk file when necessary.
Definition at line 38 of file interrogateDatabase.h.
void InterrogateDatabase::add_element | ( | ElementIndex | index, |
const InterrogateElement & | element | ||
) |
Adds the indicated data element to the database at the given index number.
Definition at line 620 of file interrogateDatabase.cxx.
References InterrogateElement::is_global().
void InterrogateDatabase::add_function | ( | FunctionIndex | index, |
InterrogateFunction * | function | ||
) |
Adds the indicated function to the database at the given index number.
Definition at line 573 of file interrogateDatabase.cxx.
References InterrogateFunction::is_global().
void InterrogateDatabase::add_make_seq | ( | MakeSeqIndex | index, |
const InterrogateMakeSeq & | make_seq | ||
) |
Adds the indicated make_seq to the database at the given index number.
Definition at line 637 of file interrogateDatabase.cxx.
void InterrogateDatabase::add_manifest | ( | ManifestIndex | index, |
const InterrogateManifest & | manifest | ||
) |
Adds the indicated manifest constant to the database at the given index number.
Definition at line 605 of file interrogateDatabase.cxx.
void InterrogateDatabase::add_type | ( | TypeIndex | index, |
const InterrogateType & | type | ||
) |
Adds the indicated type to the database at the given index number.
Definition at line 544 of file interrogateDatabase.cxx.
References InterrogateType::is_global(), and InterrogateType::merge_with().
void InterrogateDatabase::add_wrapper | ( | FunctionWrapperIndex | index, |
const InterrogateFunctionWrapper & | wrapper | ||
) |
Adds the indicated function wrapper to the database at the given index number.
Definition at line 591 of file interrogateDatabase.cxx.
FunctionIndex InterrogateDatabase::get_all_function | ( | int | n | ) |
Returns the index of the nth function known to the interrogate database.
Definition at line 225 of file interrogateDatabase.cxx.
TypeIndex InterrogateDatabase::get_all_type | ( | int | n | ) |
Returns the index of the nth type known to the interrogate database.
Definition at line 167 of file interrogateDatabase.cxx.
int InterrogateDatabase::get_current_major_version | ( | ) | [static] |
Returns the major version number currently expected in interrogate database files generated by this code base.
Definition at line 497 of file interrogateDatabase.cxx.
int InterrogateDatabase::get_current_minor_version | ( | ) | [static] |
Returns the minor version number currently expected in interrogate database files generated by this code base.
Definition at line 509 of file interrogateDatabase.cxx.
const InterrogateElement & InterrogateDatabase::get_element | ( | ElementIndex | element | ) |
Returns the data element associated with the given ElementIndex, if there is one.
Definition at line 370 of file interrogateDatabase.cxx.
bool InterrogateDatabase::get_error_flag | ( | ) |
Returns the global error flag.
This will be set true if there was some problem importing the database (e.g. cannot find an .in file), or false if everything is ok.
Definition at line 111 of file interrogateDatabase.cxx.
int InterrogateDatabase::get_file_major_version | ( | ) | [static] |
Returns the major version number of the interrogate database file currently being read.
Definition at line 474 of file interrogateDatabase.cxx.
int InterrogateDatabase::get_file_minor_version | ( | ) | [static] |
Returns the minor version number of the interrogate database file currently being read.
Definition at line 485 of file interrogateDatabase.cxx.
Referenced by InterrogateFunction::input().
void * InterrogateDatabase::get_fptr | ( | FunctionWrapperIndex | wrapper | ) |
Returns the function pointer associated with the given function wrapper, if it has a pointer available.
Returns NULL if the pointer is not available.
Definition at line 420 of file interrogateDatabase.cxx.
const InterrogateFunction & InterrogateDatabase::get_function | ( | FunctionIndex | function | ) |
Returns the function associated with the given FunctionIndex, if there is one.
Definition at line 313 of file interrogateDatabase.cxx.
ElementIndex InterrogateDatabase::get_global_element | ( | int | n | ) |
Returns the index of the nth global data element known to the interrogate database.
Definition at line 279 of file interrogateDatabase.cxx.
FunctionIndex InterrogateDatabase::get_global_function | ( | int | n | ) |
Returns the index of the nth global function known to the interrogate database.
Definition at line 196 of file interrogateDatabase.cxx.
ManifestIndex InterrogateDatabase::get_global_manifest | ( | int | n | ) |
Returns the index of the nth global manifest constant known to the interrogate database.
Definition at line 252 of file interrogateDatabase.cxx.
TypeIndex InterrogateDatabase::get_global_type | ( | int | n | ) |
Returns the index of the nth global type known to the interrogate database.
Definition at line 138 of file interrogateDatabase.cxx.
const InterrogateMakeSeq & InterrogateDatabase::get_make_seq | ( | MakeSeqIndex | element | ) |
Returns the make_seq associated with the given MakeSeqIndex, if there is one.
Definition at line 389 of file interrogateDatabase.cxx.
const InterrogateManifest & InterrogateDatabase::get_manifest | ( | ManifestIndex | manifest | ) |
Returns the manifest constant associated with the given ManifestIndex, if there is one.
Definition at line 351 of file interrogateDatabase.cxx.
int InterrogateDatabase::get_next_index | ( | ) |
Returns a new index number suitable for the next thing, that will not be shared with any other index numbers.
Definition at line 533 of file interrogateDatabase.cxx.
int InterrogateDatabase::get_num_all_functions | ( | ) |
Returns the total number of functions known to the interrogate database.
This includes all known functions, global, method, or synthesized. See also get_num_global_functions().
Definition at line 213 of file interrogateDatabase.cxx.
int InterrogateDatabase::get_num_all_types | ( | ) |
Returns the total number of types known to the interrogate database.
This includes all known types, global as well as incidental. See also get_num_global_types().
Definition at line 155 of file interrogateDatabase.cxx.
int InterrogateDatabase::get_num_global_elements | ( | ) |
Returns the total number of global data elements known to the interrogate database.
Definition at line 267 of file interrogateDatabase.cxx.
int InterrogateDatabase::get_num_global_functions | ( | ) |
Returns the total number of global functions known to the interrogate database.
These are functions defined at the global level, e.g. non-member functions.
Definition at line 184 of file interrogateDatabase.cxx.
int InterrogateDatabase::get_num_global_manifests | ( | ) |
Returns the total number of global manifest constants known to the interrogate database.
Definition at line 240 of file interrogateDatabase.cxx.
int InterrogateDatabase::get_num_global_types | ( | ) |
Returns the total number of "global" types known to the interrogate database.
These are types defined at the global level that should be considered for exporting, but not the incidental types (like pointers, etc.) that must be defined to support these.
Definition at line 126 of file interrogateDatabase.cxx.
InterrogateDatabase * InterrogateDatabase::get_ptr | ( | ) | [static] |
Returns the global pointer to the one InterrogateDatabase.
Definition at line 45 of file interrogateDatabase.cxx.
const InterrogateType & InterrogateDatabase::get_type | ( | TypeIndex | type | ) |
Returns the type associated with the given TypeIndex, if there is one.
Definition at line 294 of file interrogateDatabase.cxx.
const InterrogateFunctionWrapper & InterrogateDatabase::get_wrapper | ( | FunctionWrapperIndex | wrapper | ) |
Returns the function wrapper associated with the given FunctionWrapperIndex, if there is one.
Definition at line 332 of file interrogateDatabase.cxx.
FunctionWrapperIndex InterrogateDatabase::get_wrapper_by_unique_name | ( | const string & | unique_name | ) |
Looks up the function wrapper corresponding to the given unique name, if available.
Returns the corresponding wrapper index, or 0 if no such wrapper is found.
Definition at line 440 of file interrogateDatabase.cxx.
ElementIndex InterrogateDatabase::lookup_element_by_name | ( | const string & | name | ) | [inline] |
Returns the ElementIndex associated with the first element found with the given name, or 0 if no element has this name.
Definition at line 93 of file interrogateDatabase.I.
ElementIndex InterrogateDatabase::lookup_element_by_scoped_name | ( | const string & | name | ) | [inline] |
Returns the ElementIndex associated with the first element found with the given scoped name, or 0 if no element has this name.
Definition at line 107 of file interrogateDatabase.I.
ManifestIndex InterrogateDatabase::lookup_manifest_by_name | ( | const string & | name | ) | [inline] |
Returns the ManifestIndex associated with the first manifest found with the given name, or 0 if no manifest has this name.
Definition at line 79 of file interrogateDatabase.I.
TypeIndex InterrogateDatabase::lookup_type_by_name | ( | const string & | name | ) | [inline] |
Returns the TypeIndex associated with the first type found with the given name, or 0 if no type has this name.
Definition at line 37 of file interrogateDatabase.I.
TypeIndex InterrogateDatabase::lookup_type_by_scoped_name | ( | const string & | name | ) | [inline] |
Returns the TypeIndex associated with the first type found with the given scoped name, or 0 if no type has this name.
Definition at line 51 of file interrogateDatabase.I.
TypeIndex InterrogateDatabase::lookup_type_by_true_name | ( | const string & | name | ) | [inline] |
Returns the TypeIndex associated with the first type found with the given true name, or 0 if no type has this name.
Definition at line 65 of file interrogateDatabase.I.
bool InterrogateDatabase::read | ( | istream & | in, |
InterrogateModuleDef * | def | ||
) |
Reads a database from the indicated stream, associated with the indicated module definition and merges it with any existing data in the database, according to the expected index numbers specified in the module def.
The header information has already been read.
Returns true if the file is read successfully, false if there is an error.
Definition at line 923 of file interrogateDatabase.cxx.
References remap_indices().
int InterrogateDatabase::remap_indices | ( | int | first_index, |
IndexRemapper & | remap | ||
) |
This flavor of remap_indices() accepts a map that should be empty on initial call, and will be filled with the mapping of old index number to new index number.
This allows the caller to update its own data structures to match the new index numbers.
Definition at line 741 of file interrogateDatabase.cxx.
References IndexRemapper::add_mapping(), IndexRemapper::clear(), and IndexRemapper::map_from().
int InterrogateDatabase::remap_indices | ( | int | first_index | ) |
Resequences all of the various index numbers so that all of the functions start at first_index and increment consecutively from there, and then all of the types follow.
Returns the next available index number.
Definition at line 726 of file interrogateDatabase.cxx.
Referenced by read().
void InterrogateDatabase::remove_type | ( | TypeIndex | type | ) |
Erases the type from the database.
Definition at line 407 of file interrogateDatabase.cxx.
void InterrogateDatabase::request_module | ( | InterrogateModuleDef * | def | ) |
Requests that the interrogate data for the given module be made available.
The function pointers will be made available immediately, while the database file will be read later, the next time someone asks for interrogate data that requires it.
Definition at line 66 of file interrogateDatabase.cxx.
void InterrogateDatabase::set_error_flag | ( | bool | error_flag | ) |
Sets the global error flag.
This should be set true if there was some problem importing the database (e.g. cannot find an .in file).
Definition at line 521 of file interrogateDatabase.cxx.
InterrogateElement & InterrogateDatabase::update_element | ( | ElementIndex | element | ) |
Returns a non-const reference to the indicated data element, allowing the user to update it.
Definition at line 699 of file interrogateDatabase.cxx.
InterrogateFunction & InterrogateDatabase::update_function | ( | FunctionIndex | function | ) |
Returns a non-const reference to the indicated function, allowing the user to update it.
Definition at line 663 of file interrogateDatabase.cxx.
InterrogateMakeSeq & InterrogateDatabase::update_make_seq | ( | MakeSeqIndex | make_seq | ) |
Returns a non-const reference to the indicated make_seq, allowing the user to update it.
Definition at line 711 of file interrogateDatabase.cxx.
InterrogateManifest & InterrogateDatabase::update_manifest | ( | ManifestIndex | manifest | ) |
Returns a non-const reference to the indicated manifest constant, allowing the user to update it.
Definition at line 687 of file interrogateDatabase.cxx.
InterrogateType & InterrogateDatabase::update_type | ( | TypeIndex | type | ) |
Returns a non-const reference to the indicated type, allowing the user to update it.
Definition at line 650 of file interrogateDatabase.cxx.
InterrogateFunctionWrapper & InterrogateDatabase::update_wrapper | ( | FunctionWrapperIndex | wrapper | ) |
Returns a non-const reference to the indicated function wrapper, allowing the user to update it.
Definition at line 675 of file interrogateDatabase.cxx.
void InterrogateDatabase::write | ( | ostream & | out, |
InterrogateModuleDef * | def | ||
) | const |
Writes the database to the indicated stream for later reading.
Definition at line 859 of file interrogateDatabase.cxx.