Panda3D
dcPackerCatalog.I
1 // Filename: dcPackerCatalog.I
2 // Created by: drose (21Jun04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: DCPackerCatalog::LiveCatalog::get_begin
18 // Access: Public
19 // Description: Returns the beginning of the indicated field within
20 // the live data.
21 ////////////////////////////////////////////////////////////////////
23 get_begin(int n) const {
24  nassertr(n >= 0 && n < (int)_live_entries.size(), 0);
25  return _live_entries[n]._begin;
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: DCPackerCatalog::LiveCatalog::get_end
30 // Access: Public
31 // Description: Returns the end of the indicated field (the byte
32 // position of the first following field) within the
33 // live data.
34 ////////////////////////////////////////////////////////////////////
36 get_end(int n) const {
37  nassertr(n >= 0 && n < (int)_live_entries.size(), 0);
38  return _live_entries[n]._end;
39 }
40 
41 ////////////////////////////////////////////////////////////////////
42 // Function: DCPackerCatalog::LiveCatalog::get_num_entries
43 // Access: Public
44 // Description: Returns the number of entries in the catalog.
45 ////////////////////////////////////////////////////////////////////
47 get_num_entries() const {
48  return _catalog->get_num_entries();
49 }
50 
51 ////////////////////////////////////////////////////////////////////
52 // Function: DCPackerCatalog::LiveCatalog::get_entry
53 // Access: Public
54 // Description: Returns the nth entry in the catalog.
55 ////////////////////////////////////////////////////////////////////
57 get_entry(int n) const {
58  return _catalog->get_entry(n);
59 }
60 
61 ////////////////////////////////////////////////////////////////////
62 // Function: DCPackerCatalog::LiveCatalog::find_entry_by_name
63 // Access: Public
64 // Description: Returns the index number of the entry with the
65 // indicated name, or -1 if no entry has the indicated
66 // name. The return value is suitable for passing to
67 // get_entry().
68 ////////////////////////////////////////////////////////////////////
70 find_entry_by_name(const string &name) const {
71  return _catalog->find_entry_by_name(name);
72 }
73 
74 ////////////////////////////////////////////////////////////////////
75 // Function: DCPackerCatalog::LiveCatalog::find_entry_by_field
76 // Access: Public
77 // Description: Returns the index number of the entry with the
78 // indicated field, or -1 if no entry has the indicated
79 // field. The return value is suitable for passing to
80 // get_entry().
81 ////////////////////////////////////////////////////////////////////
84  return _catalog->find_entry_by_field(field);
85 }
86 
87 ////////////////////////////////////////////////////////////////////
88 // Function: DCPackerCatalog::get_num_entries
89 // Access: Public
90 // Description: Returns the number of entries in the catalog.
91 ////////////////////////////////////////////////////////////////////
92 INLINE int DCPackerCatalog::
93 get_num_entries() const {
94  return _entries.size();
95 }
96 
97 ////////////////////////////////////////////////////////////////////
98 // Function: DCPackerCatalog::get_entry
99 // Access: Public
100 // Description: Returns the nth entry in the catalog.
101 ////////////////////////////////////////////////////////////////////
103 get_entry(int n) const {
104  nassertr(n >= 0 && n < (int)_entries.size(), _entries[0]);
105  return _entries[n];
106 }
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 na...
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 f...
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 f...
int get_num_entries() const
Returns the number of entries in the catalog.
int get_num_entries() const
Returns the number of entries in the catalog.
size_t get_end(int n) const
Returns the end of the indicated field (the byte position of the first following field) within the li...
const Entry & get_entry(int n) const
Returns the nth entry in the catalog.
size_t get_begin(int n) const
Returns the beginning of the indicated field within the live data.
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 na...
const Entry & get_entry(int n) const
Returns the nth entry in the catalog.
This defines the internal interface for packing values into a DCField.