2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/public-api/object/base-object.h>
22 #include <dali/public-api/object/type-registry.h>
23 #include <dali/integration-api/debug.h>
24 #include <dali/internal/event/common/object-registry-impl.h>
25 #include <dali/internal/event/common/stage-impl.h>
26 #include <dali/internal/event/common/type-registry-impl.h>
33 BaseObject::BaseObject()
37 BaseObject::~BaseObject()
41 void BaseObject::RegisterObject()
43 if( Internal::Stage::IsInstalled() )
45 Internal::Stage::GetCurrent()->GetObjectRegistry().RegisterObject( this );
49 void BaseObject::UnregisterObject()
51 // Guard to allow handle destruction after Core has been destroyed
52 if( Internal::Stage::IsInstalled() )
54 Internal::Stage::GetCurrent()->GetObjectRegistry().UnregisterObject( this );
58 bool BaseObject::DoAction(const std::string& actionName, const std::vector<Property::Value>& attributes)
60 Dali::Internal::TypeRegistry* registry = Dali::Internal::TypeRegistry::Get();
64 return registry->DoActionTo(this, actionName, attributes);
70 const std::string& BaseObject::GetTypeName() const
72 Dali::Internal::TypeRegistry* registry = Dali::Internal::TypeRegistry::Get();
76 Dali::TypeInfo typeInfo = registry->GetTypeInfo(this);
79 return typeInfo.GetName();
83 // Return an empty string if type-name not found.
84 DALI_LOG_WARNING( "TypeName Not Found\n" );
88 bool BaseObject::GetTypeInfo(Dali::TypeInfo& typeInfo) const
90 Dali::Internal::TypeRegistry* registry = Dali::Internal::TypeRegistry::Get();
92 Dali::TypeInfo info = registry->GetTypeInfo(this);
104 bool BaseObject::DoConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functor )
106 Dali::Internal::TypeRegistry* registry = Dali::Internal::TypeRegistry::Get();
110 return registry->ConnectSignal( this, connectionTracker, signalName, functor );