Skip to content

Commit 4ad4cf4

Browse files
rolandlichtersjenkins
authored andcommitted
revert allowSpecialCharacters flag
1 parent 598c787 commit 4ad4cf4

7 files changed

Lines changed: 76 additions & 87 deletions

File tree

Docs/UserGuide/userguide.tex

Lines changed: 61 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
%\title{Open Source Risk Engine \\ User Guide }
132132
\title{ORE User Guide}
133133
\author{Acadia Inc.}
134-
\date{13 March 2023}
134+
\date{31 March 2023}
135135
\maketitle
136136

137137
\newpage
@@ -152,7 +152,7 @@ \section*{Document History}
152152
30 June 2021 & Acadia & updates for release 6\\
153153
16 September 2022 & Acadia & updates for release 7\\
154154
6 December 2022 & Acadia & updates for release 8\\
155-
13 March 2023 & Acadia & updates for release 9\\
155+
31 March 2023 & Acadia & updates for release 9\\
156156
\hline
157157
\end{supertabular}
158158
\end{center}
@@ -709,9 +709,9 @@ \subsubsection*{Generate Visual Studio Projects with CMake}
709709
\item Run CMake command:
710710
\begin{itemize}
711711
\item 32-bit: \\
712-
{\tt cmake -G "Visual Studio 17 2022" -A x64 -DBOOST\_INCLUDEDIR=\%BOOST\% -DBOOST\_LIBRARYDIR=\%BOOST\_LIB64\% -DMSVC\_LINK\_DYNAMIC\_RUNTIME=true -B build}
712+
{\tt cmake -G "Visual Studio 17 2022" -A x64 -DBOOST\_INCLUDEDIR=\%BOOST\% -DBOOST\_LIBRARYDIR=\%BOOST\_LIB64\% -DQL\_ENABLE\_SESSIONS=ON -DMSVC\_LINK\_DYNAMIC\_RUNTIME=true -B build}
713713
\item 64-bit: \\
714-
{\tt cmake -G "Visual Studio 17 2022" -A x32 -DBOOST\_INCLUDEDIR=\%BOOST\% -DBOOST\_LIBRARYDIR=\%BOOST\_LIB32\% -DMSVC\_LINK\_DYNAMIC\_RUNTIME=true -B build}
714+
{\tt cmake -G "Visual Studio 17 2022" -A x32 -DBOOST\_INCLUDEDIR=\%BOOST\% -DBOOST\_LIBRARYDIR=\%BOOST\_LIB32\% -DQL\_ENABLE\_SESSIONS=ON -DMSVC\_LINK\_DYNAMIC\_RUNTIME=true -B build}
715715
\end{itemize}
716716
Replace the generator "Visual Studio 17 2022" with the actual installed version.
717717
The solution and project files will be generated in the {\tt $\langle$ORE\_ROOT$\rangle${\bs}build} subdirectory.
@@ -725,13 +725,18 @@ \subsubsection*{Unix}
725725
With the 5th release we have discontinued automake support so that ORE can only be built with CMake on Unix systems, as follows.
726726

727727
\begin{enumerate}
728-
\item Change to the ORE project directory that contains the {\tt QuantLib}, {\tt QuantExt}, etc, folders; create subdirectory {\tt build} and change to subdirectory {\tt build}
728+
\item set environment variable to locate the boost include and boost library directories\\
729+
\medskip
730+
{\tt export BOOST\_LIB=path/to/boost/lib}\\
731+
{\tt export BOOST\_INC=path/to/boost/include}
732+
\medskip
733+
\Item Change to the ORE project directory that contains the {\tt QuantLib}, {\tt QuantExt}, etc, folders; create subdirectory {\tt build} and change to subdirectory {\tt build}
729734
\item Configure CMake by invoking \\
730735
\medskip
731-
{\tt cmake -DBOOST\_ROOT=\${BOOST} -DBOOST\_LIBRARYDIR=\${BOOST}/stage/lib ..} \\
736+
{\tt cmake -DBOOST\_ROOT=\${BOOST\_INC} -DBOOST\_LIBRARYDIR=\${BOOST\_LIB} -DQL\_ENABLE\_SESSIONS=ON ..} \\
732737
\medskip
733-
734-
Alternatively, set environment variables {\tt BOOST\_ROOT} and {\tt BOOST\_LIBRARYDIR} and run \\
738+
where the {\tt QL\_ENABLE\_SESSIONS} variable is set to ON in order to enable some multi-threading applications in ORE.
739+
Alternatively, set environment variables {\tt BOOST\_ROOT} and {\tt BOOST\_LIBRARYDIR} directly and run \\
735740
\medskip
736741
{\tt cmake ..} \\
737742
\medskip
@@ -796,6 +801,7 @@ \subsubsection*{Building on Windows with CMake}
796801
{\tt \hspace{2cm} -D BOOST\_LIBRARYDIR=\%BOOST\_LIB64\% }\textbackslash\\
797802
{\tt \hspace{2cm} -D CMAKE\_BUILD\_TYPE=Release }\textbackslash\\
798803
{\tt \hspace{2cm} -D MSVC\_LINK\_DYNAMIC\_RUNTIME=true} \textbackslash\\
804+
{\tt \hspace{2cm} -D QL\_ENABLE\_SESSIONS=ON} \textbackslash\\
799805
{\tt \hspace{2cm} -G Ninja ..} \\
800806
\medskip
801807
where the -G option allows choosing the desired build system generator.
@@ -942,53 +948,53 @@ \subsubsection*{Environment variables}
942948

943949
Set the following environment variables to the paths where the above items live on your machine, e.g:
944950

945-
{\tt set DEMO\_BOOST\_ROOT=C:{\bs}repos{\bs}boost{\bs}boost\_1\_81\_0} \\
946-
{\tt set DEMO\_BOOST\_LIB=C:{\bs}repos{\bs}boost{\bs}boost\_1\_81\_0{\bs}lib{\bs}x64{\bs}lib} \\
947-
{\tt set DEMO\_SWIG\_DIR=C:{\bs}repos{\bs}swigwin-4.1.1} \\
948-
{\tt set DEMO\_ORE\_DIR=C:{\bs}repos{\bs}ore } \\
949-
{\tt set DEMO\_ORE\_SWIG\_DIR=C:{\bs}repos{\bs}oreswig}
951+
{\tt set BOOST\_INC=C:{\bs}repos{\bs}boost{\bs}boost\_1\_81\_0} \\
952+
{\tt set BOOST\_LIB=C:{\bs}repos{\bs}boost{\bs}boost\_1\_81\_0{\bs}lib{\bs}x64{\bs}lib} \\
953+
{\tt set SWIG=C:{\bs}repos{\bs}swigwin-4.1.1} \\
954+
{\tt set ORE=C:{\bs}repos{\bs}ore } \\
955+
{\tt set ORESWIG=C:{\bs}repos{\bs}oreswig}
950956

951957
\subsubsection*{Build ORE}
952958

953959
Generate the project files:
954960

955961
\medskip
956-
{\tt cd \%DEMO\_ORE\_DIR\%} \\
962+
{\tt cd \%ORE\%} \\
957963
{\tt mkdir build }\\
958-
{\tt cd \%DEMO\_ORE\_DIR\%{\bs}build} \\
959-
{\tt set BOOST\_INCLUDEDIR=\%DEMO\_BOOST\_ROOT\%} \\
960-
{\tt set BOOST\_LIBRARYDIR=\%DEMO\_BOOST\_LIB\%} \\
961-
%{\tt "C:{\bs}Program Files{\bs}CMake{\bs}bin{\bs}cmake.exe" .. $\backslash$\\
964+
{\tt cd \%ORE\%{\bs}build} \\
962965
{\tt cmake .. $\backslash$\\
963966
\hspace{1cm} -DBoost\_NO\_WARN\_NEW\_VERSIONS=1 $\backslash$\\
964967
\hspace{1cm} -Wno-dev -G "Visual Studio 17 2022" $\backslash$ \\
965968
\hspace{1cm} -A x64 $\backslash$\\
966-
\hspace{1cm} -DMSVC\_LINK\_DYNAMIC\_RUNTIME=OFF}
969+
\hspace{1cm} -DMSVC\_LINK\_DYNAMIC\_RUNTIME=OFF $\backslash$ \\
970+
\hspace{1cm} -DBOOST\_ROOT=\$BOOST\_INC $\backslash$\\
971+
\hspace{1cm} -DBOOST\_LIBRARYDIR=\$BOOST\_LIB $\backslash$
972+
\hspace{2cm} -DQL\_ENABLE\_SESSIONS=ON}
967973

968974
\medskip
969-
This will create \%DEMO\_ORE\_DIR\%{\bs}build{\bs}ORE.sln
975+
This will create \%ORE\%{\bs}build{\bs}ORE.sln
970976

971977
\medskip
972978
Build:
973979

974980
\medskip
975-
{\tt cd \%DEMO\_ORE\_DIR\%{\bs}build} \\
981+
{\tt cd \%ORE\%{\bs}build} \\
976982
%{\tt "C:{\bs}Program Files{\bs}CMake{\bs}bin{\bs}cmake.exe" -{}-build . -{}-config Release}
977983
{\tt cmake -{}-build . -{}-config Release}
978984

979985
\medskip
980-
This will create \%DEMO\_ORE\_DIR\%{\bs}build{\bs}OREAnalytics{\bs}orea{\bs}Release{\bs}OREAnalytics-x64-mt.lib
986+
This will create \%ORE\%{\bs}build{\bs}OREAnalytics{\bs}orea{\bs}Release{\bs}OREAnalytics-x64-mt.lib
981987

982988
\subsubsection*{Build ORE-SWIG Wrapper and Wheel}
983989

984990
In contrast to the generic cmake-based SWIG build in section \ref{sec:oreswig}, we are now resorting to python's setup.py.
985991

986992
\medskip
987-
{\tt cd \%DEMO\_ORE\_SWIG\_DIR\%{\bs}OREAnalytics-SWIG{\bs}Python} \\
988-
{\tt set BOOST\_ROOT=\%DEMO\_BOOST\_ROOT\%} \\
989-
{\tt set BOOST\_LIB=\%DEMO\_BOOST\_LIB\%} \\
990-
{\tt set ORE\_DIR=\%DEMO\_ORE\_DIR\%} \\
991-
{\tt set PATH=\%PATH\%;\%DEMO\_SWIG\_DIR\%} \\
993+
{\tt cd \%ORESWIG\%{\bs}OREAnalytics-SWIG{\bs}Python} \\
994+
{\tt set BOOST\_ROOT=\%BOOST\_INC\%} \\
995+
% set BOOST_LIB is needed but already done above
996+
% set ORE needed but already done above
997+
{\tt set PATH=\%PATH\%;\%SWIG\%} \\
992998
{\tt set ORE\_STATIC\_RUNTIME=1} \\
993999
{\tt python setup.py wrap} \\
9941000
{\tt python setup.py build} \\
@@ -1001,7 +1007,7 @@ \subsubsection*{Build ORE-SWIG Wrapper and Wheel}
10011007
\item the Python module and static library in folder {\tt <PATH>{\bs}build{\bs}lib.win-amd64-cpython-310} (the directory name depends on the machine and python version)
10021008
\item the wheel file (filename.whl) in folder {\tt <PATH>{\bs}dist}
10031009
\end{itemize}
1004-
where {\tt <PATH>} stands for {\tt \%DEMO\_ORE\_SWIG\_DIR\%{\bs}OREAnalytics-SWIG{\bs}Python}.
1010+
where {\tt <PATH>} stands for {\tt \%ORESWIG\%{\bs}OREAnalytics-SWIG{\bs}Python}.
10051011

