Panda3D

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
InternalName Class Referencefinal

Encodes a string name in a hash table, mapping it to a pointer. More...

`#include "internalName.h"`

Inheritance diagram for InternalName:

## Public Member Functions
virtual void | finalize (BamReader *manager)
| Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More...
int | find_ancestor (const std::string &basename) const
| Returns the index of the ancestor with the indicated basename, or -1 if no ancestor has that basename. More...
virtual TypeHandle | force_init_type ()
const InternalName * | get_ancestor (int n) const
| Returns the ancestor with the indicated index number. More...
const std::string & | get_basename () const
std::string | get_name () const
std::string | get_net_basename (int n) const
| Returns the basename of this name prefixed by the indicated number of ancestors. More...
const InternalName * | get_top () const
| Returns the oldest ancestor in the InternalName's chain, not counting the root. More...
virtual TypeHandle | get_type () const
std::string | join (const std::string &sep) const
| Like get_name, but uses a custom separator instead of ".". More...
void | output (std::ostream &out) const
virtual bool | unref () const
| This method overrides ReferenceCount::unref() to clear the pointer from its parent's table when its reference count goes to zero. More...
virtual void | write_datagram (BamWriter *manager, Datagram &me)
| Function to write the important information in the particular object to a Datagram. More...
Public Member Functions inherited from TypedWritableReferenceCount
| TypedWritableReferenceCount (const TypedWritableReferenceCount &copy)
virtual ReferenceCount * | as_reference_count ()
| Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More...
void | operator= (const TypedWritableReferenceCount &copy)
Public Member Functions inherited from TypedWritable
| TypedWritable (const TypedWritable &copy)
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager)
| Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). More...
vector_uchar | encode_to_bam_stream () const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More...
bool | encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More...
virtual void | fillin (DatagramIterator &scan, BamReader *manager)
| This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. More...
UpdateSeq | get_bam_modified () const
| Returns the current bam_modified counter. More...
void | mark_bam_modified ()
| Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
void | operator= (const TypedWritable &copy)
virtual bool | require_fully_complete () const
| Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More...
virtual void | update_bam_nested (BamWriter *manager)
| Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More...
Public Member Functions inherited from TypedObject
| TypedObject (const TypedObject &copy)=default
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer. More...
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer. More...
int | get_best_parent_from_Set (const std::set< int > &) const
int | get_type_index () const
| Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly. More...
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type. More...
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object. More...
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
void | ref () const
| Explicitly increments the reference count. More...
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero. More...
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus. More...
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one. More...
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object. More...
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object. More...

