33#define HURRICANE_COMMONS_H
69 template<
typename DboType>
72 inline void operator() ( DboType* dbo ) { dbo->destroy(); }
76 template<
typename DboType>
77 class dbo_ptr :
public std::shared_ptr<DboType> {
79 dbo_ptr ( DboType* dbo ) : std::shared_ptr<DboType>(dbo,DboDestroy<DboType>()) { }
90 inline string _TName (
const string& s ) {
return s; }
91 inline string _PName (
const string& s ) {
return "Hurricane::" + s; }
94 inline Type abs (
const Type& value ) {
return (value<0) ? -value : value; }
100 template<
typename Element>
101 inline void erase_element ( vector<Element*>& v,
const Element* e )
103 for (
auto ielement = v.begin() ; ielement != v.end() ; ++ielement )
104 if (*ielement == e) { v.erase( ielement );
return; }
112 inline int floatCompare (
float a,
float b )
114 assert (
sizeof(
float) ==
sizeof(
int) );
116 if ( a == b )
return 0;
117 return *(
int*)&a - *(
int*)&b;
120 inline int floatDifference (
float a,
float b,
int threshold )
122 int difference = floatCompare(a,b);
123 if ( abs(difference) < threshold )
return 0;
125 return (difference<0) ? -1 : 1;
129 inline void floatRound (
float& value,
float precision )
131 float rounded = roundf ( value*precision );
132 value = rounded / precision;
136 inline float roundfp (
float value,
float precision=100.0 ) {
return roundf(value*precision)/precision; }
139 template<
typename Type>
inline void order ( Type& a, Type& b ) {
if (a>b) std::swap(a,b); }
141 template<
typename Type>
inline Type setInBound ( Type lower, Type upper, Type& value )
143 if (value < lower) value = lower;
144 else if (value > upper) value = upper;
149 string& split ( std::string& );
155#include "hurricane/Record.h"
167template<
typename Data>
inline Hurricane::Slot* getSlot ( std::string name, Data );
175template<
typename Data>
inline std::string getString ( Data data )
176{
return std::string(
"<type ")
178 + std::string(
" unsupported by getString()>"); }
180template<>
inline std::string getString<std::nullptr_t> ( std::nullptr_t )
181{
return "nullptr" ; }
185template<>
inline std::string getString<const bool&> (
const bool& b )
186{
return (b)?
"True":
"False" ; }
188template<>
inline std::string getString<const int&> (
const int& i )
189{ std::ostringstream os (
""); os << i;
return os.str(); }
191template<>
inline std::string getString<const long&> (
const long& l )
192{ std::ostringstream os (
""); os << l;
return os.str(); }
194template<>
inline std::string getString<const unsigned int&> (
const unsigned int& u )
195{ std::ostringstream os (
""); os << u;
return os.str(); }
197template<>
inline std::string getString<const unsigned long&> (
const unsigned long& ul )
198{ std::ostringstream os (
""); os << ul;
return os.str(); }
200template<>
inline std::string getString<const unsigned long long&> (
const unsigned long long& ull )
201{ std::ostringstream os (
""); os << ull;
return os.str(); }
203template<>
inline std::string getString<const unsigned short int&> (
const unsigned short int& us )
204{ std::ostringstream os (
""); os << us;
return os.str(); }
206template<>
inline std::string getString<const float&> (
const float& f )
207{ std::ostringstream os (
""); os << f;
return os.str(); }
209template<>
inline std::string getString<const double&> (
const double& d )
210{ std::ostringstream os; os << d;
return os.str(); }
212template<>
inline std::string getString<const std::string&> (
const std::string& s )
217template<>
inline std::string getString<const bool*> (
const bool* b )
218{
return (*b)?
"True":
"False" ; }
220template<>
inline std::string getString<const char*> (
const char* c )
223template<>
inline std::string getString<const int*> (
const int* i )
224{ std::ostringstream os (
""); os << *i;
return os.str(); }
226template<>
inline std::string getString<const long*> (
const long* l )
227{ std::ostringstream os (
""); os << *l;
return os.str(); }
229template<>
inline std::string getString<const unsigned int*> (
const unsigned int* u )
230{ std::ostringstream os (
""); os << *u;
return os.str(); }
232template<>
inline std::string getString<const unsigned long*> (
const unsigned long* ul )
233{ std::ostringstream os (
""); os << *ul;
return os.str(); }
235template<>
inline std::string getString<const unsigned long long*> (
const unsigned long long* ull )
236{ std::ostringstream os (
""); os << *ull;
return os.str(); }
238template<>
inline std::string getString<const unsigned short int*> (
const unsigned short int* us )
239{ std::ostringstream os (
""); os << *us;
return os.str(); }
241template<>
inline std::string getString<const float*> (
const float* f )
242{ std::ostringstream os (
""); os << *f;
return os.str(); }
244template<>
inline std::string getString<const double*> (
const double* d )
245{ std::ostringstream os; os << *d;
return os.str(); }
247template<>
inline std::string getString<const void*> (
const void* p )
248{ std::ostringstream os (
"0x"); os << std::hex << p;
return os.str(); }
250template<>
inline std::string getString<const std::string*> (
const std::string* s )
256template<>
inline std::string getString<bool*> (
bool* b )
257{
return (*b)?
"True":
"False" ; }
259template<>
inline std::string getString<char*> (
char* c )
262template<>
inline std::string getString<int*> (
int* i )
263{ std::ostringstream os (
""); os << *i;
return os.str(); }
265template<>
inline std::string getString<long*> (
long* l )
266{ std::ostringstream os (
""); os << *l;
return os.str(); }
268template<>
inline std::string getString<unsigned int*> (
unsigned int* u )
269{ std::ostringstream os (
""); os << *u;
return os.str(); }
271template<>
inline std::string getString<unsigned long*> (
unsigned long* ul )
272{ std::ostringstream os (
""); os << *ul;
return os.str(); }
274template<>
inline std::string getString<unsigned long long*> (
unsigned long long* ull )
275{ std::ostringstream os (
""); os << *ull;
return os.str(); }
277template<>
inline std::string getString<unsigned short int*> (
unsigned short int* us )
278{ std::ostringstream os (
""); os << *us;
return os.str(); }
280template<>
inline std::string getString<float*> (
float* f )
281{ std::ostringstream os (
""); os << *f;
return os.str(); }
283template<>
inline std::string getString<double*> (
double* d )
284{ std::ostringstream os; os << *d;
return os.str(); }
286template<>
inline std::string getString<void*> (
void* p )
287{ std::ostringstream os (
"0x"); os << std::hex << p;
return os.str(); }
289template<>
inline std::string getString<std::string*> ( std::string* s )
295template<>
inline std::string getString<bool> (
bool b )
296{
return (b)?
"True":
"False" ; }
298template<>
inline std::string getString<char> (
char c )
299{
return std::string(1,c); }
301template<>
inline std::string getString<int> (
int i )
302{ std::ostringstream os (
""); os << i;
return os.str(); }
304template<>
inline std::string getString<long> (
long l )
305{ std::ostringstream os (
""); os << l;
return os.str(); }
307template<>
inline std::string getString<unsigned int> (
unsigned int u )
308{ std::ostringstream os (
""); os << u;
return os.str(); }
310template<>
inline std::string getString<unsigned long> (
unsigned long ul )
311{ std::ostringstream os (
""); os << ul;
return os.str(); }
313template<>
inline std::string getString<unsigned long long> (
unsigned long long ull )
314{ std::ostringstream os (
""); os << ull;
return os.str(); }
316template<>
inline std::string getString<unsigned short int> (
unsigned short int us )
317{ std::ostringstream os (
""); os << us;
return os.str(); }
319template<>
inline std::string getString<float> (
float f )
320{ std::ostringstream os (
""); os << f;
return os.str(); }
322template<>
inline std::string getString<double> (
double d )
323{ std::ostringstream os; os << d;
return os.str(); }
325template<>
inline std::string getString<std::string> ( std::string s )
329template<
typename Data>
inline Hurricane::Record* getRecord ( Data data )
339template<
typename T,
typename U>
340inline std::string getString (
const std::pair<T,U>& p )
342 return "const std::pair<T,U>";
346template<
typename T,
typename U>
347inline Hurricane::Record* getRecord (
const std::pair<T,U>& p )
349 Hurricane::Record* record = NULL;
350 record =
new Hurricane::Record (
"const std::pair<T,U>" );
351 record->add( getSlot<const T>(std::string(
"first" ), &p.first ) );
352 record->add( getSlot<const U>(std::string(
"second"), &p.second) );
357template<
typename T,
typename U>
358inline std::string getString ( std::pair<T,U>& p )
360 return "std::pair<T,U>";
364template<
typename T,
typename U>
365inline Hurricane::Record* getRecord ( std::pair<T,U>& p )
367 Hurricane::Record* record = NULL;
368 record =
new Hurricane::Record (
"std::pair<T,U>" );
369 record->add( getSlot<T>(std::string(
"first" ), &p.first ) );
370 record->add( getSlot<U>(std::string(
"second"), &p.second) );
379template<
typename Element,
size_t N>
380inline std::string getString ( std::array<Element,N>* v )
382 std::string name =
"const std::array<Element,N>:";
383 return name + getString<size_t>(v->size());
387template<
typename Element,
size_t N>
388inline Hurricane::Record* getRecord ( std::array<Element,N>* v )
390 Hurricane::Record* record = NULL;
392 record =
new Hurricane::Record (
"std::array<Element,N>" );
394 typename std::array<Element,N>::iterator iterator = v->begin();
395 while ( iterator != v->end() ) {
396 record->add ( getSlot<Element>(getString(n++), *iterator) );
404template<
typename Element,
size_t N>
405inline std::string getString (
const std::array<Element,N>* v )
407 std::string name =
"const std::array<Element,N>:";
408 return name + getString<size_t>(v->size());
412template<
typename Element,
size_t N>
413inline Hurricane::Record* getRecord (
const std::array<Element,N>* v )
415 Hurricane::Record* record = NULL;
417 record =
new Hurricane::Record (
"const std::array<Element,N>" );
419 typename std::array<Element,N>::const_iterator iterator = v->begin();
420 while ( iterator != v->end() ) {
421 record->add ( getSlot<const Element>(getString(n++), *iterator) );
429template<
typename Element,
size_t N>
430inline std::string getString ( std::array<Element,N>& v )
432 std::string name =
"std::array<Element,N>&:";
433 return name + getString<size_t>(v.size());
437template<
typename Element,
size_t N>
438inline Hurricane::Record* getRecord ( std::array<Element,N>& v )
440 Hurricane::Record* record = NULL;
442 record =
new Hurricane::Record (
"std::array<Element,N>&" );
444 for (
auto element : v )
445 record->add( getSlot<Element>(getString(n++), element) );
451template<
typename Element,
size_t N>
452inline std::string getString (
const std::array<Element,N>& v )
454 std::string name =
"const std::array<Element,N>&:";
455 return name + getString<size_t>(v.size());
459template<
typename Element,
size_t N>
460inline Hurricane::Record* getRecord (
const std::array<Element,N>& v )
462 Hurricane::Record* record = NULL;
464 record =
new Hurricane::Record (
"const std::array<Element,N>&" );
466 for (
auto element : v )
467 record->add( getSlot<Element>(getString(n++), element) );
477template<
typename Element>
478inline std::string getString ( std::vector<Element>* v )
480 std::string name =
"std::vector<Element>*:";
481 return name + getString<size_t>(v->size());
485template<
typename Element>
486inline Hurricane::Record* getRecord ( std::vector<Element>* v )
488 Hurricane::Record* record = NULL;
490 record =
new Hurricane::Record (
"std::vector<Element>*" );
492 typename std::vector<Element>::iterator iterator = v->begin();
493 while ( iterator != v->end() ) {
494 record->add ( getSlot<const Element*>(getString(n++), &(*iterator)) );
506template<
typename Element>
507inline std::string getString ( std::vector<Element*>* v )
509 std::string name =
"std::vector<Element*>*:";
510 return name + getString<size_t>(v->size());
514template<
typename Element>
515inline Hurricane::Record* getRecord ( std::vector<Element*>* v )
517 Hurricane::Record* record = NULL;
519 record =
new Hurricane::Record (
"std::vector<Element*>*" );
521 typename std::vector<Element*>::iterator iterator = v->begin();
522 while ( iterator != v->end() ) {
523 record->add ( getSlot<Element*>(getString(n++), *iterator) );
535template<
typename Element>
536inline std::string getString (
const std::vector<Element>* v )
538 std::string name =
"const std::vector<Element>*:";
539 return name + getString<size_t>(v->size());
543template<
typename Element>
544inline Hurricane::Record* getRecord (
const std::vector<Element>* v )
546 Hurricane::Record* record = NULL;
548 record =
new Hurricane::Record (
"const std::vector<Element>*" );
550 typename std::vector<Element>::const_iterator iterator = v->begin();
551 while ( iterator != v->end() ) {
552 record->add ( getSlot<const Element*>(getString(n++), &(*iterator)) );
564template<
typename Element>
565inline std::string getString (
const std::vector<Element*>* v )
567 std::string name =
"const std::vector<Element*>*:";
568 return name + getString<size_t>(v->size());
572template<
typename Element>
573inline Hurricane::Record* getRecord (
const std::vector<Element*>* v )
575 Hurricane::Record* record = NULL;
576 if (not v->empty()) {
577 record =
new Hurricane::Record (
"const std::vector<Element*>*" );
579 typename std::vector<Element*>::const_iterator iterator = v->begin();
580 while (iterator != v->end()) {
581 record->add ( getSlot<const Element*>(getString(n++), *iterator) );
593template<
typename Element>
594inline std::string getString (
const std::list<Element>* l )
596 std::string name =
"const std::list<Element>*:";
597 return name + getString<size_t>(l->size());
601template<
typename Element>
602inline Hurricane::Record* getRecord (
const std::list<Element>* l )
604 Hurricane::Record* record = NULL;
606 record =
new Hurricane::Record (
"const std::list<Element>" );
608 typename std::list<Element>::const_iterator iterator = l->begin();
609 while ( iterator != l->end() ) {
610 record->add ( getSlot<const Element*>(getString(n++), &(*iterator)) );
618template<
typename Element>
619inline std::string getString ( std::list<Element>* l )
621 std::string name =
"std::list<Element>*:";
622 return name + getString<size_t>(l->size());
626template<
typename Element>
627inline Hurricane::Record* getRecord ( std::list<Element>* l )
629 Hurricane::Record* record = NULL;
631 record =
new Hurricane::Record (
"std::list<Element>" );
633 typename std::list<Element>::iterator iterator = l->begin();
634 while ( iterator != l->end() ) {
635 record->add ( getSlot<const Element*>(getString(n++), &(*iterator)) );
647template<
typename Key,
typename Element>
648inline std::string getString ( std::map<Key,Element>* m )
650 std::string name =
"std::map<Element>:";
651 return name + getString<size_t>(m->size());
655template<
typename Key,
typename Element>
656inline Hurricane::Record* getRecord ( std::map<Key,Element>* m )
658 Hurricane::Record* record = NULL;
660 record =
new Hurricane::Record (
"std::map<Element>" );
661 typename std::map<Key,Element>::iterator iterator = m->begin();
662 while ( iterator != m->end() ) {
663 record->add ( getSlot<Element>(getString(iterator->first), iterator->second) );
671template<
typename Key,
typename Element>
672inline std::string getString (
const std::map<Key,Element>* m )
674 std::string name =
"const std::map<Element>:";
675 return name + getString<size_t>(m->size());
679template<
typename Key,
typename Element>
680inline Hurricane::Record* getRecord (
const std::map<Key,Element>* m )
682 Hurricane::Record* record = NULL;
684 record =
new Hurricane::Record (
"const std::map<Element>" );
685 typename std::map<Key,Element>::const_iterator iterator = m->begin();
686 while ( iterator != m->end() ) {
687 record->add ( getSlot<const Element>(getString(iterator->first), iterator->second) );
699template<
typename Key,
typename Element,
typename Compare>
700inline std::string getString ( std::map<Key,Element,Compare>* m )
702 std::string name =
"std::map<Element>:";
703 return name + getString<size_t>(m->size());
707template<
typename Key,
typename Element,
typename Compare>
708inline Hurricane::Record* getRecord ( std::map<Key,Element,Compare>* m )
710 Hurricane::Record* record = NULL;
712 record =
new Hurricane::Record (
"std::map<Element>" );
713 typename std::map<Key,Element,Compare>::iterator iterator = m->begin();
714 while ( iterator != m->end() ) {
715 record->add ( getSlot<Element>(getString(iterator->first), iterator->second) );
723template<
typename Key,
typename Element,
typename Compare>
724inline std::string getString (
const std::map<Key,Element,Compare>* m )
726 std::string name =
"const std::map<Element>:";
727 return name + getString<size_t>(m->size());
731template<
typename Key,
typename Element,
typename Compare>
732inline Hurricane::Record* getRecord (
const std::map<Key,Element,Compare>* m )
734 Hurricane::Record* record = NULL;
736 record =
new Hurricane::Record (
"const std::map<Element>" );
737 typename std::map<Key,Element,Compare>::const_iterator iterator = m->begin();
738 while ( iterator != m->end() ) {
739 record->add ( getSlot<const Element>(getString(iterator->first), iterator->second) );
751template<
typename Key,
typename Element,
typename Compare>
752inline std::string getString (
const std::multimap<Key,Element,Compare>* m )
754 std::string name =
"const std::multimap<Element>:";
755 return name + getString<size_t>(m->size());
759template<
typename Key,
typename Element,
typename Compare>
760inline Hurricane::Record* getRecord (
const std::multimap<Key,Element,Compare>* m )
762 Hurricane::Record* record = NULL;
764 record =
new Hurricane::Record (
"const std::multimap<Element>" );
765 typename std::multimap<Key,Element,Compare>::const_iterator iterator = m->begin();
766 while ( iterator != m->end() ) {
767 record->add ( getSlot<const Element>(getString(iterator->first), iterator->second) );
775template<
typename Key,
typename Element,
typename Compare>
776inline std::string getString ( std::multimap<Key,Element,Compare>* m )
778 std::string name =
"std::multimap<Element>:";
779 return name + getString<size_t>(m->size());
783template<
typename Key,
typename Element,
typename Compare>
784inline Hurricane::Record* getRecord ( std::multimap<Key,Element,Compare>* m )
786 Hurricane::Record* record = NULL;
788 record =
new Hurricane::Record (
"std::multimap<Element>" );
789 typename std::multimap<Key,Element,Compare>::iterator iterator = m->begin();
790 while ( iterator != m->end() ) {
791 record->add ( getSlot<Element>(getString(iterator->first), iterator->second) );
803template<
typename Element,
typename Compare>
804inline std::string getString (
const std::set<Element,Compare>* s )
806 std::string name =
"const std::set<Element>:";
807 return name + getString<size_t>(s->size());
811template<
typename Element,
typename Compare>
812inline Hurricane::Record* getRecord (
const std::set<Element,Compare>* s )
814 Hurricane::Record* record = NULL;
816 record =
new Hurricane::Record (
"const std::set<Element>" );
818 typename std::set<Element,Compare>::const_iterator iterator = s->begin();
819 while ( iterator != s->end() ) {
820 record->add ( getSlot<const Element>(getString(n++), *iterator) );
828template<
typename Element,
typename Compare,
typename Allocator >
829inline std::string getString ( std::set<Element,Compare,Allocator>* s )
831 std::string name =
"std::set<Element>:";
832 return name + getString<size_t>(s->size());
836template<
typename Element,
typename Compare,
typename Allocator >
837inline Hurricane::Record* getRecord ( std::set<Element,Compare,Allocator>* s )
839 Hurricane::Record* record = NULL;
840 if (not s->empty()) {
841 record =
new Hurricane::Record (
"std::set<Element>" );
843 typename std::set<Element,Compare,Allocator>::iterator iterator = s->begin();
844 while ( iterator != s->end() ) {
845 record->add( getSlot<Element>(getString(n++), *iterator) );
856template<
typename Element,
typename Compare>
857inline std::string getString (
const std::set<Element,Compare>& s )
859 std::string name =
"const std::set<Element>:";
860 return name + getString<size_t>(s.size());
864template<
typename Element,
typename Compare>
865inline Hurricane::Record* getRecord (
const std::set<Element,Compare>& s )
867 Hurricane::Record* record = NULL;
869 record =
new Hurricane::Record (
"const std::set<Element>" );
871 typename std::set<Element,Compare>::const_iterator iterator = s.begin();
872 while ( iterator != s.end() ) {
873 record->add ( getSlot<Element>(getString(n++), *iterator) );
884template<
typename Element,
typename Compare>
885inline std::string getString (
const std::multiset<Element,Compare>* s )
887 std::string name =
"std::multiset<Element>:";
888 return name + getString<size_t>(s->size());
892template<
typename Element,
typename Compare>
893inline Hurricane::Record* getRecord (
const std::multiset<Element,Compare>* s )
895 Hurricane::Record* record = NULL;
897 record =
new Hurricane::Record (
"std::multiset<Element>" );
899 typename std::multiset<Element,Compare>::const_iterator iterator = s->begin();
900 while ( iterator != s->end() ) {
901 record->add ( getSlot<Element>(getString(n++), *iterator) );
909#include "hurricane/Tabulation.h"
926 inline bool enabled (
int )
const;
927 inline tstream&
log (
int level,
int count=0 );
929 inline tstream ( std::ostream & );
930 inline tstream& put (
char c );
934 inline tstream& _tabw (
int count );
937 inline tstream& operator<< ( std::ostream& (*pf)(std::ostream &) );
946inline tstream::tstream ( std::ostream& s )
947 : std::ostream(s.rdbuf())
960inline bool tstream::enabled ()
const {
return (_level >= _minLevel) and (_level < _maxLevel); }
961inline bool tstream::enabled (
int l )
const {
return (l >= _minLevel) and (l < _maxLevel); }
963inline tstream& tstream::put (
char c ) {
if (
enabled())
static_cast<std::ostream*
>(
this)->put(c);
return *
this; }
964inline tstream& tstream::flush () {
if (
enabled())
static_cast<std::ostream*
>(
this)->flush();
return *
this; }
965inline tstream& tstream::operator<< ( std::ostream& (*pf)(std::ostream&) ) {
if (
enabled()) (*pf)(*this);
return *
this; }
967{
static_cast<std::ostream&
>(o) << t;
return o; }
969inline tstream& tstream::_tab () {
if (
enabled()) (*
static_cast<std::ostream*
>(
this)) << _tabulation;
return *
this; }
970inline tstream& tstream::_tabw (
int count )
973 if (count > 0)
while(count--) _tabulation++;
974 else if (count < 0)
while(count++) _tabulation--;
980{
setLevel(level); _tab();
return _tabw(count); }
984{
if (o.
enabled()) {
static_cast<std::ostream&
>(o) << s; }
return o; };
993{
if (o.
enabled()) {
static_cast<std::ostream&
>(o) << getString<T*>(t); }
return o; };
1001{
if (o.
enabled()) {
static_cast<std::ostream&
>(o) << getString<T>(t); }
return o; };
1005{
if (o.
enabled()) {
static_cast<std::ostream&
>(o) << getString<const T*>(t); }
return o; };
1008inline tstream& operator<< (
tstream& o, std::ios_base& (*pf)(std::ios_base&) )
1009{
if (o.
enabled()) {
static_cast<std::ostream&
>(o) << pf; }
return o; };
1011struct _Tsetw {
int n_; };
1012inline _Tsetw tsetw (
int n ) {
return { n }; }
1014struct _Tsetf {
int n_; };
1015inline _Tsetf tsetf (
int n ) {
return { n }; }
1019{
if (o.
enabled()) {
static_cast<std::ostream&
>(o) << std::setw(manip.n_); }
return o; }
1024#define cdebug_log(level,indent) if (cdebug.enabled(level)) cdebug.log(level,indent)
1025#define cdebug_tabw(level,indent) cdebug.tabw(level,indent)
1028# define GETSTRING_POINTER_SUPPORT(Data) \
1029 template<> inline std::string getString<Data*>( Data* data ) \
1031 if (!data) return "NULL [" #Data "]"; \
1032 return data->_getString(); \
1035 template<> inline std::string getString<const Data*>( const Data* data ) \
1036 { if (!data) return "NULL [const " #Data "]"; return data->_getString(); }
1039# define IOSTREAM_POINTER_SUPPORT(Data) \
1040 inline std::ostream& operator<< ( std::ostream& o, Data* d ) \
1042 if (!d) return o << "NULL [" #Data "]"; \
1043 return o << "&" << getString<const Data*>(d); \
1045 inline std::ostream& operator<< ( std::ostream& o, const Data* d ) \
1047 if (!d) return o << "NULL [const " #Data "]"; \
1048 return o << "&" << getString<const Data*>(d); \
1052# define TSTREAM_POINTER_SUPPORT(Data) \
1053 inline tstream& operator<< ( tstream& o, Data* d ) \
1054 { return o << "&" << getString<const Data*>(d); } \
1055 inline tstream& operator<< ( tstream& o, const Data* d ) \
1056 { return o << "&" << getString<const Data*>(d); }
1059# define GETRECORD_POINTER_SUPPORT(Data) \
1060 template<> inline Hurricane::Record* getRecord<Data*>( Data* data ) \
1061 { if (!data) return NULL; return data->_getRecord(); } \
1063 template<> inline Hurricane::Record* getRecord<const Data*>( const Data* data ) \
1064 { if (!data) return NULL; return data->_getRecord(); }
1067# define GETSTRING_REFERENCE_SUPPORT(Data) \
1068 template<> inline std::string getString<Data&>( Data& data ) \
1069 { return data._getString(); } \
1071 template<> inline std::string getString<const Data&>( const Data& data ) \
1072 { return data._getString(); }
1075# define IOSTREAM_REFERENCE_SUPPORT(Data) \
1076 inline std::ostream& operator<< ( std::ostream& o, Data& d ) \
1077 { return o << getString<Data&>(d); } \
1079 inline std::ostream& operator<< ( std::ostream& o, const Data& d ) \
1080 { return o << getString<const Data&>(d); } \
1083# define GETRECORD_REFERENCE_SUPPORT(Data) \
1084 template<> inline Hurricane::Record* getRecord<Data&>( Data& data ) \
1085 { return data._getRecord(); } \
1087 template<> inline Hurricane::Record* getRecord<const Data&>( const Data& data ) \
1088 { return data._getRecord(); }
1091# define GETSTRING_VALUE_SUPPORT(Data) \
1092 template<> inline std::string getString<Data>( Data data ) \
1093 { return data._getString(); }
1096# define IOSTREAM_VALUE_SUPPORT(Data) \
1097 inline std::ostream& operator<< ( std::ostream& o, Data d ) \
1098 { return o << getString<Data>(d); }
1101# define GETRECORD_VALUE_SUPPORT(Data) \
1102 template<> inline Hurricane::Record* getRecord<Data>( Data data ) \
1103 { return data._getRecord(); }
1106# define INSPECTOR_P_SUPPORT(Data) \
1107 GETRECORD_POINTER_SUPPORT(Data) \
1108 GETSTRING_POINTER_SUPPORT(Data) \
1109 IOSTREAM_POINTER_SUPPORT(Data) \
1110 TSTREAM_POINTER_SUPPORT(Data)
1113# define INSPECTOR_R_SUPPORT(Data) \
1114 GETRECORD_REFERENCE_SUPPORT(Data) \
1115 GETSTRING_REFERENCE_SUPPORT(Data) \
1116 IOSTREAM_REFERENCE_SUPPORT(Data)
1119# define INSPECTOR_PR_SUPPORT(Data) \
1120 GETSTRING_POINTER_SUPPORT(Data) \
1121 GETSTRING_REFERENCE_SUPPORT(Data) \
1122 GETSTRING_VALUE_SUPPORT(Data) \
1123 IOSTREAM_POINTER_SUPPORT(Data) \
1124 IOSTREAM_REFERENCE_SUPPORT(Data) \
1125 GETRECORD_POINTER_SUPPORT(Data) \
1126 GETRECORD_REFERENCE_SUPPORT(Data)
1129# define INSPECTOR_PV_SUPPORT(Data) \
1130 GETSTRING_POINTER_SUPPORT(Data) \
1131 GETSTRING_VALUE_SUPPORT(Data) \
1132 IOSTREAM_POINTER_SUPPORT(Data) \
1133 IOSTREAM_VALUE_SUPPORT(Data) \
1134 GETRECORD_POINTER_SUPPORT(Data) \
1135 GETRECORD_VALUE_SUPPORT(Data)
1142#include "hurricane/Slot.h"
1143#include "hurricane/Initializer.h"
1144#include "hurricane/JsonWriter.h"
1145#include "hurricane/JsonObject.h"
Generic Collection auto-pointer.
Definition Collection.h:235
Tabulation description (API)
Definition Tabulation.h:33
Trace & indentation enabled stream.
Definition Commons.h:917
bool enabled() const
Definition Commons.h:960
int getLevel() const
Definition Commons.h:958
int setMinLevel(int)
Definition Commons.h:956
tstream & log(int level, int count=0)
Definition Commons.h:979
int setLevel(int)
Definition Commons.h:959
tstream & tabw(int level, int count)
Definition Commons.h:962
int setMaxLevel(int)
Definition Commons.h:957
int getMinLevel() const
Definition Commons.h:954
int getMaxLevel() const
Definition Commons.h:955
Contains Almost Everything.
Definition BasicLayer.h:39
string demangle(const char *symbol)