10061012
\medskip
10071013
To use the wrapper directly: \\
@@ -1040,22 +1046,24 @@ \subsubsection*{Prerequisites}
10401046

10411047
\subsubsection*{Environment variables}
10421048

1043-
Set the following environment variables to the paths where the above items live on your machine, e.g:
1049+
Set the following environment variables to the paths where the ore and ore swig repos, as well as boost live on your machine, e.g:
10441050

10451051
\medskip
1046-
{\tt export DEMO\_BOOST\_DIR=/home/username/quaternion/boost/install} \\
1047-
{\tt export DEMO\_ORE\_DIR=/home/username/quaternion/ore} \\
1048-
{\tt export DEMO\_ORE\_SWIG\_DIR=/home/username/quaternion/oreswig}
1052+
{\tt export ORE=$HOME/dev/ore} \\
1053+
{\tt export ORESWIG=$HOME/dev/oreswig}\\
1054+
{\tt export BOOST\_INC=/opt/homebrew/include} \\
1055+
{\tt export BOOST\_LIB=/opt/homebrew/lib}
10491056

10501057
\subsubsection*{Build ORE}
10511058

10521059
Use cmake to generate the project Makefiles
10531060

10541061
\medskip
1055-
{\tt cd \$DEMO\_ORE\_DIR} \\
1062+
{\tt cd \$ORE} \\
10561063
{\tt mkdir build} \\
1057-
{\tt cd \$DEMO\_ORE\_DIR/build} \\
1064+
{\tt cd \$ORE/build} \\
10581065
{\tt cmake .. \\
1066+
\hspace{1cm} -DQL\_ENABLE\_SESSIONS=ON $\backslash$\\
10591067
\hspace{1cm} -DCMAKE\_POSITION\_INDEPENDENT\_CODE=ON $\backslash$\\
10601068
\hspace{1cm} -DORE\_BUILD\_DOC=OFF $\backslash$ \\
10611069
\hspace{1cm} -DORE\_BUILD\_EXAMPLES=OFF $\backslash$ \\
@@ -1066,20 +1074,19 @@ \subsubsection*{Build ORE}
10661074
\hspace{1cm} -DQL\_BUILD\_TEST\_SUITE=OFF $\backslash$\\
10671075
\hspace{1cm} -DBoost\_NO\_WARN\_NEW\_VERSIONS=1 $\backslash$\\
10681076
\hspace{1cm} -DBoost\_NO\_SYSTEM\_PATHS=1 $\backslash$\\
1069-
\hspace{1cm} -DBOOST\_ROOT=\$DEMO\_BOOST\_DIR }
1070-
1071-
\medskip
1072-
This will generate \$DEMO\_ORE\_DIR/build/Makefile
1077+
\hspace{1cm} -DBOOST\_ROOT=\$BOOST\_INC $\backslash$\\
1078+
\hspace{1cm} -DBOOST\_LIBRARYDIR=\$BOOST\_LIB}
1079+
}
10731080

10741081
\medskip
10751082
Execute the following to kick off the build:
10761083

10771084
\medskip
1078-
{\tt cd \$DEMO\_ORE\_DIR/build} \\
1085+
{\tt cd \$ORE/build} \\
10791086
{\tt cmake -{}-build} .
10801087

10811088
\medskip
1082-
This will generate \$DEMO\_ORE\_DIR/build/OREAnalytics/orea/libOREAnalytics.so
1089+
This will generate \$ORE/build/OREAnalytics/orea/libOREAnalytics.so or .dylib
10831090

10841091
\subsubsection*{Build ORE-SWIG Wrapper and Wheel}
10851092

