g2o
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 104 of file cache.h.

Constructor & Destructor Documentation

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

Definition at line 120 of file cache.cpp.

120  {
121  _vertex = vertex_;
122  }
OptimizableGraph::Vertex * _vertex
Definition: cache.h:116
g2o::CacheContainer::~CacheContainer ( )
virtual

Definition at line 179 of file cache.cpp.

179  {
180  for (iterator it=begin(); it!=end(); ++it){
181  delete (it->second);
182  }
183  }

Member Function Documentation

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

Definition at line 131 of file cache.cpp.

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

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

131  {
132  Factory* f = Factory::instance();
133  HyperGraph::HyperGraphElement* e = f->construct(key.type());
134  if (!e) {
135  cerr << __PRETTY_FUNCTION__ << endl;
136  cerr << "fatal error in creating cache of type " << key.type() << endl;
137  return 0;
138  }
139  Cache* c = dynamic_cast<Cache*>(e);
140  if (! c){
141  cerr << __PRETTY_FUNCTION__ << endl;
142  cerr << "fatal error in creating cache of type " << key.type() << endl;
143  return 0;
144  }
145  c->_container = this;
146  c->_parameters = key._parameters;
147  if (c->resolveDependancies()){
148  insert(make_pair(key,c));
149  c->update();
150  return c;
151  }
152  return 0;
153  }
#define __PRETTY_FUNCTION__
Definition: macros.h:89
static Factory * instance()
return the instance
Definition: factory.cpp:61
Cache * g2o::CacheContainer::findCache ( const Cache::CacheKey key)

Definition at line 124 of file cache.cpp.

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

124  {
125  iterator it=find(key);
126  if (it==end())
127  return 0;
128  return it->second;
129  }
OptimizableGraph * g2o::CacheContainer::graph ( )

Definition at line 159 of file cache.cpp.

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

159  {
160  if (_vertex)
161  return _vertex->graph();
162  return 0;
163  }
const OptimizableGraph * graph() const
OptimizableGraph::Vertex * _vertex
Definition: cache.h:116
void g2o::CacheContainer::setUpdateNeeded ( bool  needUpdate = true)

Definition at line 172 of file cache.cpp.

References g2o::Cache::_updateNeeded.

Referenced by g2o::OptimizableGraph::Vertex::updateCache().

172  {
173  _updateNeeded=needUpdate;
174  for (iterator it=begin(); it!=end(); ++it){
175  (it->second)->_updateNeeded = needUpdate;
176  }
177  }
bool _updateNeeded
Definition: cache.h:117
void g2o::CacheContainer::update ( )

Definition at line 165 of file cache.cpp.

References g2o::Cache::_updateNeeded, and g2o::Cache::update().

Referenced by g2o::OptimizableGraph::Vertex::updateCache().

165  {
166  for (iterator it=begin(); it!=end(); it++){
167  (it->second)->update();
168  }
169  _updateNeeded=false;
170  }
bool _updateNeeded
Definition: cache.h:117
OptimizableGraph::Vertex * g2o::CacheContainer::vertex ( )

Definition at line 155 of file cache.cpp.

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

155  {
156  return _vertex;
157  }
OptimizableGraph::Vertex * _vertex
Definition: cache.h:116

Member Data Documentation

bool g2o::CacheContainer::_updateNeeded
protected

Definition at line 117 of file cache.h.

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

Definition at line 116 of file cache.h.


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