libmoost
/home/mhx/git/github/libmoost/test/pdl/test_class_1.cpp
Go to the documentation of this file.
00001 /* vim:set ts=3 sw=3 sts=3 et: */
00028 #include <stdexcept>
00029 
00030 #include <boost/lexical_cast.hpp>
00031 
00032 #include "test_class_1.h"
00033 
00034 namespace { so_load_watcher lw("test_module1"); }
00035 
00036 int my_test_class1::inst = 1;
00037 int my_test_class2::inst = 1;
00038 
00039 my_test_class1::my_test_class1()
00040    : m_inst(boost::lexical_cast<std::string>(inst++)), m_ctr(0)
00041 {
00042    pdl_test_event("ctor test_module1:my_test_class1 " + m_inst);
00043 }
00044 
00045 my_test_class1::~my_test_class1()
00046 {
00047    pdl_test_event("dtor test_module1:my_test_class1 " + m_inst);
00048 }
00049 
00050 int my_test_class1::do_it()
00051 {
00052    return 1 + 10*m_ctr++;
00053 }
00054 
00055 my_test_class2::my_test_class2()
00056    : m_inst(boost::lexical_cast<std::string>(inst++))
00057 {
00058    pdl_test_event("ctor test_module1:my_test_class2 " + m_inst);
00059 }
00060 
00061 my_test_class2::~my_test_class2()
00062 {
00063    pdl_test_event("dtor test_module1:my_test_class2 " + m_inst);
00064 }
00065 
00066 int my_test_class2::do_it()
00067 {
00068    return 2;
00069 }
00070 
00071 my_fail_class::my_fail_class()
00072 {
00073    throw std::runtime_error("whatever");
00074 }
00075 
00076 int my_fail_class::do_it()
00077 {
00078    return 0;
00079 }
00080 
00081 PDL_EXPORT_DYNAMIC_CLASS(my_test_class1)
00082 PDL_EXPORT_DYNAMIC_CLASS(my_test_class2)
00083 PDL_EXPORT_DYNAMIC_CLASS(my_fail_class)