9 #ifndef STK_UTIL_DIAG_WRITEREXT_HPP 10 #define STK_UTIL_DIAG_WRITEREXT_HPP 22 #include <stk_util/stk_config.h> 26 #include <stk_util/diag/Writer.hpp> 30 #include <stk_util/diag/StringUtil.hpp> 32 #include <stk_util/util/FeatureTest.hpp> 34 #include <stk_util/util/FArrayPrint.hpp> 35 #include <stk_util/parallel/MPI.hpp> 36 #include <stk_util/diag/Mapv.hpp> 37 #include <stk_util/diag/Option.hpp> 60 Writer &
operator<<(Writer &dout,
const std::type_info &t);
74 Writer &operator<<(Writer &dout, const std::auto_ptr<T> &t) {
76 dout <<
" " <<
typeid(t) <<
", " << t.get() <<
", " << *t;
78 dout <<
" " <<
typeid(t) <<
", <not created or not owner>";
94 template <
class T,
class U>
95 Writer &operator<<(Writer & dout, const std::pair<T, U> &pair) {
97 dout <<
"(" << pair.first <<
":" << pair.second <<
")";
117 const std::vector<T> & t)
120 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
122 if (t.size() <= 10) {
123 for (
typename std::vector<T>::const_iterator it = t.begin(); it != t.end(); ++it)
124 dout << (*it) <<
" ";
129 for (
typename std::vector<T>::const_iterator it = t.begin(); it != t.end(); ++it, ++i)
130 dout <<
"[" << i <<
"] " << (*it) <<
dendl;
154 const std::vector<T *> & t)
157 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
160 for (
typename std::vector<T *>::const_iterator it = t.begin(); it != t.end(); ++it, ++i)
184 const std::list<T> & t)
187 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
190 for (
typename std::list<T>::const_iterator it = t.begin(); it != t.end(); ++it, ++i)
191 dout <<
"[" << i <<
"] " << (*it) <<
dendl;
214 const std::list<T *> & t)
217 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
220 for (
typename std::list<T *>::const_iterator it = t.begin(); it != t.end(); ++it, ++i)
240 template <
class Key,
class T,
class L>
244 const std::map<Key, T, L> & t)
247 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
249 for (
typename std::map<Key, T, L>::const_iterator it = t.begin(); it != t.end(); ++it)
250 dout <<
"[" << (*it).first <<
"] " << (*it).second << dendl;
269 template <
class Key,
class T,
class L>
273 const std::map<Key, T *, L> & t)
276 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
278 for (
typename std::map<Key, T *, L>::const_iterator it = t.begin(); it != t.end(); ++it)
279 dout <<
"[" << (*it).first <<
"] " <<
c_ptr_<T>((*it).second) << std::endl;
298 template <
class Key,
class T,
class L>
302 const std::multimap<Key, T, L> & t)
305 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
307 for (
typename std::multimap<Key, T, L>::const_iterator it = t.begin(); it != t.end(); ++it)
308 dout <<
"[" << (*it).first <<
"] " << (*it).second << dendl;
327 template <
class Key,
class T,
class L>
331 const std::multimap<Key, T *, L> & t)
334 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
336 for (
typename std::multimap<Key, T *, L>::const_iterator it = t.begin(); it != t.end(); ++it)
337 dout <<
"[" << (*it).first <<
"] " <<
c_ptr_<T>((*it).second) << std::endl;
356 template <
class Key,
class L>
360 const std::set<Key, L> & t)
363 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
365 for (
typename std::set<Key, L>::const_iterator it = t.begin(); it != t.end(); ++it)
366 dout << (*it) <<
dendl;
385 template <
class Key,
class L>
389 const std::set<Key *, L> & t)
392 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
394 for (
typename std::set<Key *, L>::const_iterator it = t.begin(); it != t.end(); ++it)
414 template <
class Key,
class L>
418 const std::multiset<Key, L> & t)
421 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
423 for (
typename std::multiset<Key, L>::const_iterator it = t.begin(); it != t.end(); ++it)
424 dout << (*it) <<
dendl;
443 template <
class Key,
class L>
447 const std::multiset<Key *, L> & t)
450 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
452 for (
typename std::multiset<Key *, L>::const_iterator it = t.begin(); it != t.end(); ++it)
522 Writer &operator<<(Writer &dout, const std::bitset<n> &t) {
523 if (dout.shouldPrint())
524 dout.getStream() << t;
542 Writer &operator<<(Writer &dout, const std::vector<T> &t) {
543 return dump(dout, t);
558 Writer &operator<<(Writer &dout, const std::list<T> &t) {
559 return dump(dout, t);
573 template <
class Key,
class T,
class L>
574 Writer &operator<<(Writer &dout, const std::map<Key, T, L> &t) {
575 return dump(dout, t);
589 template <
class Key,
class T,
class L>
590 Writer &operator<<(Writer &dout, const std::multimap<Key, T, L> &t) {
591 return dump(dout, t);
605 template <
class Key,
class L>
606 Writer &operator<<(Writer &dout, const std::set<Key, L> &t) {
607 return dump(dout, t);
621 template <
class Key,
class L>
622 Writer &operator<<(Writer &dout, const std::multiset<Key, L> &t) {
623 return dump(dout, t);
653 #if defined( STK_HAS_MPI ) 665 Writer &operator<<(Writer &dout, const sierra::MPI::Loc<int> &loc);
678 Writer &operator<<(Writer &dout, const sierra::MPI::Loc<double> &loc);
691 Writer &operator<<(Writer &dout, const sierra::MPI::Loc<float> &loc);
704 Writer &operator<<(
Writer &dout,
const sierra::MPI::TempLoc &loc);
706 #endif // if defined( STK_HAS_MPI ) 723 template<
class ElementType,
733 operator<<(Writer &dout, const sierra::Array<ElementType, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 > &array)
739 dout << type.substr(0, type.find(
", sierra::TypeListEnd")) <<
">" << push <<
dendl;
741 dout << pop <<
dendl;
747 template<
class ElementType,
757 operator<<(Writer &dout, const sierra::ArrayContainer<ElementType, Tag0, Tag1, Tag2, Tag3, Tag4, Tag5, Tag6, Tag7 > &array)
763 dout << type.substr(0, type.find(
", sierra::TypeListEnd")) <<
">" << push <<
dendl;
765 dout << pop <<
dendl;
771 template<
class ElementType,
int Dimension>
773 operator<<(Writer &dout, const sierra::FArray<ElementType, Dimension> &array)
780 dout << pop <<
dendl;
785 template<
class ElementType,
int Dimension>
787 operator<<(Writer &dout, const sierra::FArrayContainer<ElementType, Dimension> &array)
794 dout << pop <<
dendl;
814 const sierra::Mapv_no_delete<T> & t)
817 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
819 for (
typename sierra::Mapv_no_delete<T>::const_iterator it = t.begin(); it != t.end(); ++it) {
820 dout <<
"[" << (*it).mapv_key() <<
"] " << (*it) <<
dendl;
840 template <
class Key,
class T,
class U>
847 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
849 for (
typename sierra::vecmap<Key, T, U>::const_iterator it = t.begin(); it != t.end(); ++it)
850 dout <<
"[" << (*it).first <<
"] " << (*it).second << dendl;
869 template <
class Key,
class T,
class U>
876 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
878 for (
typename sierra::vecmap<Key, T *, U>::const_iterator it = t.begin(); it != t.end(); ++it)
879 dout <<
"[" << (*it).first <<
"] " << *(*it).second << dendl;
898 template <
class Key,
class T,
class U>
905 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
907 for (
typename sierra::vecmap<Key *, T *, U>::const_iterator it = t.begin(); it != t.end(); ++it)
908 dout <<
"[" << (*it).first <<
"] " << *(*it).second << dendl;
927 template <
class T,
class U>
934 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
937 for (
typename sierra::vecset<T, U>::const_iterator it = t.begin(); it != t.end(); ++it, ++i)
938 dout <<
"[" << i <<
"] " << (*it) <<
dendl;
957 template <
class T,
class U>
964 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
967 for (
typename sierra:: vecset<T *, U>::const_iterator it = t.begin(); it != t.end(); ++it, ++i)
968 dout <<
"[" << i <<
"] " << *(*it) <<
dendl;
986 template <
class T,
class U>
993 dout <<
typeid(t) <<
", " << t.
mapv_key();
1009 template <
class T,
class U>
1013 const sierra::Mapv<T, U> & t)
1016 dout <<
typeid(t) <<
", size " << t.size() << push <<
dendl;
1018 for (
typename sierra::Mapv<T, U>::const_iterator it = t.begin(); it != t.end(); ++it) {
1019 dout <<
"[" << (*it).mapv_key() <<
"] " << (*it) <<
dendl;
1039 template <
class T,
class U>
1040 Writer &operator<<(Writer &dout, const sierra::vecset<T, U> &t) {
1041 return dump(dout, t);
1055 template <
class Key,
class T,
class U>
1056 Writer &operator<<(Writer &dout, const sierra::vecmap<Key, T, U> &t) {
1057 return dump(dout, t);
1071 template <
class T,
class U>
1072 Writer &operator<<(Writer &dout, const sierra::vecset<T *, U> &t) {
1073 return dump(dout, t);
1087 template <
class Key,
class T,
class U>
1088 Writer &operator<<(Writer &dout, const sierra::vecmap<Key *, T *, U> &t) {
1089 return dump(dout, t);
1104 Writer &operator<<(Writer &dout, const sierra::Mapv_no_delete<T> &t) {
1105 return dump(dout, t);
1119 template <
class T,
class U>
1120 Writer &operator<<(Writer &dout, const sierra::Mapv<T, U> &t) {
1121 return dump(dout, t);
1135 template <
class T,
class U>
1136 Writer &operator<<(Writer &dout, const sierra::MapvNode<T, U> &t) {
1137 return dump(dout, t);
1151 template <
class Key,
class T,
class U>
1152 Writer &operator<<(Writer &dout, const sierra::vecmap<Key, T *, U> &t) {
1153 return dump(dout, t);
1164 #endif // STK_UTIL_DIAG_WRITEREXT_HPP Writer & dump(Writer &dout, const sierra::Mapv< T, U > &t)
Template function dump writes a Mapv object to the diagnostic writer.
Writer & dendl(Writer &dout)
Writer function dendl calls the Writer::dendl manipulator.
const char * demangle(const char *symbol)
Function demangle returns the demangled C++ symbol from the mangled C++ symbol. The mangled named is ...
Class c_ptr_func_ simply stores a pointer to an object of type T. This allows pointers which want to ...
std::ostream & getStream()
Member function getStream returns the output stream.
Extend Array with deep copy assignment and resize operations.
bool shouldPrint()
Member function shouldPrint returns true if the line should print.
Class c_ptr_ simply stores a pointer to an object of type T. This allows pointers which want to be de...
Multidimensional array of contiguous memory. The memory is not owned by the array, but container access semantics are enforced, i.e. const Array<> elements cannot be assigned to.
c_ptr_func_< T, const sierra::String & > c_ptr_name(const T *t)
Template function c_ptr_name implements c_ptr_func with the function 'name'.
Vector-based std::map functionality.
Extend FArray with deep copy assignment and resize operations.
Class Writer implements a runtime selectable diagnostic output writer to aid in the development and d...
const key_type & mapv_key() const
Vector-based std::set functionality.
Multidimensional array view of contiguous memory.
std::ostream & operator<<(std::ostream &s, const Bucket &k)
Print the part names for which this bucket is a subset.