15 #include <boost/program_options.hpp> 17 #include "TBufferFile.h" 32 descString +=
" [options] [--";
36 "\n The program dumps information about how much storage space is needed to store the class" 38 boost::program_options::options_description desc(descString);
41 boost::program_options::positional_options_description
p;
44 boost::program_options::variables_map vm;
46 store(boost::program_options::command_line_parser(argc, argv).
options(desc).positional(p).
run(), vm);
49 std::cerr <<
"failed to parse command line \n" << iException.what() <<
"\n";
67 TClass* cls = TClass::GetClass(className.c_str());
69 std::cerr <<
"class '" << className <<
"' is unknown by ROOT\n";
73 void* objInstance = cls->New();
74 if (
nullptr == objInstance) {
79 TBufferFile bf(TBuffer::kWrite);
82 cls->WriteBuffer(bf, objInstance);
85 std::cout <<
"Total amount stored: " << bf.Length() <<
" bytes" << std::endl;
86 std::cout <<
"\nNOTE: add 4 bytes for each 'has written' value because of a bug in ROOT's printout of the accounting" 87 <<
"\n Each class (inheriting or as member data) has metadata an overhead of 10 bytes" << std::endl;
static char const *const kHelpCommandOpt
virtual std::string explainSelf() const
char const * what() const override
static char const *const kClassNameOpt
int main(int argc, char *argv[])
static void enable()
enable automatic library loading
static char const *const kHelpOpt
std::string className(const T &t)