libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
Public 成员函数 | 静态 Public 成员函数 | 静态 Protected 成员函数 | Private 成员函数 | 所有成员列表
libMesh::FactoryImp< Derived, Base > 模板类 参考

Factory implementation class. 更多...

#include <factory.h>

类 libMesh::FactoryImp< Derived, Base > 继承关系图:
[图例]

Public 成员函数

 FactoryImp (const std::string &name)
 Constructor. 更多...
 
 ~FactoryImp ()=default
 Destructor. 更多...
 

静态 Public 成员函数

static std::unique_ptr< Base > build (const std::string &name)
 Builds an object of type Base identified by name. 更多...
 

静态 Protected 成员函数

static std::map< std::string,
Factory< Base > * > & 
factory_map ()
 Map from a name to a Factory<Base> * pointer. 更多...
 

Private 成员函数

virtual std::unique_ptr< Base > create () override
 

详细描述

template<class Derived, class Base>
class libMesh::FactoryImp< Derived, Base >

Factory implementation class.

在文件 factory.h88 行定义.

构造及析构函数说明

template<class Derived , class Base >
libMesh::FactoryImp< Derived, Base >::FactoryImp ( const std::string &  name)
inline

Constructor.

Takes a name as input.

在文件 factory.h95 行定义.

95 : Factory<Base>(name) { }
template<class Derived , class Base >
libMesh::FactoryImp< Derived, Base >::~FactoryImp ( )
default

Destructor.

Empty.

成员函数说明

template<class Base >
std::unique_ptr< Base > libMesh::Factory< Base >::build ( const std::string &  name)
inlinestaticinherited

Builds an object of type Base identified by name.

在文件 factory.h129 行定义.

参考 libMesh::Factory< Base >::create() , 以及 libMesh::err.

130 {
131  // name not found in the map
132  if (!factory_map().count(name))
133  {
134  libMesh::err << "Tried to build an unknown type: " << name << std::endl;
135 
136  libMesh::err << "valid options are:" << std::endl;
137 
138  for (const auto & pr : factory_map())
139  libMesh::err << " " << pr.first << std::endl;
140 
141  libmesh_error_msg("Exiting...");
142  }
143 
144  Factory<Base> * f = factory_map()[name];
145  return std::unique_ptr<Base>(f->create());
146 }
static std::map< std::string, Factory< Base > * > & factory_map()
Map from a name to a Factory&lt;Base&gt; * pointer.
OStreamProxy err
template<class Derived , class Base >
std::unique_ptr< Base > libMesh::FactoryImp< Derived, Base >::create ( )
inlineoverrideprivatevirtual
返回
A new object of type Derived.

实现了 libMesh::Factory< Base >.

在文件 factory.h152 行定义.

153 {
154  return std::make_unique<Derived>();
155 }
template<class Base>
static std::map<std::string, Factory<Base> *>& libMesh::Factory< Base >::factory_map ( )
staticprotectedinherited

Map from a name to a Factory<Base> * pointer.


该类的文档由以下文件生成: