#include <IRObject.h>
Inheritance diagram for Omniifr::IRObject_impl:
Public Member Functions | |
virtual CORBA::DefinitionKind | def_kind ()=0 |
virtual void | destroy () |
IRObject_impl () | |
virtual | ~IRObject_impl () |
void | activateObject () |
A new unique ID is assigned. | |
void | activateObjectWithId (const char *oidStr) |
void | deactivateObject () |
virtual PortableServer::POA_ptr | _default_POA () |
Returns a reference to this servant's default POA. | |
void | depend (const DependencyBase *dependency) |
An an incoming dependency to this object. | |
void | undepend (const DependencyBase *dependency) |
Remove a dependency to this object. | |
virtual void | dependentObjectSet (set< const IRObject_impl * > &result) const |
'result' is set to the set union of 'result's initial value and the set of all objects that depend upon this object (or its children). | |
virtual void | containedObjectSet (set< const IRObject_impl * > &result) const |
'result' is set to the set union of 'result's initial value and the set of all objects contained by this object, plus this object itself. | |
virtual void | uncheckedDestroy ()=0 |
Destroys this object, without first checking for dependencies. | |
virtual void | reincarnate (const PersistNode &node) |
Re-create the repository from information saved in the log file. | |
virtual void | output (ostream &os)=0 |
Save this object's state to a stream. | |
void | outputOid (ostream &os) |
Save this object's OID to a stream. | |
bool | checkReadonly () const |
Throws CORBA::NO_PERMISSION if the Repository is readonly, but only if _activated is also TRUE. | |
Private Attributes | |
multiset< const DependencyBase * > | _dependencies |
bool | _activated |
Set to TRUE when activateObject...() is called. |
|
Definition at line 88 of file IRObject.h. References _activated. 00088 :_activated(false){}
|
|
Definition at line 89 of file IRObject.h. References _dependencies, and DB. 00090 { 00091 if(!_dependencies.empty()) 00092 DB(1,"Destructed object still has dependencies. Wait for it...") 00093 }
|
|
Returns a reference to this servant's default POA. The default implementation returns a reference to the Repository's _poa. Reimplemented in Omniifr::Repository_impl. Definition at line 129 of file IRObject.cc. Referenced by activateObjectWithId(), and Omniifr::Contained_impl::move(). 00130 {
00131 return PortableServer::POA::_duplicate(Repository_impl::inst()._poa.in());
00132 }
|
|
A new unique ID is assigned.
Definition at line 134 of file IRObject.cc. References activateObjectWithId(). 00135 { 00136 // Generate a new unique ID. 00137 static long count=0; 00138 static omni_mutex mutex; 00139 int mypid =getpid(); // MS VC++6 doesn't have type pid_t! 00140 unsigned long sec,nsec; 00141 omni_thread::get_time(&sec,&nsec); // More portable than just time(). 00142 char buf[128]; 00143 { 00144 omni_mutex_lock l(mutex); 00145 sprintf(buf,"%lx.%d.%lx",++count,mypid,sec); 00146 } 00147 activateObjectWithId(buf); 00148 }
|
|
Definition at line 150 of file IRObject.cc. References _activated, _default_POA(), DB, and IFELSE_OMNIORB4. Referenced by activateObject(), Omniifr::Repository_impl::init(), and Omniifr::PrimitiveDef_impl::PrimitiveDef_impl(). 00151 { 00152 using namespace PortableServer; 00153 PortableServer::POA_var poa =_default_POA(); 00154 CORBA::String_var poaName =poa->the_name(); 00155 DB(9,"Activating object "<<poaName.in()<<"/"<<oidStr); 00156 try 00157 { 00158 ObjectId_var oid =string_to_ObjectId(oidStr); 00159 poa->activate_object_with_id(oid.in(),this); 00160 _activated=true; 00161 } 00162 catch(CORBA::BAD_PARAM& ex) 00163 { 00164 cerr<<"Can't activate "<<oidStr<<".\n" 00165 "BAD_PARAM" IFELSE_OMNIORB4(": "<<ex.NP_minorString(),) <<endl; 00166 } 00167 catch(POA::ServantAlreadyActive& ex) 00168 { 00169 cerr<<"Can't activate "<<oidStr<<".\nServant is already active."<<endl; 00170 } 00171 catch(POA::ObjectAlreadyActive& ex) 00172 { 00173 cerr<<"Can't activate "<<oidStr<<".\nObject is already active."<<endl; 00174 } 00175 catch(POA::WrongPolicy& ex) 00176 { 00177 cerr<<"Can't activate "<<oidStr<<".\nPOA '"<<poaName.in() 00178 <<"' has wrong policy for activate_object_with_id()."<<endl; 00179 exit(1); // Programming error - so quit. 00180 } 00181 }
|
|
|
'result' is set to the set union of 'result's initial value and the set of all objects contained by this object, plus this object itself.
Reimplemented in Omniifr::Container_impl. Definition at line 139 of file IRObject.h. Referenced by destroy(). 00140 {
00141 result.insert(this);
00142 }
|
|
Definition at line 184 of file IRObject.cc. References DB, and Omniifr::getPoaAndOid(). Referenced by destroy(). 00185 { 00186 using namespace PortableServer; 00187 POA_var poa; 00188 CORBA::String_var poaName; 00189 ObjectId_var oid; 00190 CORBA::String_var oidStr; 00191 getPoaAndOid(this,poa,poaName,oid,oidStr); 00192 00193 try 00194 { 00195 DB(10,"Deactivating object "<<poaName<<"/"<<oidStr.in()); 00196 poa->deactivate_object(oid.in()); 00197 } 00198 catch(POA::ObjectNotActive& ex) 00199 { 00200 cerr<<"Can't deactivate "<<oidStr<<".\nObject is not active."<<endl; 00201 } 00202 catch(POA::WrongPolicy& ex) 00203 { 00204 cerr<<"Can't deactivate "<<oidStr<<".\nPOA '"<<poaName.in() 00205 <<"' has wrong policy for deactivate_object()."<<endl; 00206 exit(1); // Programming error - so quit. 00207 } 00208 }
|
|
|
An an incoming dependency to this object. The object dependency->owner() needs this object. This object cannot be destroyed while the dependency exists. Definition at line 109 of file IRObject.h. References _dependencies. Referenced by Omniifr::Dependency3< StructMemberSeq >::set(), Omniifr::Dependency2< InterfaceDefSeq >::set(), and Omniifr::Dependency1< CORBA::IDLType >::set(). 00110 { 00111 _add_ref(); 00112 _dependencies.insert(dependency); 00113 }
|
|
'result' is set to the set union of 'result's initial value and the set of all objects that depend upon this object (or its children).
Reimplemented in Omniifr::Container_impl. Definition at line 126 of file IRObject.h. References _dependencies. Referenced by destroy(). 00127 { 00128 for(multiset<const DependencyBase*>::const_iterator i=_dependencies.begin(); 00129 i!=_dependencies.end(); 00130 ++i) 00131 { 00132 result.insert((**i).owner()); 00133 } 00134 }
|
|
Reimplemented in Omniifr::PrimitiveDef_impl. Definition at line 87 of file IRObject.cc. References containedObjectSet(), deactivateObject(), dependentObjectSet(), IFELSE_OMNIORB4, and uncheckedDestroy(). 00088 { 00089 bool dependencyPreventsDestruction =true; 00090 00091 set<const IRObject_impl*> localDeps; 00092 this->dependentObjectSet(localDeps); 00093 00094 if(localDeps.empty()) 00095 { 00096 dependencyPreventsDestruction=false; 00097 } 00098 else 00099 { 00100 set<const IRObject_impl*> localObjs; 00101 this->containedObjectSet(localObjs); 00102 00103 set<const IRObject_impl*> externalDeps; 00104 set_difference( 00105 localDeps.begin(),localDeps.end(), 00106 localObjs.begin(),localObjs.end(), 00107 inserter(externalDeps,externalDeps.end()) 00108 ); 00109 if(externalDeps.empty()) 00110 dependencyPreventsDestruction=false; 00111 } 00112 00113 if(dependencyPreventsDestruction) 00114 { 00115 // Specification dictates the following exception: 00116 throw CORBA::BAD_INV_ORDER( 00117 IFELSE_OMNIORB4(omni::BAD_INV_ORDER_DependencyPreventsDestruction,1), 00118 CORBA::COMPLETED_NO 00119 ); 00120 } 00121 else 00122 { 00123 this->uncheckedDestroy(); 00124 this->deactivateObject(); 00125 _remove_ref(); // Kill the constructor's reference to this. 00126 } 00127 }
|
|
|
Save this object's OID to a stream.
Definition at line 218 of file IRObject.cc. References Omniifr::getPoaAndOid(). Referenced by Omniifr::WstringDef_impl::output(), Omniifr::StringDef_impl::output(), Omniifr::SequenceDef_impl::output(), Omniifr::FixedDef_impl::output(), Omniifr::ArrayDef_impl::output(), and Omniifr::Contained_impl::outputSelf(). 00219 { 00220 using namespace PortableServer; 00221 POA_var poa; 00222 CORBA::String_var poaName; 00223 ObjectId_var oid; 00224 CORBA::String_var oidStr; 00225 getPoaAndOid(this,poa,poaName,oid,oidStr); 00226 00227 os<<oidStr.in(); 00228 }
|
|
Re-create the repository from information saved in the log file.
Reimplemented in Omniifr::AliasDef_impl, Omniifr::ArrayDef_impl, Omniifr::AttributeDef_impl, Omniifr::ConstantDef_impl, Omniifr::EnumDef_impl, Omniifr::ExceptionDef_impl, Omniifr::InterfaceDef_impl, Omniifr::OperationDef_impl, Omniifr::Repository_impl, Omniifr::SequenceDef_impl, Omniifr::StructDef_impl, and Omniifr::UnionDef_impl. Definition at line 211 of file IRObject.cc. Referenced by Omniifr::Repository_impl::reincarnate(). 00212 { 00213 cerr<<"Failed attempt to reincarnate. Wrong class."<<endl; 00214 node.output(cerr,"Error Node"); 00215 }
|
|
Destroys this object, without first checking for dependencies.
Implemented in Omniifr::AliasDef_impl, Omniifr::ArrayDef_impl, Omniifr::AttributeDef_impl, Omniifr::ConstantDef_impl, Omniifr::Contained_impl, Omniifr::Container_impl, Omniifr::EnumDef_impl, Omniifr::ExceptionDef_impl, Omniifr::FixedDef_impl, Omniifr::InterfaceDef_impl, Omniifr::ModuleDef_impl, Omniifr::OperationDef_impl, Omniifr::PrimitiveDef_impl, Omniifr::Repository_impl, Omniifr::SequenceDef_impl, Omniifr::StringDef_impl, Omniifr::StructDef_impl, Omniifr::UnionDef_impl, and Omniifr::WstringDef_impl. Referenced by destroy(). |
|
Remove a dependency to this object. This object can only be destroyed when all dependencies have been removed. Definition at line 117 of file IRObject.h. References _dependencies. Referenced by Omniifr::Dependency3< StructMemberSeq >::clear(), Omniifr::Dependency2< InterfaceDefSeq >::clear(), and Omniifr::Dependency1< CORBA::IDLType >::clear(). 00118 { 00119 _dependencies.erase(dependency); 00120 _remove_ref(); 00121 }
|
|
Set to TRUE when activateObject...() is called.
Definition at line 85 of file IRObject.h. Referenced by activateObjectWithId(), checkReadonly(), and IRObject_impl(). |
|
Definition at line 84 of file IRObject.h. Referenced by depend(), dependentObjectSet(), undepend(), and ~IRObject_impl(). |