1a0931ebd64adb754e843db051c0f981c63e19275Colin Cross/* 2a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * Copyright (C) 2017 The Android Open Source Project 3a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * 4a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * Licensed under the Apache License, Version 2.0 (the "License"); 5a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * you may not use this file except in compliance with the License. 6a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * You may obtain a copy of the License at 7a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * 8a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * http://www.apache.org/licenses/LICENSE-2.0 9a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * 10a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * Unless required by applicable law or agreed to in writing, software 11a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * distributed under the License is distributed on an "AS IS" BASIS, 12a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * See the License for the specific language governing permissions and 14a0931ebd64adb754e843db051c0f981c63e19275Colin Cross * limitations under the License. 15a0931ebd64adb754e843db051c0f981c63e19275Colin Cross */ 16a0931ebd64adb754e843db051c0f981c63e19275Colin Cross 17a0931ebd64adb754e843db051c0f981c63e19275Colin Cross#include <utils/Singleton.h> 18a0931ebd64adb754e843db051c0f981c63e19275Colin Cross 19a0931ebd64adb754e843db051c0f981c63e19275Colin Cross#include "Singleton_test.h" 20a0931ebd64adb754e843db051c0f981c63e19275Colin Cross 21a0931ebd64adb754e843db051c0f981c63e19275Colin Crossnamespace android { 22a0931ebd64adb754e843db051c0f981c63e19275Colin Cross 23a0931ebd64adb754e843db051c0f981c63e19275Colin Cross// Singleton<SingletonTestStruct> is referenced in Singleton_test1.cpp and 24a0931ebd64adb754e843db051c0f981c63e19275Colin Cross// Singleton_test2.cpp, but only defined in Singleton_test1.cpp. 25a0931ebd64adb754e843db051c0f981c63e19275Colin CrossANDROID_SINGLETON_STATIC_INSTANCE(SingletonTestData); 26a0931ebd64adb754e843db051c0f981c63e19275Colin Cross 27a0931ebd64adb754e843db051c0f981c63e19275Colin Crossvoid singletonSetInstanceContents(unsigned int contents) { 28a0931ebd64adb754e843db051c0f981c63e19275Colin Cross SingletonTestData::getInstance().contents = contents; 29a0931ebd64adb754e843db051c0f981c63e19275Colin Cross} 30a0931ebd64adb754e843db051c0f981c63e19275Colin Cross 31a0931ebd64adb754e843db051c0f981c63e19275Colin Crossunsigned int singletonGetInstanceContents() { 32a0931ebd64adb754e843db051c0f981c63e19275Colin Cross return SingletonTestData::getInstance().contents; 33a0931ebd64adb754e843db051c0f981c63e19275Colin Cross} 34a0931ebd64adb754e843db051c0f981c63e19275Colin Cross 35a0931ebd64adb754e843db051c0f981c63e19275Colin Crossbool singletonHasInstance() { 36a0931ebd64adb754e843db051c0f981c63e19275Colin Cross return SingletonTestData::hasInstance(); 37a0931ebd64adb754e843db051c0f981c63e19275Colin Cross} 38a0931ebd64adb754e843db051c0f981c63e19275Colin Cross 39a0931ebd64adb754e843db051c0f981c63e19275Colin Cross} 40