X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Fobject%2Fbase-object.cpp;h=243fe2709673b799db6111fbfd1e7e201a1093ce;hb=403f5989d41f4e5c5a657e24020fe32c77fc1414;hp=65c09843bc30d710a36ca5e4830061d22df14357;hpb=24a826711c9b42968089e6ad54faead44a5df376;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/object/base-object.cpp b/dali/public-api/object/base-object.cpp index 65c0984..243fe27 100644 --- a/dali/public-api/object/base-object.cpp +++ b/dali/public-api/object/base-object.cpp @@ -1,18 +1,19 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // CLASS HEADER #include @@ -23,8 +24,7 @@ #include #include #include - -using namespace std; +#include namespace Dali { @@ -39,22 +39,25 @@ BaseObject::~BaseObject() void BaseObject::RegisterObject() { - if( Internal::Stage::IsInstalled() ) + Internal::ThreadLocalStorage* tls = Internal::ThreadLocalStorage::GetInternal(); + if ( tls ) { - Internal::Stage::GetCurrent()->GetObjectRegistry().RegisterObject( this ); + tls->GetEventThreadServices().RegisterObject( this ); } } void BaseObject::UnregisterObject() { + Internal::ThreadLocalStorage* tls = Internal::ThreadLocalStorage::GetInternal(); + // Guard to allow handle destruction after Core has been destroyed - if( Internal::Stage::IsInstalled() ) + if( tls ) { - Internal::Stage::GetCurrent()->GetObjectRegistry().UnregisterObject( this ); + tls->GetEventThreadServices().UnregisterObject( this ); } } -bool BaseObject::DoAction(const std::string& actionName, const std::vector& attributes) +bool BaseObject::DoAction(const std::string& actionName, const Property::Map& attributes) { Dali::Internal::TypeRegistry* registry = Dali::Internal::TypeRegistry::Get(); @@ -72,17 +75,33 @@ const std::string& BaseObject::GetTypeName() const if( registry ) { - Dali::TypeInfo typeInfo = registry->GetTypeInfo(this); + Internal::TypeRegistry::TypeInfoPointer typeInfo = registry->GetTypeInfo(this); if( typeInfo ) { - return typeInfo.GetName(); + return typeInfo->GetName(); } } - // We should not reach here - static const std::string INVALID_NAME; - DALI_LOG_ERROR( "TypeName Not Found\n" ); - return INVALID_NAME; + // Return an empty string if type-name not found. + DALI_LOG_WARNING( "TypeName Not Found\n" ); + static std::string empty; + return empty; +} + +bool BaseObject::GetTypeInfo(Dali::TypeInfo& typeInfo) const +{ + Dali::Internal::TypeRegistry* registry = Dali::Internal::TypeRegistry::Get(); + + Internal::TypeRegistry::TypeInfoPointer info = registry->GetTypeInfo(this); + if(info) + { + typeInfo = Dali::TypeInfo( info.Get() ); + return true; + } + else + { + return false; + } } bool BaseObject::DoConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor )