OdbDesign
OdbDesign ODB++ Parser - C++ library, gRPC/REST server, CLI, tests
 
Loading...
Searching...
No Matches
Odb::Lib::App::DesignCache Class Reference

#include <DesignCache.h>

Public Types

enum class  LoadState { Unloaded , Loading , Loaded , Failed }
 
enum class  JsonPayloadKind { Design , FileModel }
 
using LoadEventCallback = std::function< void(const std::string &designName, LoadState from, LoadState to)>
 

Public Member Functions

 DesignCache (std::string directory)
 
 ~DesignCache ()
 
std::shared_ptr< ProductModel::Design > GetDesign (const std::string &designName)
 
std::shared_ptr< FileModel::Design::FileArchive > GetFileArchive (const std::string &designName)
 
void AddFileArchive (const std::string &designName, std::shared_ptr< FileModel::Design::FileArchive > fileArchive, bool save, std::uint64_t injectedBytes=0)
 
void InvalidateDesign (const std::string &designName)
 
bool SaveFileArchive (const std::string &designName)
 
std::vector< std::string > getLoadedDesignNames (const std::string &filter="") const
 
std::vector< std::string > getLoadedFileArchiveNames (const std::string &filter="") const
 
std::vector< std::string > getUnloadedDesignNames (const std::string &filter="") const
 
int loadAllFileArchives (bool stopOnError)
 
int loadAllDesigns (bool stopOnError)
 
int loadFileArchives (const Utils::StringVector &names)
 
int loadDesigns (const Utils::StringVector &names)
 
void setDirectory (const std::string &directory)
 
std::string getDirectory () const
 
void Clear ()
 
void ensureDirectoryExists () const
 
LoadState GetLoadState (const std::string &designName) const
 
void AddLoadObserver (LoadEventCallback callback)
 
bool LoadDesignAsync (const std::string &designName)
 
bool ContainsDesign (const std::string &designName) const
 
void setCacheMaxBytes (std::uint64_t maxBytes)
 
std::uint64_t getCacheMaxBytes () const
 
void setMaxBackgroundLoads (std::size_t maxLoads)
 
std::size_t getMaxBackgroundLoads () const
 
bool TryGetDesignBytes (const std::string &designName, std::string &outBytes) const
 
bool TryGetJsonPayload (const std::string &designName, JsonPayloadKind kind, std::string &outJson) const
 
bool HasCachedResponse (const std::string &designName) const
 
void SerializeResponsePayloads (const std::string &designName)
 
std::uint64_t designSerializationCount () const
 
std::uint64_t GetResponseGeneration (const std::string &designName) const
 
std::uint64_t cachedBytes () const
 
std::uint64_t cachedResponseBytes () const
 
void setMonolithicWireBudget (std::uint64_t maxBytes)
 
std::uint64_t getMonolithicWireBudget () const
 

Detailed Description

Definition at line 27 of file DesignCache.h.

Member Typedef Documentation

◆ LoadEventCallback

using Odb::Lib::App::DesignCache::LoadEventCallback = std::function<void(const std::string& designName, LoadState from, LoadState to)>

Definition at line 47 of file DesignCache.h.

Member Enumeration Documentation

◆ JsonPayloadKind

Enumerator
Design 
FileModel 

Definition at line 154 of file DesignCache.h.

◆ LoadState

Enumerator
Unloaded 
Loading 
Loaded 
Failed 

Definition at line 36 of file DesignCache.h.

Constructor & Destructor Documentation

◆ DesignCache()

Odb::Lib::App::DesignCache::DesignCache ( std::string  directory)

Definition at line 23 of file DesignCache.cpp.

Here is the call graph for this function:

◆ ~DesignCache()

Odb::Lib::App::DesignCache::~DesignCache ( )

Definition at line 29 of file DesignCache.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ AddFileArchive()

void Odb::Lib::App::DesignCache::AddFileArchive ( const std::string &  designName,
std::shared_ptr< FileModel::Design::FileArchive >  fileArchive,
bool  save,
std::uint64_t  injectedBytes = 0 
)

Definition at line 73 of file DesignCache.cpp.

Here is the call graph for this function:

◆ AddLoadObserver()

void Odb::Lib::App::DesignCache::AddLoadObserver ( LoadEventCallback  callback)

Definition at line 397 of file DesignCache.cpp.

◆ cachedBytes()

std::uint64_t Odb::Lib::App::DesignCache::cachedBytes ( ) const

Definition at line 850 of file DesignCache.cpp.

◆ cachedResponseBytes()

std::uint64_t Odb::Lib::App::DesignCache::cachedResponseBytes ( ) const

Definition at line 1094 of file DesignCache.cpp.

◆ Clear()

void Odb::Lib::App::DesignCache::Clear ( )

Definition at line 337 of file DesignCache.cpp.

Here is the caller graph for this function:

◆ ContainsDesign()

bool Odb::Lib::App::DesignCache::ContainsDesign ( const std::string &  designName) const

Definition at line 444 of file DesignCache.cpp.

Here is the caller graph for this function:

◆ designSerializationCount()

std::uint64_t Odb::Lib::App::DesignCache::designSerializationCount ( ) const

Definition at line 1089 of file DesignCache.cpp.

◆ ensureDirectoryExists()

void Odb::Lib::App::DesignCache::ensureDirectoryExists ( ) const

Definition at line 555 of file DesignCache.cpp.

Here is the caller graph for this function:

