mirror of https://github.com/CGAL/cgal
io static methods
This commit is contained in:
parent
3b7bca1920
commit
6b3fbfb5ef
|
|
@ -22,10 +22,6 @@
|
|||
namespace CGAL {
|
||||
namespace internal {
|
||||
|
||||
#ifdef CGAL_HEADER_ONLY
|
||||
const
|
||||
#endif // CGAL_HEADER_ONLY
|
||||
|
||||
const int primes [2000] = {
|
||||
/*
|
||||
* Generated in SAGE with:
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
// Author(s) : Michael Hemmer
|
||||
|
||||
#ifndef CGAL_HEADER_ONLY
|
||||
|
||||
#include <CGAL/primes.h>
|
||||
#include <CGAL/primes_impl.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,15 @@ namespace CGAL {
|
|||
class IO {
|
||||
public:
|
||||
#ifndef CGAL_HEADER_ONLY
|
||||
CGAL_EXPORT static int mode;
|
||||
CGAL_EXPORT static int mode;
|
||||
static int& get_static_mode()
|
||||
{ return IO::mode; }
|
||||
#else // CGAL_HEADER_ONLY
|
||||
inline int& get_static_mode()
|
||||
{
|
||||
static int mode = std::ios::xalloc();
|
||||
return mode;
|
||||
}
|
||||
#endif // CGAL_HEADER_ONLY
|
||||
enum Mode {ASCII = 0, PRETTY, BINARY};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -36,26 +36,11 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
#ifdef CGAL_HEADER_ONLY
|
||||
namespace {
|
||||
inline int& get_static_mode()
|
||||
{
|
||||
static int mode = std::ios::xalloc();
|
||||
return mode;
|
||||
}
|
||||
} // namespace
|
||||
#else // CGAL_HEADER_ONLY
|
||||
namespace {
|
||||
inline int& get_static_mode()
|
||||
{ return IO::mode; }
|
||||
} // namespace
|
||||
#endif // CGAL_HEADER_ONLY
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
IO::Mode
|
||||
get_mode(std::ios& i)
|
||||
{
|
||||
return static_cast<IO::Mode>(i.iword(get_static_mode()));
|
||||
return static_cast<IO::Mode>(i.iword(IO::get_static_mode()));
|
||||
}
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
|
|
@ -63,7 +48,7 @@ IO::Mode
|
|||
set_ascii_mode(std::ios& i)
|
||||
{
|
||||
IO::Mode m = get_mode(i);
|
||||
i.iword(get_static_mode()) = IO::ASCII;
|
||||
i.iword(IO::get_static_mode()) = IO::ASCII;
|
||||
return m;
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +57,7 @@ IO::Mode
|
|||
set_binary_mode(std::ios& i)
|
||||
{
|
||||
IO::Mode m = get_mode(i);
|
||||
i.iword(get_static_mode()) = IO::BINARY;
|
||||
i.iword(IO::get_static_mode()) = IO::BINARY;
|
||||
return m;
|
||||
}
|
||||
|
||||
|
|
@ -82,7 +67,7 @@ IO::Mode
|
|||
set_pretty_mode(std::ios& i)
|
||||
{
|
||||
IO::Mode m = get_mode(i);
|
||||
i.iword(get_static_mode()) = IO::PRETTY;
|
||||
i.iword(IO::get_static_mode()) = IO::PRETTY;
|
||||
return m;
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +76,7 @@ IO::Mode
|
|||
set_mode(std::ios& i, IO::Mode m)
|
||||
{
|
||||
IO::Mode old = get_mode(i);
|
||||
i.iword(get_static_mode()) = m;
|
||||
i.iword(IO::get_static_mode()) = m;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
|
@ -99,21 +84,21 @@ CGAL_INLINE_FUNCTION
|
|||
bool
|
||||
is_pretty(std::ios& i)
|
||||
{
|
||||
return i.iword(get_static_mode()) == IO::PRETTY;
|
||||
return i.iword(IO::get_static_mode()) == IO::PRETTY;
|
||||
}
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
bool
|
||||
is_ascii(std::ios& i)
|
||||
{
|
||||
return i.iword(get_static_mode()) == IO::ASCII;
|
||||
return i.iword(IO::get_static_mode()) == IO::ASCII;
|
||||
}
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
bool
|
||||
is_binary(std::ios& i)
|
||||
{
|
||||
return i.iword(get_static_mode()) == IO::BINARY;
|
||||
return i.iword(IO::get_static_mode()) == IO::BINARY;
|
||||
}
|
||||
|
||||
CGAL_INLINE_FUNCTION
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ DONE #include "/home/gdamiand/sources/CGAL/Stream_support/src/CGAL/io.cpp" // va
|
|||
DONE #include "/home/gdamiand/sources/CGAL/Stream_support/src/CGAL/Color.cpp" // constantes globales
|
||||
DONE #include "/home/gdamiand/sources/CGAL/Kernel_23/src/CGAL/kernel.cpp" // constantes globales
|
||||
DONE #include "/home/gdamiand/sources/CGAL/Number_types/src/CGAL/Interval_arithmetic.cpp" // constante globale
|
||||
DONE #include "/home/gdamiand/sources/CGAL/Number_types/src/CGAL/test_FPU_rounding_mode.cpp" // static const (ok car utilisé que pour debug)
|
||||
DONE #include "/home/gdamiand/sources/CGAL/Number_types/src/CGAL/test_FPU_rounding_mode.cpp" // variable static de classe const
|
||||
DONE #include "/home/gdamiand/sources/CGAL/Profiling_tools/src/CGAL/Timer.cpp" // variable statique de classe
|
||||
DONE #include "/home/gdamiand/sources/CGAL/Profiling_tools/src/CGAL/Real_timer.cpp" // variable statique de classe
|
||||
DONE #include "/home/gdamiand/sources/CGAL/Random_numbers/src/CGAL/Random.cpp" // variable globale; utilisée directement (donc pb pour header only) -> we need to replace the use of CGAL::default_random by CGAL::get_default_random().
|
||||
|
|
|
|||
Loading…
Reference in New Issue