Mirror reflection library 0.5.13

/home/chochlik/devel/mirror-lib/src/mirror/example/factories/person.hpp

00001 
00012 #ifndef MIRROR_EXAMPLE_FACTORIES_TETRAHEDRON_1011291729_HPP
00013 #define MIRROR_EXAMPLE_FACTORIES_TETRAHEDRON_1011291729_HPP
00014 
00015 #include <mirror/meta_class.hpp>
00016 #include <mirror/meta_enum.hpp>
00017 #include <mirror/pre_registered/type/native.hpp>
00018 #include <string>
00019 #include <ctime>
00020 
00021 namespace test {
00022 
00023 enum class gender
00024 {
00025     female,
00026     male
00027 };
00028 
00029 struct person
00030 {
00031     std::string first_name;
00032     std::string middle_name;
00033     std::string family_name;
00034 
00035     std::tm birth_date;
00036     gender sex;
00037 
00038     float weight;
00039     float height;
00040 
00041     person(
00042         const std::string& _first_name,
00043         const std::string& _family_name,
00044         const std::tm _birth_date,
00045         gender _sex,
00046         float _weight,
00047         float _height
00048     ): first_name(_first_name)
00049      , family_name(_family_name)
00050      , birth_date(_birth_date)
00051      , sex(_sex)
00052      , weight(_weight)
00053      , height(_height)
00054     { }
00055 
00056     person(
00057         const std::string& _first_name,
00058         const std::string& _middle_name,
00059         const std::string& _family_name,
00060         const std::tm _birth_date,
00061         gender _sex,
00062         float _weight,
00063         float _height
00064     ): first_name(_first_name)
00065      , middle_name(_middle_name)
00066      , family_name(_family_name)
00067      , birth_date(_birth_date)
00068      , sex(_sex)
00069      , weight(_weight)
00070      , height(_height)
00071     { }
00072 
00073     void remeasure(float _weight, float _height)
00074     {
00075         weight = _weight;
00076         height = _height;
00077     }
00078 };
00079 
00080 } // namespace test
00081 
00082 MIRROR_REG_BEGIN
00083 
00084 MIRROR_QREG_GLOBAL_SCOPE_NAMESPACE(test)
00085 
00086 MIRROR_REG_ENUM_BEGIN(test, gender)
00087     MIRROR_REG_ENUM_VALUE(female)
00088     MIRROR_REG_ENUM_VALUE(male)
00089 MIRROR_REG_ENUM_END
00090 
00091 MIRROR_REG_CLASS_BEGIN(struct, test, person)
00092 MIRROR_REG_CLASS_MEM_VARS_BEGIN
00093     MIRROR_REG_CLASS_MEM_VAR(_, _, _, first_name)
00094     MIRROR_REG_CLASS_MEM_VAR(_, _, _, middle_name)
00095     MIRROR_REG_CLASS_MEM_VAR(_, _, _, family_name)
00096     MIRROR_REG_CLASS_MEM_VAR(_, _, _, birth_date)
00097     MIRROR_REG_CLASS_MEM_VAR(_, _, _, sex)
00098     MIRROR_REG_CLASS_MEM_VAR(_, _, _, weight)
00099     MIRROR_REG_CLASS_MEM_VAR(_, _, _, height)
00100 MIRROR_REG_CLASS_MEM_VARS_END
00101 MIRROR_REG_CONSTRUCTORS_BEGIN
00102     MIRROR_REG_COPY_CONSTRUCTOR(public)
00103 
00104     MIRROR_REG_CONSTRUCTOR_BEGIN(public, 1)
00105         MIRROR_REG_CONSTRUCTOR_PARAM(_, first_name)
00106         MIRROR_REG_CONSTRUCTOR_PARAM(_, family_name)
00107         MIRROR_REG_CONSTRUCTOR_PARAM(_, birth_date)
00108         MIRROR_REG_CONSTRUCTOR_PARAM(_, sex)
00109         MIRROR_REG_CONSTRUCTOR_PARAM(_, weight)
00110         MIRROR_REG_CONSTRUCTOR_PARAM(_, height)
00111     MIRROR_REG_CONSTRUCTOR_END(1)
00112 
00113     MIRROR_REG_CONSTRUCTOR_BEGIN(public, 2)
00114         MIRROR_REG_CONSTRUCTOR_PARAM(_, first_name)
00115         MIRROR_REG_CONSTRUCTOR_PARAM(_, middle_name)
00116         MIRROR_REG_CONSTRUCTOR_PARAM(_, family_name)
00117         MIRROR_REG_CONSTRUCTOR_PARAM(_, birth_date)
00118         MIRROR_REG_CONSTRUCTOR_PARAM(_, sex)
00119         MIRROR_REG_CONSTRUCTOR_PARAM(_, weight)
00120         MIRROR_REG_CONSTRUCTOR_PARAM(_, height)
00121     MIRROR_REG_CONSTRUCTOR_END(2)
00122 MIRROR_REG_CONSTRUCTORS_END
00123 
00124 MIRROR_REG_MEM_FUNCTIONS_BEGIN
00125     MIRROR_REG_MEM_OVLD_FUNC_BEGIN(remeasure)
00126     MIRROR_REG_MEM_FUNCTION_BEGIN(public, _, void, remeasure, _)
00127         MIRROR_REG_MEM_FUNCTION_PARAM(_, weight)
00128         MIRROR_REG_MEM_FUNCTION_PARAM(_, height)
00129     MIRROR_REG_MEM_FUNCTION_END(_,_)
00130     MIRROR_REG_MEM_OVLD_FUNC_END(remeasure)
00131 MIRROR_REG_MEM_FUNCTIONS_END
00132 MIRROR_REG_CLASS_END
00133 
00134 MIRROR_REG_END
00135 
00136 #endif
00137 

Copyright © 2006-2011 Matus Chochlik, University of Zilina, Zilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Fri Dec 16 2011 by Doxygen (version 1.7.3).
Important note: Although the 'boostified' version of Mirror uses the Boost C++ libraries Coding Guidelines and is implemented inside of the boost namespace, it IS NOT an officially reviewed and accepted Boost library. Mirror is being developed with the intention to be submitted for review for inclusion to the Boost C++ libraries.