1 #ifndef __DALI_BASE_OBJECT_H__
2 #define __DALI_BASE_OBJECT_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/ref-object.h>
23 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/object/property.h>
25 #include <dali/public-api/signals/functor-delegate.h>
30 * @addtogroup dali-core-object
37 * @brief A base class for objects.
39 class DALI_IMPORT_API BaseObject : public Dali::RefObject
44 * @brief Connects a void() functor to a specified signal.
46 * @pre The signal must be available in this object.
47 * @param [in] connectionTracker A connection tracker which can be used to disconnect.
48 * @param [in] signalName Name of the signal to connect to.
49 * @param [in] functor The functor to copy.
50 * @return True if the signal was available.
53 bool ConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, const T& functor )
55 return DoConnectSignal( connectionTracker, signalName, FunctorDelegate::New( functor ) );
59 * @copydoc Dali::BaseHandle::DoAction
61 bool DoAction(const std::string& actionName, const Property::Map& attributes);
64 * @copydoc Dali::BaseHandle::GetTypeName
66 const std::string& GetTypeName() const;
69 * @copydoc Dali::BaseHandle::GetTypeInfo
71 bool GetTypeInfo(Dali::TypeInfo& info) const;
73 public: // Not intended for application developers
76 * @copydoc Dali::BaseHandle::DoConnectSignal
78 bool DoConnectSignal( ConnectionTrackerInterface* connectionTracker, const std::string& signalName, FunctorDelegate* functorDelegate );
83 * @brief Default constructor.
88 * @brief A reference counted object may only be deleted by calling Unreference().
90 virtual ~BaseObject();
93 * @brief Registers the object as created with the Object registry.
95 void RegisterObject();
98 * @brief Unregisters the object from Object registry.
100 void UnregisterObject();
105 DALI_INTERNAL BaseObject(const BaseObject& rhs);
108 DALI_INTERNAL BaseObject& operator=(const BaseObject& rhs);
111 // Helpers for public-api forwarding methods
114 * @brief Get the implementation of a handle.
116 * @param[in] handle The handle
117 * @return A reference to the object the handle points at.
119 inline BaseObject& GetImplementation(Dali::BaseHandle& handle)
121 DALI_ASSERT_ALWAYS( handle && "BaseObject handle is empty" );
123 return handle.GetBaseObject();
127 * @brief Get the implementation of a handle.
129 * @param[in] handle The handle
130 * @return A reference to the object the handle points at.
132 inline const BaseObject& GetImplementation(const Dali::BaseHandle& handle)
134 DALI_ASSERT_ALWAYS( handle && "BaseObject handle is empty" );
136 return handle.GetBaseObject();
144 # endif // __DALI_BASE_OBJECT_H__