52enum { INDEX_NONE = -1 };
88template <
typename KeyType,
typename ValueType>
92 typedef std::map<KeyType, ValueType> AMap;
93 typedef typename AMap::iterator AnIterator;
109 void Add(
const KeyType& Key,
const ValueType& Value)
111 m_KeyValuePair.insert(
typename AMap::value_type(Key, Value));
124 return m_KeyValuePair.find(Key) != m_KeyValuePair.end();
141 std::pair<AnIterator, bool>
const& result = m_KeyValuePair.insert(
typename AMap::value_type(Key, aValue));
147 return result.first->second;
152 return result.first->second;
166 ValueType*
Find(
const KeyType& Key)
168 AnIterator result = m_KeyValuePair.find(Key);
170 if(result != m_KeyValuePair.end())
172 return &result->second;
190 return m_KeyValuePair[Key];
204 return m_KeyValuePair.at(Key);
209 return (uint32_t) m_KeyValuePair.size();
214 return m_KeyValuePair.begin();
219 return m_KeyValuePair.end();
224 return m_KeyValuePair.cbegin();
229 return m_KeyValuePair.cend();
241template<
typename BuildingBlock>
275 uint32_t occurences = 0;
276 typename std::vector<BuildingBlock>::iterator iterator = m_Elements.begin();
278 while (iterator != m_Elements.end())
280 if (*iterator == aBlock)
282 iterator = m_Elements.erase(iterator);
300 void Add(BuildingBlock aBlock)
302 m_Elements.push_back(aBlock);
312 KR_CORE_ASSERT((Index >= 0 && Index <
Num()),
"KarmaVector: Range check failed");
328 int32_t index =
Find(Item);
352 int32_t
Find(
const BuildingBlock& Item)
const
354 int32_t returnIndex = 0;
356 typename std::vector<BuildingBlock>::const_iterator iter = m_Elements.begin();
358 for (; iter != m_Elements.end(); iter++)
360 if (m_Elements[returnIndex] == Item)
367 if (iter != m_Elements.end())
385 typename std::vector<BuildingBlock>::const_iterator iterator = m_Elements.begin();
387 while (iterator != m_Elements.end())
389 if (*iterator == aBlock)
416 RemoveAtSwapImpl(Index);
437 int32_t Index =
Find(Item);
439 if (Index == INDEX_NONE)
456 return (uint32_t) m_Elements.size();
473 typename std::vector<BuildingBlock>::iterator iter = m_Elements.begin();
476 if constexpr(std::is_pointer_v<BuildingBlock>)
478 for (iter = m_Elements.begin(); iter != m_Elements.end(); iter++)
480 if (*iter !=
nullptr)
492 void Resize(uint32_t NewSize)
494 m_Elements.resize(NewSize);
520 m_Elements[Index] = Value;
529 inline void Clear() { m_Elements.clear(); }
536 inline const std::vector<BuildingBlock>&
GetElements()
const {
return m_Elements; }
551 typename std::vector<BuildingBlock>::iterator
begin()
553 return m_Elements.begin();
561 typename std::vector<BuildingBlock>::iterator
end()
563 return m_Elements.end();
566 typename std::vector<BuildingBlock>::const_iterator
begin()
const
568 return m_Elements.cbegin();
571 typename std::vector<BuildingBlock>::const_iterator
end()
const
573 return m_Elements.cend();
586 KR_CORE_ASSERT(Index >= 0,
"");
590 return m_Elements.at(Index);
593 KR_CORE_ASSERT(
false,
"Shouldn't happen");
595 static BuildingBlock aBlock;
609 return Index >= 0 && Index <
Num();
619 BuildingBlock& operator[](int32_t Index)
622 return m_Elements[Index];
625 const BuildingBlock& operator[](int32_t Index)
const
628 return m_Elements[Index];
638 void RemoveAtSwapImpl(int32_t Index)
640 const BuildingBlock* Data =
GetData();
641 const BuildingBlock* Dest = Data + Index;
644 const int32_t NumElementsAfterHole =
Num() - Index - 1;
645 const int32_t NumElementsToMoveIntoHole = glm::min(1, NumElementsAfterHole);
647 if (NumElementsToMoveIntoHole)
651 const int32_t LastElementIndex =
Num() - 1;
653 m_Elements[Index] = m_Elements[LastElementIndex];
655 m_Elements.pop_back();
659 std::vector<BuildingBlock> m_Elements;
698 std::string m_DefaultProtocol;
699 std::string m_DefaultName;
700 std::string m_DefaultHost;
701 std::string m_DefaultPortal;
702 std::string m_DefaultSaveExt;
703 int32_t m_DefaultPort;
746 static bool m_bDefaultsInitialized;
756 FURL(
const std::string& Filename =
"");
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
#define FORCEINLINE
Typical inlining macro for clarity.
Definition Core.h:170
ETeleportType
Definition KarmaTypes.h:682
@ TeleportPhysics
Definition KarmaTypes.h:687
@ None
Definition KarmaTypes.h:684
@ ResetPhysics
Definition KarmaTypes.h:690
EAllowShrinking
Definition KarmaTypes.h:21
@ Yes
Definition KarmaTypes.h:23
@ No
Definition KarmaTypes.h:26
ETravelType
Traveling from server to server.
Definition KarmaTypes.h:666
@ TRAVEL_Partial
Definition KarmaTypes.h:671
@ TRAVEL_Absolute
Definition KarmaTypes.h:668
@ TRAVEL_Relative
Definition KarmaTypes.h:674
@ TRAVEL_MAX
Definition KarmaTypes.h:677
#define KR_CORE_INFO(...)
A macro for logging information in the Core part.
Definition Log.h:85
bool Contains(const KeyType &Key) const
Checks if the map contains a specified key.
Definition KarmaTypes.h:122
ValueType * Find(const KeyType &Key)
Find the value associated with a specified key.
Definition KarmaTypes.h:166
const ValueType & operator[](const KeyType &Key) const
Overloaded subscript operator for accessing values by key (const version).
Definition KarmaTypes.h:202
ValueType & operator[](const KeyType &Key)
Overloaded subscript operator for accessing values by key.
Definition KarmaTypes.h:188
void Add(const KeyType &Key, const ValueType &Value)
Addes a key-value pair to the map.
Definition KarmaTypes.h:109
KarmaMap()
Constructor.
Definition KarmaTypes.h:100
ValueType & FindOrAdd(const KeyType &Key)
Find the value associated with a specified key, or if none exists, adds a value using the default con...
Definition KarmaTypes.h:138
std::vector< BuildingBlock >::iterator end()
Getter for the last vector element.
Definition KarmaTypes.h:561
~KarmaVector()
Destructor.
Definition KarmaTypes.h:259
KarmaVector()
Constructor.
Definition KarmaTypes.h:250
uint32_t Num() const
Returns the total number of elements in a vector.
Definition KarmaTypes.h:454
FORCEINLINE int32_t AddUnique(const BuildingBlock &Item)
Definition KarmaTypes.h:326
std::vector< BuildingBlock >::iterator begin()
Getter for first vector element.
Definition KarmaTypes.h:551
std::vector< BuildingBlock > & ModifyElements()
Getter for elements of vector for modification in appropriate way.
Definition KarmaTypes.h:544
FORCEINLINE bool IsValidIndex(int32_t Index) const
Definition KarmaTypes.h:607
void RemoveAtSwap(int32_t Index)
Removes an element at given location, swapping the last element into its place, and shrinking the arr...
Definition KarmaTypes.h:413
void Add(BuildingBlock aBlock)
Add an element to the vector.
Definition KarmaTypes.h:300
int32_t Find(const BuildingBlock &Item) const
Definition KarmaTypes.h:352
bool Contains(BuildingBlock aBlock) const
Sees if the vector contains the specified element.
Definition KarmaTypes.h:383
void SmartReset()
Just clear the elements.
Definition KarmaTypes.h:505
FORCEINLINE BuildingBlock & IndexToObject(int32_t Index)
Definition KarmaTypes.h:584
void RangeCheck(uint32_t Index) const
Sanity check for the index.
Definition KarmaTypes.h:310
uint32_t Remove(BuildingBlock aBlock)
Removes an element from the vector.
Definition KarmaTypes.h:273
void SetVectorElementByIndex(int32_t Index, BuildingBlock Value)
Set the element of a vector using the vector index.
Definition KarmaTypes.h:518
FORCEINLINE BuildingBlock const * GetData() const
Helper function to return typed pointer to the first entry of array.
Definition KarmaTypes.h:617
void Clear()
Clears the vector from all the elements.
Definition KarmaTypes.h:529
const std::vector< BuildingBlock > & GetElements() const
Getter for the elements of vector.
Definition KarmaTypes.h:536
uint32_t RemoveSingleSwap(const BuildingBlock &Item)
Removes a first appearence of single element from the array, swapping the last element into its place...
Definition KarmaTypes.h:435
void Reset()
We just reset the vector. UE has the following implementation.
Definition KarmaTypes.h:470
Specifies why an actor is being deleted/removed from a level.
Definition KarmaTypes.h:31
Type
Definition KarmaTypes.h:33
@ EndPlayInEditor
Definition KarmaTypes.h:39
@ Destroyed
Definition KarmaTypes.h:35
@ RemovedFromWorld
Definition KarmaTypes.h:41
@ Quit
Definition KarmaTypes.h:43
@ LevelTransition
Definition KarmaTypes.h:37
Specifies the goal/source of a UWorld object.
Definition KarmaTypes.h:56
Type
Definition KarmaTypes.h:58
@ GamePreview
Definition KarmaTypes.h:75
@ None
Definition KarmaTypes.h:60
@ Editor
Definition KarmaTypes.h:66
@ Game
Definition KarmaTypes.h:63
@ Inactive
Definition KarmaTypes.h:81
@ PIE
Definition KarmaTypes.h:69
@ EditorPreview
Definition KarmaTypes.h:72
@ GameRPC
Definition KarmaTypes.h:78
int32_t m_Port
Definition KarmaTypes.h:728
std::string m_Host
Definition KarmaTypes.h:725
static FUrlConfig UrlConfig
Definition KarmaTypes.h:745
std::string m_Portal
Definition KarmaTypes.h:742
FURL(const std::string &Filename="")
Definition KarmaTypes.cpp:29
std::string m_Map
Definition KarmaTypes.h:733
std::string m_Protocol
Definition KarmaTypes.h:722
std::string m_RedirectURL
Definition KarmaTypes.h:736
Helper for obtaining the default Url configuration.
Definition KarmaTypes.h:697
void Reset()
Definition KarmaTypes.cpp:18
void Init()
Definition KarmaTypes.cpp:7