Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / internal / update / common / property-owner-messages.h
1 #ifndef __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H__
2 #define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 // INTERNAL INCLUDES
21 #include <dali/internal/update/common/property-owner.h>
22 #include <dali/internal/common/event-to-update.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 namespace SceneGraph
31 {
32
33 // Messages for PropertyOwner
34
35 inline void InstallCustomPropertyMessage( EventToUpdate& eventToUpdate, const PropertyOwner& owner, PropertyBase& property )
36 {
37   typedef MessageValue1< PropertyOwner, PropertyBase* > LocalType;
38
39   // Reserve some memory inside the message queue
40   unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
41
42   // Construct message in the message queue memory; note that delete should not be called on the return value
43   new (slot) LocalType( &owner, &PropertyOwner::InstallCustomProperty, &property );
44 }
45
46 inline void ApplyConstraintMessage( EventToUpdate& eventToUpdate, const PropertyOwner& owner, ConstraintBase& constraint )
47 {
48   typedef MessageValue1< PropertyOwner, OwnerPointer<ConstraintBase> > LocalType;
49
50   // Reserve some memory inside the message queue
51   unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
52
53   // Construct message in the message queue memory; note that delete should not be called on the return value
54   new (slot) LocalType( &owner, &PropertyOwner::ApplyConstraint, &constraint );
55 }
56
57 inline void RemoveConstraintMessage( EventToUpdate& eventToUpdate, const PropertyOwner& owner, const ConstraintBase& constConstraint )
58 {
59   // The update-thread can modify this object.
60   ConstraintBase& constraint = const_cast< ConstraintBase& >( constConstraint );
61
62   typedef MessageValue1< PropertyOwner, ConstraintBase* > LocalType;
63
64   // Reserve some memory inside the message queue
65   unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
66
67   // Construct message in the message queue memory; note that delete should not be called on the return value
68   new (slot) LocalType( &owner, &PropertyOwner::RemoveConstraint, &constraint );
69 }
70
71 } // namespace SceneGraph
72
73 } // namespace Internal
74
75 } // namespace Dali
76
77 #endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H__