00001 // Package : omniIFR 00002 // Contained.h 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 #ifndef OMNIIFR__CONTAINED_H 00024 #define OMNIIFR__CONTAINED_H 00025 00026 #include "IRObject.h" 00027 00028 using namespace CORBA; 00029 00030 namespace Omniifr { 00031 00032 class Repository_impl; 00033 class Container_impl; 00034 00035 class Contained_impl : 00036 public virtual POA_CORBA::Contained, 00037 public virtual IRObject_impl 00038 { 00039 public: // CORBA interface methods 00040 00041 // read/write attributes 00042 char* id(); 00043 void id( const char* ); 00044 char* name(); 00045 void name( const char* ); 00046 char* version(); 00047 void version( const char* ); 00048 // readonly attributes 00049 Container_ptr defined_in(); 00050 char* absolute_name(); 00051 Repository_ptr containing_repository(); 00052 // methods 00053 virtual CORBA::Contained::Description* describe() =0; 00054 void move(Container_ptr, const char*, const char*); 00055 00056 public: 00057 Contained_impl(){} 00067 void init( 00068 const char* id, 00069 const char* name, 00070 const char* version, 00071 Container_impl* defined_in, 00072 int index =0 00073 ); 00074 virtual ~Contained_impl() {} 00075 virtual void uncheckedDestroy() =0; 00079 int _index; 00080 protected: 00081 RepositoryId_var _id; 00082 Identifier_var _name; 00083 VersionSpec_var _version; 00084 00086 char* definedInId(); 00087 00097 void outputSelf(ostream &os, const char* className) 00098 { 00099 os<<"NAME"<<_absolute_name.in()<<" oid="; 00100 outputOid(os); 00101 os<<"\n id="<<_id.in()<< 00102 "\n version="<<_version.in()<< 00103 "\n class="<<className<< 00104 "\n index="<<_index; 00105 } 00106 00107 private: 00108 Container_impl* _defined_in; 00109 ScopedName_var _absolute_name; 00110 private: 00112 void updateAbsoluteName(); 00113 }; // Contained_impl 00114 00115 } // end namespace Omniifr 00116 00117 #endif // OMNIIFR__CONTAINED_H