WSF
wsf::altloc::Component Class Reference

#include <WsfAltLocComponent.hpp>

Inheritance diagram for wsf::altloc::Component:
Collaboration diagram for wsf::altloc::Component:

Classes

union  Offset

Public Types

enum  { cCOMPONENT = 20181205 }
Public Types inherited from WsfObject
typedef std::vector< WsfStringIdTypeList
 The list of types returned by GetTypeList.
Public Types inherited from WsfComponentT< WsfPlatform >
typedef WsfPlatform ParentType
 This is needed to support the WsfComponentList template.

Public Member Functions

 Component ()
 Component (const Component &aSrc)
Componentoperator= (const Component &)=delete
 ~Component () override=default
Public Member Functions inherited from WsfObject
 WsfObject ()
 This is the constructor for the WsfObject class.
 ~WsfObject () override
 This is the destructor for the WsfObject class.
const char * GetScriptClassName () const override
const std::string & GetType () const
WsfStringId GetTypeId () const
 Get the string ID of the 'type' of the object.
void SetType (WsfStringId aType)
const std::string & GetBaseType () const
WsfStringId GetBaseTypeId () const
const TypeListGetTypeList () const
bool IsA_TypeOf (WsfStringId aType) const
WsfObjectoperator= (const WsfObject &aRhs)
 Assignment operator.
template<typename T>
void Serialize (T &aBuff)
 For XIO (de)serialization.
const std::string & GetName () const
WsfStringId GetNameId () const
void SetName (WsfStringId aName)
Public Member Functions inherited from WsfComponentT< WsfPlatform >
 WsfComponentT ()
 WsfComponentT (const WsfComponentT &) noexcept
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 Initialize (double aSimTime)
virtual bool Initialize2 (double aSimTime)
virtual void PreInput ()

Static Public Attributes

static constexpr const char * cNAME = "AlternateLocationsComponent"
static constexpr const char * cCOMMAND = "alternate_locations"
static constexpr double cINVALID_DRAW = -1.0
static constexpr int cINVALID_LOCATION_INDEX = -1

Component infrastructure methods.

BlockType mBlockType
WsfStringId mReferenceName
ComponentmReferenceComponent
Offset mOffset
std::vector< WeightedLocationmLocations
double mDraw
double mWeightsSum
int mLocationIndex
WsfStringId GetComponentName () const override
const int * GetComponentRoles () const override
WsfComponentCloneComponent () const override
void * QueryInterface (int aRole) override
bool ProcessInput (UtInput &aInput) override
WsfObjectClone () const override
bool PreInitialize (double aSimTime) override
static ComponentFind (const WsfPlatform &aParent)
 Find the instance of this component attached to the specified platform.
static ComponentFindOrCreate (WsfPlatform &aParent)

Additional Inherited Members

 WsfObject (const WsfObject &aSrc)
 Copy constructor (for Clone()).

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
cCOMPONENT 

Constructor & Destructor Documentation

◆ Component() [1/2]

◆ Component() [2/2]

wsf::altloc::Component::Component ( const Component & aSrc)

◆ ~Component()

wsf::altloc::Component::~Component ( )
overridedefault

Member Function Documentation

◆ Clone()

WsfObject * wsf::altloc::Component::Clone ( ) const
overridevirtual

Return a copy of this object. Must be implemented by all derived types. If cloning is impossible, a WsfUncloneableException should be thrown.

Implements WsfObject.

References Component(), and WsfObject::WsfObject().

◆ CloneComponent()

WsfComponent * wsf::altloc::Component::CloneComponent ( ) const
overridevirtual

Clones a component. May return null if component does not support clone.

Implements WsfComponent.

References Component().

◆ Find()

Component * wsf::altloc::Component::Find ( const WsfPlatform & aParent)
static

Find the instance of this component attached to the specified platform.

References Component(), WsfComponentList::FindByRole(), and WsfPlatform::GetComponents().

Referenced by FindOrCreate().

◆ FindOrCreate()

Component * wsf::altloc::Component::FindOrCreate ( WsfPlatform & aParent)
static

Find the instance of this component attached to the specified platform, and create it if it doesn't exist.

References Component(), Find(), and WsfPlatform::GetComponents().

◆ GetComponentName()

WsfStringId wsf::altloc::Component::GetComponentName ( ) const
overridevirtual

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 WsfObject::GetNameId().

◆ GetComponentRoles()

const int * wsf::altloc::Component::GetComponentRoles ( ) const
overridevirtual

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 cCOMPONENT, and cWSF_COMPONENT_NULL.

◆ operator=()

Component & wsf::altloc::Component::operator= ( const Component & )
delete

References Component().

