22#ifndef LIMA_MMCOMMONS_H
23#define LIMA_MMCOMMONS_H
27#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
28#include <QtCore/QMutex>
31#include <QtCore/QRecursiveMutex>
32#define QTENDL Qt::endl
39#pragma warning( disable : 4512 )
46typedef __int16 int16_t;
47typedef unsigned __int16 uint16_t;
48typedef __int32 int32_t;
49typedef unsigned __int32 uint32_t;
50typedef __int64 int64_t;
51typedef unsigned __int64 uint64_t;
55#include <boost/serialization/strong_typedef.hpp>
60#ifdef LIMA_DATA_EXPORTING
61 #define LIMA_DATA_EXPORT __declspec(dllexport)
63 #define LIMA_DATA_EXPORT __declspec(dllimport)
66#ifdef LIMA_DATAHANDLER_EXPORTING
67 #define LIMA_DATAHANDLER_EXPORT __declspec(dllexport)
69 #define LIMA_DATAHANDLER_EXPORT __declspec(dllimport)
72#ifdef LIMA_FSAACCESS_EXPORTING
73 #define LIMA_FSAACCESS_EXPORT __declspec(dllexport)
75 #define LIMA_FSAACCESS_EXPORT __declspec(dllimport)
78#ifdef LIMA_MEDIAPROCESSORS_EXPORTING
79 #define LIMA_MEDIAPROCESSORS_EXPORT __declspec(dllexport)
81 #define LIMA_MEDIAPROCESSORS_EXPORT __declspec(dllimport)
84#ifdef LIMA_MEDIATICDATA_EXPORTING
85 #define LIMA_MEDIATICDATA_EXPORT __declspec(dllexport)
87 #define LIMA_MEDIATICDATA_EXPORT __declspec(dllimport)
90#ifdef LIMA_COMMONMISC_EXPORTING
91 #define LIMA_COMMONMISC_EXPORT __declspec(dllexport)
93 #define LIMA_COMMONMISC_EXPORT __declspec(dllimport)
96#ifdef LIMA_COMMONTOOLS_EXPORTING
97 #define LIMA_COMMONTOOLS_EXPORT __declspec(dllexport)
99 #define LIMA_COMMONTOOLS_EXPORT __declspec(dllimport)
102#ifdef LIMA_PROCESSUNITFRAMEWORK_EXPORTING
103 #define LIMA_PROCESSUNITFRAMEWORK_EXPORT __declspec(dllexport)
105 #define LIMA_PROCESSUNITFRAMEWORK_EXPORT __declspec(dllimport)
108#ifdef LIMA_TIME_EXPORTING
109 #define LIMA_TIME_EXPORT __declspec(dllexport)
111 #define LIMA_TIME_EXPORT __declspec(dllimport)
114#ifdef LIMA_XMLCONFIGURATIONFILES_EXPORTING
115 #define LIMA_XMLCONFIGURATIONFILES_EXPORT __declspec(dllexport)
117 #define LIMA_XMLCONFIGURATIONFILES_EXPORT __declspec(dllimport)
120#ifdef LIMA_COMMON_EXPORTING
121 #define LIMA_COMMON_EXPORT __declspec(dllexport)
123 #define LIMA_COMMON_EXPORT __declspec(dllimport)
128#define LIMA_DATA_EXPORT
129#define LIMA_DATAHANDLER_EXPORT
130#define LIMA_FSAACCESS_EXPORT
131#define LIMA_MEDIAPROCESSORS_EXPORT
132#define LIMA_MEDIATICDATA_EXPORT
133#define LIMA_COMMONMISC_EXPORT
134#define LIMA_COMMONTOOLS_EXPORT
135#define LIMA_PROCESSUNITFRAMEWORK_EXPORT
136#define LIMA_TIME_EXPORT
137#define LIMA_XMLCONFIGURATIONFILES_EXPORT
138#define LIMA_COMMON_EXPORT
156#define LTRACE QLOG_TRACE()
157#define LDEBUG QLOG_DEBUG()
158#define LINFO QLOG_INFO()
159#define LNOTICE QLOG_INFO()
160#define LWARN QLOG_WARN()
161#define LERROR QLOG_ERROR()
162#define LFATAL QLOG_FATAL()
173#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
174 static QMutex mutex(QMutex::Recursive);
176 static QRecursiveMutex mutex;
178 QMutexLocker locker(&mutex);
188 static LogInit logInit(X); \
189 auto& logger = *(logInit.pLogger); \
190 logger.setLoggingLevel(QsLogging::Categories::instance().levelFor( X ));
196#define LENDL ". Note: LENDL is deprecated. It will be removed from a future release."
198#define ABSTRACTFACTORYPATTERNLOGINIT LOGINIT("Common::AbstractFactoryPattern")
199#define ABSTRACTPROCESSINGCLIENTLOGINIT LOGINIT("Common::AbstractProcessingClient")
200#define AGLOGINIT LOGINIT("Common::AnnotationGraph")
201#define BOWLOGINIT LOGINIT("Common::BOW");
202#define CLIENTFACTORYLOGINIT LOGINIT("Common::ClientFactory")
203#define COMPSTRACCESSLOGINIT LOGINIT("Common::CompStrAccess")
204#define FSAAHASHLOGINIT LOGINIT("Common::FsaAccessHash")
205#define FSAAIOLOGINIT LOGINIT("Common::FsaAccessIO")
206#define FSAALOGINIT LOGINIT("Common::FsaAccess")
207#define HANDLERLOGINIT LOGINIT("Common::Handler")
208#define LDATALOGINIT LOGINIT("Common::LanguageData")
209#define MDATALOGINIT LOGINIT("Common::MediaticData")
210#define MISCLOGINIT LOGINIT("Common::Misc")
211#define PROCESSORSLOGINIT LOGINIT("Common::Processors")
212#define PROCESSUNITFRAMEWORKLOGINIT LOGINIT("Common::ProcessUnitFramework")
213#define PROPERTYCODELOGINIT LOGINIT("Common::PropertyCode")
214#define STRINGMAPLOGINIT LOGINIT("Common::StringMap")
215#define STRPOOLLOGINIT LOGINIT("Common::StringPool")
216#define TGVLOGINIT LOGINIT("Common::TGV")
217#define XMLCFGLOGINIT LOGINIT("Common::XMLConfigurationFiles")
218#define DYNAMICLIBMANAGERLOGINIT LOGINIT("Common::DynamicLibrariesManager")
220QDebug&
operator<< (QDebug& qd,
const std::string& str );
224#define LIMA_UNUSED(x) (void)x;
227#define USE_STD_BITSET_FOR_LINGUISTIC_CODE
229#ifdef USE_STD_BITSET_FOR_LINGUISTIC_CODE
252#define UNDEFLANG static_cast<Lima::MediaId>(std::numeric_limits<uint8_t>::max())
280 virtual const
char *
what () const throw()
override
293#define LIMA_EXCEPTION(X) { \
294 QString errorString; \
295 QTextStream qts(&errorString); \
296 qts << __FILE__ << ":" << __LINE__ << ": " << X ; \
297 LERROR << errorString; \
298 throw LimaException(errorString); \
306#define LIMA_EXCEPTION_SELECT(X,Y) { \
307 QString errorString; \
308 QTextStream qts(&errorString); \
309 qts << __FILE__ << ":" << __LINE__ << ": " << X ; \
310 LERROR << errorString; \
311 throw Y(errorString); \
318#define LIMA_EXCEPTION_LOGINIT(X,Y) { \
320 QString errorString; \
321 QTextStream qts(&errorString); \
322 qts << __FILE__ << ":" << __LINE__ << ": " << Y ; \
323 LERROR << errorString; \
324 throw Lima::LimaException(errorString); \
332#define LIMA_EXCEPTION_SELECT_LOGINIT(X,Y,Z) { \
334 QString errorString; \
335 QTextStream qts(&errorString); \
336 qts << __FILE__ << ":" << __LINE__ << ": " << Y ; \
337 LERROR << errorString; \
338 throw Z(errorString); \
380 oo <<
"uninitialized media " << (int)m_medId;
384 m_reason = std::string(
"uninitialized media ")+m_med;
391 m_med(media.toStdString()),
404 oo <<
"uninitialized media " << (int)m_medId;
408 m_reason = std::string(
"uninitialized media ")+m_med;
433 m_reason = std::string(
"Fsa not initialized because of ") + reason.toStdString();
438 m_reason = std::string(
"Fsa not initialized because of ") + reason;
454 m_reason = std::string(
"parameter out of range ") + reason.toStdString();
458 m_reason = std::string(
"parameter out of range ") + reason;
475 m_reason = std::string(
"XMLException: ") + message;
480 m_reason = std::string(
"XMLException: ") + message.toStdString();
485 m_reason = std::string(
"XMLException: ") + message;
QDebug & operator<<(QDebug &qd, const std::string &str)
Use this exception to signal the used of a wrongly initialized LIMA dictionary.
virtual ~AccessByStringNotInitialized()
AccessByStringNotInitialized & operator=(const AccessByStringNotInitialized &)=delete
AccessByStringNotInitialized(const std::string &reason)
AccessByStringNotInitialized(const AccessByStringNotInitialized &)=default
AccessByStringNotInitialized(const QString &reason)
Use this exception to signal a wrong access to a LIMA dictionary.
AccessByStringOutOfRange & operator=(const AccessByStringOutOfRange &)=delete
AccessByStringOutOfRange(const AccessByStringOutOfRange &)=default
virtual ~AccessByStringOutOfRange()
AccessByStringOutOfRange(const QString &reason)
AccessByStringOutOfRange(const std::string &reason)
Use this exception to signal an error in one of the configuration files.
InvalidConfiguration(const char *message="")
InvalidConfiguration(const std::string &message)
virtual ~InvalidConfiguration()=default
InvalidConfiguration(const QString &message)
The main LIMA exception class.
virtual ~LimaException()=default
virtual const char * what() const override
LimaException & operator=(const LimaException &e)=delete
LimaException(const char *message="")
LimaException(const std::string &message)
LimaException(const QString &message)
LimaException(const LimaException &)=default
Throw this exception when encountering problems with XML files opening or parsing.
XMLException(const QString &message)
XMLException(const std::string &message)
XMLException(const char *message="")
XMLException & operator=(const XMLException &)=delete
XMLException(const XMLException &)=default
QsLogging::Logger * pLogger
static Categories & instance()
Level levelFor(const QString &category) const
static Logger & instance(const QString &zone=QLatin1String(""))
void setLoggingLevel(Level newLevel)
Logging at a level < 'newLevel' will be ignored.
BOOST_STRONG_TYPEDEF(char, NoParameters)