MCPcopy Create free account
hub / github.com/Xtra-Computing/thundersvm / TypedConfigurations

Class TypedConfigurations

include/thundersvm/util/log.h:1958–2084  ·  view source on GitHub ↗

@brief Configurations with data types. @detail el::Configurations have string based values. This is whats used internally in order to read correct configurations. This is to perform faster while writing logs using correct configurations. This is thread safe and final class containing non-virtual destructor (means nothing should inherit this class)

Source from the content-addressed store, hash-verified

1956///
1957/// This is thread safe and final class containing non-virtual destructor (means nothing should inherit this class)
1958 class TypedConfigurations : public base::threading::ThreadSafe {
1959 public:
1960 /// @brief Constructor to initialize (construct) the object off el::Configurations
1961 /// @param configurations Configurations pointer/reference to base this typed configurations off.
1962 /// @param logStreamsReference Use ELPP->registeredLoggers()->logStreamsReference()
1963 TypedConfigurations(Configurations* configurations, base::LogStreamsReferenceMap* logStreamsReference);
1964
1965 TypedConfigurations(const TypedConfigurations& other);
1966
1967 virtual ~TypedConfigurations(void) {
1968 }
1969
1970 const Configurations* configurations(void) const {
1971 return m_configurations;
1972 }
1973
1974 bool enabled(Level level);
1975 bool toFile(Level level);
1976 const std::string& filename(Level level);
1977 bool toStandardOutput(Level level);
1978 const base::LogFormat& logFormat(Level level);
1979 const base::SubsecondPrecision& subsecondPrecision(Level level = Level::Global);
1980 const base::MillisecondsWidth& millisecondsWidth(Level level = Level::Global);
1981 bool performanceTracking(Level level = Level::Global);
1982 base::type::fstream_t* fileStream(Level level);
1983 std::size_t maxLogFileSize(Level level);
1984 std::size_t logFlushThreshold(Level level);
1985
1986 private:
1987 Configurations* m_configurations;
1988 std::map<Level, bool> m_enabledMap;
1989 std::map<Level, bool> m_toFileMap;
1990 std::map<Level, std::string> m_filenameMap;
1991 std::map<Level, bool> m_toStandardOutputMap;
1992 std::map<Level, base::LogFormat> m_logFormatMap;
1993 std::map<Level, base::SubsecondPrecision> m_subsecondPrecisionMap;
1994 std::map<Level, bool> m_performanceTrackingMap;
1995 std::map<Level, base::FileStreamPtr> m_fileStreamMap;
1996 std::map<Level, std::size_t> m_maxLogFileSizeMap;
1997 std::map<Level, std::size_t> m_logFlushThresholdMap;
1998 base::LogStreamsReferenceMap* m_logStreamsReference;
1999
2000 friend class el::Helpers;
2001 friend class el::base::MessageBuilder;
2002 friend class el::base::Writer;
2003 friend class el::base::DefaultLogDispatchCallback;
2004 friend class el::base::LogDispatcher;
2005
2006 template <typename Conf_T>
2007 inline Conf_T getConfigByVal(Level level, const std::map<Level, Conf_T>* confMap, const char* confName) {
2008 base::threading::ScopedLock scopedLock(lock());
2009 return unsafeGetConfigByVal(level, confMap, confName); // This is not unsafe anymore - mutex locked in scope
2010 }
2011
2012 template <typename Conf_T>
2013 inline Conf_T& getConfigByRef(Level level, std::map<Level, Conf_T>* confMap, const char* confName) {
2014 base::threading::ScopedLock scopedLock(lock());
2015 return unsafeGetConfigByRef(level, confMap, confName); // This is not unsafe anymore - mutex locked in scope

Callers 1

Calls 1

endMethod · 0.80

Tested by

no test coverage detected