• Antelope Release 5.10 Linux CentOS release 7.6.1810 (Core) 3.10.0 2020-05-12

 

NAME

Oorb::Configure - Configuration base class for classes in the oorb library

SYNOPSIS

-loorb $(ORBLIBS)

#include "oorb.h"

namespace Oorb

template class<T> class Configure

DESCRIPTION

The Oorb(3) Configure class is a sub-class of BUConfigure(3) and forms a base-class with which to make classes in the Oorb library configurable. In addition to the standard types parsed by the BUConfigure(3) class, the Configure class defines the additional types of bool, for an official C++ bool i.e. boolean value; time, for an epoch time stored as a double-precision floating point and represented in input as a string interpretable by the str2epoch(3) function; and timedelta, for an epoch time difference value stored as a double-precision floating point. Null values for time and timedelta types parse to -9999999999.999. Expanding on the capabilities of the BUConfigure class, this Configure class is defined as a C++ template class, where the template argument T represents a struct typedef as documented in the BUConfigure(3) man-page, which struct the Configure class controls and configures. Unlike the BUConfigure(3) base class, the Configure class declares a public member of type T called m_params, then in its constructor automatically calls BUConfigure(3)'s setConfigureSpecs method to initialize m_params. Subclasses of Configure-based classes may further extend the configuration parameters of the object by declaring additional member structures, with associated typedefs, making sure to initialize them with setConfigureSpecs in the sub-class constructor. See the EXAMPLE below.

CONSTRUCTORS

EXAMPLE

What follows is an example of making a subclass of Configure(3), followed by a further subclassing:

#include "oorb.h"

using namespace Oorb;

typedef struct baseParamsStruct {
    int    aBaseParam;
} baseParamsStruct;

BU_ConfigureSpec baseConfigureSpecs[] = {
    { "int", "abaseparam", "1", BU_Offset( baseParamsStruct, aBaseParam ), 0, NULL },
    { "end", NULL, NULL, 0, 0, NULL }
};

class 	Base : public Configure<baseParamsStruct> {
    public:
        Base( void ) : Configure<baseConfigureSpecs> { return; };
        ~Base( void ) { return; };
};

typedef struct subParamsStruct {
    bool    subTrueFalse;
    char*   aSubParam;
} subParamsStruct;

BU_ConfigureSpec subConfigureSpecs[] = {
  { "bool", "subtruefalse", "false",  BU_Offset( subParamsStruct, subTrueFalse 0, NULL },
  { "string", "asubparam", "someval",  BU_Offset( subParamsStruct, aSubParam ), 0, NULL },
  { "end", NULL, NULL, 0, 0, NULL }
};

class Sub : public Base {
    public:
        Sub( void ) : Base() {
            memset( &(this->m_subParams), 0, sizeof( subParamsStruct ) );
            this->setConfigureSpecs( subConfigureSpecs, (char*) &(this->m_subParams), NULL );
            return;
        }
        ~Sub( void ) { return; }

        subParamsStruct m_subParams;
};

LIBRARY

-loorb $(ORBLIBS)

ATTRIBUTES

MT-Safe

SEE ALSO

Oorb(3), Oorb::ConfigMgrTask(3)

BUGS AND CAVEATS

This Configure base class should not be confused with the Oorb::ConfigMgrTask(3), which is used to configure specific Oorb(3)-library based programs.

AUTHOR

Kent Lindquist
Printer icon