Add named objects and implement support for ProgramFragmentStore and ProgramFragment to be used by name in scripts.
diff --git a/libs/rs/rsObjectBase.h b/libs/rs/rsObjectBase.h
index ca7acda..4c52e9c 100644
--- a/libs/rs/rsObjectBase.h
+++ b/libs/rs/rsObjectBase.h
@@ -33,7 +33,13 @@
void incRef() const;
void decRef() const;
+ const char * getName() const {
+ return mName;
+ }
+ void setName(const char *);
+
private:
+ char * mName;
mutable int32_t mRefCount;
@@ -49,12 +55,16 @@
ObjectBaseRef(const ObjectBaseRef &ref) {
mRef = ref.get();
- mRef->incRef();
+ if (mRef) {
+ mRef->incRef();
+ }
}
ObjectBaseRef(T *ref) {
mRef = ref;
- ref->incRef();
+ if (mRef) {
+ ref->incRef();
+ }
}
~ObjectBaseRef() {
@@ -65,10 +75,16 @@
if (mRef != ref) {
clear();
mRef = ref;
- ref->incRef();
+ if (mRef) {
+ ref->incRef();
+ }
}
}
+ void set(const ObjectBaseRef &ref) {
+ set(ref.mRef);
+ }
+
void clear() {
if (mRef) {
mRef->decRef();