- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# LogContentsPrinter.h

    00001
    00015 #pragma once
    00016
    00017 #include "Loggable.h"
    00018 #include "CompositeLoggable.h"
    00019 #include "GenericSimpleLoggable.h"
    00020 #include "VectorLoggable.h"
    00021 #include "LoggableTraits.h"
    00022
    00023 #include "TStd.h"
    00024 #include <vector>
    00025
    00026 #include <boost/utility/enable_if.hpp>
    00027 #include <boost/type_traits.hpp>
    00028
    00029 namespace Nvidia {
    00030 namespace Logging {
    00031
    00039 class LogContentsPrinter
    00040 {
    00041 public:
    00052     template<typename T>
    00053     void LogContent(const TCHAR* name, T value)
    00054     {
    00055         LogContentInternal(std::tstring(name), value);
    00056     }
    00057
    00068     template<typename T>
    00069     void LogContent(const std::tstring& name, T value)
    00070     {
    00071         LogContentInternal(name, value);
    00072     }
    00073
    00074 protected:
    00079     virtual void LogContentInternal(const std::tstring& name, const SimpleLoggable& loggable) = 0;
    00080
    00085     virtual void LogContentInternal(const std::tstring& name, const CompositeLoggable& loggable) = 0;
    00086
    00088     template<typename T>
    00089     void LogContentInternal(const std::tstring& name, T value,
    00090         typename boost::disable_if_c<boost::is_base_of<Loggable, T>::value, T>::type* = 0)
    00091     {
    00092         typename LoggableTraits<T>::LoggableType loggable(value);
    00093         LogContentInternal(name, loggable);
    00094     }
    00095
    00097     template<typename T>
    00098     void LogContentInternal(const std::tstring& name, const std::vector<T>& value)
    00099     {
    00100         VectorLoggable<T> loggable(value);
    00101         LogContentInternal(name, loggable);
    00102     }
    00103 };
    00104
    00105 }
    00106 }