@@ -1090,26 +1097,28 @@ \subsubsection*{Build ORE-SWIG Wrapper and Wheel}
10901097
{\tt export BOOST\_THREAD=boost\_thread-mt} \\
10911098

10921099
\medskip
1093-
{\tt cd \$DEMO\_ORE\_SWIG\_DIR/OREAnalytics-SWIG/Python} \\
1094-
{\tt export ORE=\$DEMO\_ORE\_DIR} \\
1095-
{\tt export BOOST\_INC=\$DEMO\_BOOST\_DIR}/include} \\
1096-
{\tt export BOOST\_LIB=\$DEMO\_BOOST\_DIR}/lib} \\
1097-
{\tt python3 setup.py wrap} \\
1098-
{\tt python3 setup.py build} \\
1099-
{\tt python3 -m build -{}-wheel}
1100+
1101+
Ensure that environent variables ORE, BOOST\_INC and BOOST\_LIB are set (see above), then
11001102

11011103
\medskip
1102-
will then generate the wheel file (filename.whl) in folder \$DEMO\_ORE\_SWIG\_DIR/OREAnalytics-SWIG/Python/dist.
1104+
{\tt cd \$ORESWIG/OREAnalytics-SWIG/Python} \\
1105+
{\tt python setup.py wrap} \\
1106+
{\tt python setup.py build} \\
1107+
{\tt python -m build -{}-wheel}
1108+
1109+
\medskip
1110+
will then generate the wheel file (filename.whl) in folder \$ORESWIG/OREAnalytics-SWIG/Python/dist.
1111+
For the second step above you may need to modify the \$ORESWIG/OREAnalytics-SWIG/oreanalytics-config script to return the appropriate cflags and libs on your machine.
11031112

11041113
\medskip
11051114
To use the wheel:
11061115

11071116
\medskip
1108-
{\tt cd \$DEMO\_ORE\_SWIG\_DIR/OREAnalytics-SWIG/Python/Examples} \\
1109-
{\tt python3 -m venv env1} \\
1117+
{\tt cd \$ORESWIG/OREAnalytics-SWIG/Python/Examples} \\
1118+
{\tt python -m venv env1} \\
11101119
{\tt . ./env1/bin/activate} \\
1111-
{\tt pip install \$DEMO\_ORE\_SWIG\_DIR/OREAnalytics-SWIG/Python/dist/filename.whl} \\
1112-
{\tt python3 swap.py} \\
1120+
{\tt pip install \$ORESWIG/OREAnalytics-SWIG/Python/dist/filename.whl} \\
1121+
{\tt python commodityforward.py} \\
11131122
{\tt deactivate} \\
11141123
{\tt rm -rf env1}
11151124

OREAnalytics/orea/app/analytic.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ void PricingAnalyticImpl::runAnalytic(
452452
}
453453

454454
LOG("Sensi analysis - generate");
455-
sensiAnalysis->registerProgressIndicator(boost::make_shared<ProgressLog>("sensitivities"));
455+
sensiAnalysis->registerProgressIndicator(boost::make_shared<ProgressLog>("sensitivities", 100, ORE_NOTICE));
456456
sensiAnalysis->generateSensitivities();
457457

