TestLoggingAvailability.cpp
Go to the documentation of this file.
00001 #include "logging/tests/TestLoggingAvailability.hpp"
00002 #include <rtt/rt_string.hpp>
00003 #include "logging/Category.hpp"
00004 
00005 #include <rtt/Logger.hpp>
00006 #include "ocl/Component.hpp"
00007 
00008 #include <log4cpp/HierarchyMaintainer.hh>
00009 
00010 namespace OCL {
00011 namespace logging {
00012 namespace test {
00013 
00014 static const char* categoryName = "org.orocos.ocl.logging.tests";
00015 
00016 LoggingAvailability::LoggingAvailability(std::string name) :
00017                 RTT::TaskContext(name),
00018         logger(dynamic_cast<OCL::logging::Category*>(
00019                    &log4cpp::Category::getInstance(
00020                        categoryName + std::string(".") + name)))
00021 {
00022 }
00023 
00024 LoggingAvailability::~LoggingAvailability()
00025 {
00026 }
00027 
00028 bool LoggingAvailability::configureHook()
00029 {
00030     if (logger)
00031     {
00032         logger->info(RTT::rt_string("Available in configureHook"));
00033     }
00034     else
00035     {
00036         log(Error) << "Not available in configureHook()" << endlog();
00037     }
00038     return true;
00039 }    
00040 
00041 bool LoggingAvailability::startHook()
00042 {
00043     if (logger)
00044     {
00045         logger->info(RTT::rt_string("Available in startHook"));
00046     }
00047     else
00048     {
00049         log(Error) << "Not available in startHook()" << endlog();
00050     }
00051     return true;
00052 }
00053         
00054 void LoggingAvailability::updateHook()
00055 {
00056     if (logger)
00057     {
00058         logger->info(RTT::rt_string("Available in updateHook"));
00059     }
00060     else
00061     {
00062         log(Error) << "Not available in updateHook()" << endlog();
00063     }
00064 }
00065 
00066 void LoggingAvailability::stopHook()
00067 {
00068     if (logger)
00069     {
00070         logger->info(RTT::rt_string("Available in stopHook"));
00071     }
00072     else
00073     {
00074         log(Error) << "Not available in stopHook()" << endlog();
00075     }
00076 }
00077 
00078 // namespaces
00079 }
00080 }
00081 }
00082 
00083 //ORO_CREATE_COMPONENT_TYPE();
00084 ORO_LIST_COMPONENT_TYPE(OCL::logging::test::LoggingAvailability);


ocl
Author(s): OCL Development Team
autogenerated on Mon Oct 6 2014 03:16:37