15 int classdesc_epilogue_not_included();
16 int _dummy=classdesc_epilogue_not_included();
32 typedef basic_string<wchar_t> wstring;
41 #if defined(__cplusplus) && __cplusplus>=201103L 42 #include <unordered_map> 43 #include <unordered_set> 53 #include <tr1/type_traits> 54 #if !defined(__ICC) || __ICC > 1100 //tr1 shared_ptr impl not functional with icc 10.1 58 #include <boost/tr1/type_traits.hpp> 59 #include <boost/tr1/memory.hpp> 66 #if defined(__cplusplus) && __cplusplus>=201103L || defined(_MSC_VER) 68 #include <unordered_map> 69 #include <unordered_set> 71 #include <type_traits> 75 using std::false_type;
78 using std::is_integral;
79 using std::is_floating_point;
82 using std::is_pointer;
83 using std::is_reference;
84 using std::is_member_object_pointer;
85 using std::is_member_function_pointer;
89 using std::is_function;
91 using std::is_arithmetic;
92 using std::is_fundamental;
95 using std::is_compound;
96 using std::is_member_pointer;
99 using std::is_volatile;
102 using std::is_polymorphic;
103 using std::is_abstract;
104 using std::is_signed;
105 using std::is_unsigned;
106 using std::alignment_of;
112 using std::is_base_of;
113 using std::is_convertible;
115 using std::remove_const;
116 using std::remove_volatile;
117 using std::remove_cv;
118 using std::add_const;
119 using std::add_volatile;
122 using std::remove_reference;
124 using std::remove_extent;
125 using std::remove_all_extents;
127 using std::remove_pointer;
128 using std::add_pointer;
131 using std::shared_ptr;
134 using std::is_default_constructible;
135 using std::is_copy_constructible;
136 using std::is_assignable;
140 #ifndef HAVE_LONGLONG 141 #define HAVE_LONGLONG 144 #elif defined(BOOST_TR1) || defined(TR1) 147 using std::tr1::true_type;
148 using std::tr1::false_type;
150 using std::tr1::is_void;
151 using std::tr1::is_integral;
152 using std::tr1::is_floating_point;
155 using std::tr1::is_pointer;
156 using std::tr1::is_reference;
157 using std::tr1::is_member_object_pointer;
158 using std::tr1::is_member_function_pointer;
159 using std::tr1::is_enum;
160 using std::tr1::is_union;
161 using std::tr1::is_class;
162 using std::tr1::is_function;
164 using std::tr1::is_arithmetic;
165 using std::tr1::is_fundamental;
166 using std::tr1::is_object;
167 using std::tr1::is_scalar;
168 using std::tr1::is_compound;
169 using std::tr1::is_member_pointer;
171 using std::tr1::is_const;
172 using std::tr1::is_volatile;
173 using std::tr1::is_pod;
174 using std::tr1::is_empty;
175 using std::tr1::is_polymorphic;
176 using std::tr1::is_abstract;
177 using std::tr1::is_signed;
178 using std::tr1::is_unsigned;
179 using std::tr1::alignment_of;
182 using std::tr1::extent;
184 using std::tr1::is_same;
185 using std::tr1::is_base_of;
186 using std::tr1::is_convertible;
188 using std::tr1::remove_const;
189 using std::tr1::remove_volatile;
190 using std::tr1::remove_cv;
191 using std::tr1::add_const;
192 using std::tr1::add_volatile;
193 using std::tr1::add_cv;
195 using std::tr1::remove_reference;
197 using std::tr1::remove_extent;
198 using std::tr1::remove_all_extents;
200 using std::tr1::remove_pointer;
201 using std::tr1::add_pointer;
205 #if (!defined(__ICC) || __ICC > 1100) 206 using std::tr1::shared_ptr;
210 template <
class T>
struct is_default_constructible:
212 public std::tr1::has_nothrow_constructor<T> {};
213 template <
class T>
struct is_copy_constructible:
214 public std::tr1::has_nothrow_copy<T> {};
215 template <
class T,
class U>
struct is_assignable
217 static const bool value=std::tr1::has_nothrow_assign<T>::value &&
218 std::tr1::is_convertible<U,T>::value;
222 template <
class C,
class A>
223 struct is_default_constructible<
std::basic_string<C,A> >:
224 public std::tr1::true_type {};
225 template <
class C,
class A>
226 struct is_copy_constructible<std::basic_string<C,A> >:
227 public std::tr1::true_type {};
228 template <
class C,
class A,
class U>
229 struct is_assignable<std::basic_string<C,A>, U>
231 static const bool value=
232 std::tr1::is_convertible<U,std::basic_string<C,A> >::value;
242 template <
bool,
class type=
void>
struct enable_if_c {
typedef type T;};
253 template <
bool C,
class True,
class F>
259 template <
class True,
class F>
269 template <
class T>
struct is_sequence {
static const bool value=
false;};
271 static const bool value=
true;};
273 static const bool value=
true;};
275 static const bool value=
true;};
280 template <
class T>
struct is_string {
static const bool value=
false;};
282 {
static const bool value=
true;};
289 template <
class T,
class C,
class A>
291 static const bool value=
true;};
292 template <
class K,
class V,
class C,
class A>
294 static const bool value=
true;};
295 template <
class T,
class C,
class A>
297 static const bool value=
true;};
298 template <
class K,
class V,
class C,
class A>
300 static const bool value=
true;};
302 #if defined(__cplusplus) && __cplusplus>=201103L 303 template <
class K,
class V,
class H,
class P,
class A>
305 static const bool value=
true;};
306 template <
class K,
class H,
class P,
class A>
308 static const bool value=
true;};
309 template <
class K,
class V,
class H,
class P,
class A>
311 static const bool value=
true;};
312 template <
class K,
class H,
class P,
class A>
314 static const bool value=
true;};
320 static const bool value=
326 template <
class T>
struct Not 327 {
static const bool value=!T::value;};
329 template <
class A,
class B>
struct And 330 {
static const bool value=A::value && B::value;};
332 template <
class A,
class B>
struct Or 333 {
static const bool value=A::value || B::value;};
335 template <
int X,
int Y>
struct Eq 336 {
static const bool value=X==Y;};
347 public And<is_default_constructible<T>, is_copy_constructible<T> > {};
358 static const bool value=
false;
368 exception(
const string& s=
"classdesc exception"): std::runtime_error(s) {}
375 template <
class T>
struct tn;
376 template <
class T> std::string typeName();
378 #if defined(__cplusplus) && __cplusplus>=201103L 380 template <
class T,
class... A> std::string varTn() {
return typeName<T>()+
","+varTn<A...>();}
381 template <
class T> std::string varTn() {
return typeName<T>();}
385 template <>
inline std::string typeName<bool>() {
return "bool";}
386 template <>
inline std::string typeName<char>() {
return "char";}
387 template <>
inline std::string typeName<short>() {
return "short";}
388 template <>
inline std::string typeName<int>() {
return "int";}
389 template <>
inline std::string typeName<long>() {
return "long";}
391 template <>
inline std::string typeName<signed char>() {
return "signed char";}
392 template <>
inline std::string typeName<unsigned char>() {
return "unsigned char";}
393 template <>
inline std::string typeName<unsigned short>(){
return "unsigned short";}
394 template <>
inline std::string typeName<unsigned int>() {
return "unsigned int";}
395 template <>
inline std::string typeName<unsigned long>() {
return "unsigned long";}
398 template <>
inline std::string typeName<long long>() {
return "long long";}
399 template <>
inline std::string typeName<unsigned long long>() {
return "unsigned long long";}
402 template <>
inline std::string typeName<float>() {
return "float";}
403 template <>
inline std::string typeName<double>() {
return "double";}
404 template <>
inline std::string typeName<long double>() {
return "long double";}
407 template <>
inline std::string typeName<std::string>() {
return "std::string";}
408 template <>
inline std::string typeName<std::wstring>() {
return "std::wstring";}
412 #if __cplusplus>=201103L 413 template <>
inline std::string typeName<char16_t>() {
return "char16_t";}
414 template <>
inline std::string typeName<char32_t>() {
return "char32_t";}
417 template <
class T>
struct tn<T*>
419 static std::string name()
420 {
return typeName<T>()+
"*";}
423 template <
class T>
struct tn<shared_ptr<T> >
425 static std::string name()
426 {
return "classdesc::shared_ptr<"+typeName<T>()+
">";}
429 #if defined(__cplusplus) && __cplusplus <= 201402 430 #if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__) 431 #pragma GCC diagnostic push 432 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 434 template <
class T>
struct tn<std::auto_ptr<T> >
436 static std::string name()
437 {
return "auto_ptr<"+typeName<T>()+
">";}
439 #if defined(__GNUC__) && !defined(__ICC) && !defined(__clang__) 440 #pragma GCC diagnostic pop 444 #if defined(__cplusplus) && __cplusplus>=201103L 445 template <
class T>
struct tn<std::unique_ptr<T> >
447 static std::string name()
448 {
return "std::unique_ptr<"+typeName<T>()+
">";}
452 template <
class T,
class A>
struct tn<std::vector<T,A> >
454 static std::string name()
455 {
return "std::vector<"+typeName<T>()+
">";}
458 template <
class T,
class A>
struct tn<std::list<T,A> >
460 static std::string name()
461 {
return "std::list<"+typeName<T>()+
">";}
464 template <
class T,
class A>
struct tn<std::deque<T,A> >
466 static std::string name()
467 {
return "std::deque<"+typeName<T>()+
">";}
470 template <
class T,
class C,
class A>
struct tn<std::set<T,C,A> >
472 static std::string name()
473 {
return "std::set<"+typeName<T>()+
">";}
476 template <
class K,
class V,
class C,
class A>
struct tn<std::map<K,V,C,A> >
478 static std::string name()
479 {
return "std::map<"+typeName<K>()+
","+typeName<V>()+
">";}
482 template <
class K,
class V>
struct tn<std::pair<K,V> >
484 static std::string name()
485 {
return "std::pair<"+typeName<K>()+
","+typeName<V>()+
">";}
497 typedef std::map<std::string,int> SVMap;
498 typedef std::map<int,std::string> VSMap;
508 for (
const EnumKey *i=data; i<data+size; i++)
510 s2v[i->name]=i->value;
511 v2s[i->value]=i->name;
514 T operator()(std::string key)
const {
515 SVMap::const_iterator i=s2v.find(key);
516 if (i!=s2v.end())
return T(i->second);
519 std::string operator()(
int val)
const 521 VSMap::const_iterator i=v2s.find(val);
522 if (i!=v2s.end())
return i->second;
525 std::string operator()(T val)
const {
return operator()(
int(val));}
527 size_t size()
const {
return v2s.size();}
528 typedef VSMap::const_iterator iterator;
529 iterator begin()
const {
return v2s.begin();}
530 iterator end()
const {
return v2s.end();}
536 typedef string value_type;
537 typedef string* pointer;
538 typedef const string& reference;
541 const string& operator*()
const {
return It::operator*().second;}
542 const string* operator->()
const {
return &It::operator*().second;}
545 Siterator sbegin()
const {
return begin();}
551 typedef T value_type;
553 typedef const T& reference;
556 T operator*()
const {
return T(It::operator*().first);}
559 Viterator vbegin()
const {
return begin();}
571 template <
class T>
int enumKey(
const std::string&);
572 template <
class T> std::string enumKey(
int);
576 enum_keys() {
return enum_keysData<T>::keys;}
581 {
return o<<enum_keys<T>()(x);}
593 operator std::string()
const {
594 return enumKey<typename remove_const<T>::type>(
static_cast<int>(ref));
596 operator int()
const {
return static_cast<int>(ref);}
597 const Enum_handle& operator=(T x) {ref=x;
return *
this;}
598 const Enum_handle& operator=(
int x) {ref=T(x);
return *
this;}
600 {ref=T(enumKey<T>(x));
return *
this;}
613 std::ostream& operator<<(std::ostream& o, Enum_handle<T> x)
615 o << static_cast<std::string>(x);
637 void operator()(
void *targ,
const string& desc, T& arg) {}
641 inline std::string tail(
const string& x) {
643 std::string::size_type i=r.rfind(
'.');
644 return r.substr( i==std::string::npos? 0: i+1);
648 inline std::string head(
const string& x) {
650 std::string::size_type i=r.rfind(
'.');
651 return r.substr( 0, i==std::string::npos? std::string::npos: i);
659 {
typedef std::pair<K,V> T;};
670 template <
class U>
explicit ExcludeClass(
const U& x): T(x) {}
671 template <
class U>
const T& operator=(
const U& x) {
return T::operator=(x);}
672 template <
class U>
operator const U&()
const {
return *
static_cast<U*
>(
this);}
673 template <
class U>
operator U&() {
return *
static_cast<U*
>(
this);}
681 typedef const T& ConstRefType;
685 template <
class U>
const T& operator=(
const U& x) {
return val=x;}
686 template <
class U>
operator U()
const {
return val;}
687 operator RefType () {
return val;}
688 operator ConstRefType ()
const {
return val;}
689 T operator+(
const T& x)
const {
return val+x;}
690 T operator-(
const T& x)
const {
return val-x;}
691 T operator*(
const T& x)
const {
return val*x;}
692 T operator/(
const T& x)
const {
return val/x;}
693 T operator%(
const T& x)
const {
return mod(val,x);}
694 T operator+=(
const T& x) {
return val+=x;}
695 T operator-=(
const T& x) {
return val-=x;}
696 T operator*=(
const T& x) {
return val*=x;}
697 T operator/=(
const T& x) {
return val/=x;}
698 T operator%=(
const T& x) {val=mod(val,x);
return val;}
699 bool operator==(
const T& x)
const {
return val==x;}
701 template <
class U>
bool operator!=(U x)
const {
return !operator==(x);}
705 conditional<is_class<T>::value, ExcludeClass<T>, ExcludeFundamental<T> >::T
710 template <
class U>
explicit Exclude(
const U& x): Super(x) {}
711 template <
class U>
const T& operator=(
const U& x) {
return Super::operator=(x);}
719 #if __cplusplus>=201103L 720 Exclude(std::nullptr_t): val(
nullptr) {}
721 bool operator==(std::nullptr_t)
const {
return val==
nullptr;}
723 bool operator==(
const T* x)
const {
return val==x;}
724 bool operator==(
const Exclude<T*>& x)
const {
return val==x.val;}
725 template <
class U>
bool operator!=(U x)
const {
return !operator==(x);}
726 template <
class U>
explicit Exclude(
const U& x): val(x) {}
727 template <
class U>
const T& operator=(U x) {
return *(val=x);}
728 template <
class U>
operator U()
const {
return val;}
729 T& operator*() {
return *val;}
730 const T& operator*()
const {
return *val;}
731 T* operator->() {
return val;}
732 const T* operator->()
const {
return val;}
735 operator+(U x) {
return val+x;}
738 operator+(U x)
const {
return val+x;}
739 std::ptrdiff_t operator-(
const T* x)
const {
return val-x;}
742 template <
class T,
class U>
748 std::ptrdiff_t operator-(
const T* x,
const Exclude<T*> y)
752 std::ptrdiff_t operator-(T* x,
const Exclude<T*> y)
755 template <
class T,
class U> T mod(T x, U y) {
return x%y;}
756 template <
class U>
float mod(
float x, U y) {
return std::fmod(x,y);}
757 template <
class U>
double mod(
double x, U y) {
return std::fmod(x,y);}
764 typedef bool& RefType;
765 typedef const bool& ConstRefType;
768 template <
class U>
explicit Exclude(
const U& x): val(x) {}
769 template <
class U>
bool operator=(
const U& x) {
return val=x;}
770 template <
class U>
operator U()
const {
return val;}
771 operator RefType () {
return val;}
772 operator ConstRefType ()
const {
return val;}
773 bool operator&&(
const bool& x)
const {
return val&&x;}
774 bool operator||(
const bool& x)
const {
return val||x;}
775 bool operator&=(
const bool& x) {
return val=val&&x;}
776 bool operator|=(
const bool& x) {
return val=val||x;}
777 bool operator!()
const {
return !val;}
783 template <
class action_t>
787 void operator()(action_t&,
const string&,U&) {}
797 static B& cast(C& x) {
return static_cast<B&
>(x);}
799 static const B& cast(
const C& x) {
return static_cast<const B&
>(x);}
806 string r(
".base_"+typeName<T>());
807 for (
size_t i=1; i<r.size(); ++i)
808 if (!isalnum(r[i])) r[i]=
'_';
can a temporary of type T be constructed and passed to an argument
Definition: classdesc.h:351
Definition: classdesc.h:326
Definition: classdesc.h:794
determines if T is a standard sequence container
Definition: classdesc.h:269
MPIbuf manipulator to send the MPIbuf's contents to a remote process.
Definition: classdescMP.h:37
Definition: classdesc.h:335
Definition: classdesc.h:329
Definition: classdesc.h:375
Definition: classdesc.h:667
Definition: classdesc.h:631
Definition: classdesc.h:623
Definition: classdesc.h:254
Definition: classdesc.h:629
Definition: classdesc.h:635
determines if this is a string
Definition: classdesc.h:280
Definition: classdesc.h:626
helper for constructing null descriptors
Definition: classdesc.h:784
helper for unpacking into map value_types
Definition: classdesc.h:655
Definition: classdesc.h:715
determines if T is a container
Definition: classdesc.h:319
Definition: classdesc.h:588
Definition: classdesc.h:332
Definition: classdesc.h:630
std::ostream & operator<<(std::ostream &s, const ecolab::Graph &x)
for use with TCL_obj. Graphviz format is used with the netgraph command.
Contains definitions related to classdesc functionality.
Definition: arrays.h:2514
controlled template specialisation: stolen from boost::enable_if.
Definition: classdesc.h:249
has default constructor, and is copiable
Definition: classdesc.h:346
Definition: classdesc.h:501
Definition: classdesc.h:266
Definition: classdesc.h:548
Definition: classdesc.h:533
string basename()
returns a valid identifier to append to the descriptor of a base class
Definition: classdesc.h:804
base class for exceptions thrown by classdesc
Definition: classdesc.h:366
determines if T is a standard associative container
Definition: classdesc.h:288
Definition: classdesc.h:678
enum symbol handling
Definition: classdesc.h:491
Definition: classdesc.h:704
Definition: classdesc.h:242