◆ getCacheMaxBytes()

std::uint64_t Odb::Lib::App::DesignCache::getCacheMaxBytes ( ) const

Definition at line 422 of file DesignCache.cpp.

◆ GetDesign()

std::shared_ptr< ProductModel::Design > Odb::Lib::App::DesignCache::GetDesign ( const std::string &  designName)

Definition at line 44 of file DesignCache.cpp.

Here is the caller graph for this function:

◆ getDirectory()

std::string Odb::Lib::App::DesignCache::getDirectory ( ) const

Definition at line 331 of file DesignCache.cpp.

◆ GetFileArchive()

std::shared_ptr< FileModel::Design::FileArchive > Odb::Lib::App::DesignCache::GetFileArchive ( const std::string &  designName)

Definition at line 54 of file DesignCache.cpp.

Here is the caller graph for this function:

◆ getLoadedDesignNames()

std::vector< std::string > Odb::Lib::App::DesignCache::getLoadedDesignNames ( const std::string &  filter = "") const

Definition at line 148 of file DesignCache.cpp.

◆ getLoadedFileArchiveNames()

std::vector< std::string > Odb::Lib::App::DesignCache::getLoadedFileArchiveNames ( const std::string &  filter = "") const

Definition at line 159 of file DesignCache.cpp.

◆ GetLoadState()

DesignCache::LoadState Odb::Lib::App::DesignCache::GetLoadState ( const std::string &  designName) const

Definition at line 386 of file DesignCache.cpp.

Here is the caller graph for this function:

◆ getMaxBackgroundLoads()

std::size_t Odb::Lib::App::DesignCache::getMaxBackgroundLoads ( ) const

Definition at line 438 of file DesignCache.cpp.

◆ getMonolithicWireBudget()

std::uint64_t Odb::Lib::App::DesignCache::getMonolithicWireBudget ( ) const

Definition at line 1105 of file DesignCache.cpp.

◆ GetResponseGeneration()

std::uint64_t Odb::Lib::App::DesignCache::GetResponseGeneration ( const std::string &  designName) const

Definition at line 845 of file DesignCache.cpp.

Here is the caller graph for this function:

◆ getUnloadedDesignNames()

std::vector< std::string > Odb::Lib::App::DesignCache::getUnloadedDesignNames ( const std::string &  filter = "") const

Definition at line 170 of file DesignCache.cpp.

◆ HasCachedResponse()

bool Odb::Lib::App::DesignCache::HasCachedResponse ( const std::string &  designName) const

Definition at line 1084 of file DesignCache.cpp.

◆ InvalidateDesign()

void Odb::Lib::App::DesignCache::InvalidateDesign ( const std::string &  designName)

Definition at line 111 of file DesignCache.cpp.

◆ loadAllDesigns()

int Odb::Lib::App::DesignCache::loadAllDesigns ( bool  stopOnError)

Definition at line 238 of file DesignCache.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadAllFileArchives()

int Odb::Lib::App::DesignCache::loadAllFileArchives ( bool  stopOnError)

Definition at line 201 of file DesignCache.cpp.

Here is the call graph for this function:

◆ LoadDesignAsync()

bool Odb::Lib::App::DesignCache::LoadDesignAsync ( const std::string &  designName)

Definition at line 449 of file DesignCache.cpp.

Here is the caller graph for this function:

◆ loadDesigns()

int Odb::Lib::App::DesignCache::loadDesigns ( const Utils::StringVector &  names)

Definition at line 301 of file DesignCache.cpp.

Here is the call graph for this function:

◆ loadFileArchives()

int Odb::Lib::App::DesignCache::loadFileArchives ( const Utils::StringVector &  names)

Definition at line 277 of file DesignCache.cpp.

Here is the call graph for this function:

◆ SaveFileArchive()

bool Odb::Lib::App::DesignCache::SaveFileArchive ( const std::string &  designName)

Definition at line 133 of file DesignCache.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SerializeResponsePayloads()

void Odb::Lib::App::DesignCache::SerializeResponsePayloads ( const std::string &  designName)

Definition at line 1329 of file DesignCache.cpp.

◆ setCacheMaxBytes()

void Odb::Lib::App::DesignCache::setCacheMaxBytes ( std::uint64_t  maxBytes)

Definition at line 410 of file DesignCache.cpp.

Here is the caller graph for this function:

◆ setDirectory()

void Odb::Lib::App::DesignCache::setDirectory ( const std::string &  directory)

Definition at line 325 of file DesignCache.cpp.

Here is the caller graph for this function:

◆ setMaxBackgroundLoads()

void Odb::Lib::App::DesignCache::setMaxBackgroundLoads ( std::size_t  maxLoads)

Definition at line 428 of file DesignCache.cpp.

Here is the caller graph for this function:

◆ setMonolithicWireBudget()

void Odb::Lib::App::DesignCache::setMonolithicWireBudget ( std::uint64_t  maxBytes)

Definition at line 1099 of file DesignCache.cpp.

◆ TryGetDesignBytes()

bool Odb::Lib::App::DesignCache::TryGetDesignBytes ( const std::string &  designName,
std::string &  outBytes 
) const

Definition at line 1074 of file DesignCache.cpp.

◆ TryGetJsonPayload()

bool Odb::Lib::App::DesignCache::TryGetJsonPayload ( const std::string &  designName,
JsonPayloadKind  kind,
std::string &  outJson 
) const

Definition at line 1079 of file DesignCache.cpp.


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