/****************************************************************************
**
** Copyright (C) 2019 Ford Motor Company
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
\page remoteobjects-example-dynamic-replica.html
\title Example 2: Direct Connection with a Dynamic Replica
\brief Describes how the Qt Remote Objects establishes a direct connection with a dynamic replica.
\target qtro-example2

Initially, a dynamic replica is created as a "bare" QObject - without
properties, signals or slots. Then, during initialization, QtRO returns the
API for the object, after the connection to the source is made. Thus, the API
is added to the object at runtime.

There are no changes to be made on the source side, as a dynamic \l Replica
only impacts how the requestor node acquires the replica. So, we use the
source-side code shown in \l {qtro-example1}{Example 1}.

\list 1
    \li Add replica generation to the project.

        Because the replica is dynamically acquired, no \c .rep file is
        required unlike in \l {qtro-example1}{Example 1}.

    \li Create the remote node and connect it to the source host node.

        The code for this step is unchanged from \l {qtro-example1}{Example 1}.
        \snippet doc_src_simpleswitch.cpp simpleSwitch_dynamicclientnode_example2

    \li Acquire a replica of the remote source object.

        In \c main.cpp, we use a QSharedPointer to hold a replica of the
        remote object, and then instantiate a replica requestor object:

        \snippet doc_src_simpleswitch.cpp simpleSwitch_dynamicclientmaincpp_example2
\endlist

The complete declaration and definition of the requestor class,
\c DynamicClient, is as follows:

\c dynamicclient.h
\snippet doc_src_simpleswitch.cpp simpleSwitch_dynamicclientheader_example2

\c dynamicclient.cpp
\snippet doc_src_simpleswitch.cpp simpleSwitch_dynamicclientcpp_example2

When run together with the source-side example, the output is identical
to \l {qtro-example1}{Example 1}.

*/
