Rose
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Friends | List of all members
rose::Node Class Reference

A class to define a polymorphic member in an N-Array tree. More...

#include <StructuredTypes.h>

Inheritance diagram for rose::Node:
Inheritance graph
[legend]
Collaboration diagram for rose::Node:
Collaboration graph
[legend]

Public Types

using NodePtr = std::shared_ptr< Node >
 

Public Member Functions

 Node (const std::shared_ptr< Container > &container)
 Create a node and add it to a Container. More...
 
virtual std::string_view nodeId () const noexcept
 
void setId (const Id &nodeId) noexcept
 Set Id.
 
std::string_view getId () const
 Get Id.
 
IdPath getIdPath () const
 Get the Id Path.
 
virtual void addedToContainer ()
 Called when a Node is added to a Container. More...
 
std::shared_ptr< Containercontainer ()
 
std::shared_ptr< Containercontainer () const
 
template<typename C >
std::shared_ptr< C > containerAs ()
 
template<typename C >
std::shared_ptr< C > containerAs () const
 
std::shared_ptr< const NodegetNode () const
 Get a const std::shared_ptr to this node. More...
 
std::shared_ptr< NodegetNode ()
 Get a std::shared_ptr to this node. More...
 
template<typename NodeType >
std::shared_ptr< const NodegetNode () const
 Get a std::shared_ptr<const NodeType> to this node. More...
 
template<typename NodeType >
std::shared_ptr< NodeType > getNode ()
 Get a std::shared_ptr<NodeType> to this node. More...
 
std::shared_ptr< Noderemove ()
 

Static Public Member Functions

template<typename NodeType >
static std::shared_ptr< NodeType > create ()
 Create a Node with no arguments. More...
 
template<typename NodeType , typename ... Args>
static std::shared_ptr< NodeType > create (Args ... args)
 Create a Node with arguments. More...
 
template<typename NodeType , typename ContainerType , typename ... Args>
static std::shared_ptr< NodeType > add (ContainerType container, Args ... args)
 Create a Node with arguments and add to a Container. More...
 

Static Public Attributes

static constexpr std::string_view id = "Node"
 

Protected Attributes

std::weak_ptr< ContainermContainer {}
 The Container that holds the Node. More...
 
Id mId {}
 

Friends

class Container
 

Detailed Description

A class to define a polymorphic member in an N-Array tree.

Constructor & Destructor Documentation

◆ Node()

rose::Node::Node ( const std::shared_ptr< Container > &  container)
explicit

Create a node and add it to a Container.

Parameters
container

Member Function Documentation

◆ add()

template<typename NodeType , typename ContainerType , typename ... Args>
static std::shared_ptr<NodeType> rose::Node::add ( ContainerType  container,
Args ...  args 
)
inlinestatic

Create a Node with arguments and add to a Container.

Template Parameters
NodeTypeThe type of Node to create.
ContainerTypeThe type of Container the Node is added to.
ArgsThe argument parameter pack type.
Parameters
containerThe Container.
argsThe argument parameter pack data.
Returns
A std::shared_ptr to the NodeType created.

◆ addedToContainer()

virtual void rose::Node::addedToContainer ( )
inlinevirtual

Called when a Node is added to a Container.

By default it is ignored but can be used to perform initialization that is required when a Node is placed in a Container.

Reimplemented in rose::MapProjection, rose::CapsLockKey, rose::ImageKey, rose::LetterKey, rose::Keyboard, rose::GridOverlay, rose::CelestialOverlay, rose::Dialog, and rose::TextField.

◆ create() [1/2]

template<typename NodeType >
static std::shared_ptr<NodeType> rose::Node::create ( )
inlinestatic

Create a Node with no arguments.

Template Parameters
NodeTypeThe type of Node to create.
Returns
A std::shared_ptr to the NodeType created.

◆ create() [2/2]

template<typename NodeType , typename ... Args>
static std::shared_ptr<NodeType> rose::Node::create ( Args ...  args)
inlinestatic

Create a Node with arguments.

Template Parameters
NodeTypeThe type of Node to create.
ArgsThe argument parameter pack type.
Parameters
argsThe argument parameter pack data.
Returns
A std::shared_ptr to the NodeType created.

◆ getNode() [1/4]

std::shared_ptr<const Node> rose::Node::getNode ( ) const
inline

Get a const std::shared_ptr to this node.

Returns
std::shared_ptr<const Node>

◆ getNode() [2/4]

std::shared_ptr<Node> rose::Node::getNode ( )
inline

Get a std::shared_ptr to this node.

Returns
std::shared_ptr<const Node>

◆ getNode() [3/4]

template<typename NodeType >
std::shared_ptr<const Node> rose::Node::getNode ( ) const
inline

Get a std::shared_ptr<const NodeType> to this node.

Template Parameters
NodeType
Returns
std::shared_ptr<const NodeType> which will be empty if this Node is not a NodeType or derived from NodeType.

◆ getNode() [4/4]

template<typename NodeType >
std::shared_ptr<NodeType> rose::Node::getNode ( )
inline

Get a std::shared_ptr<NodeType> to this node.

Template Parameters
NodeType
Returns
std::shared_ptr<NodeType> which will be empty if this Node is not a NodeType or derived from NodeType.

Member Data Documentation

◆ mContainer

std::weak_ptr<Container> rose::Node::mContainer {}
protected

The Container that holds the Node.

The object Id string.


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