15 #ifndef GEOMVERTEXARRAYDATA_H
16 #define GEOMVERTEXARRAYDATA_H
18 #include "pandabase.h"
19 #include "copyOnWriteObject.h"
20 #include "geomVertexArrayFormat.h"
21 #include "geomEnums.h"
22 #include "pta_uchar.h"
23 #include "updateSeq.h"
24 #include "cycleData.h"
25 #include "cycleDataReader.h"
26 #include "cycleDataWriter.h"
27 #include "cycleDataStageReader.h"
28 #include "cycleDataStageWriter.h"
29 #include "pipelineCycler.h"
32 #include "simpleLru.h"
33 #include "vertexDataBuffer.h"
34 #include "config_gobj.h"
35 #include "bamReader.h"
72 UsageHint usage_hint);
80 INLINE
const GeomVertexArrayFormat *get_array_format()
const;
82 INLINE UsageHint get_usage_hint()
const;
83 void set_usage_hint(UsageHint usage_hint);
85 INLINE
bool has_column(
const InternalName *name)
const;
87 INLINE
int get_num_rows()
const;
88 INLINE
bool set_num_rows(
int n);
89 INLINE
bool unclean_set_num_rows(
int n);
90 INLINE
bool reserve_num_rows(
int n);
91 INLINE
void clear_rows();
93 INLINE
int get_data_size_bytes()
const;
96 void output(ostream &out)
const;
97 void write(ostream &out,
int indent_level = 0)
const;
99 INLINE
bool request_resident()
const;
112 INLINE
static SimpleLru *get_independent_lru();
113 INLINE
static SimpleLru *get_small_lru();
114 static void lru_epoch();
117 #if PY_VERSION_HEX >= 0x02060000
118 EXTENSION(
int __getbuffer__(PyObject *
self, Py_buffer *view,
int flags));
119 EXTENSION(
int __getbuffer__(PyObject *
self, Py_buffer *view,
int flags)
const);
120 EXTENSION(
void __releasebuffer__(PyObject *
self, Py_buffer *view)
const);
130 void reverse_data_endianness(
unsigned char *dest,
131 const unsigned char *source,
size_t size);
134 CPT(GeomVertexArrayFormat) _array_format;
149 bool _endian_reversed;
153 class EXPCL_PANDA_GOBJ CData :
public CycleData {
156 INLINE CData(
const CData ©);
157 INLINE
void operator = (
const CData ©);
160 ALLOC_DELETED_CHAIN(CData);
163 void *extra_data)
const;
167 return GeomVertexArrayData::get_class_type();
170 UsageHint _usage_hint;
182 static void init_type() {
183 register_type(_type_handle,
"GeomVertexArrayData::CData");
218 static void init_type() {
219 CopyOnWriteObject::init_type();
220 register_type(_type_handle,
"GeomVertexArrayData",
221 CopyOnWriteObject::get_class_type());
225 return get_class_type();
227 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
258 const GeomVertexArrayData::CData *_cdata,
260 INLINE GeomVertexArrayDataHandle(
const GeomVertexArrayDataHandle &);
261 INLINE
void operator = (
const GeomVertexArrayDataHandle &);
264 INLINE ~GeomVertexArrayDataHandle();
267 ALLOC_DELETED_CHAIN_DECL(GeomVertexArrayDataHandle);
269 INLINE
Thread *get_current_thread()
const;
271 INLINE
const unsigned char *get_read_pointer(
bool force)
const;
272 unsigned char *get_write_pointer();
278 INLINE
const GeomVertexArrayFormat *get_array_format()
const;
279 INLINE UsageHint get_usage_hint()
const;
281 INLINE
int get_num_rows()
const;
282 bool set_num_rows(
int n);
283 bool unclean_set_num_rows(
int n);
284 bool reserve_num_rows(
int n);
285 INLINE
void clear_rows();
287 INLINE
int get_data_size_bytes()
const;
290 INLINE
bool request_resident()
const;
295 void copy_data_from(
const GeomVertexArrayDataHandle *other);
296 void copy_subdata_from(
size_t to_start,
size_t to_size,
297 const GeomVertexArrayDataHandle *other,
298 size_t from_start,
size_t from_size);
300 void copy_data_from(
const unsigned char *source,
size_t size);
301 void copy_subdata_from(
size_t to_start,
size_t to_size,
302 const unsigned char *source,
303 size_t from_start,
size_t from_size);
305 EXTENSION(
void copy_data_from(PyObject *buffer));
306 EXTENSION(
void copy_subdata_from(
size_t to_start,
size_t to_size,
308 EXTENSION(
void copy_subdata_from(
size_t to_start,
size_t to_size,
310 size_t from_start,
size_t from_size));
312 INLINE
string get_data()
const;
313 void set_data(
const string &data);
314 INLINE
string get_subdata(
size_t start,
size_t size)
const;
315 void set_subdata(
size_t start,
size_t size,
const string &data);
317 INLINE
void mark_used()
const;
322 GeomVertexArrayData::CData *_cdata;
329 static void init_type() {
330 ReferenceCount::init_type();
331 register_type(_type_handle,
"GeomVertexArrayDataHandle",
332 ReferenceCount::get_class_type());
343 #include "geomVertexArrayData.I"
An implementation of a very simple LRU algorithm.
This is our own Panda specialization on the default STL map.
PTA_uchar read_raw_data(BamReader *manager, DatagramIterator &source)
Called by CData::fillin to read the raw data of the array from the indicated datagram.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This class is similar to CycleDataWriter, except it allows writing to a particular stage of the pipel...
A single page of data maintained by a PipelineCycler.
Base class for objects that can be written to and read from Bam files.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is our own Panda specialization on the default STL list.
This data object is returned by GeomVertexArrayData::get_handle() or modify_handle().
A table of objects that are saved within the graphics context for reference by handle later...
void set_lru_size(size_t lru_size)
Specifies the size of this page, presumably in bytes, although any unit is possible.
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
A single block as returned from SimpleAllocator::alloc().
virtual void evict_lru()
Evicts the page from the LRU.
One atomic piece that may be managed by a SimpleLru chain.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
This is used to keep track of, and limit the size of, the cache of munged vertices, which would otherwise be distributed through all of the GeomVertexData objects in the system.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
A block of bytes that stores the actual raw vertex data referenced by a GeomVertexArrayData object...
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()...
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
A collection of VertexDataPages, which can be used to allocate new VertexDataBlock objects...
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...
This class is similar to CycleDataReader, except it allows reading from a particular stage of the pip...
A base class for all things that want to be reference-counted.
An STL function object class, this is intended to be used on any ordered collection of class objects ...
This base class provides basic reference counting, but also can be used with a CopyOnWritePointer to ...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A thread; that is, a lightweight process.
This is a special class object that holds all the information returned by a particular GSG to indicat...
static void register_with_read_factory()
Tells the BamReader how to create objects of type GeomVertexArrayData.
A class to retrieve the individual data elements previously stored in a Datagram. ...
virtual void write_datagram(BamWriter *, Datagram &) const
Writes the contents of this object to the datagram for shipping out to a Bam file.
TypeHandle is the identifier used to differentiate C++ class types.
This is a sequence number that increments monotonically.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
This is the data for one array of a GeomVertexData structure.
virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...