/usr/include/trilinos/Teuchos_FancyOStream.hpp is in libtrilinos-teuchos-dev 12.12.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 | // @HEADER
// ***********************************************************************
//
// Teuchos: Common Tools Package
// Copyright (2004) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
//
// ***********************************************************************
// @HEADER
#ifndef TEUCHOS_FANCY_O_STREAM_HPP
#define TEUCHOS_FANCY_O_STREAM_HPP
#include "Teuchos_RCP.hpp"
#include "Teuchos_GlobalMPISession.hpp"
#include "Teuchos_oblackholestream.hpp"
#include "Teuchos_as.hpp"
namespace Teuchos {
/** \brief Stream buffering class that performs the magic of indenting
* data sent to an std::ostream object.
*
* \ingroup teuchos_outputting_grp
*
* Note, this is not a user-level class. Users should use
* <tt>basic_FancyOStream</tt>.
*/
template<typename CharT, typename Traits>
class basic_FancyOStream_buf : public std::basic_streambuf<CharT,Traits>
{
public:
/** \brief . */
typedef CharT char_type;
/** \brief . */
typedef Traits traits_type;
/** \brief . */
typedef typename traits_type::int_type int_type;
/** \brief . */
typedef typename traits_type::pos_type pos_type;
/** \brief . */
typedef typename traits_type::off_type off_type;
/** \brief . */
basic_FancyOStream_buf(
const RCP<std::basic_ostream<char_type,traits_type> > &oStream
,const std::basic_string<char_type,traits_type> &tabIndentStr
,const int startingTab
,const bool showLinePrefix
,const int maxLenLinePrefix
,const bool showTabCount
,const bool showProcRank
);
/** \brief . */
void initialize(
const RCP<std::basic_ostream<char_type,traits_type> > &oStream
,const std::basic_string<char_type,traits_type> &tabIndentStr
,const int startingTab
,const bool showLinePrefix
,const int maxLenLinePrefix
,const bool showTabCount
,const bool showProcRank
);
/** \brief . */
RCP<std::basic_ostream<char_type,traits_type> > getOStream();
/** \brief . */
void setTabIndentStr(const std::basic_string<char_type,traits_type> &tabIndentStr);
/** \brief . */
const std::basic_string<char_type,traits_type>& getTabIndentStr() const;
/** \brief .*/
void setShowLinePrefix(const bool showLinePrefix);
/** \brief .*/
bool getShowLinePrefix() const;
/** \brief .*/
void setMaxLenLinePrefix(const int maxLenLinePrefix);
/** \brief .*/
int getMaxLenLinePrefix() const;
/** \brief . */
void setShowTabCount(const bool showTabCount);
/** \brief . */
bool getShowTabCount() const;
/** \brief . */
void setShowProcRank(const bool showProcRank);
/** \brief . */
bool getShowProcRank() const;
/// \brief Set the (MPI) process rank and the number of processes in the communicator.
///
/// \param procRank [in] The rank of the calling process.
/// \param numProcs [in] The number of processes in the communicator.
///
/// You must call this method before you may call setOutputToRootOnly().
void setProcRankAndSize( const int procRank, const int numProcs );
/// \brief Get the rank of the calling (MPI) process.
///
/// \pre The calling process rank and the number of processes in the
/// communicator were set via a call to setProcRankAndSize().
int getProcRank() const;
/// \brief Get the number of processes in the communicator.
///
/// \pre The calling process rank and the number of processes in the
/// communicator were set via a call to setProcRankAndSize().
int getNumProcs() const;
/// \brief Set the stream to print only on the (MPI) process with the given rank.
///
/// \pre The calling process rank and the number of processes in the
/// communicator were set via a call to setProcRankAndSize().
///
/// \param rootRank [in] The rank of the process on which to print.
/// The convention is to use Process 0 as the "root" process, but
/// this is not required.
///
/// \warning The effect of this method is currently irreversible.
/// This commits downstream users of this output stream to the
/// same assignment of ranks to processes. The result of calling
/// setProcRankAndSize() after this method has been called is
/// undefined. It will likely have no effect.
void setOutputToRootOnly( const int rootRank );
/** \brief . */
int getOutputToRootOnly() const;
/// \brief Push one or more tabs.
///
/// Users should generally not call this method directly. It is
/// better to use OSTab to automate the process. OSTab's
/// constructor calls pushTab() for you. It also calls popTab()
/// automatically on scope exit, whether the scope was exited
/// normally or by an exception throw. This "puts things back how
/// you found them."
void pushTab(const int tabs);
/** \brief . */
int getNumCurrTabs() const;
/// \brief Pop the current tab.
///
/// Users should generally not call this method directly. It is
/// better to use OSTab to automate the process. OSTab calls
/// popTab() automatically on scope exit, whether the scope was
/// exited normally or by an exception throw. This "puts things
/// back how you found them."
void popTab();
/** \brief . */
void pushLinePrefix(
const std::basic_string<char_type,traits_type> &linePrefix
);
/** \brief . */
void popLinePrefix();
/** \brief . */
const std::basic_string<char_type,traits_type>& getTopLinePrefix() const;
/** \brief . */
void pushDisableTabbing();
/** \brief . */
void popDisableTabbing();
protected:
//! @name Protected overridden functions from std::basic_streambuf
//@{
/** \brief . */
std::streamsize xsputn(const char_type* s, std::streamsize n);
/** \brief . */
int_type overflow(int_type c);
#ifdef TEUCHOS_FANCY_OSTREAM_SHOW_ALL_CALLS
void imbue(const locale& l)
{
std::cerr << "\ncalled imbue()\n";
std::basic_streambuf<CharT,Traits>::imbue(l);
}
basic_streambuf<char_type,Traits>*
setbuf(char_type* s, streamsize n)
{
std::cerr << "\ncalled setbuf()\n";
return std::basic_streambuf<CharT,Traits>::setbuf(s,n);
}
pos_type
seekoff(off_type a, ios_base::seekdir b,ios_base::openmode c)
{
std::cerr << "\ncalled seekoff()\n";
return std::basic_streambuf<CharT,Traits>::seekoff(a,b,c);
}
pos_type
seekpos(pos_type a, ios_base::openmode b)
{
std::cerr << "\ncalled seekpos()\n";
return std::basic_streambuf<CharT,Traits>::seekpos(a,b);
}
int
sync()
{
std::cerr << "\ncalled sync()\n";
return std::basic_streambuf<CharT,Traits>::sync();
}
streamsize
showmanyc()
{
std::cerr << "\ncalled showmanyc()\n";
return std::basic_streambuf<CharT,Traits>::showmanyc();
}
streamsize
xsgetn(char_type* s, streamsize n)
{
std::cerr << "\ncalled xsgetn()\n";
return std::basic_streambuf<CharT,Traits>::xsgetn(s,n);
}
int_type
underflow()
{
std::cerr << "\ncalled underflow()\n";
return std::basic_streambuf<CharT,Traits>::underflow();
}
int_type
uflow()
{
std::cerr << "\ncalled uflow()\n";
return std::basic_streambuf<CharT,Traits>::uflow();
}
int_type
pbackfail(int_type c = traits_type::eof())
{
std::cerr << "\ncalled pbackfail()\n";
return std::basic_streambuf<CharT,Traits>::pbackfail(c);
}
#endif // TEUCHOS_FANCY_OSTREAM_SHOW_ALL_CALLS
//@}
private:
// ////////////////////////
// Private types
typedef std::basic_string<char_type,traits_type> string_t;
typedef std::deque<int> tabIndentStack_t;
typedef std::deque<string_t> linePrefixStack_t;
// ////////////////////////
// Private data members
RCP<std::basic_ostream<char_type,traits_type> > oStreamSet_;
RCP<std::basic_ostream<char_type,traits_type> > oStream_;
std::basic_string<char_type,traits_type> tabIndentStr_;
bool showLinePrefix_;
int maxLenLinePrefix_;
bool showTabCount_;
bool showProcRank_;
int rootRank_;
int procRank_;
int numProcs_;
int rankPrintWidth_;
RCP<std::ostringstream> lineOut_;
int tabIndent_;
tabIndentStack_t tabIndentStack_;
linePrefixStack_t linePrefixStack_;
int enableTabbingStack_;
bool wroteNewline_;
// ////////////////////////
// Private member functions
std::ostream& out();
void writeChars( const char_type s[], std::streamsize n );
void writeFrontMatter();
// Not defined and not to be called
basic_FancyOStream_buf();
basic_FancyOStream_buf(const basic_FancyOStream_buf<CharT,Traits>&);
basic_FancyOStream_buf<CharT,Traits> operator=(
const basic_FancyOStream_buf<CharT,Traits>&
);
};
/** \brief std::ostream subclass that performs the magic of indenting data
* sent to an std::ostream object among other things.
*
* Use the typedef <tt>FancyOStream</tt> for support for the <tt>char</tt>
* character type.
*
* Indentation of the stream is accomplished through creating
* <tt>basic_OSTab</tt> objects (i.e. typedef <tt>OSTab</tt>). For example,
* when accepting a <tt>FancyOStream</tt> object, one might indent it like:
*
\code
void someFunc(FancyOStream &out)
{
OSTab(out);
out << "This is indented!\n";
...
}
\endcode
*
* In addition to indenting output, this stream object can also print various
* types of information at the beginning of each line. The type of information
* supported is:
* <ul>
* <li> (MPI) process rank: Set using <tt>setShowProcRank()</tt>.
* <li> Line prefix name: Set using <tt>showLinePrefix()</tt> and <tt>OSTab::OSTab()</tt>.
* <li> Tab counts (useful for debugging): Set using <tt>setShowTabCount()</tt>.
* </ul>
*
* See <tt>FancyOutputting_test.cpp</tt> for examples of how this class is
* used and the output it generates.
*/
template <typename CharT, typename Traits = std::char_traits<CharT> >
class basic_FancyOStream : public std::basic_ostream<CharT, Traits>
{
public:
//! @name Public types
//@{
/** \brief . */
typedef CharT char_type;
/** \brief . */
typedef Traits traits_type;
/** \brief . */
typedef typename traits_type::int_type int_type;
/** \brief . */
typedef typename traits_type::pos_type pos_type;
/** \brief . */
typedef typename traits_type::off_type off_type;
/** \brief . */
/** \brief . */
typedef basic_FancyOStream_buf<CharT,Traits> streambuf_t;
/** \brief . */
typedef std::basic_ostream<char_type, traits_type> ostream_t;
//@}
//! @name Public client functions
//@{
/// \brief Constructor.
///
/// \param oStream [in/out] Output stream to wrap.
/// \param tabIndentStr [in] String to use as a prefix for each tab
/// level. Default is a single space (per tab level).
/// \param startingTab [in] Starting tab level. Default is 0.
/// \param showLinePrefix [in] Whether to show the line prefix.
/// (This does not include the tab indent string. Tabs will
/// indent regardless.)
/// \param maxLenLinePrefix [in] Maximum number of characters in the
/// line prefix. (This does not include the tab indent string.)
/// \param showTabCount [in] Whether to show the tab count in front
/// of each line of text.
/// \param showProcRank [in] Whether to print the rank of the
/// calling (MPI) process in front of each line of text. If you
/// set this to true, you <i>must</i> call setProcRankAndSize()
/// before printing to this output stream, or the process rank
/// will not be defined.
///
/// The following things are called "front matter":
/// - Rank of the calling (MPI) process
/// - Line prefix
/// - Tab count
///
/// This object may print any or all of these things in front of
/// each line. (Delimit each line by using <tt>std::endl</tt>, not
/// with "\n". The latter is not portable in any case!) You may
/// control which of these get printed by the corresponding Boolean
/// argument of this constructor.
explicit
basic_FancyOStream(
const RCP< std::basic_ostream<char_type,traits_type> > &oStream
,const std::basic_string<char_type,traits_type> &tabIndentStr = " "
,const int startingTab = 0
,const bool showLinePrefix = false
,const int maxLenLinePrefix = 10
,const bool showTabCount = false
,const bool showProcRank = false
);
/// \brief Initialize the output stream.
///
/// This takes the same arguments as the constructor.
void initialize(
const RCP< std::basic_ostream<char_type,traits_type> > &oStream
,const std::basic_string<char_type,traits_type> &tabIndentStr = " "
,const int startingTab = 0
,const bool showLinePrefix = false
,const int maxLenLinePrefix = 10
,const bool showTabCount = false
,const bool showProcRank = false
);
//! Get the output stream this object wraps.
RCP<std::basic_ostream<char_type,traits_type> > getOStream();
//! Set the tab indent string.
basic_FancyOStream& setTabIndentStr(
const std::basic_string<char_type,traits_type> &tabIndentStr
);
//! Get the tab indent string.
const std::basic_string<char_type,traits_type>& getTabIndentStr() const;
/// \brief Control whether this stream prints "front matter."
///
/// "Front matter" includes the following things:
/// - Rank of the calling (MPI) process
/// - Line prefix
/// - Tab count
///
/// This object may print any or all of these things in front of
/// each line. (Delimit each line by using <tt>std::endl</tt>, not
/// with "\n". The latter is not portable in any case!) You may
/// control <i>individually</i> which of these get printed by the
/// corresponding Boolean argument of this object's constructor.
/// You may also call this method to turn on or off printing of
/// <i>all</i> front matter.
basic_FancyOStream& setShowAllFrontMatter(const bool showAllFrontMatter);
/** \brief .*/
basic_FancyOStream& setShowLinePrefix(const bool showLinePrefix);
/** \brief .*/
basic_FancyOStream& setMaxLenLinePrefix(const int maxLenLinePrefix);
/** \brief . */
basic_FancyOStream& setShowTabCount(const bool showTabCount);
/** \brief . */
basic_FancyOStream& setShowProcRank(const bool showProcRank);
/// \brief Set the (MPI) process rank and the number of processes in the communicator.
///
/// \param procRank [in] The rank of the calling process.
/// \param numProcs [in] The number of processes in the communicator.
///
/// You must call this method before you may call setOutputToRootOnly().
basic_FancyOStream& setProcRankAndSize( const int procRank, const int numProcs );
/// \brief Set the stream to print only on the (MPI) process with the given rank.
///
/// \pre The calling process rank and the number of processes in the
/// communicator were set via a call to setProcRankAndSize().
///
/// \param rootRank [in] The rank of the process on which to print.
/// The convention is to use Process 0 as the "root" process, but
/// this is not required.
///
/// \warning The effect of this method is currently irreversible.
/// This commits downstream users of this output stream to the
/// same assignment of ranks to processes. The result of calling
/// setProcRankAndSize() after this method has been called is
/// undefined. It will likely have no effect.
basic_FancyOStream& setOutputToRootOnly( const int rootRank );
/** \brief . */
int getOutputToRootOnly() const;
/** \brief . */
void copyAllOutputOptions(const basic_FancyOStream<CharT,Traits> &oStream);
//@}
//! @name Functions designed to be used by basic_OSTab
//@{
/// \brief Push one or more tabs.
///
/// Users should generally not call this method directly. It is
/// better to use OSTab to automate the process. OSTab's
/// constructor calls pushTab() for you. It also calls popTab()
/// automatically on scope exit, whether the scope was exited
/// normally or by an exception throw. This "puts things back how
/// you found them."
void pushTab(const int tabs = 1);
/** \brief . */
int getNumCurrTabs() const;
/// \brief Pop the current tab.
///
/// Users should generally not call this method directly. It is
/// better to use OSTab to automate the process. OSTab calls
/// popTab() automatically on scope exit, whether the scope was
/// exited normally or by an exception throw. This "puts things
/// back how you found them."
void popTab();
/** \brief . */
void pushLinePrefix(const std::basic_string<char_type,traits_type> &linePrefix);
/** \brief . */
void popLinePrefix();
/** \brief . */
const std::basic_string<char_type,traits_type>& getTopLinePrefix() const;
/** \brief . */
void pushDisableTabbing();
/** \brief . */
void popDisableTabbing();
//@}
private:
streambuf_t streambuf_;
// Not defined and not to be called
basic_FancyOStream();
basic_FancyOStream(const basic_FancyOStream<CharT,Traits>&);
basic_FancyOStream<CharT,Traits> operator=(const basic_FancyOStream<CharT,Traits>&);
};
/** \brief Dynamically allocate a FancyOStream and return it wrapped in an RCP
* object.
*
* Returns a <tt>null</tt> object if the input stream is null.
*
* \relates basic_FancyOStream
*/
inline
RCP<basic_FancyOStream<char> >
fancyOStream(
const RCP< std::basic_ostream<char> >& oStream,
const std::basic_string<char>& tabIndentStr = " ",
const int startingTab = 0,
const bool showLinePrefix = false,
const int maxLenLinePrefix = 10,
const bool showTabCount = false,
const bool showProcRank = false
)
{
if (nonnull(oStream)) {
return rcp(
new basic_FancyOStream<char>(
oStream,tabIndentStr,startingTab,showLinePrefix,
maxLenLinePrefix,showTabCount,showProcRank
)
);
}
return null;
}
/** \brief Get a FancyOStream from an std::ostream object.
*
* If the object already is a FancyOStream, then nothing has to be done.
* Otherwise, a temp FancyOStream is created for this purpose. If
* <tt>out.get()==NULL</tt> then <tt>return.get()==NULL</tt> on return also!
*
* \relates basic_FancyOStream
*/
inline
RCP<basic_FancyOStream<char> >
getFancyOStream( const RCP<std::basic_ostream<char> > &out )
{
if (is_null(out))
return Teuchos::null;
RCP<basic_FancyOStream<char> >
fancyOut = rcp_dynamic_cast<basic_FancyOStream<char> >(out);
if(nonnull(fancyOut))
return fancyOut;
return rcp(new basic_FancyOStream<char>(out));
}
/** \brief Tabbing class for helping to create formated, indented output for a
* <tt>basic_FancyOStream</tt> object.
*
* Use the typedef <tt>OSStream</tt> for support for the <tt>char</tt>
* character type.
*
* This class is used to create tab indents and set line prefix names for
* output that is generated by a <tt>basic_FancyOStream</tt> object.
*
* \relates basic_FancyOStream
*/
template <typename CharT, typename Traits = std::char_traits<CharT> >
class basic_OSTab
{
public:
/** \brief . */
static const int DISABLE_TABBING = -99999; // This magic number should be just fine!
/** \brief. */
basic_OSTab(
const RCP<basic_FancyOStream<CharT,Traits> > &fancyOStream
,const int tabs = 1
,const std::basic_string<CharT,Traits> linePrefix = ""
)
:fancyOStream_(fancyOStream)
,tabs_(tabs)
,linePrefix_(linePrefix)
{
updateState();
}
/** \brief. */
basic_OSTab(
const RCP<std::basic_ostream<CharT,Traits> > &oStream
,const int tabs = 1
,const std::basic_string<CharT,Traits> linePrefix = ""
)
:fancyOStream_(getFancyOStream(oStream))
,tabs_(tabs)
,linePrefix_(linePrefix)
{
updateState();
}
/** \brief Warning: Only call this constructor for stack-based object. */
basic_OSTab(
basic_FancyOStream<CharT,Traits> &fancyOStream
,const int tabs = 1
,const std::basic_string<CharT,Traits> linePrefix = ""
)
:fancyOStream_(rcp(&fancyOStream,false))
,tabs_(tabs)
,linePrefix_(linePrefix)
{
updateState();
}
/** \brief Warning: Only call this constructor for stack-based object. */
basic_OSTab(
std::basic_ostream<CharT,Traits> &oStream
,const int tabs = 1
,const std::basic_string<CharT,Traits> linePrefix = ""
)
:fancyOStream_(getFancyOStream(rcp(&oStream, false)))
,tabs_(tabs)
,linePrefix_(linePrefix)
{
updateState();
}
/** \brief. */
basic_OSTab( const basic_OSTab &osTab )
:fancyOStream_(osTab.fancyOStream_)
,tabs_(osTab.tabs_)
{
updateState();
}
/** \brief. */
~basic_OSTab()
{
if(fancyOStream_.get()) {
if(tabs_==DISABLE_TABBING)
fancyOStream_->popDisableTabbing();
else
fancyOStream_->popTab();
if(linePrefix_.length()) fancyOStream_->popLinePrefix();
}
}
/** \brief. */
basic_OSTab<CharT,Traits>& operator=( const basic_OSTab &osTab )
{
fancyOStream_ = osTab.fancyOStream_;
tabs_ = osTab.tabs_;
updateState();
return *this;
}
/** \brief. */
basic_OSTab<CharT,Traits>& incrTab(const int tabs = 1)
{
tabs_ += tabs;
if(fancyOStream_.get()) {
fancyOStream_->popTab();
fancyOStream_->pushTab(tabs_);
}
return *this;
}
/** \brief. */
basic_FancyOStream<CharT,Traits>& o() const
{
return *fancyOStream_;
}
/** \brief. */
basic_FancyOStream<CharT,Traits>* get() const
{
return fancyOStream_.get();
}
private:
RCP<basic_FancyOStream<CharT,Traits> > fancyOStream_;
int tabs_;
std::basic_string<CharT,Traits> linePrefix_;
void updateState()
{
if(fancyOStream_.get()) {
if(tabs_==DISABLE_TABBING)
fancyOStream_->pushDisableTabbing();
else
fancyOStream_->pushTab(tabs_);
if(linePrefix_.length()) fancyOStream_->pushLinePrefix(linePrefix_);
}
}
};
/** \brief Create a tab for an RCP-wrapped <tt>basic_FancyOStream</tt> object
* to cause the indentation of all output automatically!.
*
* This function returns an RCP object to a <tt>basic_FancyOStream</tt> object
* that has its tab indented by one. If the input <tt>*out</tt> object is
* already a <tt>%basic_FancyOStream</tt> object, then that object is used as
* is. If the <tt>*out</tt> object is not a <tt>%basic_FancyOStream</tt>
* object, then a new <tt>%basic_FancyOStream</tt> object is created and its
* tab is set!"
*
* In any case, when the returned RCP object is destroyed, the tab will be
* removed automatically!
*
* \relates basic_FancyOStream
*/
template <typename CharT, typename Traits>
RCP<basic_FancyOStream<CharT,Traits> >
tab(
const RCP<basic_FancyOStream<CharT,Traits> > &out,
const int tabs = 1,
const std::basic_string<CharT,Traits> linePrefix = ""
)
{
if(out.get()==NULL)
return Teuchos::null;
RCP<basic_FancyOStream<CharT,Traits> > fancyOut = out;
set_extra_data(
rcp(new basic_OSTab<CharT,Traits>(out,tabs,linePrefix)),
"OSTab",
inOutArg(fancyOut),
PRE_DESTROY,
false
);
return fancyOut;
}
/** \brief Create a tab for an RCP-wrapped <tt>std:: std::ostream</tt> object
* to cause the indentation of all output automatically!.
*
* This function returns an RCP object to a <tt>basic_FancyOStream</tt> object
* that has its tab indented by one. If the input <tt>*out</tt> object is
* already a <tt>%basic_FancyOStream</tt> object, then that object is used as
* is. If the <tt>*out</tt> object is not a <tt>%basic_FancyOStream</tt>
* object, then a new <tt>%basic_FancyOStream</tt> object is created and its
* tab is set!"
*
* In any case, when the returned RCP object is destroyed, the tab will be
* removed automatically!
*
* \relates basic_FancyOStream
*/
template <typename CharT, typename Traits>
RCP<basic_FancyOStream<CharT,Traits> >
tab(
const RCP<std::basic_ostream<CharT,Traits> > &out
,const int tabs = 1
,const std::basic_string<CharT,Traits> linePrefix = ""
)
{
return tab(getFancyOStream(out),tabs,linePrefix);
}
// ///////////////////////////////
// Typedefs
/** \brief .
* \ingroup teuchos_outputting_grp
*/
typedef basic_FancyOStream<char> FancyOStream;
/** \brief .
* \ingroup teuchos_outputting_grp
*/
typedef basic_OSTab<char> OSTab;
/** \brief .
* \ingroup teuchos_outputting_grp
*/
#define TEUCHOS_OSTAB ::Teuchos::OSTab __localThisTab = this->getOSTab()
/** \brief .
* \ingroup teuchos_outputting_grp
*/
#define TEUCHOS_OSTAB_DIFF( DIFF ) ::Teuchos::OSTab DIFF ## __localThisTab = this->getOSTab()
// ////////////////////////////////
// Defintions
//
// basic_FancyOStream_buf
//
template<typename CharT, typename Traits>
basic_FancyOStream_buf<CharT,Traits>::basic_FancyOStream_buf(
const RCP<std::basic_ostream<char_type,traits_type> > &oStream
,const std::basic_string<char_type,traits_type> &tabIndentStr
,const int startingTab
,const bool showLinePrefix
,const int maxLenLinePrefix
,const bool showTabCount
,const bool showProcRank
)
{
this->initialize(oStream,tabIndentStr,startingTab,showLinePrefix,
maxLenLinePrefix,showTabCount,showProcRank);
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::initialize(
const RCP<std::basic_ostream<char_type,traits_type> > &oStream
,const std::basic_string<char_type,traits_type> &tabIndentStr
,const int startingTab
,const bool showLinePrefix
,const int maxLenLinePrefix
,const bool showTabCount
,const bool showProcRank
)
{
oStreamSet_ = oStream;
oStream_ = oStream;
tabIndentStr_ = tabIndentStr;
showLinePrefix_ = showLinePrefix;
maxLenLinePrefix_ = maxLenLinePrefix;
showTabCount_ = showTabCount;
showProcRank_ = showProcRank;
rootRank_ = -1;
procRank_ = GlobalMPISession::getRank();
numProcs_ = GlobalMPISession::getNProc();
rankPrintWidth_ = int(std::log10(float(numProcs_)))+1;
tabIndent_ = startingTab;
tabIndentStack_.clear();
linePrefixStack_.clear();
wroteNewline_ = true;
enableTabbingStack_ = 0;
}
template<typename CharT, typename Traits>
RCP<std::basic_ostream<CharT,Traits> >
basic_FancyOStream_buf<CharT,Traits>::getOStream()
{
return oStreamSet_;
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::setTabIndentStr(
const std::basic_string<char_type,traits_type> &tabIndentStr
)
{
tabIndentStr_ = tabIndentStr;
}
template<typename CharT, typename Traits>
const std::basic_string<CharT,Traits>&
basic_FancyOStream_buf<CharT,Traits>::getTabIndentStr() const
{
return tabIndentStr_;
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::setShowLinePrefix(const bool showLinePrefix)
{
showLinePrefix_ = showLinePrefix;
}
template<typename CharT, typename Traits>
bool basic_FancyOStream_buf<CharT,Traits>::getShowLinePrefix() const
{
return showLinePrefix_;
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::setMaxLenLinePrefix(const int maxLenLinePrefix)
{
TEUCHOS_TEST_FOR_EXCEPT( !(maxLenLinePrefix>=5) );
maxLenLinePrefix_ = maxLenLinePrefix;
}
template<typename CharT, typename Traits>
int basic_FancyOStream_buf<CharT,Traits>::getMaxLenLinePrefix() const
{
return maxLenLinePrefix_;
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::setShowTabCount(const bool showTabCount)
{
showTabCount_ = showTabCount;
}
template<typename CharT, typename Traits>
bool basic_FancyOStream_buf<CharT,Traits>::getShowTabCount() const
{
return showTabCount_;
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::setShowProcRank(const bool showProcRank)
{
showProcRank_ = showProcRank;
}
template<typename CharT, typename Traits>
bool basic_FancyOStream_buf<CharT,Traits>::getShowProcRank() const
{
return showProcRank_;
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::setProcRankAndSize(
const int procRank, const int numProcs
)
{
procRank_ = procRank;
numProcs_ = numProcs;
}
template<typename CharT, typename Traits>
int basic_FancyOStream_buf<CharT,Traits>::getProcRank() const
{
return procRank_;
}
template<typename CharT, typename Traits>
int basic_FancyOStream_buf<CharT,Traits>::getNumProcs() const
{
return numProcs_;
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::setOutputToRootOnly(
const int rootRank
)
{
rootRank_ = rootRank;
if(rootRank >= 0) {
if(rootRank == procRank_)
oStream_ = oStreamSet_;
else
oStream_ = rcp(new oblackholestream());
// Only processor is being output to so there is no need for line
// batching!
lineOut_ = null;
}
else {
oStream_ = oStreamSet_;
// Output is being sent to all processors so we need line batching to
// insure that each line will be printed all together!
lineOut_ = rcp(new std::ostringstream());
}
}
template<typename CharT, typename Traits>
int basic_FancyOStream_buf<CharT,Traits>::getOutputToRootOnly() const
{
return rootRank_;
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::pushTab(const int tabs)
{
if( tabIndent_ + tabs < 0 ) {
tabIndentStack_.push_back(-tabIndent_);
tabIndent_ = 0;
}
else {
tabIndentStack_.push_back(tabs);
tabIndent_ += tabs;
}
}
template<typename CharT, typename Traits>
int basic_FancyOStream_buf<CharT,Traits>::getNumCurrTabs() const
{
return tabIndent_;
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::popTab()
{
tabIndent_ -= tabIndentStack_.back();
tabIndentStack_.pop_back();
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::pushLinePrefix(
const std::basic_string<char_type,traits_type> &linePrefix
)
{
linePrefixStack_.push_back(linePrefix);
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::popLinePrefix()
{
linePrefixStack_.pop_back();
}
template<typename CharT, typename Traits>
const std::basic_string<CharT,Traits>&
basic_FancyOStream_buf<CharT,Traits>::getTopLinePrefix() const
{
return linePrefixStack_.back();
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::pushDisableTabbing()
{
++enableTabbingStack_;
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::popDisableTabbing()
{
--enableTabbingStack_;
}
// protected
template<typename CharT, typename Traits>
std::streamsize basic_FancyOStream_buf<CharT,Traits>::xsputn(
const char_type* s, std::streamsize n
)
{
#ifdef TEUCHOS_FANCY_OSTREAM_SHOW_ALL_CALLS
std::cerr << "\ncalled xsputn()\n";
#endif
writeChars(s,n);
return n;
}
template<typename CharT, typename Traits>
typename basic_FancyOStream_buf<CharT,Traits>::int_type
basic_FancyOStream_buf<CharT,Traits>::overflow(int_type c)
{
#ifdef TEUCHOS_FANCY_OSTREAM_SHOW_ALL_CALLS
std::cerr << "\ncalled overflow()\n";
#endif
if(c != traits_type::eof()) {
const char_type cc[] = { traits_type::to_char_type(c) };
this->writeChars(cc,1);
}
return traits_type::not_eof(c);
//return std::basic_streambuf<CharT,Traits>::overflow(c);
}
// private
template<typename CharT, typename Traits>
std::ostream& basic_FancyOStream_buf<CharT,Traits>::out()
{
if(lineOut_.get())
return *lineOut_;
return *oStream_;
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::writeChars(
const char_type s[], std::streamsize n
)
{
if(n == 0) return;
std::streamsize p = 0, first_p = 0;
bool done_outputting = false;
const char_type newline = '\n';
while( !done_outputting ) {
// Find the next newline
for( p = first_p; p < n; ++p ) {
if(s[p] == newline) {
break;
}
}
if(p == n) {
// We did not find a newline at the end!
--p;
done_outputting = true;
}
else if( p == n-1 && s[p] == newline ) {
// The last character in the std::string is a newline
done_outputting = true;
}
// Write the beginning of the line if we need to
if(wroteNewline_) {
writeFrontMatter();
wroteNewline_ = false;
}
// Write up to the newline or the end of the std::string
out().write(s+first_p,p-first_p+1);
if(s[p] == newline) {
wroteNewline_ = true;
if(lineOut_.get()) {
*oStream_ << lineOut_->str() << std::flush;
lineOut_->str("");
}
}
// Update for next search
if(!done_outputting)
first_p = p+1;
}
}
template<typename CharT, typename Traits>
void basic_FancyOStream_buf<CharT,Traits>::writeFrontMatter()
{
bool didOutput = false;
std::ostream &o = this->out();
if(showProcRank_) {
o << "p=" << std::right << std::setw(rankPrintWidth_) << procRank_;
didOutput = true;
}
if(showLinePrefix_) {
if(didOutput)
o << ", ";
std::string currLinePrefix = "";
if ( linePrefixStack_.size() )
currLinePrefix = this->getTopLinePrefix();
const int localMaxLenLinePrefix =
TEUCHOS_MAX( as<int>(currLinePrefix.length()), maxLenLinePrefix_ );
o << std::left << std::setw(localMaxLenLinePrefix);
o << currLinePrefix;
didOutput = true;
}
if(showTabCount_) {
if(didOutput)
o << ", ";
o << "tabs=" << std::right << std::setw(2) << tabIndent_;
didOutput = true;
}
// ToDo: Add the Prefix name if asked
// ToDo: Add the processor number if asked
// ToDo: Add the number of indents if asked
if(didOutput) {
o << " |" << tabIndentStr_;
}
if(enableTabbingStack_==0) {
for( int i = 0; i < tabIndent_; ++i )
o << tabIndentStr_;
}
}
//
// basic_FancyOStream
//
template<typename CharT, typename Traits>
basic_FancyOStream<CharT,Traits>::basic_FancyOStream(
const RCP< std::basic_ostream<char_type,traits_type> > &oStream
,const std::basic_string<char_type,traits_type> &tabIndentStr
,const int startingTab
,const bool showLinePrefix
,const int maxLenLinePrefix
,const bool showTabCount
,const bool showProcRank
)
:ostream_t(NULL),
streambuf_(oStream,tabIndentStr,startingTab,showLinePrefix,
maxLenLinePrefix,showTabCount,showProcRank)
{
this->init(&streambuf_);
}
template<typename CharT, typename Traits>
void basic_FancyOStream<CharT,Traits>::initialize(
const RCP< std::basic_ostream<char_type,traits_type> > &oStream
,const std::basic_string<char_type,traits_type> &tabIndentStr
,const int startingTab
,const bool showLinePrefix
,const int maxLenLinePrefix
,const bool showTabCount
,const bool showProcRank
)
{
streambuf_.initialize(oStream,tabIndentStr,startingTab,
showLinePrefix,maxLenLinePrefix,showTabCount,showProcRank);
this->init(&streambuf_);
}
template<typename CharT, typename Traits>
RCP<std::basic_ostream<CharT,Traits> >
basic_FancyOStream<CharT,Traits>::getOStream()
{
return streambuf_.getOStream();
}
template<typename CharT, typename Traits>
basic_FancyOStream<CharT,Traits>&
basic_FancyOStream<CharT,Traits>::setTabIndentStr(
const std::basic_string<char_type,traits_type> &tabIndentStr
)
{
streambuf_.setTabIndentStr(tabIndentStr);
return *this;
}
template<typename CharT, typename Traits>
const std::basic_string<CharT,Traits>&
basic_FancyOStream<CharT,Traits>::getTabIndentStr() const
{
return streambuf_.getTabIndentStr();
}
template<typename CharT, typename Traits>
basic_FancyOStream<CharT,Traits>&
basic_FancyOStream<CharT,Traits>::setShowAllFrontMatter(
const bool showAllFrontMatter
)
{
streambuf_.setShowLinePrefix(showAllFrontMatter);
streambuf_.setShowTabCount(showAllFrontMatter);
streambuf_.setShowProcRank(showAllFrontMatter);
return *this;
}
template<typename CharT, typename Traits>
basic_FancyOStream<CharT,Traits>&
basic_FancyOStream<CharT,Traits>::setShowLinePrefix(const bool showLinePrefix)
{
streambuf_.setShowLinePrefix(showLinePrefix);
return *this;
}
template<typename CharT, typename Traits>
basic_FancyOStream<CharT,Traits>&
basic_FancyOStream<CharT,Traits>::setMaxLenLinePrefix(const int maxLenLinePrefix)
{
streambuf_.setMaxLenLinePrefix(maxLenLinePrefix);
return *this;
}
template<typename CharT, typename Traits>
basic_FancyOStream<CharT,Traits>&
basic_FancyOStream<CharT,Traits>::setShowTabCount(const bool showTabCount)
{
streambuf_.setShowTabCount(showTabCount);
return *this;
}
template<typename CharT, typename Traits>
basic_FancyOStream<CharT,Traits>&
basic_FancyOStream<CharT,Traits>::setShowProcRank(const bool showProcRank)
{
streambuf_.setShowProcRank(showProcRank);
return *this;
}
template<typename CharT, typename Traits>
basic_FancyOStream<CharT,Traits>&
basic_FancyOStream<CharT,Traits>::setProcRankAndSize( const int procRank, const int numProcs )
{
streambuf_.setProcRankAndSize(procRank,numProcs);
return *this;
}
template<typename CharT, typename Traits>
basic_FancyOStream<CharT,Traits>&
basic_FancyOStream<CharT,Traits>::setOutputToRootOnly( const int rootRank )
{
streambuf_.setOutputToRootOnly(rootRank);
return *this;
}
template<typename CharT, typename Traits>
int basic_FancyOStream<CharT,Traits>::getOutputToRootOnly() const
{
return streambuf_.getOutputToRootOnly();
}
template<typename CharT, typename Traits>
void basic_FancyOStream<CharT,Traits>::copyAllOutputOptions(
const basic_FancyOStream<CharT,Traits> &oStream )
{
//streambuf_.setTabIndentStr(oStream.streambuf_.getTabIndentStr());
streambuf_.setShowLinePrefix(oStream.streambuf_.getShowLinePrefix());
streambuf_.setMaxLenLinePrefix(oStream.streambuf_.getMaxLenLinePrefix());
streambuf_.setShowTabCount(oStream.streambuf_.getShowTabCount());
streambuf_.setShowProcRank(oStream.streambuf_.getShowProcRank());
streambuf_.setProcRankAndSize(oStream.streambuf_.getProcRank(),
oStream.streambuf_.getNumProcs());
streambuf_.setOutputToRootOnly(oStream.streambuf_.getOutputToRootOnly());
}
template<typename CharT, typename Traits>
void basic_FancyOStream<CharT,Traits>::pushTab(const int tabs)
{
streambuf_.pushTab(tabs);
}
template<typename CharT, typename Traits>
int basic_FancyOStream<CharT,Traits>::getNumCurrTabs() const
{
return streambuf_.getNumCurrTabs();
}
template<typename CharT, typename Traits>
void basic_FancyOStream<CharT,Traits>::popTab()
{
streambuf_.popTab();
}
template<typename CharT, typename Traits>
void basic_FancyOStream<CharT,Traits>::pushLinePrefix(
const std::basic_string<char_type,traits_type> &linePrefix
)
{
streambuf_.pushLinePrefix(linePrefix);
}
template<typename CharT, typename Traits>
void basic_FancyOStream<CharT,Traits>::popLinePrefix()
{
streambuf_.popLinePrefix();
}
template<typename CharT, typename Traits>
const std::basic_string<CharT,Traits>&
basic_FancyOStream<CharT,Traits>::getTopLinePrefix() const
{
return streambuf_.getTopLinePrefix();
}
template<typename CharT, typename Traits>
void basic_FancyOStream<CharT,Traits>::pushDisableTabbing()
{
streambuf_.pushDisableTabbing();
}
template<typename CharT, typename Traits>
void basic_FancyOStream<CharT,Traits>::popDisableTabbing()
{
return streambuf_.popDisableTabbing();
}
} // namespace Teuchos
#endif // TEUCHOS_FANCY_O_STREAM_HPP
|