TAO::PG_Group_List_Store::PG_Group_List_Store ( Storable_Factory & storable_factory) : next_group_id_ (0) , storable_factory_ (storable_factory) , loaded_from_stream_ (false) , last_changed_ (0) , stale_ (false) { // Create a temporary stream simply to check if a readable // version already exists. bool stream_exists = false; { ACE_Auto_Ptr<TAO::Storable_Base> stream ( this->create_stream ("r")); if (stream->exists ()) stream_exists = true; } if (stream_exists) { File_Guard fg(*this, SFG::CREATE_WITH_FILE); } else { File_Guard fg(*this, SFG::CREATE_WITHOUT_FILE); this->write (fg.peer ()); } }
Savable::Savable (TAO::Storable_Factory & storable_factory) : storable_factory_(storable_factory) , loaded_from_stream_ (false) { for (int index = 0; index < 2; ++index) { this->i_[index] = 0; this->ui_[index] = 0; this->bytes_size_[index] = 0; this->bytes_[index] = new char [this->bytes_size_max]; for (int i = 0; i < this->bytes_size_max; ++i) { this->bytes_[index][i] = ACE_CHAR_MAX; } } ACE_Auto_Ptr<TAO::Storable_Base> stream (storable_factory_.create_stream("test.dat", "r")); if (stream->exists ()) { Savable_File_Guard fg(*this, SFG::CREATE_WITH_FILE); } else { Savable_File_Guard fg(*this, SFG::CREATE_WITHOUT_FILE); this->write (fg.peer ()); } }
bool TAO::PG_Group_List_Store::list_obsolete () { // TODO: Upate if obsolete flag is set based on CORBA call. ACE_Auto_Ptr<TAO::Storable_Base> stream (this->create_stream ("r")); if (!stream->exists ()) throw CORBA::INTERNAL (); if (stream->open () != 0) throw CORBA::INTERNAL (); return this->is_obsolete (stream->last_changed ()); }
TAO::PG_Object_Group_Storable::~PG_Object_Group_Storable (void) { if (destroyed_) { ACE_Auto_Ptr<TAO::Storable_Base> stream ( this->create_stream ("r")); if (stream->exists ()) { stream->remove (); } } }
TAO::PG_Object_Group_Storable::PG_Object_Group_Storable ( CORBA::ORB_ptr orb, PortableGroup::FactoryRegistry_ptr factory_registry, TAO::PG_Object_Group_Manipulator & manipulator, CORBA::Object_ptr empty_group, const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, const PortableGroup::Criteria & the_criteria, const TAO::PG_Property_Set_var & type_properties, TAO::Storable_Factory & storable_factory) : PG_Object_Group(orb, factory_registry, manipulator, empty_group, tagged_component, type_id, the_criteria, type_properties) , group_previously_stored_(false) , group_id_previously_stored_(0) , storable_factory_ (storable_factory) , last_changed_ (0) , loaded_from_stream_ (false) , destroyed_ (false) , write_occurred_ (false) { // Create a temporary stream simply to check if a readable // version already exists. bool stream_exists = false; { ACE_Auto_Ptr<TAO::Storable_Base> stream ( this->create_stream ("r")); if (stream->exists ()) stream_exists = true; } if (stream_exists) { Object_Group_File_Guard fg (*this, SFG::CREATE_WITH_FILE); } else { Object_Group_File_Guard fg (*this, SFG::CREATE_WITHOUT_FILE); this->write (fg.peer ()); } }
TAO::PG_Object_Group_Storable::PG_Object_Group_Storable ( PortableGroup::ObjectGroupId group_id, CORBA::ORB_ptr orb, PortableGroup::FactoryRegistry_ptr factory_registry, TAO::PG_Object_Group_Manipulator & manipulator, TAO::Storable_Factory & storable_factory) : PG_Object_Group(orb, factory_registry, manipulator) , group_previously_stored_(true) , group_id_previously_stored_(group_id) , storable_factory_ (storable_factory) , last_changed_ (0) , loaded_from_stream_ (false) , destroyed_ (false) , write_occurred_ (false) { // Create a temporary stream to simply to check if a readable // version already exists. bool stream_exists = false; { ACE_Auto_Ptr<TAO::Storable_Base> stream ( this->create_stream ("r")); if (stream->exists ()) stream_exists = true; } if (stream_exists) { Object_Group_File_Guard fg (*this, SFG::ACCESSOR); } else { throw CORBA::INTERNAL (); } }