Cogs.Core
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
Cogs::Core::PropertyStore Struct Reference

#include <PropertiesManager.h>

Classes

struct  PropertyAlloc
 

Public Member Functions

 PropertyStore (MemBlockType memType=MemBlockType::PropertyStore)
 
 PropertyStore (const PropertyStore &)
 
 PropertyStore (PropertyStore &&) noexcept
 
PropertyStoreoperator= (const PropertyStore &)
 
PropertyStoreoperator= (PropertyStore &&) noexcept
 
bool getProperty (StringView key, bool defaultValue)
 
float getProperty (StringView key, float defaultValue)
 
int getProperty (StringView key, int defaultValue)
 
uint32_t getProperty (StringView key, uint32_t defaultValue)
 
StringView getProperty (StringView key, const char *defaultValue)
 
StringView getProperty (StringView key, StringView defaultValue)
 
std::span< const float > getProperty (StringView key, std::span< const float > defaultValue)
 
glm::vec3 getProperty (StringView key, glm::vec3 defaultValue)
 
uint32_t addProperty (StringView key, bool value)
 
uint32_t addProperty (StringView key, int32_t value)
 
uint32_t addProperty (StringView key, uint32_t value)
 
uint32_t addProperty (StringView key, float value)
 
uint32_t addProperty (StringView key, double value)
 
uint32_t addProperty (StringView key, const char *value)
 
uint32_t addProperty (StringView key, StringRef value)
 
uint32_t addProperty (StringView key, StringView value)
 
uint32_t addProperty (StringView key, std::span< const float > values)
 
uint32_t addProperty (StringView key, std::span< const double > values)
 
uint32_t addProperty (StringView key, std::span< const int32_t > values)
 
uint32_t addProperty (StringView key, std::span< const uint32_t > values)
 
uint32_t addProperty (StringView key, const glm::vec3 &values)
 
uint32_t addProperty (const PropertyStore &other, uint32_t otherIndex)
 
PropertyInfogetProperty (StringView key)
 
PropertyInfogetProperty (StringRef key)
 
PropertyInfogetPropertyByIndex (uint32_t index)
 
const PropertyInfogetPropertyByIndex (uint32_t index) const
 
uint32_t findProperty (StringView key) const
 
uint32_t findProperty (uint32_t first, uint32_t count, StringRef key) const
 
bool hasProperty (StringView key) const
 
uint32_t size () const
 
StringView getKey (const PropertyInfo &p) const
 
StringView getString (const PropertyInfo &p) const
 
StringView getString (uint32_t index) const
 
std::span< float > getFloatArray (uint32_t index)
 
std::span< const float > getFloatArray (const PropertyInfo &p) const
 
std::span< const float > getFloatArray (uint32_t index) const
 
std::span< const double > getDoubleArray (const PropertyInfo &p) const
 
std::span< const double > getDoubleArray (uint32_t index) const
 
std::span< const int32_t > getIntArray (const PropertyInfo &p) const
 
std::span< const int32_t > getIntArray (uint32_t index) const
 
std::span< const uint32_t > getUIntArray (const PropertyInfo &p) const
 
std::span< const uint32_t > getUIntArray (uint32_t index) const
 
std::span< const PropertyInfogetHeaders () const
 
const uint8_t * getData () const
 
void copyProperties (const PropertyStore &other, uint32_t offset, uint32_t count)
 
size_t currentByteSize () const
 
size_t allocatedByteSize () const
 

Static Public Attributes

static constexpr uint32_t NoProperty = static_cast<uint32_t>(-1)
 Return from findProperty if key not found.
 

Private Member Functions

PropertyInfoaddProperty (StringView key, PropertyType type)
 
void addPropertyData (PropertyInfo &p, const void *data, size_t size)
 
uint8_t * getPropertyData (const PropertyInfo &p)
 
const uint8_t * getPropertyData (const PropertyInfo &p) const
 
