KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::TActorIterator< ActorType > Class Template Reference

Template actor iterator. More...

#include <ActorIterator.h>

Inheritance diagram for Karma::TActorIterator< ActorType >:
Collaboration diagram for Karma::TActorIterator< ActorType >:

Public Member Functions

 TActorIterator (const UWorld *InWorld, TSubclassOf< AActor > InClass=ActorType::StaticClass(), EActorIteratorFlags InFlags=EActorIteratorFlags(EActorIteratorFlags::OnlyActiveLevels|EActorIteratorFlags::SkipPendingKill))
 A Constructor.
 
 TActorIterator (EActorIteratorType)
 Constructor for creating an end iterator.
 
FORCEINLINE ActorType * operator* () const
 Returns the current suitable actor pointed at by the Iterator.
 
FORCEINLINE ActorType * operator-> () const
 Returns the current suitable actor pointed at by the Iterator.
 
- Public Member Functions inherited from Karma::TActorIteratorBase< TActorIterator< ActorType > >
void operator++ ()
 Iterates to next suitable actor.
 
FORCEINLINE AActoroperator* () const
 Returns the current suitable actor pointed at by the Iterator.
 
FORCEINLINE AActoroperator-> () const
 Returns the current suitable actor pointed at by the Iterator.
 
FORCEINLINE operator bool () const
 Returns whether the iterator has reached the end and no longer points to a suitable actor.
 
void ClearCurrent ()
 Clears the current Actor in the array (setting it to NULL).
 
int32 GetProgressNumerator () const
 Returns the number of actors considered thus far. Can be used in combination with GetProgressDenominator to gauge progress iterating over all actors.
 
FORCEINLINE bool CanIterateLevel (const ULevel *Level) const
 Used to examine whether this level is valid for iteration or not. This function should be redefined (thus hiding this one) in a derived class if it wants special level filtering.
 
FORCEINLINE bool IsActorSuitable (const AActor *Actor) const
 Determines whether this is a valid actor or not. This function should be redefined (thus hiding this one) in a derived class if it wants special actor filtering.
 

Friends

class TActorIteratorBase< TActorIterator >
 

Additional Inherited Members

- Protected Member Functions inherited from Karma::TActorIteratorBase< TActorIterator< ActorType > >
 TActorIteratorBase (EActorIteratorType)
 A constructor.
 
 TActorIteratorBase (const UWorld *InWorld, TSubclassOf< AActor > InClass, const EActorIteratorFlags InFlags)
 Constructor for setting m_State (FActorIteratorState) with the supplied InWorld and InClass.
 

Detailed Description

template<typename ActorType>
class Karma::TActorIterator< ActorType >

Template actor iterator.

Note
The use is like so
for (TActorIterator<AActor> ActorItr(testWorld); ActorItr; ++ActorItr)
{
KR_INFO("Iterating over actor: {0}", (*ActorItr)->GetName());
}
#define KR_INFO(...)
A macro for logging information in the Client part.
Definition Log.h:117
TActorIterator(const UWorld *InWorld, TSubclassOf< AActor > InClass=ActorType::StaticClass(), EActorIteratorFlags InFlags=EActorIteratorFlags(EActorIteratorFlags::OnlyActiveLevels|EActorIteratorFlags::SkipPendingKill))
A Constructor.
Definition ActorIterator.h:102

Constructor & Destructor Documentation

◆ TActorIterator() [1/2]

template<typename ActorType>
Karma::TActorIterator< ActorType >::TActorIterator ( const UWorld * InWorld,
TSubclassOf< AActor > InClass = ActorType::StaticClass(),
EActorIteratorFlags InFlags = EActorIteratorFlags(EActorIteratorFlags::OnlyActiveLevels | EActorIteratorFlags::SkipPendingKill) )
inlineexplicit

A Constructor.

Parameters
InWorldThe world whose actors are to be iterated over.
InClassThe subclass of actors to be iterated over.
InFlagsIteration flags indicating which types of levels and actors should be iterated
Since
Karma 1.0.0

◆ TActorIterator() [2/2]

template<typename ActorType>
Karma::TActorIterator< ActorType >::TActorIterator ( EActorIteratorType )
inlineexplicit

Constructor for creating an end iterator.

Since
Karma 1.0.0

Member Function Documentation

◆ operator*()

template<typename ActorType>
FORCEINLINE ActorType * Karma::TActorIterator< ActorType >::operator* ( ) const
inline

Returns the current suitable actor pointed at by the Iterator.

Returns
Current suitable actor
Since
Karma 1.0.0

◆ operator->()

template<typename ActorType>
FORCEINLINE ActorType * Karma::TActorIterator< ActorType >::operator-> ( ) const
inline

Returns the current suitable actor pointed at by the Iterator.

Returns
Current suitable actor
Since
Karma 1.0.0

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