<div id="toc_border"><div id="toc">\r
<p class="toc-title">Content</p>\r
<ul class="toc">\r
- <li><a href="#handle">Handle/Body Pattern</a></li>\r
- <li><a href="#property">Properties</a></li>\r
- <li><a href="#thread">DALi Thread Model</a></li>\r
</ul>\r
<p class="toc-title">Related Info</p>\r
<ul class="toc">\r
- <li><a href="../../../../org.tizen.native.mobile.apireference/classDali_1_1Actor.html">Dali::Actor API for Mobile Native</a></li>\r
- <li><a href="../../../../org.tizen.native.mobile.apireference/classDali_1_1Stage.html">Dali::Stage API for Mobile Native</a></li>\r
- <li><a href="../../../../org.tizen.native.wearable.apireference/classDali_1_1Actor.html">Dali::Actor API for Wearable Native</a></li>\r
- <li><a href="../../../../org.tizen.native.wearable.apireference/classDali_1_1Stage.html">Dali::Stage API for Wearable Native</a></li> \r
</ul>\r
</div></div>\r
</div> \r
<div id="container"><div id="contents"><div class="content">\r
<h1>Background Knowledge: Using DALi More Effectively</h1>\r
\r
-<p>This section describes useful background knowledge that enables you to use DALi more effectively.\r
+<p>This section describes useful background knowledge that enables you to use DALi more effectively.</p>\r
+<p>Topics covered are:</p>\r
\r
-<h2 id="handle" name="handle">Handle/Body Pattern</h2>\r
-\r
-<p>DALi widely adopts the handle/body pattern (a.k.a. pimpl pattern) which seperates implementation details (the body class) from its interface (the handle class). In DALi, <span style="font-family: Courier New,Courier,monospace;">Dali::Handle</span> represents the interface part and hides internal implementation classes. It additionally provides smart-pointer semantics which manages internal objects with reference counts.\r
-</p>\r
-\r
-<p>This structure is benificial for both users and developers of DALi:</p>\r
-<ul>\r
- <li><strong>Easier memory management</strong>\r
- <p>Each internal <span style="font-family: Courier New,Courier,monospace;">Dali::Object</span> class (the body class) contains a single reference count object which can be intitialized with the static "New" methods in the DALi public API. This means that C++ new/delete operators do not have to be used in the user code.</p>\r
- </li>\r
- <li><strong>Better encapsulation</strong>\r
- <p>The danger of API/ABI breaks is reduced since the implementation of a class can be changed without modifying the public API, thus without recompiling code using the public API. This also can reduce the build time.</p>\r
- </li>\r
-</ul>\r
-\r
-<h3 id="usage" name="usage">Guide for Handles</h2>\r
-\r
-<ul>\r
-\r
-<li> No need to call destructors\r
-<pre class="prettyprint">\r
-class HandleTest\r
-{\r
- HandleTest()\r
- {\r
- mActor = Actor::New();\r
- }\r
-\r
- ~HandleTest() {} // Actor object is destroyed automatically\r
-\r
- Actor mActor;\r
-};\r
-</pre>\r
-</li>\r
-\r
-<li> Can be stored in STL containers\r
-<pre class="prettyprint">\r
-class HandleTest\r
-{\r
- HandleTest()\r
- {\r
- mActors.push_back( Actor::New() );\r
- mActors.push_back( Actor::New() );\r
- ...\r
- }\r
-\r
- ~HandleTest() {} // Actors are destroyed automatically\r
-\r
- std::vector<Actor> mActors;\r
-};\r
-</pre>\r
-</li>\r
-\r
-<li> Passing by value is encouraged\r
-<pre class="prettyprint">\r
-void SomeFunction( Actor actor )\r
-{\r
- if( actor )\r
- {\r
- actor.SomeMethod();\r
- }\r
-}\r
-</pre>\r
-</li>\r
-\r
-<li> Validity check\r
-<pre class="prettyprint">\r
-{\r
- ...\r
- Actor actor; // Create a NULL object\r
-\r
- // At this stage we cannot call any of the Actor methods\r
- if( !actor ) // This test is will pass, since the actor is NULL\r
- {\r
- actor = Actor::New();\r
- ...\r
- }\r
- ...\r
-}\r
-</pre>\r
-</li>\r
-\r
-<li> Equality operators\r
-<pre class="prettyprint">\r
-{\r
- Actor handle1;\r
- Actor handle2;\r
- cout << handle1 == handle2 << endl; // "true", both handles are empty\r
-\r
- handle2 = Actor::New();\r
- cout << handle1 == handle2 << endl; // "false", one handle is empty\r
-\r
- handle1 = Actor::New();\r
- cout << handle1 == handle2 << endl; // "false", handles to different objects\r
-\r
- handle1 = handle2;\r
- cout << handle1 == handle2 << endl; // "true", handles to same object\r
-}\r
-</pre>\r
-</li>\r
-\r
-<li> Reference counting examples\r
-<pre class="prettyprint">\r
-class AnimationTest\r
-{\r
-...\r
-private:\r
- Animation mAnimation; // animation handle\r
-};\r
-void AnimationTest::Initialize ()\r
-{\r
- mAnimation = Animation::New( 10.0f ); // reference count will be 1, animation object stays alive when method returns\r
- ...\r
-}\r
-void AnimationTest::SetAnimation( Animation anim )\r
-{\r
- mAnimation = anim; // reference count of original animation decreased, 'anim' is referenced instead\r
- // if nobody else had a reference on the initial animation, the object is destroyed\r
-}\r
-</pre>\r
-\r
-<pre class="prettyprint">\r
-// At this point we own a Dali::Actor named "container"\r
-// Enter a code block\r
-{\r
- // Create an text label\r
- TextLabel actor = TextLabel::New("test");\r
- // Add the text label to a container\r
- container.Add(actor);\r
-}\r
-// Exit the code block\r
-// At this stage the text label is still alive\r
-// We don't keep the handle to the text label, but it can be retrieved from the container\r
-</pre>\r
-\r
-</ul>\r
+ <ul>\r
+ <li><a href="handle_n.htm">Handle/Body Pattern: Basic Way of Using DALi Objects</a></li>\r
+ <li><a href="properties_n.htm">Properties: Accessing to Properties of DALi Objects</a></li>\r
+ <li><a href="threads_n.htm">Thread Architecture: High-Performance Multi-Threaded Architecture of DALi</a></li>\r
+ </ul>\r
\r
\r
\r