Panda3D
Public Member Functions | Static Public Member Functions | List of all members
InterrogateDatabase Class Reference

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. More...
 
void add_function (FunctionIndex index, InterrogateFunction *function)
 Adds the indicated function to the database at the given index number. More...
 
void add_make_seq (MakeSeqIndex index, const InterrogateMakeSeq &make_seq)
 Adds the indicated make_seq to the database at the given index number. More...
 
void add_manifest (ManifestIndex index, const InterrogateManifest &manifest)
 Adds the indicated manifest constant to the database at the given index number. More...
 
void add_type (TypeIndex index, const InterrogateType &type)
 Adds the indicated type to the database at the given index number. More...
 
void add_wrapper (FunctionWrapperIndex index, const InterrogateFunctionWrapper &wrapper)
 Adds the indicated function wrapper to the database at the given index number. More...
 
FunctionIndex get_all_function (int n)
 Returns the index of the nth function known to the interrogate database. More...
 
TypeIndex get_all_type (int n)
 Returns the index of the nth type known to the interrogate database. More...
 
const InterrogateElementget_element (ElementIndex element)
 Returns the data element associated with the given ElementIndex, if there is one. More...
 
bool get_error_flag ()
 Returns the global error flag. More...
 
void * get_fptr (FunctionWrapperIndex wrapper)
 Returns the function pointer associated with the given function wrapper, if it has a pointer available. More...
 
const InterrogateFunctionget_function (FunctionIndex function)
 Returns the function associated with the given FunctionIndex, if there is one. More...
 
ElementIndex get_global_element (int n)
 Returns the index of the nth global data element known to the interrogate database. More...
 
FunctionIndex get_global_function (int n)
 Returns the index of the nth global function known to the interrogate database. More...
 
ManifestIndex get_global_manifest (int n)
 Returns the index of the nth global manifest constant known to the interrogate database. More...
 
TypeIndex get_global_type (int n)
 Returns the index of the nth global type known to the interrogate database. More...
 
const InterrogateMakeSeqget_make_seq (MakeSeqIndex element)
 Returns the make_seq associated with the given MakeSeqIndex, if there is one. More...
 
const InterrogateManifestget_manifest (ManifestIndex manifest)
 Returns the manifest constant associated with the given ManifestIndex, if there is one. More...
 
int get_next_index ()
 Returns a new index number suitable for the next thing, that will not be shared with any other index numbers. More...
 
int get_num_all_functions ()
 Returns the total number of functions known to the interrogate database. More...
 
int get_num_all_types ()
 Returns the total number of types known to the interrogate database. More...
 
int get_num_global_elements ()
 Returns the total number of global data elements known to the interrogate database. More...
 
int get_num_global_functions ()
 Returns the total number of global functions known to the interrogate database. More...
 
int get_num_global_manifests ()
 Returns the total number of global manifest constants known to the interrogate database. More...
 
int get_num_global_types ()
 Returns the total number of "global" types known to the interrogate database. More...
 
const InterrogateTypeget_type (TypeIndex type)
 Returns the type associated with the given TypeIndex, if there is one. More...
 
const InterrogateFunctionWrapperget_wrapper (FunctionWrapperIndex wrapper)
 Returns the function wrapper associated with the given FunctionWrapperIndex, if there is one. More...
 
FunctionWrapperIndex get_wrapper_by_unique_name (const std::string &unique_name)
 Looks up the function wrapper corresponding to the given unique name, if available. More...
 
ElementIndex lookup_element_by_name (const std::string &name)
 Returns the ElementIndex associated with the first element found with the given name, or 0 if no element has this name. More...
 
ElementIndex lookup_element_by_scoped_name (const std::string &name)
 Returns the ElementIndex associated with the first element found with the given scoped name, or 0 if no element has this name. More...
 
ManifestIndex lookup_manifest_by_name (const std::string &name)
 Returns the ManifestIndex associated with the first manifest found with the given name, or 0 if no manifest has this name. More...
 
TypeIndex lookup_type_by_name (const std::string &name)
 Returns the TypeIndex associated with the first type found with the given name, or 0 if no type has this name. More...
 
TypeIndex lookup_type_by_scoped_name (const std::string &name)
 Returns the TypeIndex associated with the first type found with the given scoped name, or 0 if no type has this name. More...
 
TypeIndex lookup_type_by_true_name (const std::string &name)
 Returns the TypeIndex associated with the first type found with the given true name, or 0 if no type has this name. More...
 
