use modern construct 'override' in the derive class.
[platform/core/uifw/dali-core.git] / dali / internal / update / common / property-owner-messages.h
index c8570fb..8af4362 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H__
+#ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H
+#define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
  *
  */
 
-// INTERNAL INCLUDES
+// EXTERNAL INCLUDES
+#include <string>
 
+// INTERNAL INCLUDES
 #include <dali/internal/event/common/event-thread-services.h>
 #include <dali/internal/event/common/property-input-impl.h>
 #include <dali/internal/update/common/property-owner.h>
 #include <dali/internal/update/animation/scene-graph-constraint-base.h>
-#include <string>
 
 namespace Dali
 {
@@ -53,7 +54,7 @@ public:
   /**
    * Virtual destructor
    */
-  virtual ~PropertyOwnerMessageBase();
+  ~PropertyOwnerMessageBase() override;
 
 private:
 
@@ -69,8 +70,7 @@ template< typename P >
 class AnimatablePropertyMessage : public PropertyOwnerMessageBase
 {
 public:
-
-  typedef void(AnimatableProperty<P>::*MemberFunction)( BufferIndex, typename ParameterType< P >::PassingType );
+  using MemberFunction = void ( AnimatableProperty<P>::* )( BufferIndex, typename ParameterType<P>::PassingType );
 
   /**
    * Create a message.
@@ -89,7 +89,7 @@ public:
                     typename ParameterType< P >::PassingType value )
   {
     // Reserve some memory inside the message queue
-    unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( AnimatablePropertyMessage ) );
+    uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( AnimatablePropertyMessage ) );
 
     // Construct message in the message queue memory; note that delete should not be called on the return value
     new (slot) AnimatablePropertyMessage( sceneObject, property, member, value );
@@ -98,14 +98,14 @@ public:
   /**
    * Virtual destructor
    */
-  virtual ~AnimatablePropertyMessage()
+  ~AnimatablePropertyMessage() override
   {
   }
 
   /**
    * @copydoc MessageBase::Process
    */
-  virtual void Process( BufferIndex updateBufferIndex )
+  void Process( BufferIndex updateBufferIndex ) override
   {
     (mProperty->*mMemberFunction)( updateBufferIndex, mParam );
   }
@@ -148,8 +148,7 @@ template< typename P >
 class AnimatablePropertyComponentMessage : public PropertyOwnerMessageBase
 {
 public:
-
-  typedef void(AnimatableProperty<P>::*MemberFunction)( BufferIndex, float );
+  using MemberFunction = void ( AnimatableProperty<P>::* )( BufferIndex, float );
 
   /**
    * Send a message.
@@ -168,7 +167,7 @@ public:
                     float value )
   {
     // Reserve some memory inside the message queue
-    unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( AnimatablePropertyComponentMessage ) );
+    uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( AnimatablePropertyComponentMessage ) );
 
     // Construct message in the message queue memory; note that delete should not be called on the return value
     new (slot) AnimatablePropertyComponentMessage( sceneObject, property, member, value );
@@ -177,14 +176,14 @@ public:
   /**
    * Virtual destructor
    */
-  virtual ~AnimatablePropertyComponentMessage()
+  ~AnimatablePropertyComponentMessage() override
   {
   }
 
   /**
    * @copydoc MessageBase::Process
    */
-  virtual void Process( BufferIndex updateBufferIndex )
+  void Process( BufferIndex updateBufferIndex ) override
   {
     (mProperty->*mMemberFunction)( updateBufferIndex, mParam );
   }
@@ -222,26 +221,26 @@ private:
 
 // Messages for PropertyOwner
 
-inline void InstallCustomPropertyMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, PropertyBase* property )
+inline void InstallCustomPropertyMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, OwnerPointer<PropertyBase>& property )
 {
-  typedef MessageValue1< PropertyOwner, OwnerPointer<PropertyBase> > LocalType;
+  using LocalType = MessageValue1<PropertyOwner, OwnerPointer<PropertyBase> >;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &owner, &PropertyOwner::InstallCustomProperty, property );
 }
 
-inline void ApplyConstraintMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, ConstraintBase& constraint )
+inline void ApplyConstraintMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, OwnerPointer<ConstraintBase>& constraint )
 {
-  typedef MessageValue1< PropertyOwner, OwnerPointer<ConstraintBase> > LocalType;
+  using LocalType = MessageValue1<PropertyOwner, OwnerPointer<ConstraintBase> >;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &owner, &PropertyOwner::ApplyConstraint, &constraint );
+  new (slot) LocalType( &owner, &PropertyOwner::ApplyConstraint, constraint );
 }
 
 inline void RemoveConstraintMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, const ConstraintBase& constConstraint )
@@ -249,26 +248,32 @@ inline void RemoveConstraintMessage( EventThreadServices& eventThreadServices, c
   // The update-thread can modify this object.
   ConstraintBase& constraint = const_cast< ConstraintBase& >( constConstraint );
 
-  typedef MessageValue1< PropertyOwner, ConstraintBase* > LocalType;
+  using LocalType = MessageValue1<PropertyOwner, ConstraintBase*>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
   new (slot) LocalType( &owner, &PropertyOwner::RemoveConstraint, &constraint );
 }
 
-inline void AddUniformMapMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, UniformPropertyMapping* map )
+inline void AddUniformMapMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, OwnerPointer< UniformPropertyMapping >& map )
 {
-  typedef MessageValue1< PropertyOwner, OwnerPointer< UniformPropertyMapping > > LocalType;
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  using LocalType = MessageValue1<PropertyOwner, OwnerPointer<UniformPropertyMapping> >;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
   new (slot) LocalType( &owner, &PropertyOwner::AddUniformMapping, map );
 }
 
 inline void RemoveUniformMapMessage( EventThreadServices& eventThreadServices, const PropertyOwner& owner, const std::string& uniformName )
 {
-  typedef MessageValue1< PropertyOwner, std::string > LocalType;
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  using LocalType = MessageValue1<PropertyOwner, std::string>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
   new (slot) LocalType( &owner, &PropertyOwner::RemoveUniformMapping, uniformName );
 }
 
@@ -279,4 +284,4 @@ inline void RemoveUniformMapMessage( EventThreadServices& eventThreadServices, c
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H__
+#endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_MESSAGES_H