Jason Sams | 221a4b1 | 2012-02-22 15:22:41 -0800 | [diff] [blame] | 1 | /* |
Jason Sams | 69cccdf | 2012-04-02 19:11:49 -0700 | [diff] [blame] | 2 | * Copyright (C) 2012 The Android Open Source Project |
Jason Sams | 221a4b1 | 2012-02-22 15:22:41 -0800 | [diff] [blame] | 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 | |
Jason Sams | 69cccdf | 2012-04-02 19:11:49 -0700 | [diff] [blame] | 21 | #include "utils/RefBase.h" |
Jason Sams | 221a4b1 | 2012-02-22 15:22:41 -0800 | [diff] [blame] | 22 | #include <pthread.h> |
| 23 | #include <rs.h> |
| 24 | |
| 25 | #include "RenderScript.h" |
| 26 | |
Jason Sams | 69cccdf | 2012-04-02 19:11:49 -0700 | [diff] [blame] | 27 | namespace android { |
| 28 | namespace renderscriptCpp { |
| 29 | |
| 30 | |
| 31 | class BaseObj : public android::LightRefBase<BaseObj> { |
Jason Sams | 221a4b1 | 2012-02-22 15:22:41 -0800 | [diff] [blame] | 32 | protected: |
| 33 | friend class Element; |
| 34 | friend class Type; |
Jason Sams | b2e3dc5 | 2012-02-23 17:14:39 -0800 | [diff] [blame] | 35 | friend class Allocation; |
| 36 | friend class Script; |
| 37 | friend class ScriptC; |
Jason Sams | 221a4b1 | 2012-02-22 15:22:41 -0800 | [diff] [blame] | 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 | |
Jason Sams | 69cccdf | 2012-04-02 19:11:49 -0700 | [diff] [blame] | 48 | static void * getObjID(sp<const BaseObj> o); |
Jason Sams | b2e3dc5 | 2012-02-23 17:14:39 -0800 | [diff] [blame] | 49 | |
Jason Sams | 221a4b1 | 2012-02-22 15:22:41 -0800 | [diff] [blame] | 50 | public: |
| 51 | |
| 52 | virtual ~BaseObj(); |
| 53 | virtual void updateFromNative(); |
| 54 | virtual bool equals(const BaseObj *obj); |
| 55 | }; |
| 56 | |
Jason Sams | 69cccdf | 2012-04-02 19:11:49 -0700 | [diff] [blame] | 57 | } |
| 58 | } |
Jason Sams | 221a4b1 | 2012-02-22 15:22:41 -0800 | [diff] [blame] | 59 | #endif |