Event side structure.
[platform/core/uifw/dali-core.git] / dali / internal / event / common / property-buffer-impl.h
1 #ifndef DALI_INTERNAL_PROPERTY_BUFFER_H
2 #define DALI_INTERNAL_PROPERTY_BUFFER_H
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
23 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
24 #include <dali/public-api/object/property-buffer.h> // Dali::PropertyBuffer
25 #include <dali/internal/event/common/connectable.h> // Dali::Internal::Connectable
26 #include <dali/internal/event/common/object-connector.h> // Dali::Internal::ObjectConnector
27 #include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
28
29 namespace Dali
30 {
31 namespace Internal
32 {
33
34 class PropertyBuffer;
35 typedef IntrusivePtr<PropertyBuffer> PropertyBufferPtr;
36
37 /**
38  * PropertyBuffer is an object that contains an array of structures of values that
39  * can be accessed as properties.
40  */
41 class PropertyBuffer : public Object, public Connectable
42 {
43 public:
44
45   /**
46    * @copydoc PropertBuffer::New()
47    */
48   static PropertyBufferPtr New();
49
50   /**
51    * @copydoc PropertBuffer::SetSize()
52    */
53   void SetSize( std::size_t size );
54
55   /**
56    * @copydoc PropertBuffer::GetSize()
57    */
58   std::size_t GetSize() const;
59
60   /**
61    * @copydoc PropertBuffer::SetData()
62    */
63   void SetData( void* data );
64
65   /**
66    * @copydoc PropertBuffer::GetPropertyIndex()
67    */
68   Dali::Property::Index GetPropertyIndex( const std::string name, std::size_t index );
69
70 public: // Default property extensions from Object
71
72   /**
73    * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
74    */
75   virtual unsigned int GetDefaultPropertyCount() const;
76
77   /**
78    * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
79    */
80   virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
81
82   /**
83    * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
84    */
85   virtual const char* GetDefaultPropertyName(Property::Index index) const;
86
87   /**
88    * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
89    */
90   virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
91
92   /**
93    * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
94    */
95   virtual bool IsDefaultPropertyWritable(Property::Index index) const;
96
97   /**
98    * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
99    */
100   virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
101
102   /**
103    * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
104    */
105   virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
106
107   /**
108    * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
109    */
110   virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
111
112   /**
113    * @copydoc Dali::Internal::Object::SetDefaultProperty()
114    */
115   virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
116
117   /**
118    * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
119    */
120   virtual void SetSceneGraphProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value );
121
122   /**
123    * @copydoc Dali::Internal::Object::GetDefaultProperty()
124    */
125   virtual Property::Value GetDefaultProperty( Property::Index index ) const;
126
127   /**
128    * @copydoc Dali::Internal::Object::GetPropertyOwner()
129    */
130   virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
131
132   /**
133    * @copydoc Dali::Internal::Object::GetSceneObject()
134    */
135   virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
136
137   /**
138    * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
139    */
140   virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
141
142   /**
143    * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
144    */
145   virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
146
147   /**
148    * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
149    */
150   virtual int GetPropertyComponentIndex( Property::Index index ) const;
151
152 public: // Functions from Connectable
153   /**
154    * @copydoc Dali::Internal::Connectable::OnStage()
155    */
156   virtual bool OnStage() const;
157
158   /**
159    * @copydoc Dali::Internal::Connectable::Connect()
160    */
161   virtual void Connect();
162
163   /**
164    * @copydoc Dali::Internal::Connectable::Disconnect()
165    */
166   virtual void Disconnect();
167
168 private: // implementation
169   PropertyBuffer();
170
171 private: // unimplemented methods
172   PropertyBuffer( const PropertyBuffer& );
173   PropertyBuffer& operator=( const PropertyBuffer& );
174
175 };
176
177 } // namespace Internal
178
179 // Helpers for public-api forwarding methods
180 inline Internal::PropertyBuffer& GetImplementation(Dali::PropertyBuffer& handle)
181 {
182   DALI_ASSERT_ALWAYS(handle && "PropertyBuffer handle is empty");
183
184   BaseObject& object = handle.GetBaseObject();
185
186   return static_cast<Internal::PropertyBuffer&>(object);
187 }
188
189 inline const Internal::PropertyBuffer& GetImplementation(const Dali::PropertyBuffer& handle)
190 {
191   DALI_ASSERT_ALWAYS(handle && "PropertyBuffer handle is empty");
192
193   const BaseObject& object = handle.GetBaseObject();
194
195   return static_cast<const Internal::PropertyBuffer&>(object);
196 }
197
198 } // namespace Dali
199
200 #endif // DALI_INTERNAL_PROPERTY_BUFFER_H