testlogging.cpp
Go to the documentation of this file.
1 // test mix of log4cpp and OCL::logging implementations
2 
3 #include <iostream>
5 #include "logging/Category.hpp"
6 
7 using namespace RTT;
8 
9 int main(int argc, char** argv)
10 {
11  // use only OCL::logging Category's
14 
15  std::string name = "org.test.c1";
16 
17  // what types do we get from the category itself?
18  std::cout << "\nFrom category???\n";
20  std::cout << "category2 type " << typeid(category2).name() << std::endl;
21  std::cout << "category2 ptype " << typeid(&category2).name() << std::endl;
22 
23  OCL::logging::Category* category =
24  dynamic_cast<OCL::logging::Category*>(&category2);
25  if (0 != category)
26  {
27  std::cout << "category type " << typeid(*category).name() << std::endl;
28  }
29  else
30  {
31  std::cout << "Unable cast" << std::endl;
32  }
33 
34  // and directly?
35  std::cout << "\nDirectly ...\n";
36  category = dynamic_cast<OCL::logging::Category*>(
38  if (0 != category)
39  {
40  std::cout << "category type " << typeid(*category).name() << std::endl;
41  }
42  else
43  {
44  std::cout << "Unable cast" << std::endl;
45  }
46 
47  // and through hierarchy maintainer?
48  std::cout << "\nThrough hierarchy maintainer ...\n";
50  std::cout << "category ptype " << typeid(p).name() << std::endl;
51  std::cout << "category type " << typeid(*p).name() << std::endl;
52  category = dynamic_cast<OCL::logging::Category*>(p);
53  if (0 != category)
54  {
55  std::cout << "category type " << typeid(*category).name() << std::endl;
56  }
57  else
58  {
59  std::cout << "Unable cast" << std::endl;
60  }
61 
62  category = dynamic_cast<OCL::logging::Category*>(
64  if (0 != category)
65  {
66  std::cout << "category type " << typeid(*category).name() << std::endl;
67  }
68  else
69  {
70  std::cout << "Unable cast" << std::endl;
71  }
72 
73  return 0;
74 }
static void set_category_factory(creator_function_t creator_function)
static Category & getInstance(const std::string &name)
virtual Category * getExistingInstance(const std::string &name)
int main(int argc, char **argv)
Definition: testlogging.cpp:9
static log4cpp::Category * createOCLCategory(const std::string &name, log4cpp::Category *parent, log4cpp::Priority::Value priority)
Definition: Category.cpp:138
static HierarchyMaintainer & getDefaultMaintainer()


ocl
Author(s): OCL Development Team
autogenerated on Mon Mar 23 2020 04:47:19