MUQ  0.4.3
BlockDataset.cpp
Go to the documentation of this file.
2 
3 using namespace muq::Utilities;
4 
5 
6 BlockDataset& BlockDataset::operator=(boost::any const& val) {
7 
9  auto iter = map.find(val.type());
10  if(iter == map.end()){
11  std::cerr << "ERROR: MUQ does not know how to write a boost::any with underlying type \"" << val.type().name() << "\". Currently implemented types are:\n";
12  for(auto mapIter = map.begin(); mapIter!=map.end(); ++mapIter)
13  std::cerr << " " << mapIter->first.name() << std::endl;
14  std::cerr << std::endl;
15 
16  assert(iter != map.end());
17  }
18 
19  map[val.type()](val, *this);
20 
21  return *this;
22 }
23 
24 std::shared_ptr<BlockDataset::AnyWriterMapType> BlockDataset::GetAnyWriterMap() {
25 
26  static std::shared_ptr<BlockDataset::AnyWriterMapType> map;
27 
28  if( !map )
29  map = std::make_shared<BlockDataset::AnyWriterMapType>();
30 
31  return map;
32 }
33 
35 REGISTER_HDF5BLOCK_ANYTYPE(float, float)
37 REGISTER_HDF5BLOCK_ANYTYPE(unsigned, unsigned)
38 REGISTER_HDF5BLOCK_ANYTYPE(MatrixXd, Eigen::MatrixXd)
39 REGISTER_HDF5BLOCK_ANYTYPE(MatrixXi, Eigen::MatrixXi)
40 REGISTER_HDF5BLOCK_ANYTYPE(MatrixXf, Eigen::MatrixXf)
41 REGISTER_HDF5BLOCK_ANYTYPE(VectorXf, Eigen::VectorXf)
42 REGISTER_HDF5BLOCK_ANYTYPE(VectorXd, Eigen::VectorXd)
43 REGISTER_HDF5BLOCK_ANYTYPE(VectorXi, Eigen::VectorXi)
44 
REGISTER_HDF5BLOCK_ANYTYPE(double, double) REGISTER_HDF5BLOCK_ANYTYPE(float
std::unordered_map< std::type_index, AnyWriterType > AnyWriterMapType
Definition: BlockDataset.h:39
static std::shared_ptr< AnyWriterMapType > GetAnyWriterMap()
BlockDataset & operator=(boost::any const &val)
Definition: BlockDataset.cpp:6