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

 

NAME

oorb - Library to create orbserver interaction programs

SYNOPSIS

-loorb $(ORBLIBS)

#include "oorb.h"

namespace Oorb

Basic Entities:


class    Orb

class    OrbPacket

class    OrbConnection

class    Queue

class    Configure

Tasks:


class    Task

class    ConfigMgrTask

class    Master

class    OrbConnectionTask

class    OrbReaderTask

class    OrbWriterTask

class    LogMgrTask

class    SignalMgrTask

class    StateMgrTask

class    StatusMgrTask

class    CommandMgrTask

Exceptions:


class    Exception

class    EOFException

class    StuffException

DESCRIPTION

The oorb library is an object-oriented wrapper around the Antelope orb(3) library, intended to facilitate the creation of multithreaded orbserver(1) interaction programs such as orb2orb(1). All classes are encapsulated within a namespace called Oorb. For details, see the man-pages for the individual classes. What follows is an overview description. The Oorb library is organized around a variety of Oorb::Task(3)s, each designed to run in its own thread. All tasks in an Oorb-based program are managed by a single Oorb::Master(3) task. The constructor for the Oorb::Master(3) task takes as an argument an instance of a subclass of the Oorb::ConfigMgrTask(3). Basic usage of the Oorb library is to sub-class Oorb::ConfigMgrTask(3) for the program, specifying the configuration details for the program in that class's run() method, then instantiating a single object of class Oorb::Master(3) and launching it via that instance's run() method. See the EXAMPLE below. The Oorb::Master(3) task then creates and launches all necessary threads and tasks, as configured to do so by the Oorb::ConfigMgrTask(3) it was given.

EXAMPLE

The following is an example of using the Oorb library to create a simple version of the orb2orb(3) program.
% cat Makefile
BIN= simple_orb2orb
MAN1=

ldlibs= -loorb $(ORBLIBS)

CLEAN=

include $(ANTELOPEMAKE)

OBJS= simple_orb2orb.o

$(BIN): $(OBJS)
        $(CXX) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)

%.o: %.cc
        $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@

% cat simple_orb2orb.cc

#include "oorb.h"

class SimpleConfigMgrTask : public Oorb::ConfigMgrTask {
    public:
                 SimpleConfigMgrTask( int argc, char** argv ) :
                     Oorb::ConfigMgrTask( argc, argv ) { return; };
                 ~SimpleConfigMgrTask( void ) { return; };
    void         run( void );
    std::string  usage( void ) { return std::string( this->m_programName ) + " orbin orbout"; };
};

void
SimpleConfigMgrTask::run( void ) {
    std::string reader;
    std::string writer;
    Pf*         pfconnection;

    this->init_run();

    if( m_argc != 3 ) {
        Om->log()->die_initializing( true, "Two orb names required" );
    } else {
        Om->addOrb( m_argv[1] );
        Om->addOrb( m_argv[2] );
    }

    reader = std::string( "" ) +
        "name reader                          \n" +
        "direction read                       \n" +
        "run true                             \n" +
        "read_from_orbname " +   m_argv[1] + "\n" +
        "read_from_orbtag                     \n" +
        "write_to_queue          mainq        \n" +
        "match                                \n" +
        "reject                               \n" +
        "starttime                            \n" +
        "endtime                              \n" +
        "too_old                              \n" +
        "too_new                              \n" +
        "check_unstuff           false        \n" +
        "suppress_unstuff_errors true         \n" +
        "verbose notify                       \n"
        ;

    pfconnection = pfnew( PFARR );
    pfcompile( (char*) reader.c_str(), &pfconnection );
    Om->addConnection( pfconnection );
    pffree( pfconnection );

    writer = std::string( "" ) +
        "name                    writer       \n" +
        "direction               write        \n" +
        "run                     true         \n" +
        "read_from_queue         mainq        \n" +
        "write_to_orbname " +    m_argv[2] + "\n" +
        "write_to_orbtag                      \n" +
        "max_queue               100          \n" +
        "match                                \n" +
        "reject                               \n" +
        "acknowledge             false        \n" +
        "verbose                 notify       \n"
        ;

    pfconnection = pfnew( PFARR );
    pfcompile( (char*) writer.c_str(), &pfconnection );
    Om->addConnection( pfconnection );
    pffree( pfconnection );

    this->announceTaskReady();

    this->finalize_run();
}

std::shared_ptr<Oorb::Master> Om;

int
main( int argc, char** argv )
{
    std::shared_ptr<SimpleConfigMgrTask> config;

    config = std::make_shared<SimpleConfigMgrTask>( argc, argv );
    Om     = std::make_shared<Oorb::Master>( config );

    Om->log()->startMsg();

    Om->run();

    Om->log()->finishMsg();

    return( 0 );
}
%

LIBRARY

-loorb $(ORBLIBS)

ATTRIBUTES

MT-Safe

DIAGNOSTICS

Diagnostics for the Oorb library are handled by the log-manager task (LogMgrTask).

SEE ALSO

orb2orb(1), orbserver(1), orb(3),
OorbBasics(3), OorbExceptions(3), Oorb::Configure(3),
Oorb::OrbPacket(3), Oorb::Queue(3), Oorb::OrbConnection(3),
Oorb::Task(3), Oorb::Master(3), Oorb::ConfigMgrTask(3),
Oorb::LogMgrTask(3), Oorb::SignalMgrTask(3), Oorb::StateMgrTask(3),
Oorb::StatusMgrTask(3), Oorb::CommandMgrTask(3), Oorb::OrbConnectionTask(3),
Oorb::OrbReaderTask(3), Oorb::OrbWriterTask(3), Oorb::Filter(3), OorbFilters(3)

AUTHOR

Kent Lindquist
Printer icon