Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Member Functions
InternalName Class Reference

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

#include "internalName.h"

Inheritance diagram for InternalName:
TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

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 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 InternalNameget_ancestor (int n) const
 Returns the ancestor with the indicated index number.
const string & get_basename () const
 Return the name represented by just this particular InternalName object, ignoring its parents names.
string get_name () const
 Returns the complete name represented by the InternalName and all of its parents.
string get_net_basename (int n) const
 Returns the basename of this name prefixed by the indicated number of ancestors.
InternalNameget_parent () const
 Return the parent of this InternalName.
const InternalNameget_top () const
 Returns the oldest ancestor in the InternalName's chain, not counting the root.
virtual TypeHandle get_type () const
void output (ostream &out) const
 PT (InternalName) append(const string &basename)
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.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
static PT (InternalName) make(const string &name)
static PT (InternalName) make(const string &name
static PT (InternalName) get_root()
static PT (InternalName) get_error()
static PT (InternalName) get_vertex()
static PT (InternalName) get_normal()
static PT (InternalName) get_tangent()
static PT (InternalName) get_tangent_name(const string &name)
static PT (InternalName) get_binormal()
static PT (InternalName) get_binormal_name(const string &name)
static PT (InternalName) get_texcoord()
static PT (InternalName) get_texcoord_name(const string &name)
static PT (InternalName) get_color()
static PT (InternalName) get_rotate()
static PT (InternalName) get_size()
static PT (InternalName) get_aspect_ratio()
static PT (InternalName) get_transform_blend()
static PT (InternalName) get_transform_weight()
static PT (InternalName) get_transform_index()
static PT (InternalName) get_morph(InternalName *column
static PT (InternalName) get_index()
static PT (InternalName) get_world()
static PT (InternalName) get_camera()
static PT (InternalName) get_model()
static PT (InternalName) get_view()
static void register_with_read_factory ()
 Factory method to generate a InternalName object.

Public Attributes

static int index
static const string & slider

Static Protected Member Functions

static TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type InternalName is encountered in the Bam file.
static TypedWritablemake_texcoord_from_bam (const FactoryParams &params)
 This is a temporary method; it exists only to support old bam files (4.11 through 4.17) generated before we renamed this class from TexCoordName to InternalName.

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 42 of file internalName.h.


Member Function Documentation

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 288 of file internalName.cxx.

References ReferenceCount::get_ref_count(), and unref().

int InternalName::find_ancestor ( const 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 169 of file internalName.cxx.

References ReferenceCount::test_ref_count_integrity().

Referenced by NodePath::find_all_texcoords().

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 194 of file internalName.cxx.

References ReferenceCount::test_ref_count_integrity().

const string & InternalName::get_basename ( ) const [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 54 of file internalName.I.

string InternalName::get_name ( ) const

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

Definition at line 145 of file internalName.cxx.

Referenced by GraphicsStateGuardian::fetch_specified_part(), NodePath::find_all_vertex_columns(), Texture::load_related(), TextureStage::write(), and write_datagram().

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 235 of file internalName.cxx.

Referenced by NodePath::find_all_texcoords().

InternalName * InternalName::get_parent ( ) const [inline]

Return the parent of this InternalName.

All names have a parent, except the root name.

Definition at line 42 of file internalName.I.

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 217 of file internalName.cxx.

References ReferenceCount::test_ref_count_integrity().

Referenced by NodePath::find_all_texcoords().

TypedWritable * InternalName::make_from_bam ( const FactoryParams params) [static, protected]

This function is called by the BamReader's factory when a new object of type InternalName is encountered in the Bam file.

It should create the InternalName and extract its information from the file.

Definition at line 322 of file internalName.cxx.

References DatagramIterator::get_string(), and BamReader::register_finalize().

Referenced by register_with_read_factory().

TypedWritable * InternalName::make_texcoord_from_bam ( const FactoryParams params) [static, protected]

This is a temporary method; it exists only to support old bam files (4.11 through 4.17) generated before we renamed this class from TexCoordName to InternalName.

Definition at line 358 of file internalName.cxx.

References DatagramIterator::get_string(), and BamReader::register_finalize().

Referenced by register_with_read_factory().

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

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 384 of file internalName.cxx.

References Datagram::add_string(), and get_name().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations