Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

EnumDef.cc

Go to the documentation of this file.
00001 //                            Package   : omniIFR
00002 //  EnumDef.cc                Created   : 2004/02/22
00003 //                            Author    : Alex Tingle
00004 //
00005 //    Copyright (C) 2004 Alex Tingle.
00006 //
00007 //    This file is part of the omniIFR application.
00008 //
00009 //    omniIFR is free software; you can redistribute it and/or
00010 //    modify it under the terms of the GNU Lesser General Public
00011 //    License as published by the Free Software Foundation; either
00012 //    version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //    omniIFR is distributed in the hope that it will be useful,
00015 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //    Lesser General Public License for more details.
00018 //
00019 //    You should have received a copy of the GNU Lesser General Public
00020 //    License along with this library; if not, write to the Free Software
00021 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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   // Check for invalid v.
00039   for(ULong i=0; i<v.length(); i++)
00040   {
00041     IdentifierUtil::checkInvalid(v[i]); // throws BAD_PARAM if v[i] is invalid.
00042     for(ULong j=0; j<i; j++)
00043     {
00044       if(0==strcasecmp(v[i],v[j])) // case insensitive
00045           throw CORBA::BAD_PARAM(
00046             IFELSE_OMNIORB4(omni::BAD_PARAM_ValueFactoryFailure,1),
00047             CORBA::COMPLETED_NO
00048           );
00049     }
00050   }
00051   // Do the work.
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)/*clearMemory*/);
00076   _members>>=memstr;
00077   PersistNode::outputCdrMemoryStream(os,memstr,"\n state=");
00078   os<<" ;;\n";
00079 }
00080 
00081 } // end namespace Omniifr

Generated on Fri Mar 4 13:03:23 2005 for OmniIFR by  doxygen 1.4.1