NAP
Public Member Functions | Public Attributes | List of all members
Group< T > Class Template Reference

#include <nap/group.h>

Public Member Functions

 Group ()
 
virtual bool init (utility::ErrorState &errorState) override
 
rtti::ObjectPtr< T > findObject (const std::string &id) const
 
rtti::ObjectPtr< T > findObjectRecursive (const std::string &id) const
 
template<typename M >
rtti::ObjectPtr< M > findObject (const std::string &id) const
 
template<typename M >
rtti::ObjectPtr< M > findObjectRecursive (const std::string &id) const
 
NAPAPI Group ()
 
- Public Member Functions inherited from IGroup
 IGroup (rtti::TypeInfo memberType, std::string &&membersName, std::string &&childrenName)
 
rtti::TypeInfo getMemberType () const
 
rttr::property getMembersProperty () const
 
rttr::property getChildrenProperty () const
 
const std::string & membersPropertyName () const
 
const std::string & childrenPropertyName () const
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

std::vector< rtti::ObjectPtr< T > > mMembers
 Property: 'Members' The members that belong to this group. More...
 
std::vector< rtti::ObjectPtr< Group< T > > > mChildren
 Property: 'Children' The sub groups. More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

template<typename T>
class nap::Group< T >

Groups together a set of objects of a specific type.

Inheritance diagram for Group< T >:
[legend]
Collaboration diagram for Group< T >:
[legend]

Constructor & Destructor Documentation

◆ Group() [1/2]

Group ( )

Constructs a group with members of type T

◆ Group() [2/2]

NAPAPI Group ( )

Member Function Documentation

◆ findObject() [1/2]

rtti::ObjectPtr< M > findObject ( const std::string &  id) const

Attempts to find a member in this group with the given ID.

Parameters
idmember ID
Returns
member with the given ID, nullptr if not found

◆ findObject() [2/2]

rtti::ObjectPtr<M> findObject ( const std::string &  id) const

Attempts to find a member in this group, with the given ID, as type M

auto window = mGroup->findObject<nap::RenderWindow>("Window0");
Parameters
idmember ID
Returns
member with the given ID, nullptr if not found or not of the given type

◆ findObjectRecursive() [1/2]

rtti::ObjectPtr< M > findObjectRecursive ( const std::string &  id) const

Attempts to find a member in this group and all child groups with the given ID.

Parameters
idmember ID
Returns
member with the given ID, nullptr if not found

◆ findObjectRecursive() [2/2]

rtti::ObjectPtr<M> findObjectRecursive ( const std::string &  id) const

Attempts to find a member in this group, and all child groups, with the given ID as type M.

auto window = mGroup->findObjectRecursive<nap::RenderWindow>("Window0");
Parameters
idmember ID
Returns
member with the given ID, nullptr if not found or not of the given type

◆ init()

bool init ( utility::ErrorState errorState)
overridevirtual

Initialize this group

Parameters
errorStatecontains the error if initialization fails
Returns
if initialization succeeded

Reimplemented from Object.

Member Data Documentation

◆ mChildren

std::vector<rtti::ObjectPtr<Group<T> > > mChildren

Property: 'Children' The sub groups.

◆ mMembers

std::vector<rtti::ObjectPtr<T> > mMembers

Property: 'Members' The members that belong to this group.

nap::RenderWindow
Definition: renderwindow.h:43