PLaSK library

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
plask::GeometryObject::Subtree Struct Reference

This structure can refer to part of geometry tree. More...

`#include <plask/geometry/object.hpp>`

Collaboration diagram for plask::GeometryObject::Subtree:
[legend]

## Public Member Functions
| Subtree (shared_ptr< const GeometryObject > object=shared_ptr< const GeometryObject >())
| Construct a subtree witch is empty or has only one node.
| Subtree (shared_ptr< const GeometryObject > object, const std::vector< Subtree > &children)
| Construct a subtree.
| Subtree (shared_ptr< const GeometryObject > object, std::vector< Subtree > &&children)
| Construct subtree.
bool | hasBranches () const
| Check if this subtree includes more than one branch (has more than one children or has one child which has more than one branch).
Path | toLinearPath () const
| Convert this subtree to linear path: object, child[0].object, child[0].child[0].object, ...
Path | getLastPath () const
| Get last (last child is chosen at each level), linear path from subtree.
bool | empty () const
| Check if this subtree is empty (its object points to null).

## Static Public Member Functions
static Subtree | extendIfNotEmpty (shared_ptr< const GeometryObject > root, Subtree &&children)
| Construct subtree which consists of given `root` object and `children` or empty object if `children` vector is empty.
static Subtree | extendIfNotEmpty (const GeometryObject *root, Subtree &&children)
| Construct subtree which consists of given `root` object and `children` or empty object if `children` vector is empty.

## Public Attributes
shared_ptr< const GeometryObject > | object
| Geometry object.
std::vector< Subtree > | children
| Some (but not necessary all) children of object.

## Detailed Description

This structure can refer to part of geometry tree.

Definition at line 233 of file object.hpp.

## Constructor & Destructor Documentation

## ◆ Subtree() [1/3]

plask::GeometryObject::Subtree::Subtree | ( | shared_ptr< const GeometryObject > | object = `shared_ptr<const GeometryObject>()` | ) |
| inline

Construct a subtree witch is empty or has only one node.

Parameters

  object | geometry object, or null pointer to construct an empty Subtree

Definition at line 244 of file object.hpp.

## ◆ Subtree() [2/3]

plask::GeometryObject::Subtree::Subtree | ( | shared_ptr< const GeometryObject > | object,
|  | const std::vector< Subtree > & | children
| ) |  |
| inline

Construct a subtree.

Parameters

  object | geometry object
  children | some (but not necessary all) children of `object`

Definition at line 251 of file object.hpp.

## ◆ Subtree() [3/3]

plask::GeometryObject::Subtree::Subtree | ( | shared_ptr< const GeometryObject > | object,
|  | std::vector< Subtree > && | children
| ) |  |
| inline

Construct subtree.

Parameters

  object | geometry object
  children | some (but not necessary all) children of `object`

Definition at line 259 of file object.hpp.

## Member Function Documentation

## ◆ empty()

bool plask::GeometryObject::Subtree::empty | ( |  | ) | const
| inline

Check if this subtree is empty (its object points to null).

Returns
  `true` only if this subtree is empty.

Definition at line 317 of file object.hpp.

## ◆ extendIfNotEmpty() [1/2]

static Subtree plask::GeometryObject::Subtree::extendIfNotEmpty | ( | const GeometryObject * | root,
|  | Subtree && | children
| ) |  |
| inline static

Construct subtree which consists of given `root` object and `children` or empty object if `children` vector is empty.

This method is used to make set of paths (subtree) longer if this set is not empty.

Parameters

  root | potential root of constructed subtree object
  children | potential children of `root` in constructed subtree

Returns
  subtree which consists of given `root` object and `children` or empty object if `children` vector is empty

Definition at line 286 of file object.hpp.

## ◆ extendIfNotEmpty() [2/2]

static Subtree plask::GeometryObject::Subtree::extendIfNotEmpty | ( | shared_ptr< const GeometryObject > | root,
|  | Subtree && | children
| ) |  |
| inline static

Construct subtree which consists of given `root` object and `children` or empty object if `children` vector is empty.

This method is used to make set of paths (subtree) longer if this set is not empty.

Parameters

  root | potential root of constructed subtree object
  children | potential children of `root` in constructed subtree

Returns
  subtree which consists of given `root` object and `children` or empty object if `children` vector is empty

Definition at line 272 of file object.hpp.

## ◆ getLastPath()

Path plask::GeometryObject::Subtree::getLastPath | ( |  | ) | const

Get last (last child is chosen at each level), linear path from subtree.

Returns
  last path from subtree

Definition at line 180 of file object.cpp.

## ◆ hasBranches()

bool plask::GeometryObject::Subtree::hasBranches | ( |  | ) | const

Check if this subtree includes more than one branch (has more than one children or has one child which has more than one branch).

Returns
  `true` only if this subtree includes branches, `false` if it is linear path

Definition at line 158 of file object.cpp.

## ◆ toLinearPath()

Path plask::GeometryObject::Subtree::toLinearPath | ( |  | ) | const

Convert this subtree to linear path: object, child[0].object, child[0].child[0].object, ...

Throw exception if this subtree is not linear path (includes more than one branch).

Returns
  linear path represented by this

Definition at line 167 of file object.cpp.

## Member Data Documentation

## ◆ children

std::vector<Subtree> plask::GeometryObject::Subtree::children

Some (but not necessary all) children of object.

Definition at line 238 of file object.hpp.

## ◆ object

shared_ptr<const GeometryObject> plask::GeometryObject::Subtree::object

Geometry object.

Definition at line 235 of file object.hpp.

The documentation for this struct was generated from the following files:

- plask/geometry/object.hpp
- plask/geometry/object.cpp