Panda3D

Loading...
Searching...
No Matches
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.
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.
virtual TypeHandle | force_init_type ()
const InternalName * | get_ancestor (int n) const
| Returns the ancestor with the indicated index number.
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.
const InternalName * | get_top () const
| Returns the oldest ancestor in the InternalName's chain, not counting the root.
virtual TypeHandle | get_type () const
std::string | join (const std::string &sep) const
| Like get_name, but uses a custom separator instead of ".".
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.
virtual void | write_datagram (BamWriter *manager, Datagram &me)
| Function to write the important information in the particular object to a Datagram.
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.
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().
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.
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.
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.
UpdateSeq | get_bam_modified () const
| Returns the current bam_modified counter.
void | mark_bam_modified ()
| Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
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.
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.
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.
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer.
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.
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly.
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type.
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.
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void | ref () const
| Explicitly increments the reference count.
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero.
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one.
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object.
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object.

## Static Public Member Functions
static TypeHandle | get_class_type ()
static PT(InternalName) make(const std PT(InternalName) append(const std InternalName * | get_parent () const
static void | init_type ()
static | PT (InternalName) get_aspect_ratio()
static static PT(InternalName) get_tangent_name(const std | PT (InternalName) get_binormal()
static | PT (InternalName) get_camera()
static static PT(InternalName) get_texcoord_name(const std | PT (InternalName) get_color()
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 static PT(InternalName) get_binormal_name(const std | PT (InternalName) get_texcoord()
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 std | PT (InternalName) make(const char(&literal)[N])
static void | register_with_read_factory ()
| Factory method to generate a InternalName object.
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.
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.
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.
| get_name
| Returns the complete name represented by the InternalName and all of its parents.
| get_parent
| Return the parent of this InternalName.
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.

## 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.

## Constructor & Destructor Documentation

## ◆ ~InternalName()

InternalName::~InternalName | ( |  | ) |
| virtual

Definition at line 67 of file internalName.cxx.

## 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 ReferenceCount::get_ref_count, and 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().

Referenced by NodePath::find_all_texcoords().

## ◆ force_init_type()

virtual TypeHandle InternalName::force_init_type | ( |  | ) |
| inline virtual

Reimplemented from TypedWritableReferenceCount.

Definition at line 170 of file internalName.h.

## ◆ 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_class_type()

static TypeHandle InternalName::get_class_type | ( |  | ) |
| inline static

Definition at line 155 of file internalName.h.

## ◆ 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.

Referenced by NodePath::find_all_texcoords().

## ◆ 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().

Referenced by NodePath::find_all_texcoords().

## ◆ get_type()

virtual TypeHandle InternalName::get_type | ( |  | ) | const
| inline virtual

Reimplemented from TypedWritableReferenceCount.

Definition at line 167 of file internalName.h.

## ◆ init_type()

static void InternalName::init_type | ( |  | ) |
| inline static

Definition at line 158 of file internalName.h.

## ◆ 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.

## ◆ output()

void InternalName::output | ( | std::ostream & | out | ) | const

Definition at line 252 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 GraphicsStateGuardian::fetch_specified_part(), and 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 GraphicsStateGuardian::fetch_specified_part(), NodePath::find_all_vertex_columns(), Texture::load_related(), and 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.

Referenced by GraphicsStateGuardian::fetch_specified_part().

## ◆ slider

const std::string& InternalName::slider

Definition at line 89 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