00001 // 00002 // Copyright (c) 2003 00003 // Paul Hamilton; pHamtec P/L 00004 // 00005 // Permission to use, copy, modify, distribute and sell this software 00006 // and its documentation for any purpose is hereby granted without fee, 00007 // provided that the above copyright notice appears in all copies and 00008 // that both the copyright notice and this permission notice appear in 00009 // supporting documentation. No representations are made about the 00010 // suitability of this software for any purpose. It is provided "as is" 00011 // without express or implied warranty. 00012 // 00013 // base.hpp 00014 // 00015 // 28-Jun-2003 phamilton Created 00016 // 00017 00018 #ifndef incBASE 00019 #define incBASE 00020 00021 // forwards 00022 #include "../../common/object.hpp" 00023 #include "../../common/visitable_object.hpp" 00024 #include "../../common/outerable_object.hpp" 00025 #include "../../common/composition_object.hpp" 00026 00027 namespace reflect_test { 00028 00029 class base : 00030 public ph::common::object_base, 00031 public ph::common::visitable_object_base, 00032 public ph::common::outerable_object_base, 00033 ph::common::outerable_helper, 00034 public ph::common::composition_object_base 00035 /* 00036 Concrete subclass which represents a complete object for visitable. 00037 */ 00038 { 00039 public: 00040 base(const std::string &type, const std::string &name) : 00041 _type(type), _name(name) 00042 {}; 00043 virtual ~base() {}; 00044 00045 // ph::common::object_base overrides 00046 virtual ph::common::outerable_object_base *outerable() 00047 { return this; } 00048 virtual const ph::common::outerable_object_base *outerable() const 00049 { return this; } 00050 virtual const ph::common::composition_object_base *composition() const 00051 { return this; } 00052 virtual ph::common::composition_object_base *composition() 00053 { return this; } 00054 00055 // ph::common::outerable_object_base<object> overides 00056 virtual ph::common::object_base *outer() const { return outer_helper(); } 00057 virtual void outer(ph::common::object_base *outer) { outer_helper(outer); } 00058 00059 // visitable_object_base overrides 00060 virtual const visitable_object_base *visitable() const 00061 { return this; } 00062 virtual visitable_object_base *visitable() 00063 { return this; } 00064 00065 // object_base overrides 00066 virtual bool accept(ph::common::member_visitor *v); 00067 virtual bool accept(ph::common::const_member_visitor *v) const; 00068 virtual bool accept(ph::common::object_visitor *v) 00069 { return true; } 00070 virtual bool accept(ph::common::const_object_visitor *v) const 00071 { return true; } 00072 00073 private: 00074 std::string _type; 00075 std::string _name; 00076 }; 00077 00078 }; 00079 00080 #endif // incBASE