WSF
wsf::cyber::Constraint Class Reference

#include <WsfCyberConstraint.hpp>

Inheritance diagram for wsf::cyber::Constraint:
Collaboration diagram for wsf::cyber::Constraint:

Public Member Functions

 Constraint ()
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 PreInitialize (double aSimTime)
virtual bool Initialize (double aSimTime)
virtual bool Initialize2 (double aSimTime)
virtual void PreInput ()
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)

Cyber resource methods

double GetCurrentResources () const
double GetTotalResources () const
bool RestoreResources (double aQuantity)
bool RemoveResources (double aQuantity)

Component infrastructure methods.

WsfStringId GetComponentName () const override
const int * GetComponentRoles () const override
WsfComponentCloneComponent () const override
void * QueryInterface (int aRole) override
static ConstraintFind (const WsfPlatform &aPlatform)
static ConstraintFindOrCreate (WsfPlatform &aPlatform)

Framework methods.

bool ProcessInput (UtInput &aInput) override
ConstraintClone () const override

External C2 monitoring methods.

size_t GetConcurrentAttacks (const std::string &aAttackType) const
void AddConcurrentAttack (const std::string &aAttackType, size_t aEngagementID)
void RemoveConcurrentAttack (const std::string &aAttackType, size_t aEngagementID)
void AddAttackTime (const std::string &aAttackType, double aSimTime)
size_t GetAttackCountAfterTime (const std::string &aAttackType, double aSimTime) const

Additional Inherited Members

Public Types inherited from WsfComponentT< WsfPlatform >
typedef WsfPlatform ParentType
 This is needed to support the WsfComponentList template.
Public Types inherited from WsfObject
typedef std::vector< WsfStringIdTypeList
 The list of types returned by GetTypeList.
 WsfObject (const WsfObject &aSrc)
 Copy constructor (for Clone()).

Detailed Description

A class that models the concept of a platform having unique factors that can restrict or degrade outgoing cyber attacks. The class also has script hooks to allow for external script level C2 logic. For example a platform may only conduct a particular attack x times/hour or have x concurrent attacks. If a platform does not have sufficient resources available for an attack that requires resources then the attack will not be initiated.

Constructor & Destructor Documentation

◆ Constraint()

wsf::cyber::Constraint::Constraint ( )

Member Function Documentation

◆ AddAttackTime()

void wsf::cyber::Constraint::AddAttackTime ( const std::string & aAttackType,
double aSimTime )

◆ AddConcurrentAttack()

void wsf::cyber::Constraint::AddConcurrentAttack ( const std::string & aAttackType,
size_t aEngagementID )

◆ Clone()

Constraint * wsf::cyber::Constraint::Clone ( ) const
inlineoverridevirtual

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 Constraint().

◆ CloneComponent()

WsfComponent * wsf::cyber::Constraint::CloneComponent ( ) const
overridevirtual

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

Implements WsfComponent.

References Constraint().

◆ Find()

◆ FindOrCreate()

Constraint * wsf::cyber::Constraint::FindOrCreate ( WsfPlatform & aPlatform)
static

◆ GetAttackCountAfterTime()

size_t wsf::cyber::Constraint::GetAttackCountAfterTime ( const std::string & aAttackType,
double aSimTime ) const

References pos.

◆ GetComponentName()

WsfStringId wsf::cyber::Constraint::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 WsfObject::GetNameId().

◆ GetComponentRoles()

const int * wsf::cyber::Constraint::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 cWSF_COMPONENT_CYBER_CONSTRAINT, and cWSF_COMPONENT_NULL.

◆ GetConcurrentAttacks()

size_t wsf::cyber::Constraint::GetConcurrentAttacks ( const std::string & aAttackType) const

◆ GetCurrentResources()

double wsf::cyber::Constraint::GetCurrentResources ( ) const
inline

◆ GetTotalResources()

double wsf::cyber::Constraint::GetTotalResources ( ) const
inline

◆ ProcessInput()

bool wsf::cyber::Constraint::ProcessInput ( UtInput & aInput)
overridevirtual

Evaluate the current input command and determine if it is one processed by the component. The component should get the current command from the input stream and determine if it is one that it recognizes. If it does not recognize the command then it should leave the command in the input stream and return false. If it does recognize the command then it should process the command and return true. If invalid arguments are encountered then it should throw an exception.

Parameters
aInputThe input stream.
Returns
true if the current command was recognized (and processed), or false if the command was not recognized.
Exceptions
UtInput::ExceptionBaseif an invalid input was encountered.

Reimplemented from WsfComponent.

◆ QueryInterface()

void * wsf::cyber::Constraint::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 cWSF_COMPONENT_CYBER_CONSTRAINT.

◆ RemoveConcurrentAttack()

void wsf::cyber::Constraint::RemoveConcurrentAttack ( const std::string & aAttackType,
size_t aEngagementID )

◆ RemoveResources()

bool wsf::cyber::Constraint::RemoveResources ( double aQuantity)

◆ RestoreResources()

bool wsf::cyber::Constraint::RestoreResources ( double aQuantity)

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