BioDynaMo  v1.05.119-a4ff3934
root.cc
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4 // BioDynaMo collaboration. All Rights Reserved.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // See the LICENSE file distributed with this work for details.
10 // See the NOTICE file distributed with this work for additional information
11 // regarding copyright ownership.
12 //
13 // -----------------------------------------------------------------------------
14 
15 #include "core/util/root.h"
16 #include <TClassTable.h>
17 #include <TDataMember.h>
18 #include <TList.h>
19 #include <iomanip>
20 #include <iostream>
21 
22 namespace bdm {
23 
24 // -----------------------------------------------------------------------------
25 void PrintDataMemberInfo(const std::string& class_name) {
26  auto* dm_list =
27  TClassTable::GetDict(class_name.c_str())()->GetListOfDataMembers();
28  std::cout << std::setw(40) << "Data member name"
29  << "\tOffset\tSize\tType" << std::endl;
30  for (auto el : *dm_list) {
31  auto* dm = static_cast<TDataMember*>(el);
32  std::cout << std::setw(40) << dm->GetName() << "\t" << dm->GetOffset()
33  << "\t" << dm->GetUnitSize() << "\t" << dm->GetFullTypeName()
34  << std::endl;
35  }
36 }
37 
38 } // namespace bdm
bdm
Definition: agent.cc:39
bdm::PrintDataMemberInfo
void PrintDataMemberInfo(const std::string &class_name)
Writes information of each data member of a class to cout.
Definition: root.cc:25
root.h