◆ PreInitialize()

bool wsf::altloc::Component::PreInitialize ( double aSimTime)
overridevirtual

Perform pre-initializion function. This is called by WsfPlatform::Initialize prior to actually initializing the components on a platform (i.e.: calling Initialize and Initialize2 for each component). The primary reason for this method is to allow components to add other components that will then be subsequently initialized. The component may examine the component list and add components, but it must not assume ANYTHING about the actual state of the component.

Parameters
aSimTimeThe current simulation time.
Returns
true if successful or false if unsuccessful (bad input data, etc.)

Reimplemented from WsfComponent.

References wsf::altloc::AGL, wsf::altloc::WeightedLocation::alt, wsf::altloc::WeightedLocation::altRef, wsf::altloc::WeightedLocation::altSet, cINVALID_LOCATION_INDEX, Component(), WsfObserver::Event(), wsf::altloc::SimulationExtension::Get(), WsfComponentT< WsfPlatform >::GetComponentParent(), wsf::Terrain::GetElevInterp(), WsfObject::GetName(), WsfSimulation::GetPlatformByName(), WsfPlatform::GetSimulation(), WsfSimulation::GetTerrainInterface(), wsf::altloc::WeightedLocation::hed, wsf::altloc::WeightedLocation::hedSet, wsf::altloc::WeightedLocation::lat, wsf::altloc::LOCAL, wsf::altloc::WeightedLocation::lon, mBlockType, mDraw, mLocationIndex, mLocations, mOffset, mReferenceComponent, mReferenceName, wsf::altloc::MSL, wsf::altloc::NONE, wsf::altloc::OFF_ARA, wsf::altloc::OFF_LLA, wsf::altloc::REF_LOC, and wsf::altloc::WeightedLocation::weight.

◆ ProcessInput()

bool wsf::altloc::Component::ProcessInput ( UtInput & aInput)
overridevirtual

Process input from a generic source.

Examine the current input command. If it is NOT one of the commands recognized by this class then it simply returns 'false'. If it is one of the commands recognized by this class then it processes the command and returns 'true'.

Parameters
aInputa reference to a UtInput object.
Returns
'true' if the command was one recognized by the class or 'false' if not.
Exceptions
UtInput::ExceptionBase(or an object derived from it) if the command was recognized but contains some sort of error.
Note
If a derived class does not recognize the command (i.e.: the return value is false) then it should call the base class ProcessInput method. This chain should continue until either the command is recognized or the top-level base class is encountered.

Reimplemented from WsfObject.

References cCOMMAND, cNAME, Component(), WsfComponentListT< COMPONENT_TYPE >::FindComponent(), WsfScenario::FromInput(), WsfScenario::GetDeferredInput(), WsfScenario::GetInputPlatformByName(), wsf::altloc::LOCAL, mBlockType, mLocations, mOffset, mReferenceName, mWeightsSum, wsf::altloc::NONE, wsf::altloc::OFF_ARA, wsf::altloc::OFF_LLA, platformPtr, wsf::altloc::REF_LOC, and WsfDeferredInput::Requires().

◆ QueryInterface()

void * wsf::altloc::Component::QueryInterface ( int aRole)
overridevirtual

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 cCOMPONENT.

Member Data Documentation

◆ cCOMMAND

const char* wsf::altloc::Component::cCOMMAND = "alternate_locations"
staticconstexpr

Referenced by ProcessInput().

◆ cINVALID_DRAW

double wsf::altloc::Component::cINVALID_DRAW = -1.0
staticconstexpr

◆ cINVALID_LOCATION_INDEX

int wsf::altloc::Component::cINVALID_LOCATION_INDEX = -1
staticconstexpr

Referenced by PreInitialize().

◆ cNAME

const char* wsf::altloc::Component::cNAME = "AlternateLocationsComponent"
staticconstexpr

Referenced by ProcessInput().

◆ mBlockType

BlockType wsf::altloc::Component::mBlockType

◆ mDraw

double wsf::altloc::Component::mDraw

Referenced by Component(), and PreInitialize().

◆ mLocationIndex

int wsf::altloc::Component::mLocationIndex

Referenced by Component(), and PreInitialize().

◆ mLocations

std::vector<WeightedLocation> wsf::altloc::Component::mLocations

◆ mOffset

Offset wsf::altloc::Component::mOffset

◆ mReferenceComponent

Component* wsf::altloc::Component::mReferenceComponent

Referenced by Component(), Component(), and PreInitialize().

◆ mReferenceName

WsfStringId wsf::altloc::Component::mReferenceName

◆ mWeightsSum

double wsf::altloc::Component::mWeightsSum

Referenced by Component(), and ProcessInput().


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