## Static Public Member Functions
static TypeHandle | get_class_type ()
static void | init_type ()
static | PT (InternalName) get_aspect_ratio()
static | PT (InternalName) get_camera()
static | PT (InternalName) get_error()
static | PT (InternalName) get_index()
static | PT (InternalName) get_model()
static | PT (InternalName) get_morph(InternalName *column
static | PT (InternalName) get_normal()
static | PT (InternalName) get_root()
static | PT (InternalName) get_rotate()
static | PT (InternalName) get_size()
static | PT (InternalName) get_tangent()
static | PT (InternalName) get_transform_blend()
static | PT (InternalName) get_transform_index()
static | PT (InternalName) get_transform_weight()
static | PT (InternalName) get_vertex()
static | PT (InternalName) get_view()
static | PT (InternalName) get_world()
template<int N>
static static PT(InternalName) make(const | PT (InternalName) make(const char(&literal)[N]) std
static void | register_with_read_factory ()
| Factory method to generate a InternalName object. More...
Static Public Member Functions inherited from TypedWritableReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
static | PT (TypedWritableReferenceCount) decode_from_bam_stream(vector_uchar data
Static Public Member Functions inherited from TypedWritable
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr)
| Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes. More...
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedObject
static TypeHandle | get_class_type ()
static void | init_type ()
| This function is declared non-inline to work around a compiler bug in g++ 2.96. More...
Static Public Member Functions inherited from ReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()

## Public Attributes
| get_basename
| Return the name represented by just this particular InternalName object, ignoring its parents names. More...
| get_name
| Returns the complete name represented by the InternalName and all of its parents. More...
| get_parent
| Return the parent of this InternalName. More...
static const std::string & | slider
Public Attributes inherited from TypedWritableReferenceCount
static BamReader * | reader = nullptr)
Public Attributes inherited from TypedObject
| get_type
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count. More...

## Additional Inherited Members
Static Public Attributes inherited from TypedWritable
static TypedWritable *const | Null = nullptr

## Detailed Description

Encodes a string name in a hash table, mapping it to a pointer.

This is used to tokenify names so they may be used efficiently in low-level Panda structures, for instance to differentiate the multiple sets of texture coordinates that might be stored on a Geom.

InternalNames are hierarchical, with the '.' used by convention as a separator character. You can construct a single InternalName as a composition of one or more other names, or by giving it a source string directly.

Definition at line 38 of file internalName.h.

## Member Function Documentation

## ◆ finalize()

void InternalName::finalize | ( | BamReader * | manager | ) |
| virtual

Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.

Reimplemented from TypedWritable.

Definition at line 280 of file internalName.cxx.

References unref().

## ◆ find_ancestor()

int InternalName::find_ancestor | ( | const std::string & | basename | ) | const

Returns the index of the ancestor with the indicated basename, or -1 if no ancestor has that basename.

Returns 0 if this name has the basename.

This index value may be passed to get_ancestor() or get_net_basename() to retrieve more information about the indicated name.

Definition at line 176 of file internalName.cxx.

References ReferenceCount::test_ref_count_integrity().

## ◆ get_ancestor()

const InternalName * InternalName::get_ancestor | ( | int | n | ) | const

Returns the ancestor with the indicated index number.

0 is this name itself, 1 is the name's parent, 2 is the parent's parent, and so on. If there are not enough ancestors, returns the root InternalName.

Definition at line 198 of file internalName.cxx.

References ReferenceCount::test_ref_count_integrity().

## ◆ get_net_basename()

string InternalName::get_net_basename | ( | int | n | ) | const

Returns the basename of this name prefixed by the indicated number of ancestors.

0 is this name's basename, 1 is parent.basename, 2 is grandparent.parent.basename, and so on.

Definition at line 233 of file internalName.cxx.

## ◆ get_top()

const InternalName * InternalName::get_top | ( |  | ) | const

Returns the oldest ancestor in the InternalName's chain, not counting the root.

This will be the first name in the string, e.g. "texcoord.foo.bar" will return the InternalName "texcoord".

Definition at line 218 of file internalName.cxx.

References ReferenceCount::test_ref_count_integrity().

## ◆ join()

string InternalName::join | ( | const std::string & | sep | ) | const

Like get_name, but uses a custom separator instead of ".".

Definition at line 156 of file internalName.cxx.

## ◆ register_with_read_factory()

void InternalName::register_with_read_factory | ( |  | ) |
| static

Factory method to generate a InternalName object.

Definition at line 269 of file internalName.cxx.

References BamReader::get_factory(), and Factory< Type >::register_factory().

## ◆ unref()

bool InternalName::unref | ( |  | ) | const
| virtual

This method overrides ReferenceCount::unref() to clear the pointer from its parent's table when its reference count goes to zero.

Reimplemented from ReferenceCount.

Definition at line 83 of file internalName.cxx.

References ReferenceCount::unref().

Referenced by finalize().

## ◆ write_datagram()

void InternalName::write_datagram | ( | BamWriter * | manager,
|  | Datagram & | me
| ) |  |
| virtual

Function to write the important information in the particular object to a Datagram.

Reimplemented from TypedWritable.

Definition at line 364 of file internalName.cxx.

References Datagram::add_string(), and get_name.

## Member Data Documentation

## ◆ get_basename

const std::string & InternalName::get_basename
| inline

Return the name represented by just this particular InternalName object, ignoring its parents names.

This is everything after the rightmost dot.

Definition at line 62 of file internalName.h.

Referenced by DXShaderContext9::update_shader_vertex_arrays().

## ◆ get_name

string InternalName::get_name

Returns the complete name represented by the InternalName and all of its parents.

Definition at line 61 of file internalName.h.

Referenced by write_datagram().

## ◆ get_parent

InternalName * InternalName::get_parent
| inline

Return the parent of this InternalName.

All names have a parent, except the root name.

Definition at line 60 of file internalName.h.

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

- panda/src/gobj/internalName.h
- panda/src/gobj/internalName.cxx
- panda/src/gobj/internalName.I