458458
LOG("Sensi analysis - write sensitivity report in memory");
@@ -837,7 +837,7 @@ void XvaAnalyticImpl::buildClassicCube(const boost::shared_ptr<Portfolio>& portf
837837
// set up progress indicators
838838

839839
auto progressBar = boost::make_shared<SimpleProgressBar>(o.str(), ConsoleLog::instance().width(), ConsoleLog::instance().progressBarWidth());
840-
auto progressLog = boost::make_shared<ProgressLog>("Building cube");
840+
auto progressLog = boost::make_shared<ProgressLog>("Building cube", 100, ORE_NOTICE);
841841

842842
if(inputs_->nThreads() == 1) {
843843

@@ -984,7 +984,7 @@ void XvaAnalyticImpl::amcRun(bool doClassicRun) {
984984
std::string message = "XVA: Build AMC Cube " + std::to_string(amcPortfolio_->size()) + " x " +
985985
std::to_string(grid_->valuationDates().size()) + " x " + std::to_string(samples_) + "... ";
986986
auto progressBar = boost::make_shared<SimpleProgressBar>(message, ConsoleLog::instance().width(), ConsoleLog::instance().progressBarWidth());
987-
auto progressLog = boost::make_shared<ProgressLog>("Building AMC Cube...");
987+
auto progressLog = boost::make_shared<ProgressLog>("Building AMC Cube...", 100, ORE_NOTICE);
988988

989989
if (inputs_->nThreads() == 1) {
990990
initCube(amcCube_, amcPortfolio_->ids(), cubeDepth_);

OREAnalytics/orea/app/analytic.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ class Analytic {
7373

7474
//! Constructors
7575
Analytic(){};
76-
Analytic(std::unique_ptr<Impl> impl,
76+
Analytic(//! Concrete implementation of the analytic
77+
std::unique_ptr<Impl> impl,
7778
//! The types of all (sub) analytics covered by this Analytic object
7879
//! e.g. NPV, CASHFLOW, CASHFLOWNPV, etc., covered by the PricingAnalytic
7980
const std::set<std::string>& analyticTypes,

OREAnalytics/orea/app/oreapp.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,12 @@ void OREApp::analytics() {
250250
LOG("ORE analytics done");
251251
}
252252

253-
OREApp::OREApp(boost::shared_ptr<Parameters> params, bool console, bool allowSpecialCharacters,
253+
OREApp::OREApp(boost::shared_ptr<Parameters> params, bool console,
254254
const boost::filesystem::path& logRootPath)
255255
: params_(params), inputs_(nullptr) {
256256

257257
if (console) {
258258
ConsoleLog::instance().switchOn();
259-
ConsoleLog::instance().setAllowSpecialCharacters(allowSpecialCharacters);
260259
}
261260

262261
string outputPath = params_->get("setup", "outputPath");
@@ -286,15 +285,14 @@ OREApp::OREApp(boost::shared_ptr<Parameters> params, bool console, bool allowSpe
286285
}
287286

288287
OREApp::OREApp(const boost::shared_ptr<InputParameters>& inputs, const std::string& logFile, Size logLevel,
289-
bool console, bool allowSpecialCharacters, const boost::filesystem::path& logRootPath)
288+
bool console, const boost::filesystem::path& logRootPath)
290289
: params_(nullptr), inputs_(inputs) {
291290

292291
// Initialise Singletons
293292
Settings::instance().evaluationDate() = inputs_->asof();
294293
InstrumentConventions::instance().setConventions(inputs_->conventions());
295294
if (console) {
296295
ConsoleLog::instance().switchOn();
297-
ConsoleLog::instance().setAllowSpecialCharacters(allowSpecialCharacters);
298296
}
299297

300298
setupLog(inputs_->resultsPath().string(), logFile, logLevel, logRootPath);

OREAnalytics/orea/app/oreapp.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ using namespace ore::data;
4040
class OREApp {
4141
public:
4242
//! Constructor that uses ORE parameters and input data from files
43-
OREApp(boost::shared_ptr<Parameters> params, bool console = false, bool allowSpecialCharacters = false,
43+
OREApp(boost::shared_ptr<Parameters> params, bool console = false,
4444
const boost::filesystem::path& = boost::filesystem::path());
4545
//! Constructor that assumes we have already assembled input parameters via API
4646
OREApp(const boost::shared_ptr<InputParameters>& inputs, const std::string& logFile, Size logLevel = 31,
47-
bool console = false, bool allowSpecialCharacters = false,
48-
const boost::filesystem::path& = boost::filesystem::path());
47+
bool console = false, const boost::filesystem::path& = boost::filesystem::path());
4948

5049
//! Destructor
5150
virtual ~OREApp();

OREData/ored/utilities/log.hpp

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,9 @@ class ConsoleLog : public QuantLib::Singleton<ConsoleLog, std::integral_constant
545545
friend class QuantLib::Singleton<ConsoleLog, std::integral_constant<bool, true>>;
546546
private:
547547
// may be empty but never uninitialised
548-
ConsoleLog() : enabled_(false), allowSpecialCharacters_(false), width_(50), progressBarWidth_(40) {}
548+
ConsoleLog() : enabled_(false), width_(50), progressBarWidth_(40) {}
549549

550550
bool enabled_;
551-
bool allowSpecialCharacters_;
552551
QuantLib::Size width_;
553552
QuantLib::Size progressBarWidth_;
554553
mutable boost::shared_mutex mutex_;
@@ -558,10 +557,6 @@ class ConsoleLog : public QuantLib::Singleton<ConsoleLog, std::integral_constant
558557
boost::shared_lock<boost::shared_mutex> lock(mutex());
559558
return enabled_;
560559
}
561-
bool allowSpecialCharacters() {
562-
boost::shared_lock<boost::shared_mutex> lock(mutex());
563-
return allowSpecialCharacters_;
564-
}
565560
QuantLib::Size width() {
566561
boost::shared_lock<boost::shared_mutex> lock(mutex_);
567562
return width_;
@@ -578,10 +573,6 @@ class ConsoleLog : public QuantLib::Singleton<ConsoleLog, std::integral_constant
578573
boost::unique_lock<boost::shared_mutex> lock(mutex_);
579574
enabled_ = false;
580575
}
581-
void setAllowSpecialCharacters(bool allowSpecialCharacters) {
582-
boost::unique_lock<boost::shared_mutex> lock(mutex_);
583-
allowSpecialCharacters_ = allowSpecialCharacters;
584-
}
585576
void setWidth(QuantLib::Size w) {
586577
boost::unique_lock<boost::shared_mutex> lock(mutex_);
587578
width_ = w;
@@ -600,15 +591,12 @@ class ConsoleLog : public QuantLib::Singleton<ConsoleLog, std::integral_constant
600591
Size w = ore::data::ConsoleLog::instance().width(); \
601592
std::ostringstream oss; \
602593
oss << text; \
603-
bool allowSpecialCharacters = ore::data::ConsoleLog::instance().allowSpecialCharacters(); \
594+
Size len = oss.str().length(); \
595+
Size wsLen = w > len ? w - len : 1; \
596+
oss << std::string(wsLen, ' '); \
604597
boost::unique_lock<boost::shared_mutex> lock(ore::data::ConsoleLog::instance().mutex()); \
605-
if (allowSpecialCharacters) \
606-
std::cout << setw(w) << left; \
607-
else \
608-
std::cout << " "; \
609598
std::cout << oss.str(); \
610-
if (allowSpecialCharacters) \
611-
std::cout << std::flush; \
599+
std::cout << std::flush; \
612600
} \
613601
}
614602

@@ -617,11 +605,9 @@ class ConsoleLog : public QuantLib::Singleton<ConsoleLog, std::integral_constant
617605
if (ore::data::ConsoleLog::instance().enabled()) { \
618606
std::ostringstream oss; \
619607
oss << text; \
620-
bool allowSpecialCharacters = ore::data::ConsoleLog::instance().allowSpecialCharacters(); \
621608
boost::unique_lock<boost::shared_mutex> lock(ore::data::ConsoleLog::instance().mutex()); \
622609
std::cout << oss.str() << "\n"; \
623-
if (allowSpecialCharacters) \
624-
std::cout << std::flush; \
610+
std::cout << std::flush; \
625611
} \
626612
}
627613

0 commit comments

Comments
 (0)