class_adaptor.hpp
Go to the documentation of this file.
00001 /*********************************************************************
00002 * Software License Agreement (BSD License)
00003 *
00004 *  Copyright (c) 2010, LABUST, UNIZG-FER
00005 *  All rights reserved.
00006 *
00007 *  Redistribution and use in source and binary forms, with or without
00008 *  modification, are permitted provided that the following conditions
00009 *  are met:
00010 *
00011 *   * Redistributions of source code must retain the above copyright
00012 *     notice, this list of conditions and the following disclaimer.
00013 *   * Redistributions in binary form must reproduce the above
00014 *     copyright notice, this list of conditions and the following
00015 *     disclaimer in the documentation and/or other materials provided
00016 *     with the distribution.
00017 *   * Neither the name of the LABUST nor the names of its
00018 *     contributors may be used to endorse or promote products derived
00019 *     from this software without specific prior written permission.
00020 *
00021 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028 *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029 *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031 *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032 *  POSSIBILITY OF SUCH DAMAGE.
00033 *********************************************************************/
00034 #ifndef CLASS_ADAPTOR_HPP_
00035 #define CLASS_ADAPTOR_HPP_
00036 #include <boost/preprocessor/tuple/elem.hpp>
00037 #include <boost/preprocessor/seq/for_each_i.hpp>
00038 #include <boost/preprocessor/seq/for_each.hpp>
00039 #include <boost/preprocessor/cat.hpp>
00040 #include <boost/preprocessor/dec.hpp>
00041 #include <boost/preprocessor/seq/size.hpp>
00042 #include <boost/preprocessor/repetition/repeat.hpp>
00043 #include <boost/preprocessor/control/if.hpp>
00044 
00045 #define PP_LABUST_NAMESPACE_BEGIN(R,DATA,ELEM) \
00046         namespace ELEM{
00047 
00048 #define PP_LABUST_NAMESPACE_ENUM(R,DATA,ELEM) ELEM::
00049 
00050 #define PP_LABUST_NAMESPACE_END(Z,I,DATA) }
00051 
00052 #define PP_LABUST_MAKE_STRING_LVL1(string) #string
00053 #define PP_LABUST_MAKE_STRING_LVL2(string) PP_LABUST_MAKE_STRING_LVL1(string)
00054 
00055 #define PP_LABUST_FILLER_0(X, Y) \
00056         ((X, Y)) PP_LABUST_FILLER_1
00057 #define PP_LABUST_FILLER_1(X, Y) \
00058         ((X, Y)) PP_LABUST_FILLER_0
00059 #define PP_LABUST_FILLER_0_END
00060 #define PP_LABUST_FILLER_1_END
00061 
00062 #define PP_LABUST_ATTRIBUTE_EXPAND(R, ATTRIBUTE_TUPEL_SIZE, ATTRIBUTE)   \
00063   BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,0,ATTRIBUTE) BOOST_PP_TUPLE_ELEM(ATTRIBUTE_TUPEL_SIZE,1,ATTRIBUTE); \
00064 
00065 #define PP_LABUST_NAMESPACE_DEFINITIONS_BEGIN(NAMESPACE_SEQ) \
00066         BOOST_PP_IF(                                                                                                                                                            \
00067                 BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(NAMESPACE_SEQ)),         \
00068     BOOST_PP_SEQ_FOR_EACH_R,                                                                                                    \
00069     BOOST_PP_TUPLE_EAT(4))(                                                                                                             \
00070         1, PP_LABUST_NAMESPACE_BEGIN,                                                                                                   \
00071       _, BOOST_PP_SEQ_TAIL(NAMESPACE_SEQ))
00072 
00073 #define PP_LABUST_NAMESPACE_DEFINITIONS_ENUM(NAMESPACE_SEQ) \
00074         BOOST_PP_IF(                                                                                                                                                            \
00075                 BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(NAMESPACE_SEQ)),         \
00076     BOOST_PP_SEQ_FOR_EACH_R,                                                                                                    \
00077     BOOST_PP_TUPLE_EAT(4))(                                                                                                             \
00078         1, PP_LABUST_NAMESPACE_ENUM,                                                                                                    \
00079       _, BOOST_PP_SEQ_TAIL(NAMESPACE_SEQ))
00080 
00081 #define PP_LABUST_NAMESPACE_DEFINITIONS_END(NAMESPACE_SEQ)                                                                      \
00082         BOOST_PP_REPEAT_1(                                                                                                      \
00083                 BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(NAMESPACE_SEQ)), \
00084     PP_LABUST_NAMESPACE_END, _)
00085 
00086 #define PP_LABUST_MACRO_ON_ATTRIBUTES(MACRO,ATTRIBUTES) \
00087         BOOST_PP_SEQ_FOR_EACH_R(1, MACRO, \
00088                 2, BOOST_PP_CAT(PP_LABUST_FILLER_0 ATTRIBUTES, _END))
00089 
00090 /* CLASS_ADAPTOR_HPP_ */
00091 #endif


snippets
Author(s): Gyula Nagy
autogenerated on Fri Aug 28 2015 11:22:33