Jpp  master_rocky
the software that should make you happy
JTest.hh
Go to the documentation of this file.
1 #ifndef __JLANG__JTEST__
2 #define __JLANG__JTEST__
3 
4 
5 /**
6  * \author mdejong
7  */
8 
9 namespace JLANG {}
10 namespace JPP { using namespace JLANG; }
11 
12 namespace JLANG {
13 
14  /**
15  * Auxiliary base class for compile time evaluation of test.
16  *
17  * The derived class should implement the static method JTest::test,
18  * returning JTest::JTrue.
19  * The macro JTest::JTEST will then return true if the given test is successful.
20  */
21  struct JTest {
22  protected:
23 
24  struct JTrue { char buffer; }; //!< definition of true
25  struct JFalse { int buffer; }; //!< definition of false
26 
27  static JFalse test(...); //!< default false
28 
29  template<class __T__>
30  static JFalse test(...); //!< default false
31 
32 
33  /**
34  * Auxiliary class for type checking.
35  */
36  template<class U, U> struct JTypecheck;
37 
38 
39  /**
40  * Test macro.
41  *
42  * \param __A__ test
43  * \return true if test successful; else false
44  */
45 #define JTEST(__A__) (sizeof(__A__) == sizeof(JTrue))
46  };
47 }
48 
49 #endif
Auxiliary classes and methods for language specific functionality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
definition of false
Definition: JTest.hh:25
definition of true
Definition: JTest.hh:24
Auxiliary class for type checking.
Definition: JTest.hh:36
Auxiliary base class for compile time evaluation of test.
Definition: JTest.hh:21
static JFalse test(...)
default false
static JFalse test(...)
default false