00001 #ifndef ITEM_CLASS_HXX_ 00002 # define ITEM_CLASS_HXX_ 00003 00004 # include "item_class.hh" 00005 # include "item_name.hh" 00006 00007 namespace objects 00008 { 00009 template<int ITEM_CLASS_ID> 00010 DefItemClass<ITEM_CLASS_ID>::DefItemClass() : ItemClass() 00011 { 00012 } 00013 00014 template<int ITEM_CLASS_ID> 00015 void 00016 DefItemClass<ITEM_CLASS_ID>::accept(ItemVisitor &iv) 00017 { 00018 iv(*this); 00019 } 00020 00021 template<int ITEM_CLASS_ID> 00022 int 00023 DefItemClass<ITEM_CLASS_ID>::get_id() const 00024 { 00025 return DefItemClass<ITEM_CLASS_ID>::id; 00026 } 00027 00028 template<int ITEM_CLASS_ID> 00029 const std::string & 00030 DefItemClass<ITEM_CLASS_ID>::get_name() 00031 { 00032 ItemName in; 00033 in(*this); 00034 return in.result(); 00035 } 00036 00037 template<int ITEM_CLASS_ID> 00038 void 00039 DefItemClass<ITEM_CLASS_ID>::print(std::ostream &os) 00040 { 00041 os << get_name(); 00042 } 00043 00044 inline std::ostream & 00045 operator <<(std::ostream &os, const ItemClass &ic) 00046 { 00047 (const_cast<ItemClass &>(ic)).print(os); 00048 return os; 00049 } 00050 } 00051 00052 #endif