Leviathan  0.8.0.0
Leviathan game engine
Leviathan::SendableMarkFromSystem< T > Class Template Reference

System type for marking Sendable as marked if a component of type T is marked. More...

#include <Systems.h>

+ Inheritance diagram for Leviathan::SendableMarkFromSystem< T >:

Public Member Functions

void Run (GameWorld &world)
 
void CreateNodes (const std::vector< std::tuple< Sendable *, ObjectID >> &firstdata, const std::vector< std::tuple< Position *, ObjectID >> &seconddata, const ComponentHolder< Sendable > &firstholder, const ComponentHolder< Position > &secondholder)
 
void DestroyNodes (const std::vector< std::tuple< Sendable *, ObjectID >> &firstdata, const std::vector< std::tuple< Position *, ObjectID >> &seconddata)
 
- Public Member Functions inherited from Leviathan::SystemCachedComponentCollectionStorage< std::tuple< Sendable &, T & > >
void Clear ()
 
auto GetCachedComponentCollectionCount () const
 

Additional Inherited Members

- Public Types inherited from Leviathan::SystemCachedComponentCollectionStorage< std::tuple< Sendable &, T & > >
using HolderType = CachedComponentCollectionHolder< std::tuple< Sendable &, T & > >
 
- Static Public Member Functions inherited from Leviathan::SystemCachedComponentCollectionStorage< std::tuple< Sendable &, T & > >
static void TupleCachedComponentCollectionHelper (ObjectPool< std::tuple< FirstType &, SecondType & >, ObjectID > &CachedComponentCollections, const std::vector< std::tuple< FirstType *, ObjectID >> &firstdata, const std::vector< std::tuple< SecondType *, ObjectID >> &seconddata, const ComponentHolder< FirstType > &firstholder, const ComponentHolder< SecondType > &secondholder)
 Helper function for creating nodes based on std::tuple. More...
 
static void TupleCachedComponentCollectionHelper (ObjectPool< std::tuple< FirstType &, SecondType &, ThirdType & >, ObjectID > &CachedComponentCollections, const std::vector< std::tuple< FirstType *, ObjectID >> &firstdata, const std::vector< std::tuple< SecondType *, ObjectID >> &seconddata, const std::vector< std::tuple< ThirdType *, ObjectID >> &thirddata, const ComponentHolder< FirstType > &firstholder, const ComponentHolder< SecondType > &secondholder, const ComponentHolder< ThirdType > &thirdholder)
 Tree part component TupleCachedComponentCollectionHelper. More...
 
- Public Attributes inherited from Leviathan::SystemCachedComponentCollectionStorage< std::tuple< Sendable &, T & > >
HolderType CachedComponents
 
- Static Protected Member Functions inherited from Leviathan::SystemCachedComponentCollectionStorage< std::tuple< Sendable &, T & > >
static T * _TupleHelperGetIfComponentExists (ObjectID id, const std::vector< std::tuple< T *, ObjectID >> &addedlist, const ComponentHolder< T > &holder)
 

Detailed Description

template<class T>
class Leviathan::SendableMarkFromSystem< T >

System type for marking Sendable as marked if a component of type T is marked.

Definition at line 167 of file Systems.h.

Member Function Documentation

◆ CreateNodes()

template<class T >
void Leviathan::SendableMarkFromSystem< T >::CreateNodes ( const std::vector< std::tuple< Sendable *, ObjectID >> &  firstdata,
const std::vector< std::tuple< Position *, ObjectID >> &  seconddata,
const ComponentHolder< Sendable > &  firstholder,
const ComponentHolder< Position > &  secondholder 
)
inline

Definition at line 180 of file Systems.h.

184  {
186  this->CachedComponents, firstdata, seconddata, firstholder, secondholder);
187  }
static void TupleCachedComponentCollectionHelper(ObjectPool< std::tuple< FirstType &, SecondType & >, ObjectID > &CachedComponentCollections, const std::vector< std::tuple< FirstType *, ObjectID >> &firstdata, const std::vector< std::tuple< SecondType *, ObjectID >> &seconddata, const ComponentHolder< FirstType > &firstholder, const ComponentHolder< SecondType > &secondholder)
Helper function for creating nodes based on std::tuple.
Definition: System.h:46

◆ DestroyNodes()

template<class T >
void Leviathan::SendableMarkFromSystem< T >::DestroyNodes ( const std::vector< std::tuple< Sendable *, ObjectID >> &  firstdata,
const std::vector< std::tuple< Position *, ObjectID >> &  seconddata 
)
inline

Definition at line 189 of file Systems.h.

191  {
194  }
void RemoveBasedOnKeyTupleList(const std::vector< std::tuple< Any, KeyType >> &values)
Destroys without releasing elements based on ids in vector.
Definition: ObjectPool.h:198

◆ Run()

template<class T >
void Leviathan::SendableMarkFromSystem< T >::Run ( GameWorld world)
inline

Definition at line 169 of file Systems.h.

170  {
171  auto& index = this->CachedComponents.GetIndex();
172  for(auto iter = index.begin(); iter != index.end(); ++iter) {
173 
174  if(std::get<1>(*iter->second).Marked) {
175  std::get<0>(*iter->second).Marked = true;
176  }
177  }
178  }
std::unordered_map< KeyType, ElementType * > & GetIndex()
Returns a direct access to Index.
Definition: ObjectPool.h:272

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