# component_testing::ScopedChild

## Summary

| ### Constructors and Destructors ||
|---|---|
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a96b61944764ed4d278779abc6f3e2e6b(https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child &&)` ||
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1ad976f2ff2a6e95e43f38752325c6ed1d(const https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child &)` ||
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a24c36454bf5b6cf6bc29c2a1bfcc0a73()` ||

| ### Public types ||
|---|---|
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a5e1e7c2da6702939f6a58ba496727f31` | using `https://fuchsia.dev/reference/cpp/class/fit/function-impl#classfit_1_1function__impl< void(https://fuchsia.dev/reference/cpp/other/singletonfit/result#singletonfit_1_1result< fuchsia::component::Error >)>` |

| ### Public static functions ||
|---|---|
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1adb39ae7f253f0b58db894f9ee37f4530(fuchsia::component::RealmSyncPtr realm_proxy, std::string collection, std::string name, std::string url)` | `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a930213d6b8641f8034ae50d72d182dde(fuchsia::component::RealmSyncPtr realm_proxy, std::string collection, std::string url)` | `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1afe7617cfa3c4a490b58b0fc3d68cca4c(std::string collection, std::string name, std::string url, std::shared_ptr< https://fuchsia.dev/reference/cpp/class/sys/service-directory#classsys_1_1_service_directory > svc)` | `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1ae6823a1d9077d90bb01ee78dddd1c7ea(std::string collection, std::string url, std::shared_ptr< https://fuchsia.dev/reference/cpp/class/sys/service-directory#classsys_1_1_service_directory > svc)` | `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child` |

| ### Public functions ||
|---|---|
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1ab964a12c41e0feedc1f6d725c7eb9d31() const ` | `https://fuchsia.dev/reference/cpp/class/fidl/interface-handle#classfidl_1_1_interface_handle< fuchsia::io::Directory >` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a853d3301ff2d6ed80f301fe657a3215d(https://fuchsia.dev/reference/cpp/class/fidl/interface-request#classfidl_1_1_interface_request< fuchsia::io::Directory > directory_request)` | `void` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a98350e414b29b28ebd54fe6c803e37b1(const std::string & interface_name) const ` | `https://fuchsia.dev/reference/cpp/class/fidl/interface-ptr#classfidl_1_1_interface_ptr< Interface >` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a268f1d7e1dc82e023f9c262e4e0488f7(https://fuchsia.dev/reference/cpp/class/fidl/interface-request#classfidl_1_1_interface_request< Interface > request) const ` | `zx_status_t` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a1def5f24efd2c44de9336d765c8a6a2e(const std::string & interface_name, https://fuchsia.dev/reference/cpp/class/zx/channel#classzx_1_1channel request) const ` | `zx_status_t` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1ae05f4348e5b8a46e0d3e3a0292574508(std::string path)` | `https://fuchsia.dev/reference/cpp/other/singletonzx/result#singletonzx_1_1result< https://fuchsia.dev/reference/cpp/other/singletonfidl/client-end#singletonfidl_1_1_client_end< https://fuchsia.dev/reference/cpp/struct/component-testing/protocol#structcomponent__testing_1_1_protocol > >` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1ad03c86d4f79f70f5ce2e36a1a8d37fef(const std::string & interface_name) const ` | `https://fuchsia.dev/reference/cpp/other/singletonfidl/synchronous-interface-ptr#singletonfidl_1_1_synchronous_interface_ptr< Interface >` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a1b1a152a3a8585246c81a7b33511a1a8() const ` | `std::string` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1ace8e8b4dfd9be7017f07e7012bd959d7(fuchsia::component::StartChildArgs) const ` | `https://fuchsia.dev/reference/cpp/class/component-testing/execution-controller#classcomponent__testing_1_1_execution_controller` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a3ad940fdf78c867f9eef9e352c9954eb(async_dispatcher_t *dispatcher, https://fuchsia.dev/reference/cpp/class/fit/function-impl#classfit_1_1function__impl callback)` | `void` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a22a83684a02501cf663779488815abe4()` | `const fuchsia::io::DirectorySyncPtr &` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1a705fdf102bbe16c00b74109bd6c668e0(https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child &&)=default` | `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child &` |
| `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child_1aaa40214505709bee6595f40a63dd16e1(const https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child &)=delete` | `https://fuchsia.dev/reference/cpp/class/component-testing/scoped-child#classcomponent__testing_1_1_scoped_child &` |

## Public types

### TeardownCallback

```c++
fit::function< void(fit::result< fuchsia::component::Error >)> TeardownCallback
```

## Public static functions

### New

```c++
ScopedChild New(
  fuchsia::component::RealmSyncPtr realm_proxy,
  std::string collection,
  std::string name,
  std::string url
)
```

### New

```c++
ScopedChild New(
  fuchsia::component::RealmSyncPtr realm_proxy,
  std::string collection,
  std::string url
)
```

### New

```c++
ScopedChild New(
  std::string collection,
  std::string name,
  std::string url,
  std::shared_ptr< sys::ServiceDirectory > svc
)
```

### New

```c++
ScopedChild New(
  std::string collection,
  std::string url,
  std::shared_ptr< sys::ServiceDirectory > svc
)
```

## Public functions

### CloneExposedDir

```c++
fidl::InterfaceHandle< fuchsia::io::Directory > CloneExposedDir() const 
```

### CloneExposedDir

```c++
void CloneExposedDir(
  fidl::InterfaceRequest< fuchsia::io::Directory > directory_request
)
```

### Connect

```c++
fidl::InterfacePtr< Interface > Connect(
  const std::string & interface_name
) const 
```

### Connect

```c++
zx_status_t Connect(
  fidl::InterfaceRequest< Interface > request
) const 
```

### Connect

```c++
zx_status_t Connect(
  const std::string & interface_name,
  zx::channel request
) const 
```

### Connect

```c++
zx::result< fidl::ClientEnd< Protocol > > Connect(
  std::string path
)
```

### ConnectSync

```c++
fidl::SynchronousInterfacePtr< Interface > ConnectSync(
  const std::string & interface_name
) const 
```

### GetChildName

```c++
std::string GetChildName() const 
```

### ScopedChild

```c++
 ScopedChild(
  ScopedChild &&
)=default
```

### ScopedChild

```c++
 ScopedChild(
  const ScopedChild &
)=delete
```

### Start

```c++
ExecutionController Start(
  fuchsia::component::StartChildArgs
) const 
```

### Teardown

```c++
void Teardown(
  async_dispatcher_t *dispatcher,
  TeardownCallback callback
)
```

### exposed

```c++
const fuchsia::io::DirectorySyncPtr & exposed()
```

### operator=

```c++
ScopedChild & operator=(
  ScopedChild &&
)=default
```

### operator=

```c++
ScopedChild & operator=(
  const ScopedChild &
)=delete
```

### \~ScopedChild

```c++
 ~ScopedChild()
```