[AGENT++] NOT using persistency

Henning Eggers henning.eggers at plath.de
Fri Nov 26 15:25:14 CET 2004


Hi Frank,
the Mib class provides two Constructers, one is the default constructor the
other provides a persistency directory. I always thought that only when the
directory is provided, persistency is activated.

Now I found out that the default constructor calls the construct method with
a default value for the directory ("config/") and that the construct method
never setzs persistent_objects_path to NULL. This is especially strange when
I look through the code and see that persistent_objects_path is always
checked for being NULL before anything is done concerning persistency. The
is_persistency_activated() method is just a check if persistent_objects_path
is NULL or not.

I think having a hard-coded default path is a bad idea and suggest to have
the default constructor of the Mib class to deactivate persistency by
setting persistent_objects_path to NULL. Here is the relevant code snippet
from mib.cpp. The declaration of Mib::construct() in mib.h needs to be
amended, too.

----SNIP 8<------
/**
 * Default Constructor
 */
Mib::Mib()
{
    construct( 0 );
}

/**
 * Constructor with path where persistent MIB objects should be
 * stored to and loaded from.
 * @param path - The directory to store persistent objects.
 */
Mib::Mib(const OctetStr& path)
{
 construct( &path );
}

// Destructor unchanged

void Mib::construct( const OctetStr* path)
{
 instance = this;
    if( path == 0 )
        persistent_objects_path = 0;
    else
     persistent_objects_path = new OctetStr(*path);

 // more construct stuff ommited
}

----SNAP 8<------

How about that?

Henning





More information about the AGENTPP mailing list