WSF
wsf::comm::medium::ContainerComponent< PARENT > Class Template Reference

#include <WsfCommMediumContainer.hpp>

Inheritance diagram for wsf::comm::medium::ContainerComponent< PARENT >:
Collaboration diagram for wsf::comm::medium::ContainerComponent< PARENT >:

Public Member Functions

 ContainerComponent (const WsfScenario &aScenario)
bool Initialize (double aSimTime) override
bool ProcessInput (UtInput &aInput) override
 ~ContainerComponent () override=default
WsfComponentCloneComponent () const override
 Required method implementations for components.
WsfStringId GetComponentName () const override
const int * GetComponentRoles () const override
void * QueryInterface (int aRole) override
Public Member Functions inherited from wsf::comm::medium::Container
 Container (const WsfScenario &aScenario)
 Container (const Container &aSrc)
virtual ~Container ()=default
MediumGetMedium () const
void SetMedium (std::shared_ptr< Medium > aMedium)
void SetSimulation (WsfSimulation *aSimPtr)
virtual bool ProcessContainerInput (UtInput &aInput, InputAction aAction=cNONE)
const std::set< TypeIdentifier > & GetValidMediums () const
void AddValidMedium (TypeIdentifier aValue)
void AddForbiddenMedium (TypeIdentifier aValue)
bool IsValidMedium (TypeIdentifier aValue) const
 Returns true if the provided TypeIdentifier is valid for this container.
void SetDefaultMedium (TypeIdentifier aValue)
TypeIdentifier GetDefaultMedium () const
virtual bool AddDefaultMedium ()
const WsfScenarioGetScenario () const
Public Member Functions inherited from WsfComponentT< PARENT >
 WsfComponentT ()
WsfComponentToperator= (const WsfComponentT &) noexcept
 ~WsfComponentT () override=default
virtual void ComponentParentChanged (ParentType *aParentPtr)
ParentTypeGetComponentParent () const
void SetComponentParent (ParentType *aParentPtr)
Public Member Functions inherited from WsfComponent
virtual ~WsfComponent ()=default
virtual int GetComponentInitializationOrder () const
template<typename T>
bool QueryInterfaceT (T *&aRolePtr)
bool ComponentHasRole (int aRole)
 Returns true if the component has the specified role.
virtual bool PreInitialize (double aSimTime)
virtual bool Initialize2 (double aSimTime)
virtual void PreInput ()

Static Public Member Functions

static ContainerComponent< PARENT > * Find (const PARENT &aParent)
static ContainerComponent< PARENT > * FindOrCreate (PARENT &aParent, const WsfScenario &aScenario)

Additional Inherited Members

Public Types inherited from wsf::comm::medium::Container
enum  InputAction : int { cNONE , cADD , cEDIT , cDELETE }
Public Types inherited from WsfComponentT< PARENT >
typedef PARENT ParentType
 This is needed to support the WsfComponentList template.

Detailed Description

template<typename PARENT>
class wsf::comm::medium::ContainerComponent< PARENT >

A templated component type for usage of medium Containers. Use of this template container type allows containers to be attached to parents that maintain a component list, without having to derive or instantiate a container object directly. The container, while a component itself, manages the medium object usage on the parent. The medium itself is NOT a component due to its potentially shared lifetime and incompatibilities due to assumptions in the implementation of components. As such, this container utilizes the traditional factory methods typically utilized by components and their default factories, but most of the usage is a wrapper for the functionality and handling of the medium objects themselves (which is passed to a separate factory for the handling of medium input parsing and other necessary method calls directly related to medium usage).

Note that any parent class using this template component container must still explicitly define the specialization for WSF_DECLARE_COMPONENT_ROLE_TYPE. A template factory is provided for component containers.

Constructor & Destructor Documentation

◆ ContainerComponent()

template<typename PARENT>
wsf::comm::medium::ContainerComponent< PARENT >::ContainerComponent ( const WsfScenario & aScenario)
inline

◆ ~ContainerComponent()

template<typename PARENT>
wsf::comm::medium::ContainerComponent< PARENT >::~ContainerComponent ( )
overridedefault

Member Function Documentation

◆ CloneComponent()

template<typename PARENT>
WsfComponent * wsf::comm::medium::ContainerComponent< PARENT >::CloneComponent ( ) const
inlineoverridevirtual

Required method implementations for components.

Implements WsfComponent.

References ContainerComponent().

◆ Find()

◆ FindOrCreate()

template<typename PARENT>
ContainerComponent< PARENT > * wsf::comm::medium::ContainerComponent< PARENT >::FindOrCreate ( PARENT & aParent,
const WsfScenario & aScenario )
inlinestatic

◆ GetComponentName()

template<typename PARENT>
WsfStringId wsf::comm::medium::ContainerComponent< PARENT >::GetComponentName ( ) const
inlineoverridevirtual

Returns the component's name. Each component in a component list has a unique name. Names are usually defined by the user, but they may also be generated by code and prefixed with a '#' to guarantee no collisions with user-defined names.

Implements WsfComponent.

References wsf::comm::medium::GetContainerComponentName().

◆ GetComponentRoles()

template<typename PARENT>
const int * wsf::comm::medium::ContainerComponent< PARENT >::GetComponentRoles ( ) const
inlineoverridevirtual

Returns a zero-terminated array of component roles. Note that the array should be in decreasing order of specificity and should generally the inheritance hierarchy. The first entry should be the components 'primary' role. For example a sensor would do the following:

return roles;
@ cWSF_COMPONENT_SENSOR
A 'sensor' component (WsfSensor).
Definition WsfComponentRoles.hpp:105
@ cWSF_COMPONENT_PLATFORM_PART
The component derives from WsfPlatformPart.
Definition WsfComponentRoles.hpp:98
@ cWSF_COMPONENT_ARTICULATED_PART
The component derives from WsfArticulatedPart.
Definition WsfComponentRoles.hpp:99

Implements WsfComponent.

References cWSF_COMPONENT_NULL.

◆ Initialize()

template<typename PARENT>
bool wsf::comm::medium::ContainerComponent< PARENT >::Initialize ( double aSimTime)
inlineoverridevirtual

Both WsfComponent and Container contain virtual Initialize methods with the same signature. This resolves the ambiguity.

Reimplemented from wsf::comm::medium::Container.

References wsf::comm::medium::Container::Initialize().

◆ ProcessInput()

template<typename PARENT>
bool wsf::comm::medium::ContainerComponent< PARENT >::ProcessInput ( UtInput & aInput)
inlineoverridevirtual

Both WsfComponent and Container contain virtual ProcessInput methods with the same signature. This resolves the ambiguity.

Reimplemented from wsf::comm::medium::Container.

References wsf::comm::medium::Container::ProcessInput().

◆ QueryInterface()

template<typename PARENT>
void * wsf::comm::medium::ContainerComponent< PARENT >::QueryInterface ( int aRole)
inlineoverridevirtual

Requests a component's role interface. A component can support one or more roles.

Parameters
aRoleThe role whose interface is to be returned.
Returns
A pointer to the object if it supports the indicated role, or 'null' if it does not. Usage: WsfProcessor* procPtrOrNull = (WsfProcessor*)componentPtr->QueryComponentInterface(cWSF_COMPONENT_PROCESSOR);

Implements WsfComponent.

References ContainerComponent().


The documentation for this class was generated from the following file:
Copyrights Multiple, All Rights Reserved