PropertyAlloc allocate (size_t propertySize)
 

Private Attributes

Memory::TypedBuffer< PropertyInfoheaders
 
Memory::MemoryBuffer data
 
size_t dataSize = 0
 

Detailed Description

Container for Key-property values.

Note that there is no build-in thread safety. Note that there is not type casting getting values. Get will silently return default if type mismatch.

Definition at line 74 of file PropertiesManager.h.

Constructor & Destructor Documentation

◆ PropertyStore() [1/3]

Cogs::Core::PropertyStore::PropertyStore ( MemBlockType  memType = MemBlockType::PropertyStore)

Definition at line 3 of file PropertiesManager.cpp.

◆ PropertyStore() [2/3]

Cogs::Core::PropertyStore::PropertyStore ( const PropertyStore other)

Definition at line 10 of file PropertiesManager.cpp.

◆ PropertyStore() [3/3]

Cogs::Core::PropertyStore::PropertyStore ( PropertyStore &&  other)
noexcept

Definition at line 17 of file PropertiesManager.cpp.

Member Function Documentation

◆ addProperty() [1/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( const PropertyStore other,
uint32_t  otherIndex 
)

Definition at line 494 of file PropertiesManager.cpp.

◆ addProperty() [2/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
bool  value 
)

Definition at line 40 of file PropertiesManager.cpp.

◆ addProperty() [3/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
const char *  value 
)
inline

Definition at line 99 of file PropertiesManager.h.

◆ addProperty() [4/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
const glm::vec3 &  values 
)

Definition at line 180 of file PropertiesManager.cpp.

◆ addProperty() [5/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
double  value 
)

Definition at line 54 of file PropertiesManager.cpp.

◆ addProperty() [6/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
float  value 
)

Definition at line 47 of file PropertiesManager.cpp.

◆ addProperty() [7/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
int32_t  value 
)

Definition at line 61 of file PropertiesManager.cpp.

◆ addProperty() [8/15]

Cogs::Core::PropertyInfo & Cogs::Core::PropertyStore::addProperty ( StringView  key,
PropertyType  type 
)
private

Definition at line 464 of file PropertiesManager.cpp.

◆ addProperty() [9/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
std::span< const double >  values 
)

Definition at line 103 of file PropertiesManager.cpp.

◆ addProperty() [10/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
std::span< const float >  values 
)

Definition at line 75 of file PropertiesManager.cpp.

◆ addProperty() [11/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
std::span< const int32_t >  values 
)

Definition at line 124 of file PropertiesManager.cpp.

◆ addProperty() [12/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
std::span< const uint32_t >  values 
)

Definition at line 152 of file PropertiesManager.cpp.

◆ addProperty() [13/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
StringRef  value 
)

Definition at line 223 of file PropertiesManager.cpp.

◆ addProperty() [14/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
StringView  value 
)

Definition at line 230 of file PropertiesManager.cpp.

◆ addProperty() [15/15]

uint32_t Cogs::Core::PropertyStore::addProperty ( StringView  key,
uint32_t  value 
)

Definition at line 68 of file PropertiesManager.cpp.

◆ addPropertyData()

void Cogs::Core::PropertyStore::addPropertyData ( PropertyInfo p,
const void *  data,
size_t  size 
)
private

Definition at line 476 of file PropertiesManager.cpp.

◆ allocate()

Cogs::Core::PropertyStore::PropertyAlloc Cogs::Core::PropertyStore::allocate ( size_t  propertySize)
private

Definition at line 551 of file PropertiesManager.cpp.

◆ allocatedByteSize()

size_t Cogs::Core::PropertyStore::allocatedByteSize ( ) const
inline

Definition at line 143 of file PropertiesManager.h.

◆ copyProperties()

void Cogs::Core::PropertyStore::copyProperties ( const PropertyStore other,
uint32_t  offset,
uint32_t  count 
)

Definition at line 515 of file PropertiesManager.cpp.

◆ currentByteSize()

size_t Cogs::Core::PropertyStore::currentByteSize ( ) const
inline

Definition at line 142 of file PropertiesManager.h.

◆ findProperty() [1/2]

uint32_t Cogs::Core::PropertyStore::findProperty ( StringView  key) const

Definition at line 309 of file PropertiesManager.cpp.

◆ findProperty() [2/2]

uint32_t Cogs::Core::PropertyStore::findProperty ( uint32_t  first,
uint32_t  count,
StringRef  key 
) const

Definition at line 314 of file PropertiesManager.cpp.

◆ getData()

const uint8_t * Cogs::Core::PropertyStore::getData ( ) const
inline

Definition at line 138 of file PropertiesManager.h.

◆ getDoubleArray() [1/2]

std::span< const double > Cogs::Core::PropertyStore::getDoubleArray ( const PropertyInfo p) const

Definition at line 379 of file PropertiesManager.cpp.

◆ getDoubleArray() [2/2]

std::span< const double > Cogs::Core::PropertyStore::getDoubleArray ( uint32_t  index) const

Definition at line 392 of file PropertiesManager.cpp.

◆ getFloatArray() [1/3]

std::span< const float > Cogs::Core::PropertyStore::getFloatArray ( const PropertyInfo p) const

Definition at line 400 of file PropertiesManager.cpp.

◆ getFloatArray() [2/3]

std::span< float > Cogs::Core::PropertyStore::getFloatArray ( uint32_t  index)

Definition at line 354 of file PropertiesManager.cpp.

◆ getFloatArray() [3/3]

std::span< const float > Cogs::Core::PropertyStore::getFloatArray ( uint32_t  index) const

Definition at line 371 of file PropertiesManager.cpp.

◆ getHeaders()

std::span< const PropertyInfo > Cogs::Core::PropertyStore::getHeaders ( ) const
inline

Definition at line 137 of file PropertiesManager.h.

◆ getIntArray() [1/2]

std::span< const int32_t > Cogs::Core::PropertyStore::getIntArray ( const PropertyInfo p) const

Definition at line 416 of file PropertiesManager.cpp.

◆ getIntArray() [2/2]

std::span< const int32_t > Cogs::Core::PropertyStore::getIntArray ( uint32_t  index) const

Definition at line 432 of file PropertiesManager.cpp.

◆ getKey()

Cogs::StringView Cogs::Core::PropertyStore::getKey ( const PropertyInfo p) const

Definition at line 325 of file PropertiesManager.cpp.

◆ getProperty() [1/10]

Cogs::Core::PropertyInfo & Cogs::Core::PropertyStore::getProperty ( StringRef  key)

Definition at line 286 of file PropertiesManager.cpp.

◆ getProperty() [2/10]

Cogs::Core::PropertyInfo & Cogs::Core::PropertyStore::getProperty ( StringView  key)

Definition at line 281 of file PropertiesManager.cpp.

◆ getProperty() [3/10]

bool Cogs::Core::PropertyStore::getProperty ( StringView  key,
bool  defaultValue 
)

Definition at line 185 of file PropertiesManager.cpp.

◆ getProperty() [4/10]

StringView Cogs::Core::PropertyStore::getProperty ( StringView  key,
const char *  defaultValue 
)
inline

Definition at line 89 of file PropertiesManager.h.

◆ getProperty() [5/10]

float Cogs::Core::PropertyStore::getProperty ( StringView  key,
float  defaultValue 
)

Definition at line 194 of file PropertiesManager.cpp.

◆ getProperty() [6/10]

glm::vec3 Cogs::Core::PropertyStore::getProperty ( StringView  key,
glm::vec3  defaultValue 
)

Definition at line 266 of file PropertiesManager.cpp.

◆ getProperty() [7/10]

int Cogs::Core::PropertyStore::getProperty ( StringView  key,
int  defaultValue 
)

Definition at line 204 of file PropertiesManager.cpp.

◆ getProperty() [8/10]

std::span< const float > Cogs::Core::PropertyStore::getProperty ( StringView  key,
std::span< const float >  defaultValue 
)

Definition at line 253 of file PropertiesManager.cpp.

◆ getProperty() [9/10]

Cogs::StringView Cogs::Core::PropertyStore::getProperty ( StringView  key,
StringView  defaultValue 
)

Definition at line 247 of file PropertiesManager.cpp.

◆ getProperty() [10/10]

uint32_t Cogs::Core::PropertyStore::getProperty ( StringView  key,
uint32_t  defaultValue 
)

Definition at line 214 of file PropertiesManager.cpp.

◆ getPropertyByIndex() [1/2]

Cogs::Core::PropertyInfo & Cogs::Core::PropertyStore::getPropertyByIndex ( uint32_t  index)

Definition at line 299 of file PropertiesManager.cpp.

◆ getPropertyByIndex() [2/2]

const Cogs::Core::PropertyInfo & Cogs::Core::PropertyStore::getPropertyByIndex ( uint32_t  index) const

Definition at line 304 of file PropertiesManager.cpp.

◆ getPropertyData() [1/2]

uint8_t * Cogs::Core::PropertyStore::getPropertyData ( const PropertyInfo p)
private

Definition at line 484 of file PropertiesManager.cpp.

◆ getPropertyData() [2/2]

const uint8_t * Cogs::Core::PropertyStore::getPropertyData ( const PropertyInfo p) const
private

Definition at line 489 of file PropertiesManager.cpp.

◆ getString() [1/2]

Cogs::StringView Cogs::Core::PropertyStore::getString ( const PropertyInfo p) const

Definition at line 330 of file PropertiesManager.cpp.

◆ getString() [2/2]

Cogs::StringView Cogs::Core::PropertyStore::getString ( uint32_t  index) const

Definition at line 349 of file PropertiesManager.cpp.

◆ getUIntArray() [1/2]

std::span< const uint32_t > Cogs::Core::PropertyStore::getUIntArray ( const PropertyInfo p) const

Definition at line 440 of file PropertiesManager.cpp.

◆ getUIntArray() [2/2]

std::span< const uint32_t > Cogs::Core::PropertyStore::getUIntArray ( uint32_t  index) const

Definition at line 456 of file PropertiesManager.cpp.

◆ hasProperty()

bool Cogs::Core::PropertyStore::hasProperty ( StringView  key) const
inline

Definition at line 116 of file PropertiesManager.h.

◆ operator=() [1/2]

Cogs::Core::PropertyStore & Cogs::Core::PropertyStore::operator= ( const PropertyStore other)

Definition at line 24 of file PropertiesManager.cpp.

◆ operator=() [2/2]

Cogs::Core::PropertyStore & Cogs::Core::PropertyStore::operator= ( PropertyStore &&  other)
noexcept

Definition at line 32 of file PropertiesManager.cpp.

◆ size()

uint32_t Cogs::Core::PropertyStore::size ( ) const
inline

Definition at line 118 of file PropertiesManager.h.

Member Data Documentation

◆ data

Memory::MemoryBuffer Cogs::Core::PropertyStore::data
private

Definition at line 162 of file PropertiesManager.h.

◆ dataSize

size_t Cogs::Core::PropertyStore::dataSize = 0
private

Definition at line 163 of file PropertiesManager.h.

◆ headers

Memory::TypedBuffer<PropertyInfo> Cogs::Core::PropertyStore::headers
private

Definition at line 161 of file PropertiesManager.h.

◆ NoProperty

constexpr uint32_t Cogs::Core::PropertyStore::NoProperty = static_cast<uint32_t>(-1)
staticconstexpr

Return from findProperty if key not found.

Definition at line 77 of file PropertiesManager.h.


The documentation for this struct was generated from the following files: