mirror of https://github.com/KLayout/klayout.git
First steps towards enablement of MSVC2017 for pymod. A lot of things to TODO yet ...
This commit is contained in:
parent
d81dcb6b22
commit
23d715001b
|
|
@ -30,6 +30,7 @@
|
||||||
namespace std_ext = __gnu_cxx;
|
namespace std_ext = __gnu_cxx;
|
||||||
# define DB_HASH_NAMESPACE __gnu_cxx
|
# define DB_HASH_NAMESPACE __gnu_cxx
|
||||||
#else
|
#else
|
||||||
|
# define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
|
||||||
# include <hash_map>
|
# include <hash_map>
|
||||||
# include <hash_set>
|
# include <hash_set>
|
||||||
namespace std_ext = std;
|
namespace std_ext = std;
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,6 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace tl
|
|
||||||
{
|
|
||||||
template<> DB_PUBLIC tl::Registrar<db::Library> *tl::Registrar<db::Library>::instance = 0;
|
|
||||||
template class DB_PUBLIC tl::RegisteredClass<db::Library>;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace db
|
namespace db
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ path<C>::area () const
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class C>
|
template <class C>
|
||||||
DB_PUBLIC std::string
|
std::string
|
||||||
path<C>::to_string () const
|
path<C>::to_string () const
|
||||||
{
|
{
|
||||||
std::string s = "(";
|
std::string s = "(";
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,6 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
namespace tl
|
|
||||||
{
|
|
||||||
template<> DB_PUBLIC tl::Registrar<db::StreamFormatDeclaration> *tl::Registrar<db::StreamFormatDeclaration>::instance = 0;
|
|
||||||
template class DB_PUBLIC tl::RegisteredClass<db::StreamFormatDeclaration>;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace db
|
namespace db
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,6 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
namespace tl
|
|
||||||
{
|
|
||||||
template<> DB_PUBLIC tl::Registrar<db::TechnologyComponentProvider> *tl::Registrar<db::TechnologyComponentProvider>::instance = 0;
|
|
||||||
template class DB_PUBLIC tl::RegisteredClass<db::TechnologyComponentProvider>;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace db
|
namespace db
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#define HDR_dbTypes
|
#define HDR_dbTypes
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#define _USE_MATH_DEFINES // for MSVC
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,6 @@
|
||||||
#include "dbUserObject.h"
|
#include "dbUserObject.h"
|
||||||
#include "tlClassRegistry.h"
|
#include "tlClassRegistry.h"
|
||||||
|
|
||||||
namespace tl
|
|
||||||
{
|
|
||||||
template<> DB_PUBLIC tl::Registrar<db::user_object_factory_base<db::Coord> > *tl::Registrar<db::user_object_factory_base<db::Coord> >::instance = 0;
|
|
||||||
template class DB_PUBLIC tl::RegisteredClass<db::user_object_factory_base<db::Coord> >;
|
|
||||||
template<> DB_PUBLIC tl::Registrar<db::user_object_factory_base<db::DCoord> > *tl::Registrar<db::user_object_factory_base<db::DCoord> >::instance = 0;
|
|
||||||
template class DB_PUBLIC tl::RegisteredClass<db::user_object_factory_base<db::DCoord> >;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace db
|
namespace db
|
||||||
{
|
{
|
||||||
static unsigned int s_class_id = 1;
|
static unsigned int s_class_id = 1;
|
||||||
|
|
|
||||||
|
|
@ -195,14 +195,14 @@ public:
|
||||||
return std::string ("(not a valid enum value)");
|
return std::string ("(not a valid enum value)");
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string enum_to_string (const E *e)
|
static std::string enum_to_string_ext (const E *e)
|
||||||
{
|
{
|
||||||
const Enum<E> *ecls = dynamic_cast<const Enum<E> *> (cls_decl<E> ());
|
const Enum<E> *ecls = dynamic_cast<const Enum<E> *> (cls_decl<E> ());
|
||||||
tl_assert (ecls != 0);
|
tl_assert (ecls != 0);
|
||||||
return ecls->enum_to_string (*e);
|
return ecls->enum_to_string (*e);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string enum_to_string_inspect (const E *e)
|
static std::string enum_to_string_inspect_ext (const E *e)
|
||||||
{
|
{
|
||||||
const Enum<E> *ecls = dynamic_cast<const Enum<E> *> (cls_decl<E> ());
|
const Enum<E> *ecls = dynamic_cast<const Enum<E> *> (cls_decl<E> ());
|
||||||
tl_assert (ecls != 0);
|
tl_assert (ecls != 0);
|
||||||
|
|
@ -246,8 +246,8 @@ public:
|
||||||
gsi::Methods m =
|
gsi::Methods m =
|
||||||
gsi::constructor ("new", &new_enum_from_int, gsi::arg("i"), "@brief Creates an enum from an integer value") +
|
gsi::constructor ("new", &new_enum_from_int, gsi::arg("i"), "@brief Creates an enum from an integer value") +
|
||||||
gsi::constructor ("new", &new_enum_from_string, gsi::arg("s"), "@brief Creates an enum from a string value") +
|
gsi::constructor ("new", &new_enum_from_string, gsi::arg("s"), "@brief Creates an enum from a string value") +
|
||||||
gsi::method_ext ("to_s", &enum_to_string, "@brief Gets the symbolic string from an enum") +
|
gsi::method_ext ("to_s", &enum_to_string_ext, "@brief Gets the symbolic string from an enum") +
|
||||||
gsi::method_ext ("inspect", &enum_to_string_inspect, "@brief Converts an enum to a visual string") +
|
gsi::method_ext ("inspect", &enum_to_string_inspect_ext, "@brief Converts an enum to a visual string") +
|
||||||
gsi::method_ext ("to_i", &enum_to_i, "@brief Gets the integer value from the enum") +
|
gsi::method_ext ("to_i", &enum_to_i, "@brief Gets the integer value from the enum") +
|
||||||
gsi::method_ext ("==", &enum_eq, gsi::arg("other"), "@brief Compares two enums") +
|
gsi::method_ext ("==", &enum_eq, gsi::arg("other"), "@brief Compares two enums") +
|
||||||
gsi::method_ext ("!=", &enum_ne, gsi::arg("other"), "@brief Compares two enums for inequality") +
|
gsi::method_ext ("!=", &enum_ne, gsi::arg("other"), "@brief Compares two enums for inequality") +
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,6 @@
|
||||||
|
|
||||||
#include "gsiInterpreter.h"
|
#include "gsiInterpreter.h"
|
||||||
|
|
||||||
namespace tl
|
|
||||||
{
|
|
||||||
template<> GSI_PUBLIC tl::Registrar<gsi::Interpreter> *tl::Registrar<gsi::Interpreter>::instance = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace gsi
|
namespace gsi
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -572,6 +572,13 @@ struct pair_decl
|
||||||
// warning:
|
// warning:
|
||||||
#define __SUPPRESS_UNUSED_WARNING(x) (void)(x)
|
#define __SUPPRESS_UNUSED_WARNING(x) (void)(x)
|
||||||
|
|
||||||
|
// HACK: the Qt binding code takes __null instead of NULL, but
|
||||||
|
// MS defines it as empty in sal.h ... better __null was NULL again.
|
||||||
|
#if defined(__null)
|
||||||
|
# undef __null
|
||||||
|
# define __null 0
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
|
# include "../qt5/QtGui/gsiDeclQtGuiTypeTraits.h"
|
||||||
# include "../qt5/QtGui/gsiQtExternals.h"
|
# include "../qt5/QtGui/gsiQtExternals.h"
|
||||||
#else
|
#else
|
||||||
|
# include "../qt4/QtGui/gsiDeclQtGuiTypeTraits.h"
|
||||||
# include "../qt4/QtGui/gsiQtExternals.h"
|
# include "../qt4/QtGui/gsiQtExternals.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
|
# include "../qt5/QtWidgets/gsiDeclQtWidgetsTypeTraits.h"
|
||||||
# include "../qt5/QtWidgets/gsiQtExternals.h"
|
# include "../qt5/QtWidgets/gsiQtExternals.h"
|
||||||
#else
|
#else
|
||||||
// no present in Qt4
|
// no present in Qt4
|
||||||
|
|
|
||||||
|
|
@ -61,16 +61,31 @@ equals(HAVE_RUBY, "1") {
|
||||||
QMAKE_RPATHDIR += $$RPATH
|
QMAKE_RPATHDIR += $$RPATH
|
||||||
}
|
}
|
||||||
|
|
||||||
QMAKE_CXXFLAGS_WARN_ON += \
|
msvc {
|
||||||
-pedantic \
|
|
||||||
-Woverloaded-virtual \
|
INCLUDEPATH += \
|
||||||
-Wsign-promo \
|
$$THIRD_PARTY/zlib/1.2.11/include \
|
||||||
-Wsynth \
|
|
||||||
-Wno-deprecated \
|
QMAKE_CXXFLAGS += -bigobj
|
||||||
-Wno-long-long \
|
|
||||||
-Wno-strict-aliasing \
|
QMAKE_CXXFLAGS_WARN_ON += \
|
||||||
-Wno-deprecated-declarations \
|
|
||||||
-Wno-reserved-user-defined-literal \
|
}
|
||||||
|
|
||||||
|
!msvc {
|
||||||
|
|
||||||
|
QMAKE_CXXFLAGS_WARN_ON += \
|
||||||
|
-pedantic \
|
||||||
|
-Woverloaded-virtual \
|
||||||
|
-Wsign-promo \
|
||||||
|
-Wsynth \
|
||||||
|
-Wno-deprecated \
|
||||||
|
-Wno-long-long \
|
||||||
|
-Wno-strict-aliasing \
|
||||||
|
-Wno-deprecated-declarations \
|
||||||
|
-Wno-reserved-user-defined-literal \
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
equals(HAVE_QT, "0") {
|
equals(HAVE_QT, "0") {
|
||||||
|
|
||||||
|
|
@ -79,7 +94,7 @@ equals(HAVE_QT, "0") {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
DEFINES += HAVE_QT
|
DEFINES += HAVE_QT
|
||||||
QT += network xml sql
|
QT += core network xml sql
|
||||||
|
|
||||||
equals(HAVE_QT5, "1") {
|
equals(HAVE_QT5, "1") {
|
||||||
QT += designer printsupport
|
QT += designer printsupport
|
||||||
|
|
@ -94,10 +109,14 @@ equals(HAVE_QT, "0") {
|
||||||
}
|
}
|
||||||
|
|
||||||
# only support the required symbols for shared object load performance
|
# only support the required symbols for shared object load performance
|
||||||
win32 {
|
msvc {
|
||||||
QMAKE_LFLAGS += -Wl,--exclude-all-symbols
|
# ...
|
||||||
} else {
|
} else {
|
||||||
QMAKE_CXXFLAGS += -fvisibility=hidden
|
win32 {
|
||||||
|
QMAKE_LFLAGS += -Wl,--exclude-all-symbols
|
||||||
|
} else {
|
||||||
|
QMAKE_CXXFLAGS += -fvisibility=hidden
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VERSION_STRING = $$KLAYOUT_VERSION
|
VERSION_STRING = $$KLAYOUT_VERSION
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@
|
||||||
#if defined(HAVE_QTBINDINGS)
|
#if defined(HAVE_QTBINDINGS)
|
||||||
# include "gsiQtGuiExternals.h"
|
# include "gsiQtGuiExternals.h"
|
||||||
# include "gsiQtWidgetsExternals.h"
|
# include "gsiQtWidgetsExternals.h"
|
||||||
|
|
||||||
FORCE_LINK_GSI_QTGUI
|
FORCE_LINK_GSI_QTGUI
|
||||||
FORCE_LINK_GSI_QTWIDGETS // for Qt5
|
FORCE_LINK_GSI_QTWIDGETS // for Qt5
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,6 @@ namespace tl
|
||||||
template <> struct type_traits<gsi::PluginBase> : public type_traits<void> {
|
template <> struct type_traits<gsi::PluginBase> : public type_traits<void> {
|
||||||
typedef tl::false_tag has_copy_constructor;
|
typedef tl::false_tag has_copy_constructor;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <> Registrar<gsi::PluginFactoryBase> *Registrar<gsi::PluginFactoryBase>::instance = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace gsi
|
namespace gsi
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ LayoutHandle::layout_changed ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LayoutHandle::rename (const std::string &name, bool force) throw (tl::Exception)
|
LayoutHandle::rename (const std::string &name, bool force)
|
||||||
{
|
{
|
||||||
std::string n (name);
|
std::string n (name);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ public:
|
||||||
* If "force" is set to true, the layout will be given that name, irregardless if
|
* If "force" is set to true, the layout will be given that name, irregardless if
|
||||||
* the name already is being used. If "force" is false, a new unique name is created.
|
* the name already is being used. If "force" is false, a new unique name is created.
|
||||||
*/
|
*/
|
||||||
void rename (const std::string &name, bool force = false) throw (tl::Exception);
|
void rename (const std::string &name, bool force = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the name of the handle
|
* @brief Gets the name of the handle
|
||||||
|
|
|
||||||
|
|
@ -589,9 +589,3 @@ PluginRoot::instance ()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace tl
|
|
||||||
{
|
|
||||||
template<> LAYBASIC_PUBLIC Registrar<lay::PluginDeclaration> *tl::Registrar<lay::PluginDeclaration>::instance = 0;
|
|
||||||
template class LAYBASIC_PUBLIC tl::RegisteredClass<lay::PluginDeclaration>;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -22,17 +22,5 @@
|
||||||
|
|
||||||
|
|
||||||
#include "layTechnology.h"
|
#include "layTechnology.h"
|
||||||
#include "layPlugin.h"
|
|
||||||
#include "layStream.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
namespace tl
|
|
||||||
{
|
|
||||||
template<> LAYBASIC_PUBLIC tl::Registrar<lay::TechnologyEditorProvider> *tl::Registrar<lay::TechnologyEditorProvider>::instance = 0;
|
|
||||||
template class LAYBASIC_PUBLIC tl::RegisteredClass<lay::TechnologyEditorProvider>;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// .. nothing yet ..
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ TEMPLATE = lib
|
||||||
# $(DESTDIR) and $(TARGET)
|
# $(DESTDIR) and $(TARGET)
|
||||||
win32 {
|
win32 {
|
||||||
|
|
||||||
QMAKE_POST_LINK += $(COPY) $(DESTDIR_TARGET) $$DESTDIR_UT/$${TARGET}.ut
|
QMAKE_POST_LINK += $(COPY) $(DESTDIR_TARGET) $$shell_path($$DESTDIR_UT/$${TARGET}.ut)
|
||||||
|
|
||||||
# to avoid the major version being appended to the dll name - in this case -lxyz won't link it again
|
# to avoid the major version being appended to the dll name - in this case -lxyz won't link it again
|
||||||
# because the library is called xyx0.dll.
|
# because the library is called xyx0.dll.
|
||||||
|
|
|
||||||
|
|
@ -122,9 +122,3 @@ MacroInterpreter::suffix (const std::string &dsl_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace tl
|
|
||||||
{
|
|
||||||
template<> LYM_PUBLIC tl::Registrar<lym::MacroInterpreter> *Registrar<lym::MacroInterpreter>::instance = 0;
|
|
||||||
template class LYM_PUBLIC tl::RegisteredClass<lym::MacroInterpreter>;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -192,11 +192,3 @@ class StandardFormatDeclaration
|
||||||
static tl::RegisteredClass<rdb::FormatDeclaration> format_decl (new StandardFormatDeclaration (), 0, "KLayout-RDB");
|
static tl::RegisteredClass<rdb::FormatDeclaration> format_decl (new StandardFormatDeclaration (), 0, "KLayout-RDB");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace tl
|
|
||||||
{
|
|
||||||
template<> RDB_PUBLIC tl::Registrar<rdb::FormatDeclaration> *tl::Registrar<rdb::FormatDeclaration>::instance = 0;
|
|
||||||
template class RDB_PUBLIC tl::RegisteredClass<rdb::FormatDeclaration>;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,16 @@ include($$PWD/../../lib.pri)
|
||||||
|
|
||||||
DEFINES += MAKE_TL_LIBRARY
|
DEFINES += MAKE_TL_LIBRARY
|
||||||
|
|
||||||
LIBS += -lz
|
!msvc {
|
||||||
|
LIBS += -lz
|
||||||
|
}
|
||||||
|
|
||||||
|
msvc {
|
||||||
|
|
||||||
|
LIBS += \
|
||||||
|
-L$$THIRD_PARTY/zlib/1.2.11/lib -lzlib
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
equals(HAVE_QT, "0") {
|
equals(HAVE_QT, "0") {
|
||||||
LIBS += -lpthread
|
LIBS += -lpthread
|
||||||
|
|
@ -152,6 +161,3 @@ equals(HAVE_CURL, "1") {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INCLUDEPATH =
|
|
||||||
DEPENDPATH =
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,3 +23,39 @@
|
||||||
|
|
||||||
#include "tlClassRegistry.h"
|
#include "tlClassRegistry.h"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
namespace tl
|
||||||
|
{
|
||||||
|
|
||||||
|
struct ti_compare_f
|
||||||
|
{
|
||||||
|
bool operator() (const std::type_info *a, const std::type_info *b) const
|
||||||
|
{
|
||||||
|
return a->before (*b);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::map<const std::type_info *, RegistrarBase *, ti_compare_f> inst_map_type;
|
||||||
|
static inst_map_type s_inst_map;
|
||||||
|
|
||||||
|
TL_PUBLIC void set_registrar_instance_by_type (const std::type_info &ti, RegistrarBase *rb)
|
||||||
|
{
|
||||||
|
if (rb) {
|
||||||
|
s_inst_map[&ti] = rb;
|
||||||
|
} else {
|
||||||
|
s_inst_map.erase (&ti);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TL_PUBLIC RegistrarBase *registrar_instance_by_type (const std::type_info &ti)
|
||||||
|
{
|
||||||
|
inst_map_type::const_iterator im = s_inst_map.find (&ti);
|
||||||
|
if (im != s_inst_map.end ()) {
|
||||||
|
return im->second;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include "tlCommon.h"
|
#include "tlCommon.h"
|
||||||
|
|
||||||
#include "tlLog.h"
|
#include "tlLog.h"
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
namespace tl
|
namespace tl
|
||||||
{
|
{
|
||||||
|
|
@ -93,10 +94,12 @@ public:
|
||||||
RegisteredClass (X *inst, int position = 0, const char *name = "", bool owned = true)
|
RegisteredClass (X *inst, int position = 0, const char *name = "", bool owned = true)
|
||||||
: m_owned (owned)
|
: m_owned (owned)
|
||||||
{
|
{
|
||||||
if (! Registrar<X>::instance) {
|
Registrar<X> *instance = Registrar<X>::get_instance ();
|
||||||
Registrar<X>::instance = new Registrar<X> ();
|
if (! instance) {
|
||||||
|
instance = new Registrar<X> ();
|
||||||
|
Registrar<X>::set_instance (instance);
|
||||||
}
|
}
|
||||||
mp_node = Registrar<X>::instance->insert (inst, owned, position, name);
|
mp_node = instance->insert (inst, owned, position, name);
|
||||||
|
|
||||||
if (tl::verbosity () >= 40) {
|
if (tl::verbosity () >= 40) {
|
||||||
tl::info << "Registered object '" << name << "' with priority " << position;
|
tl::info << "Registered object '" << name << "' with priority " << position;
|
||||||
|
|
@ -105,13 +108,18 @@ public:
|
||||||
|
|
||||||
~RegisteredClass ()
|
~RegisteredClass ()
|
||||||
{
|
{
|
||||||
// remove the associated object
|
Registrar<X> *instance = Registrar<X>::get_instance ();
|
||||||
Registrar<X>::instance->remove (mp_node);
|
if (instance) {
|
||||||
|
|
||||||
|
// remove the associated object
|
||||||
|
instance->remove (mp_node);
|
||||||
|
|
||||||
|
if (instance->begin () == instance->end ()) {
|
||||||
|
// no more registered objects left - remove registrar
|
||||||
|
delete instance;
|
||||||
|
Registrar<X>::set_instance (0);
|
||||||
|
}
|
||||||
|
|
||||||
if (Registrar<X>::instance->begin () == Registrar<X>::instance->end ()) {
|
|
||||||
// no more registered objects left - remove registrar
|
|
||||||
delete Registrar<X>::instance;
|
|
||||||
Registrar<X>::instance = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,6 +128,22 @@ private:
|
||||||
bool m_owned;
|
bool m_owned;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A base class for the registrar types
|
||||||
|
*/
|
||||||
|
class RegistrarBase { };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the registrar instance by type
|
||||||
|
*/
|
||||||
|
TL_PUBLIC void set_registrar_instance_by_type (const std::type_info &ti, RegistrarBase *rb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the registrar instance by type
|
||||||
|
* Returns 0 if no registrar instance is set by this type;
|
||||||
|
*/
|
||||||
|
TL_PUBLIC RegistrarBase *registrar_instance_by_type (const std::type_info &ti);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The registrar capable of registering objects of type Y derived from X
|
* @brief The registrar capable of registering objects of type Y derived from X
|
||||||
*
|
*
|
||||||
|
|
@ -131,6 +155,7 @@ private:
|
||||||
*/
|
*/
|
||||||
template <class X>
|
template <class X>
|
||||||
class Registrar
|
class Registrar
|
||||||
|
: public RegistrarBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class iterator
|
class iterator
|
||||||
|
|
@ -220,15 +245,18 @@ public:
|
||||||
|
|
||||||
static Registrar<X> *get_instance ()
|
static Registrar<X> *get_instance ()
|
||||||
{
|
{
|
||||||
return instance;
|
return static_cast<Registrar<X> *> (registrar_instance_by_type (typeid (X)));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_instance (Registrar<X> *instance)
|
||||||
|
{
|
||||||
|
set_registrar_instance_by_type (typeid (X), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class iterator;
|
friend class iterator;
|
||||||
template <class Y> friend class RegisteredClass;
|
template <class Y> friend class RegisteredClass;
|
||||||
|
|
||||||
static Registrar<X> *instance;
|
|
||||||
|
|
||||||
RegistrarNode<X> *insert (X *cls, bool owned, int position, const std::string &name)
|
RegistrarNode<X> *insert (X *cls, bool owned, int position, const std::string &name)
|
||||||
{
|
{
|
||||||
RegistrarNode<X> **link = &mp_first;
|
RegistrarNode<X> **link = &mp_first;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#include "tlLog.h"
|
#include "tlLog.h"
|
||||||
#include "tlCommandLineParser.h"
|
#include "tlCommandLineParser.h"
|
||||||
#include "tlFileUtils.h"
|
#include "tlFileUtils.h"
|
||||||
|
#include "tlString.h"
|
||||||
|
|
||||||
namespace tl
|
namespace tl
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,14 @@
|
||||||
namespace tl
|
namespace tl
|
||||||
{
|
{
|
||||||
|
|
||||||
TL_PUBLIC void handle_event_exception (tl::Exception &ex)
|
void handle_event_exception (tl::Exception &ex)
|
||||||
{
|
{
|
||||||
// Exceptions have unpredicable side effects for events so we just log
|
// Exceptions have unpredicable side effects for events so we just log
|
||||||
// them here.
|
// them here.
|
||||||
tl::warn << ex.msg ();
|
tl::warn << ex.msg ();
|
||||||
}
|
}
|
||||||
|
|
||||||
TL_PUBLIC void handle_event_exception (std::exception &ex)
|
void handle_event_exception (std::exception &ex)
|
||||||
{
|
{
|
||||||
// Exceptions have unpredicable side effects for events so we just log
|
// Exceptions have unpredicable side effects for events so we just log
|
||||||
// them here.
|
// them here.
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,12 @@ namespace tl
|
||||||
/**
|
/**
|
||||||
* @brief A helper function to handle event exceptions of tl::Exception type
|
* @brief A helper function to handle event exceptions of tl::Exception type
|
||||||
*/
|
*/
|
||||||
void handle_event_exception (tl::Exception &ex);
|
TL_PUBLIC void handle_event_exception (tl::Exception &ex);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A helper function to handle event exceptions of std::exception type
|
* @brief A helper function to handle event exceptions of std::exception type
|
||||||
*/
|
*/
|
||||||
void handle_event_exception (std::exception &ex);
|
TL_PUBLIC void handle_event_exception (std::exception &ex);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A framework of observer and observables
|
* @brief A framework of observer and observables
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#define _USE_MATH_DEFINES // for MSVC
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
||||||
|
|
@ -27,19 +27,36 @@
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#if defined(_MSC_VER)
|
||||||
#include <unistd.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
# include <sys/types.h>
|
||||||
|
# include <sys/stat.h>
|
||||||
|
# include <io.h>
|
||||||
|
# include <Windows.h>
|
||||||
|
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
|
||||||
|
# include <sys/stat.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <dirent.h>
|
||||||
# include <dir.h>
|
# include <dir.h>
|
||||||
# include <windows.h>
|
# include <Windows.h>
|
||||||
#elif defined(__APPLE__)
|
|
||||||
# include <libproc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#elif defined(__APPLE__)
|
||||||
|
|
||||||
|
# include <sys/stat.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <dirent.h>
|
||||||
|
# include <libproc.h>
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
# include <sys/stat.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <dirent.h>
|
||||||
|
# include <dlfcn.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace tl
|
namespace tl
|
||||||
|
|
@ -664,13 +681,21 @@ bool file_exists (const std::string &p)
|
||||||
bool is_writable (const std::string &p)
|
bool is_writable (const std::string &p)
|
||||||
{
|
{
|
||||||
stat_struct st;
|
stat_struct st;
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
return stat_func (p, st) == 0 && (st.st_mode & _S_IWRITE) != 0;
|
||||||
|
#else
|
||||||
return stat_func (p, st) == 0 && (st.st_mode & S_IWUSR) != 0;
|
return stat_func (p, st) == 0 && (st.st_mode & S_IWUSR) != 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_readable (const std::string &p)
|
bool is_readable (const std::string &p)
|
||||||
{
|
{
|
||||||
stat_struct st;
|
stat_struct st;
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
return stat_func (p, st) == 0 && (st.st_mode & _S_IREAD) != 0;
|
||||||
|
#else
|
||||||
return stat_func (p, st) == 0 && (st.st_mode & S_IRUSR) != 0;
|
return stat_func (p, st) == 0 && (st.st_mode & S_IRUSR) != 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_dir (const std::string &p)
|
bool is_dir (const std::string &p)
|
||||||
|
|
@ -679,7 +704,11 @@ bool is_dir (const std::string &p)
|
||||||
if (stat_func (p, st) != 0) {
|
if (stat_func (p, st) != 0) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
return !(st.st_mode & _S_IFREG);
|
||||||
|
#else
|
||||||
return !S_ISREG (st.st_mode);
|
return !S_ISREG (st.st_mode);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,9 @@
|
||||||
#include "tlString.h"
|
#include "tlString.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#if !defined(_MSC_VER)
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
@ -250,7 +252,11 @@ ChannelProxy::ChannelProxy (const ChannelProxy &d)
|
||||||
static bool
|
static bool
|
||||||
can_colorize (FILE *stream)
|
can_colorize (FILE *stream)
|
||||||
{
|
{
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
return isatty (fileno (stream));
|
return isatty (fileno (stream));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ANSI_RED "\033[31;1m"
|
#define ANSI_RED "\033[31;1m"
|
||||||
|
|
|
||||||
|
|
@ -721,7 +721,7 @@ from_string (const std::string &s, const unsigned char * &result)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
from_string (const std::string &s, double &v) throw (tl::Exception)
|
from_string (const std::string &s, double &v)
|
||||||
{
|
{
|
||||||
const char *cp = s.c_str ();
|
const char *cp = s.c_str ();
|
||||||
while (*cp && isspace (*cp)) {
|
while (*cp && isspace (*cp)) {
|
||||||
|
|
@ -743,7 +743,7 @@ from_string (const std::string &s, double &v) throw (tl::Exception)
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void
|
void
|
||||||
convert_string_to_int (const std::string &s, T &v) throw (tl::Exception)
|
convert_string_to_int (const std::string &s, T &v)
|
||||||
{
|
{
|
||||||
double x;
|
double x;
|
||||||
// HACK: this should be some real string-to-int conversion
|
// HACK: this should be some real string-to-int conversion
|
||||||
|
|
@ -761,43 +761,43 @@ convert_string_to_int (const std::string &s, T &v) throw (tl::Exception)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
from_string (const std::string &s, int &v) throw (tl::Exception)
|
from_string (const std::string &s, int &v)
|
||||||
{
|
{
|
||||||
convert_string_to_int (s, v);
|
convert_string_to_int (s, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
from_string (const std::string &s, long &v) throw (tl::Exception)
|
from_string (const std::string &s, long &v)
|
||||||
{
|
{
|
||||||
convert_string_to_int (s, v);
|
convert_string_to_int (s, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
from_string (const std::string &s, long long &v) throw (tl::Exception)
|
from_string (const std::string &s, long long &v)
|
||||||
{
|
{
|
||||||
convert_string_to_int (s, v);
|
convert_string_to_int (s, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
from_string (const std::string &s, unsigned int &v) throw (tl::Exception)
|
from_string (const std::string &s, unsigned int &v)
|
||||||
{
|
{
|
||||||
convert_string_to_int (s, v);
|
convert_string_to_int (s, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
from_string (const std::string &s, unsigned long &v) throw (tl::Exception)
|
from_string (const std::string &s, unsigned long &v)
|
||||||
{
|
{
|
||||||
convert_string_to_int (s, v);
|
convert_string_to_int (s, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
from_string (const std::string &s, unsigned long long &v) throw (tl::Exception)
|
from_string (const std::string &s, unsigned long long &v)
|
||||||
{
|
{
|
||||||
convert_string_to_int (s, v);
|
convert_string_to_int (s, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
from_string (const std::string &s, bool &b) throw (tl::Exception)
|
from_string (const std::string &s, bool &b)
|
||||||
{
|
{
|
||||||
std::string t (tl::trim (s));
|
std::string t (tl::trim (s));
|
||||||
if (t == "true") {
|
if (t == "true") {
|
||||||
|
|
|
||||||
|
|
@ -757,14 +757,14 @@ private:
|
||||||
|
|
||||||
TL_PUBLIC void from_string (const std::string &s, const char * &result);
|
TL_PUBLIC void from_string (const std::string &s, const char * &result);
|
||||||
TL_PUBLIC void from_string (const std::string &s, const unsigned char * &result);
|
TL_PUBLIC void from_string (const std::string &s, const unsigned char * &result);
|
||||||
TL_PUBLIC void from_string (const std::string &s, double &v) throw (tl::Exception);
|
TL_PUBLIC void from_string (const std::string &s, double &v);
|
||||||
TL_PUBLIC void from_string (const std::string &s, int &v) throw (tl::Exception);
|
TL_PUBLIC void from_string (const std::string &s, int &v);
|
||||||
TL_PUBLIC void from_string (const std::string &s, long &v) throw (tl::Exception);
|
TL_PUBLIC void from_string (const std::string &s, long &v);
|
||||||
TL_PUBLIC void from_string (const std::string &s, long long &v) throw (tl::Exception);
|
TL_PUBLIC void from_string (const std::string &s, long long &v);
|
||||||
TL_PUBLIC void from_string (const std::string &s, unsigned int &v) throw (tl::Exception);
|
TL_PUBLIC void from_string (const std::string &s, unsigned int &v);
|
||||||
TL_PUBLIC void from_string (const std::string &s, unsigned long &v) throw (tl::Exception);
|
TL_PUBLIC void from_string (const std::string &s, unsigned long &v);
|
||||||
TL_PUBLIC void from_string (const std::string &s, unsigned long long &v) throw (tl::Exception);
|
TL_PUBLIC void from_string (const std::string &s, unsigned long long &v);
|
||||||
TL_PUBLIC void from_string (const std::string &s, bool &b) throw (tl::Exception);
|
TL_PUBLIC void from_string (const std::string &s, bool &b);
|
||||||
|
|
||||||
inline void from_string (const std::string &s, std::string &v) { v = s; }
|
inline void from_string (const std::string &s, std::string &v) { v = s; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ private:
|
||||||
#if defined(HAVE_QT)
|
#if defined(HAVE_QT)
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class TL_PUBLIC ThreadStorage
|
class ThreadStorage
|
||||||
: public QThreadStorage<T>
|
: public QThreadStorage<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -32,46 +32,52 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef _MSC_VER // not available on MS VC++
|
#if !defined(_MSC_VER) // not available on MS VC++
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
# include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__MACH__)
|
#if defined(__MACH__)
|
||||||
#include <mach/clock.h>
|
# include <mach/clock.h>
|
||||||
#include <mach/mach.h>
|
# include <mach/mach.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace tl
|
namespace tl
|
||||||
{
|
{
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
// Gets the current time in ms from epoch
|
||||||
|
|
||||||
void current_utc_time (struct timespec *ts)
|
static int64_t ms_time ()
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined(__MACH__)
|
#if defined(__MACH__)
|
||||||
|
|
||||||
clock_serv_t cclock;
|
clock_serv_t cclock;
|
||||||
mach_timespec_t mts;
|
mach_timespec_t mts;
|
||||||
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
||||||
clock_get_time(cclock, &mts);
|
clock_get_time(cclock, &mts);
|
||||||
mach_port_deallocate(mach_task_self(), cclock);
|
mach_port_deallocate(mach_task_self(), cclock);
|
||||||
ts->tv_sec = mts.tv_sec;
|
|
||||||
ts->tv_nsec = mts.tv_nsec;
|
return int64_t (mts.tv_sec) * 1000 + int64_t (0.5 + mts.tv_nsec / 1.0e6);
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
|
FILETIME ft;
|
||||||
|
GetSystemTimeAsFileTime (&ft);
|
||||||
|
// device by 8192 -> should fit into a 64bit type
|
||||||
|
uint64_t t = (uint64_t (ft.dwHighDateTime) << (64 - 13)) | (uint64_t (ft.dwLowDateTime) >> 13);
|
||||||
|
return int64_t (0.5 + t / 0.8192);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
timespec ts;
|
||||||
clock_gettime(CLOCK_REALTIME, ts);
|
clock_gettime(CLOCK_REALTIME, ts);
|
||||||
|
return int64_t (ts.tv_sec) * 1000 + int64_t (0.5 + ts.tv_nsec / 1.0e6);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
|
||||||
// Gets the current time in ms from epoch
|
|
||||||
|
|
||||||
static int64_t ms_time ()
|
|
||||||
{
|
|
||||||
struct timespec spec;
|
|
||||||
current_utc_time (&spec);
|
|
||||||
|
|
||||||
return int64_t (spec.tv_sec) * 1000 + int64_t (0.5 + spec.tv_nsec / 1.0e6);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
|
@ -100,9 +106,6 @@ Timer::start ()
|
||||||
m_sys_ms += (timer_t) ((clks.tms_stime + clks.tms_cstime) * clk2msec + 0.5);
|
m_sys_ms += (timer_t) ((clks.tms_stime + clks.tms_cstime) * clk2msec + 0.5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct timespec spec;
|
|
||||||
current_utc_time (&spec);
|
|
||||||
|
|
||||||
m_wall_ms += ms_time ();
|
m_wall_ms += ms_time ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -456,7 +456,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void execute (tl::TestBase *_this) throw (tl::Exception) = 0;
|
virtual void execute (tl::TestBase *_this) = 0;
|
||||||
|
|
||||||
void write_detailed_diff (std::ostream &os, const std::string &subject, const std::string &ref);
|
void write_detailed_diff (std::ostream &os, const std::string &subject, const std::string &ref);
|
||||||
|
|
||||||
|
|
@ -496,11 +496,11 @@ struct TestImpl##NAME \
|
||||||
: public tl::TestBase \
|
: public tl::TestBase \
|
||||||
{ \
|
{ \
|
||||||
TestImpl##NAME () : TestBase (__FILE__, #NAME) { } \
|
TestImpl##NAME () : TestBase (__FILE__, #NAME) { } \
|
||||||
virtual void execute (tl::TestBase *_this) throw (tl::Exception); \
|
virtual void execute (tl::TestBase *_this); \
|
||||||
}; \
|
}; \
|
||||||
static TestImpl##NAME TestImpl_Inst##NAME; \
|
static TestImpl##NAME TestImpl_Inst##NAME; \
|
||||||
} \
|
} \
|
||||||
void TestImpl##NAME::execute (tl::TestBase *_this) throw (tl::Exception)
|
void TestImpl##NAME::execute (tl::TestBase *_this)
|
||||||
|
|
||||||
#define EXPECT_EQ(WHAT,EQUALS) \
|
#define EXPECT_EQ(WHAT,EQUALS) \
|
||||||
_this->checkpoint (__FILE__, __LINE__); \
|
_this->checkpoint (__FILE__, __LINE__); \
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "tlClassRegistry.h"
|
#include "tlClassRegistry.h"
|
||||||
#include "tlUnitTest.h"
|
#include "tlUnitTest.h"
|
||||||
|
|
||||||
|
|
@ -39,13 +38,13 @@ public:
|
||||||
class Y : public X
|
class Y : public X
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual const char *name () const { return "Y"; };
|
virtual const char *name () const { return "Y"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Z : public X
|
class Z : public X
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual const char *name () const { return "Z"; };
|
virtual const char *name () const { return "Z"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -59,12 +58,12 @@ public:
|
||||||
|
|
||||||
class B : public A
|
class B : public A
|
||||||
{
|
{
|
||||||
virtual const char *name () const { return "B"; };
|
virtual const char *name () const { return "B"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class C : public A
|
class C : public A
|
||||||
{
|
{
|
||||||
virtual const char *name () const { return "C"; };
|
virtual const char *name () const { return "C"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -112,10 +111,3 @@ TEST(3)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace tl
|
|
||||||
{
|
|
||||||
template <> tl::Registrar<class_registry_test::X> *Registrar<class_registry_test::X>::instance = 0;
|
|
||||||
template <> tl::Registrar<class_registry_test::A> *Registrar<class_registry_test::A>::instance = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "tlUnitTest.h"
|
#include "tlUnitTest.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#define _USE_MATH_DEFINES // for MSVC
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
// basics
|
// basics
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@
|
||||||
#include "tlTimer.h"
|
#include "tlTimer.h"
|
||||||
#include "tlUnitTest.h"
|
#include "tlUnitTest.h"
|
||||||
|
|
||||||
#include <cmath>
|
#define _USE_MATH_DEFINES // for MSVC
|
||||||
|
#include <math.h>
|
||||||
#include <clocale>
|
#include <clocale>
|
||||||
|
|
||||||
using namespace tl;
|
using namespace tl;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
#include <windows.h>
|
#include <Windows.h>
|
||||||
inline void usleep(long us)
|
inline void usleep(long us)
|
||||||
{
|
{
|
||||||
Sleep(us / 1000);
|
Sleep(us / 1000);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue