g2o
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
g2o::CacheContainer Class Reference

#include <cache.h>

Inheritance diagram for g2o::CacheContainer:
Inheritance graph
[legend]
Collaboration diagram for g2o::CacheContainer:
Collaboration graph
[legend]

Public Member Functions

 CacheContainer (OptimizableGraph::Vertex *vertex_)
 
virtual ~CacheContainer ()
 
OptimizableGraph::Vertexvertex ()
 
OptimizableGraphgraph ()
 
CachefindCache (const Cache::CacheKey &key)
 
CachecreateCache (const Cache::CacheKey &key)
 
void setUpdateNeeded (bool needUpdate=true)
 
void update ()
 

Protected Attributes

OptimizableGraph::Vertex_vertex
 
bool _updateNeeded
 

Detailed Description

Definition at line 108 of file cache.h.

Constructor & Destructor Documentation

◆ CacheContainer()

g2o::CacheContainer::CacheContainer ( OptimizableGraph::Vertex vertex_)

Definition at line 107 of file cache.cpp.

108 : _updateNeeded(true) {
109 _vertex = vertex_;
110}
OptimizableGraph::Vertex * _vertex
Definition cache.h:120

References _vertex.

◆ ~CacheContainer()

g2o::CacheContainer::~CacheContainer ( )
virtual

Definition at line 164 of file cache.cpp.

164 {
165 for (iterator it = begin(); it != end(); ++it) {
166 delete (it->second);
167 }
168}

Member Function Documentation

◆ createCache()

Cache * g2o::CacheContainer::createCache ( const Cache::CacheKey key)

Definition at line 118 of file cache.cpp.

118 {
119 Factory* f = Factory::instance();
120 HyperGraph::HyperGraphElement* e = f->construct(key.type());
121 if (!e) {
123 G2O_ERROR("fatal error in creating cache of type {}", key.type());
124 return nullptr;
125 }
126 Cache* c = dynamic_cast<Cache*>(e);
127 if (!c) {
129 G2O_ERROR("fatal error in creating cache of type {}, wrong type",
130 key.type());
131 return nullptr;
132 }
133 c->_container = this;
134 c->_parameters = key._parameters;
135 if (c->resolveDependencies()) {
136 insert(make_pair(key, c));
137 c->update();
138 return c;
139 }
140 return nullptr;
141}
static Factory * instance()
return the instance
Definition factory.cpp:46
#define G2O_ERROR(...)
Definition logger.h:89
#define __PRETTY_FUNCTION__
Definition macros.h:90

References __PRETTY_FUNCTION__, g2o::Cache::_container, g2o::Cache::CacheKey::_parameters, g2o::Cache::_parameters, g2o::Factory::construct(), G2O_ERROR, g2o::Factory::instance(), g2o::Cache::resolveDependencies(), g2o::Cache::CacheKey::type(), and g2o::Cache::update().

Referenced by g2o::Cache::installDependency(), and g2o::OptimizableGraph::Edge::resolveCache().

◆ findCache()

Cache * g2o::CacheContainer::findCache ( const Cache::CacheKey key)

Definition at line 112 of file cache.cpp.

112 {
113 iterator it = find(key);
114 if (it == end()) return nullptr;
115 return it->second;
116}

Referenced by g2o::Cache::installDependency(), and g2o::OptimizableGraph::Edge::resolveCache().

◆ graph()

OptimizableGraph * g2o::CacheContainer::graph ( )

Definition at line 145 of file cache.cpp.

145 {
146 if (_vertex) return _vertex->graph();
147 return nullptr;
148}
const OptimizableGraph * graph() const

References _vertex, and g2o::OptimizableGraph::Vertex::graph().

Referenced by g2o::Cache::graph().

◆ setUpdateNeeded()

void g2o::CacheContainer::setUpdateNeeded ( bool  needUpdate = true)

Definition at line 157 of file cache.cpp.

157 {
158 _updateNeeded = needUpdate;
159 for (iterator it = begin(); it != end(); ++it) {
160 (it->second)->_updateNeeded = needUpdate;
161 }
162}

References _updateNeeded.

◆ update()

void g2o::CacheContainer::update ( )

Definition at line 150 of file cache.cpp.

150 {
151 for (iterator it = begin(); it != end(); ++it) {
152 (it->second)->update();
153 }
154 _updateNeeded = false;
155}

References _updateNeeded, and update().

Referenced by update().

◆ vertex()

OptimizableGraph::Vertex * g2o::CacheContainer::vertex ( )

Definition at line 143 of file cache.cpp.

143{ return _vertex; }

References _vertex.

Referenced by g2o::Cache::vertex().

Member Data Documentation

◆ _updateNeeded

bool g2o::CacheContainer::_updateNeeded
protected

Definition at line 121 of file cache.h.

Referenced by setUpdateNeeded(), and update().

◆ _vertex

OptimizableGraph::Vertex* g2o::CacheContainer::_vertex
protected

Definition at line 120 of file cache.h.

Referenced by CacheContainer(), graph(), and vertex().


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