Public Member Functions | Private Member Functions | Private Attributes

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.

  : filename_ (ACE_TEXT ("__PERSISTENT_EVENT__.DB"))
  , block_size_ (512)
  , factory_ (0)
{
}

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

Destructor.

Definition at line 22 of file Standard_Event_Persistence.cpp.

{
}


Member Function Documentation

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

Reimplemented from ACE_Shared_Object.

Definition at line 108 of file Standard_Event_Persistence.cpp.

{
  delete this->factory_;
  this->factory_ = 0;
  return 0;
}

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.

{
  //@@todo guard? ; doublecheck?
  if (this->factory_ == 0)
  {
    ACE_NEW_NORETURN (
      this->factory_,
      Standard_Event_Persistence_Factory ()
      );
    if (this->factory_ != 0)
    {
      if (!this->factory_->open (this->filename_.c_str ()))
      {
        this->factory_ = 0;
      }
    }
  }
  return this->factory_;
}

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.

{
  int result = 0;
  bool verbose = false;
  for (int narg = 0; narg < argc; ++narg)
  {
    ACE_TCHAR * av = argv[narg];
    if (ACE_OS::strcasecmp (av, ACE_TEXT ("-v")) == 0)
    {
      verbose = true;
      ACE_DEBUG ((LM_DEBUG,
        ACE_TEXT ("(%P|%t) Standard_Event_Persistence: -verbose\n")
        ));
    }
    else if (ACE_OS::strcasecmp (av, ACE_TEXT ("-file_path")) == 0 && narg + 1 < argc)
    {
      this->filename_ = argv[narg + 1];
      if (TAO_debug_level > 0 || verbose)
      {
        ACE_DEBUG ((LM_DEBUG,
          ACE_TEXT ("(%P|%t) Standard_Event_Persistence: Setting -file_path: %s\n"),
          this->filename_.c_str ()
        ));
      }
      narg += 1;
    }
    else if (ACE_OS::strcasecmp (av, ACE_TEXT ("-block_size")) == 0 && narg + 1 < argc)
    {
      this->block_size_ = ACE_OS::atoi(argv[narg + 1]);
      if (TAO_debug_level > 0 || verbose)
      {
        ACE_DEBUG ((LM_DEBUG,
          ACE_TEXT ("(%P|%t) Standard_Event_Persistence: Setting -block_size: %d\n"),
          this->block_size_
        ));
      }
      narg += 1;
    }
    else
    {
      ACE_ERROR ((LM_ERROR,
        ACE_TEXT ("(%P|%t) Unknown parameter to Standard Event Persistence: %s\n"),
        argv[narg]
        ));
      result = -1;
    }
  }
  return result;
}

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

Implements TAO_Notify::Event_Persistence_Strategy.

Definition at line 50 of file Standard_Event_Persistence.cpp.

{
  delete this->factory_;
  this->factory_ = 0;
}


Member Data Documentation

Definition at line 124 of file Standard_Event_Persistence.h.

Definition at line 125 of file Standard_Event_Persistence.h.

Definition at line 123 of file Standard_Event_Persistence.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines