TAO_Notify::Standard_Event_Persistence Class Reference

The standard implementation of the Event_Persistence_Strategy interface. More...

#include <Standard_Event_Persistence.h>

Inheritance diagram for TAO_Notify::Standard_Event_Persistence:

Inheritance graph
[legend]
Collaboration diagram for TAO_Notify::Standard_Event_Persistence:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Standard_Event_Persistence ()
 Constructor.
virtual ~Standard_Event_Persistence ()
 Destructor.
virtual int init (int argc, ACE_TCHAR *argv[])
virtual int fini ()
virtual Event_Persistence_Factoryget_factory ()

Private Member Functions

virtual void reset ()

Private Attributes

ACE_TString filename_
ACE_UINT32 block_size_
Standard_Event_Persistence_Factoryfactory_

Detailed Description

The standard implementation of the Event_Persistence_Strategy interface.

Definition at line 101 of file Standard_Event_Persistence.h.


Constructor & Destructor Documentation

TAO_Notify::Standard_Event_Persistence::Standard_Event_Persistence (  ) 

Constructor.

Definition at line 15 of file Standard_Event_Persistence.cpp.

00016   : filename_ (ACE_TEXT ("__PERSISTENT_EVENT__.DB"))
00017   , block_size_ (512)
00018   , factory_ (0)
00019 {
00020 }

TAO_Notify::Standard_Event_Persistence::~Standard_Event_Persistence (  )  [virtual]

Destructor.

Definition at line 22 of file Standard_Event_Persistence.cpp.

00023 {
00024 }


Member Function Documentation

int TAO_Notify::Standard_Event_Persistence::fini (  )  [virtual]

Reimplemented from ACE_Shared_Object.

Definition at line 108 of file Standard_Event_Persistence.cpp.

References factory_.

00109 {
00110   delete this->factory_;
00111   this->factory_ = 0;
00112   return 0;
00113 }

Event_Persistence_Factory * TAO_Notify::Standard_Event_Persistence::get_factory (  )  [virtual]

Implements TAO_Notify::Event_Persistence_Strategy.

Definition at line 28 of file Standard_Event_Persistence.cpp.

References ACE_NEW_NORETURN, and factory_.

00029 {
00030   //@@todo guard? ; doublecheck?
00031   if (this->factory_ == 0)
00032   {
00033     ACE_NEW_NORETURN (
00034       this->factory_,
00035       Standard_Event_Persistence_Factory ()
00036       );
00037     if (this->factory_ != 0)
00038     {
00039       if (!this->factory_->open (this->filename_.c_str ()))
00040       {
00041         this->factory_ = 0;
00042       }
00043     }
00044   }
00045   return this->factory_;
00046 }

int TAO_Notify::Standard_Event_Persistence::init ( int  argc,
ACE_TCHAR argv[] 
) [virtual]

Reimplemented from ACE_Shared_Object.

Definition at line 57 of file Standard_Event_Persistence.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), ACE_OS::atoi(), block_size_, filename_, LM_DEBUG, LM_ERROR, ACE_OS::strcasecmp(), and TAO_debug_level.

00058 {
00059   int result = 0;
00060   bool verbose = false;
00061   for (int narg = 0; narg < argc; ++narg)
00062   {
00063     ACE_TCHAR * av = argv[narg];
00064     if (ACE_OS::strcasecmp (av, ACE_TEXT ("-v")) == 0)
00065     {
00066       verbose = true;
00067       ACE_DEBUG ((LM_DEBUG,
00068         ACE_TEXT ("(%P|%t) Standard_Event_Persistence: -verbose\n")
00069         ));
00070     }
00071     else if (ACE_OS::strcasecmp (av, ACE_TEXT ("-file_path")) == 0 && narg + 1 < argc)
00072     {
00073       this->filename_ = argv[narg + 1];
00074       if (TAO_debug_level > 0 || verbose)
00075       {
00076         ACE_DEBUG ((LM_DEBUG,
00077           ACE_TEXT ("(%P|%t) Standard_Event_Persistence: Setting -file_path: %s\n"),
00078           this->filename_.c_str ()
00079         ));
00080       }
00081       narg += 1;
00082     }
00083     else if (ACE_OS::strcasecmp (av, ACE_TEXT ("-block_size")) == 0 && narg + 1 < argc)
00084     {
00085       this->block_size_ = ACE_OS::atoi(argv[narg + 1]);
00086       if (TAO_debug_level > 0 || verbose)
00087       {
00088         ACE_DEBUG ((LM_DEBUG,
00089           ACE_TEXT ("(%P|%t) Standard_Event_Persistence: Setting -block_size: %d\n"),
00090           this->block_size_
00091         ));
00092       }
00093       narg += 1;
00094     }
00095     else
00096     {
00097       ACE_ERROR ((LM_ERROR,
00098         ACE_TEXT ("(%P|%t) Unknown parameter to Standard Event Persistence: %s\n"),
00099         argv[narg]
00100         ));
00101       result = -1;
00102     }
00103   }
00104   return result;
00105 }

void TAO_Notify::Standard_Event_Persistence::reset (  )  [private, virtual]

Implements TAO_Notify::Event_Persistence_Strategy.

Definition at line 50 of file Standard_Event_Persistence.cpp.

References factory_.

00051 {
00052   delete this->factory_;
00053   this->factory_ = 0;
00054 }


Member Data Documentation

ACE_UINT32 TAO_Notify::Standard_Event_Persistence::block_size_ [private]

Definition at line 124 of file Standard_Event_Persistence.h.

Referenced by init().

Standard_Event_Persistence_Factory* TAO_Notify::Standard_Event_Persistence::factory_ [private]

Definition at line 125 of file Standard_Event_Persistence.h.

Referenced by fini(), get_factory(), and reset().

ACE_TString TAO_Notify::Standard_Event_Persistence::filename_ [private]

Definition at line 123 of file Standard_Event_Persistence.h.

Referenced by init().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:46:44 2010 for TAO_CosNotification by  doxygen 1.4.7