14#ifndef COPYONWRITEOBJECT_H
15#define COPYONWRITEOBJECT_H
31 #define COW_THREADED 1
41class EXPCL_PANDA_PUTIL CopyOnWriteObject :
public CachedTypedWritableReferenceCount {
43 INLINE CopyOnWriteObject();
44 INLINE CopyOnWriteObject(
const CopyOnWriteObject ©);
45 INLINE
void operator = (
const CopyOnWriteObject ©);
49 virtual bool unref()
const;
58 virtual PT(CopyOnWriteObject) make_cow_copy()=0;
69 LockStatus _lock_status;
75 return get_class_type();
77 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
85 static void init_type() {
86 CachedTypedWritableReferenceCount::init_type();
88 CachedTypedWritableReferenceCount::get_class_type());
94 friend class CopyOnWritePointer;
102class CopyOnWriteObj :
public CopyOnWriteObject,
public Base {
104 INLINE CopyOnWriteObj();
105 INLINE CopyOnWriteObj(
const Base ©);
106 INLINE CopyOnWriteObj(
const CopyOnWriteObj<Base> ©);
107 ALLOC_DELETED_CHAIN(CopyOnWriteObj<Base>);
110 virtual PT(CopyOnWriteObject) make_cow_copy();
114 return get_class_type();
116 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
124 static void init_type();
133template<
class Base,
class Param1>
134class CopyOnWriteObj1 :
public CopyOnWriteObject,
public Base {
136 INLINE CopyOnWriteObj1(Param1 p1);
137 INLINE CopyOnWriteObj1(
const Base ©);
138 INLINE CopyOnWriteObj1(
const CopyOnWriteObj1<Base, Param1> ©);
140 typedef CopyOnWriteObj1<Base, Param1> ThisClass;
141 ALLOC_DELETED_CHAIN(ThisClass)
144 virtual PT(CopyOnWriteObject) make_cow_copy();
148 return get_class_type();
150 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
158 static void init_type();
166INLINE
void PointerToBase<CopyOnWriteObject>::update_type(
To *ptr) {}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void cache_ref() const
Explicitly increments the cache reference count and the normal reference count simultaneously.
bool cache_unref() const
Explicitly decrements the cache reference count and the normal reference count simultaneously.
void cache_ref_only() const
Decrements the cache reference count without affecting the normal reference count.
A condition variable, usually used to communicate information about changing state to a thread that i...
A standard mutex, or mutual exclusion lock.
virtual bool unref() const
Explicitly decrements the reference count.
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...