Panda3D
Classes | Public Member Functions | Friends

DCPackerCatalog Class Reference

This object contains the names of all of the nested fields available within a particular field. More...

#include "dcPackerCatalog.h"

List of all members.

Classes

class  Entry
class  LiveCatalog
class  LiveCatalogEntry

Public Member Functions

int find_entry_by_field (const DCPackerInterface *field) const
 Returns the index number of the entry with the indicated field, or -1 if no entry has the indicated field.
int find_entry_by_name (const string &name) const
 Returns the index number of the entry with the indicated name, or -1 if no entry has the indicated name.
const Entryget_entry (int n) const
 Returns the nth entry in the catalog.
const LiveCatalogget_live_catalog (const char *data, size_t length) const
 Returns a LiveCatalog object indicating the positions within the indicated data record of each field within the catalog.
int get_num_entries () const
 Returns the number of entries in the catalog.
void release_live_catalog (const LiveCatalog *live_catalog) const
 Releases the LiveCatalog object that was returned by an earlier call to get_live_catalog().

Friends

class DCPackerInterface

Detailed Description

This object contains the names of all of the nested fields available within a particular field.

It is created on demand when a catalog is first requested from a particular field; its ownership is retained by the field so it must not be deleted.

Definition at line 32 of file dcPackerCatalog.h.


Member Function Documentation

int DCPackerCatalog::find_entry_by_field ( const DCPackerInterface field) const

Returns the index number of the entry with the indicated field, or -1 if no entry has the indicated field.

The return value is suitable for passing to get_entry().

Definition at line 92 of file dcPackerCatalog.cxx.

int DCPackerCatalog::find_entry_by_name ( const string &  name) const

Returns the index number of the entry with the indicated name, or -1 if no entry has the indicated name.

The return value is suitable for passing to get_entry().

Definition at line 74 of file dcPackerCatalog.cxx.

Referenced by DCPackerInterface::find_seek_index().

const DCPackerCatalog::Entry & DCPackerCatalog::get_entry ( int  n) const [inline]

Returns the nth entry in the catalog.

Definition at line 103 of file dcPackerCatalog.I.

const DCPackerCatalog::LiveCatalog * DCPackerCatalog::get_live_catalog ( const char *  data,
size_t  length 
) const

Returns a LiveCatalog object indicating the positions within the indicated data record of each field within the catalog.

If the catalog's fields are all fixed-width, this may return a statically-allocated LiveCatalog object that is the same for all data records; otherwise, it will allocate a new LiveCatalog object that must be freed with a later call to release_live_catalog().

Definition at line 114 of file dcPackerCatalog.cxx.

References DCPacker::begin_unpack(), DCPacker::end_unpack(), DCPackerInterface::has_fixed_structure(), and DCPacker::set_unpack_data().

Referenced by DCPacker::begin_repack(), and DCPacker::seek().

int DCPackerCatalog::get_num_entries ( ) const [inline]

Returns the number of entries in the catalog.

Definition at line 93 of file dcPackerCatalog.I.

void DCPackerCatalog::release_live_catalog ( const LiveCatalog live_catalog) const

Releases the LiveCatalog object that was returned by an earlier call to get_live_catalog().

If this represents a newly-allocated live catalog, it will free it; otherwise, it will do nothing.

It is therefore always correct (and necessary) to match a call to get_live_catalog() with a later call to release_live_catalog().

Definition at line 166 of file dcPackerCatalog.cxx.

Referenced by DCPacker::seek().


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