1 /* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __ANDROID_BASE_OBJ_H__ 18 #define __ANDROID_BASE_OBJ_H__ 19 20 21 #include "utils/RefBase.h" 22 #include <pthread.h> 23 #include <rs.h> 24 25 #include "RenderScript.h" 26 27 namespace android { 28 namespace renderscriptCpp { 29 30 31 class BaseObj : public android::LightRefBase<BaseObj> { 32 protected: 33 friend class Element; 34 friend class Type; 35 friend class Allocation; 36 friend class Script; 37 friend class ScriptC; 38 39 void *mID; 40 RenderScript *mRS; 41 android::String8 mName; 42 43 void * getID() const; 44 45 BaseObj(void *id, RenderScript *rs); 46 void checkValid(); 47 48 static void * getObjID(sp<const BaseObj> o); 49 50 public: 51 52 virtual ~BaseObj(); 53 virtual void updateFromNative(); 54 virtual bool equals(const BaseObj *obj); 55 }; 56 57 } 58 } 59 #endif 60