00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "EnumDef.h"
00024 #include "Repository.h"
00025 #include "IdentifierUtil.h"
00026 #include "PersistNode.h"
00027
00028 namespace Omniifr {
00029
00030 EnumMemberSeq* EnumDef_impl::members()
00031 {
00032 return new EnumMemberSeq(_members);
00033 }
00034
00035 void EnumDef_impl::members(const EnumMemberSeq& v)
00036 {
00037 checkReadonly();
00038
00039 for(ULong i=0; i<v.length(); i++)
00040 {
00041 IdentifierUtil::checkInvalid(v[i]);
00042 for(ULong j=0; j<i; j++)
00043 {
00044 if(0==strcasecmp(v[i],v[j]))
00045 throw CORBA::BAD_PARAM(
00046 IFELSE_OMNIORB4(omni::BAD_PARAM_ValueFactoryFailure,1),
00047 CORBA::COMPLETED_NO
00048 );
00049 }
00050 }
00051
00052 _members=v;
00053 }
00054
00055 TypeCode_ptr EnumDef_impl::type()
00056 {
00057 return Repository_impl::inst()._orb
00058 ->create_enum_tc(_id.in(),_name.in(),_members);
00059 }
00060
00061 void EnumDef_impl::uncheckedDestroy()
00062 {
00063 Contained_impl::uncheckedDestroy();
00064 }
00065
00066 void EnumDef_impl::reincarnate(const PersistNode& node)
00067 {
00068 cdrMemoryStream memstr =node.attrCdrStream("state");
00069 _members<<=memstr;
00070 }
00071
00072 void EnumDef_impl::output(ostream &os)
00073 {
00074 outputSelf(os,"EnumDef");
00075 cdrMemoryStream memstr(CORBA::ULong(0),CORBA::Boolean(1));
00076 _members>>=memstr;
00077 PersistNode::outputCdrMemoryStream(os,memstr,"\n state=");
00078 os<<" ;;\n";
00079 }
00080
00081 }