bool read (std::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. More...
 
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. More...
 
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. More...
 
void remove_type (TypeIndex type)
 Erases the type from the database. More...
 
void request_module (InterrogateModuleDef *def)
 Requests that the interrogate data for the given module be made available. More...
 
void set_error_flag (bool error_flag)
 Sets the global error flag. More...
 
InterrogateElementupdate_element (ElementIndex element)
 Returns a non-const reference to the indicated data element, allowing the user to update it. More...
 
InterrogateFunctionupdate_function (FunctionIndex function)
 Returns a non-const reference to the indicated function, allowing the user to update it. More...
 
InterrogateMakeSequpdate_make_seq (MakeSeqIndex make_seq)
 Returns a non-const reference to the indicated make_seq, allowing the user to update it. More...
 
InterrogateManifestupdate_manifest (ManifestIndex manifest)
 Returns a non-const reference to the indicated manifest constant, allowing the user to update it. More...
 
InterrogateTypeupdate_type (TypeIndex type)
 Returns a non-const reference to the indicated type, allowing the user to update it. More...
 
InterrogateFunctionWrapperupdate_wrapper (FunctionWrapperIndex wrapper)
 Returns a non-const reference to the indicated function wrapper, allowing the user to update it. More...
 
void write (std::ostream &out, InterrogateModuleDef *def) const
 Writes the database to the indicated stream for later reading. More...
 

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. More...
 
static int get_current_minor_version ()
 Returns the minor version number currently expected in interrogate database files generated by this code base. More...
 
static int get_file_major_version ()
 Returns the major version number of the interrogate database file currently being read. More...
 
static int get_file_minor_version ()
 Returns the minor version number of the interrogate database file currently being read. More...
 
static InterrogateDatabaseget_ptr ()
 Returns the global pointer to the one InterrogateDatabase. More...
 

Detailed Description

This stores all of the interrogate data and handles reading the data from a disk file when necessary.

Definition at line 36 of file interrogateDatabase.h.

Member Function Documentation

◆ add_element()

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 526 of file interrogateDatabase.cxx.

References InterrogateElement::is_global().

◆ add_function()

void InterrogateDatabase::add_function ( FunctionIndex  index,
InterrogateFunction function 
)

Adds the indicated function to the database at the given index number.

Definition at line 486 of file interrogateDatabase.cxx.

◆ add_make_seq()

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 540 of file interrogateDatabase.cxx.

◆ add_manifest()

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 514 of file interrogateDatabase.cxx.

◆ add_type()

void InterrogateDatabase::add_type ( TypeIndex  index,
const InterrogateType type 
)

Adds the indicated type to the database at the given index number.

Definition at line 461 of file interrogateDatabase.cxx.

References InterrogateType::is_global(), and InterrogateType::merge_with().

◆ add_wrapper()

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 502 of file interrogateDatabase.cxx.

◆ get_all_function()

FunctionIndex InterrogateDatabase::get_all_function ( int  n)

Returns the index of the nth function known to the interrogate database.

Definition at line 191 of file interrogateDatabase.cxx.

◆ get_all_type()

TypeIndex InterrogateDatabase::get_all_type ( int  n)

Returns the index of the nth type known to the interrogate database.

Definition at line 144 of file interrogateDatabase.cxx.

◆ get_current_major_version()

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 426 of file interrogateDatabase.cxx.

◆ get_current_minor_version()

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 435 of file interrogateDatabase.cxx.

◆ get_element()

const InterrogateElement & InterrogateDatabase::get_element ( ElementIndex  element)

Returns the data element associated with the given ElementIndex, if there is one.

Definition at line 317 of file interrogateDatabase.cxx.

◆ get_error_flag()

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 101 of file interrogateDatabase.cxx.

◆ get_file_major_version()

int InterrogateDatabase::get_file_major_version ( )
static

Returns the major version number of the interrogate database file currently being read.

Definition at line 408 of file interrogateDatabase.cxx.

◆ get_file_minor_version()

int InterrogateDatabase::get_file_minor_version ( )
static

Returns the minor version number of the interrogate database file currently being read.

Definition at line 417 of file interrogateDatabase.cxx.

Referenced by InterrogateElement::input().

◆ get_fptr()

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 359 of file interrogateDatabase.cxx.

◆ get_function()

const InterrogateFunction & InterrogateDatabase::get_function ( FunctionIndex  function)

Returns the function associated with the given FunctionIndex, if there is one.

Definition at line 266 of file interrogateDatabase.cxx.

◆ get_global_element()

ElementIndex InterrogateDatabase::get_global_element ( int  n)

Returns the index of the nth global data element known to the interrogate database.

Definition at line 237 of file interrogateDatabase.cxx.

◆ get_global_function()

FunctionIndex InterrogateDatabase::get_global_function ( int  n)

Returns the index of the nth global function known to the interrogate database.

Definition at line 168 of file interrogateDatabase.cxx.

◆ get_global_manifest()

ManifestIndex InterrogateDatabase::get_global_manifest ( int  n)

Returns the index of the nth global manifest constant known to the interrogate database.

Definition at line 214 of file interrogateDatabase.cxx.

◆ get_global_type()

TypeIndex InterrogateDatabase::get_global_type ( int  n)

Returns the index of the nth global type known to the interrogate database.

Definition at line 121 of file interrogateDatabase.cxx.

◆ get_make_seq()

const InterrogateMakeSeq & InterrogateDatabase::get_make_seq ( MakeSeqIndex  element)

Returns the make_seq associated with the given MakeSeqIndex, if there is one.

Definition at line 334 of file interrogateDatabase.cxx.

◆ get_manifest()

const InterrogateManifest & InterrogateDatabase::get_manifest ( ManifestIndex  manifest)

Returns the manifest constant associated with the given ManifestIndex, if there is one.

Definition at line 300 of file interrogateDatabase.cxx.

◆ get_next_index()

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 453 of file interrogateDatabase.cxx.

◆ get_num_all_functions()

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 182 of file interrogateDatabase.cxx.

◆ get_num_all_types()

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 135 of file interrogateDatabase.cxx.

◆ get_num_global_elements()

int InterrogateDatabase::get_num_global_elements ( )

Returns the total number of global data elements known to the interrogate database.

Definition at line 227 of file interrogateDatabase.cxx.

◆ get_num_global_functions()

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 158 of file interrogateDatabase.cxx.

◆ get_num_global_manifests()

int InterrogateDatabase::get_num_global_manifests ( )

Returns the total number of global manifest constants known to the interrogate database.

Definition at line 204 of file interrogateDatabase.cxx.

◆ get_num_global_types()

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 112 of file interrogateDatabase.cxx.

◆ get_ptr()

InterrogateDatabase * InterrogateDatabase::get_ptr ( )
static

Returns the global pointer to the one InterrogateDatabase.

Definition at line 42 of file interrogateDatabase.cxx.

◆ get_type()

const InterrogateType & InterrogateDatabase::get_type ( TypeIndex  type)

Returns the type associated with the given TypeIndex, if there is one.

Definition at line 249 of file interrogateDatabase.cxx.

◆ get_wrapper()

const InterrogateFunctionWrapper & InterrogateDatabase::get_wrapper ( FunctionWrapperIndex  wrapper)

Returns the function wrapper associated with the given FunctionWrapperIndex, if there is one.

Definition at line 283 of file interrogateDatabase.cxx.

◆ get_wrapper_by_unique_name()

FunctionWrapperIndex InterrogateDatabase::get_wrapper_by_unique_name ( const std::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 376 of file interrogateDatabase.cxx.

◆ lookup_element_by_name()

ElementIndex InterrogateDatabase::lookup_element_by_name ( const std::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 74 of file interrogateDatabase.I.

◆ lookup_element_by_scoped_name()

ElementIndex InterrogateDatabase::lookup_element_by_scoped_name ( const std::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 85 of file interrogateDatabase.I.

◆ lookup_manifest_by_name()

ManifestIndex InterrogateDatabase::lookup_manifest_by_name ( const std::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 63 of file interrogateDatabase.I.

◆ lookup_type_by_name()

TypeIndex InterrogateDatabase::lookup_type_by_name ( const std::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 30 of file interrogateDatabase.I.

◆ lookup_type_by_scoped_name()

TypeIndex InterrogateDatabase::lookup_type_by_scoped_name ( const std::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 41 of file interrogateDatabase.I.

◆ lookup_type_by_true_name()

TypeIndex InterrogateDatabase::lookup_type_by_true_name ( const std::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 52 of file interrogateDatabase.I.

◆ read()

bool InterrogateDatabase::read ( std::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 799 of file interrogateDatabase.cxx.

References remap_indices().

◆ remap_indices() [1/2]

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 613 of file interrogateDatabase.cxx.

Referenced by read().

◆ remap_indices() [2/2]

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 625 of file interrogateDatabase.cxx.

References IndexRemapper::add_mapping(), IndexRemapper::clear(), and IndexRemapper::map_from().

◆ remove_type()

void InterrogateDatabase::remove_type ( TypeIndex  type)

Erases the type from the database.

Definition at line 350 of file interrogateDatabase.cxx.

◆ request_module()

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 60 of file interrogateDatabase.cxx.

◆ set_error_flag()

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 444 of file interrogateDatabase.cxx.

◆ update_element()

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 592 of file interrogateDatabase.cxx.

◆ update_function()

InterrogateFunction & InterrogateDatabase::update_function ( FunctionIndex  function)

Returns a non-const reference to the indicated function, allowing the user to update it.

Definition at line 562 of file interrogateDatabase.cxx.

◆ update_make_seq()

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 602 of file interrogateDatabase.cxx.

◆ update_manifest()

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 582 of file interrogateDatabase.cxx.

◆ update_type()

InterrogateType & InterrogateDatabase::update_type ( TypeIndex  type)

Returns a non-const reference to the indicated type, allowing the user to update it.

Definition at line 551 of file interrogateDatabase.cxx.

◆ update_wrapper()

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 572 of file interrogateDatabase.cxx.

◆ write()

void InterrogateDatabase::write ( std::ostream &  out,
InterrogateModuleDef def 
) const

Writes the database to the indicated stream for later reading.

Definition at line 740 of file interrogateDatabase.cxx.

References idf_output_string().


The documentation for this class was generated from the following files: