NAME
Oorb::OrbConnection - class to manage connections to orbservers for the oorb library
SYNOPSIS
-loorb $(ORBLIBS)
#include "oorb.h"
namespace Oorb
class OrbConnection
DESCRIPTION
The
OrbConnection class represents connections to
orbserver(1)s in the
Oorb(3) library. This includes methods for standard operations on an
orb(3) connection, notably selecting and rejecting source-name streams,
repositioning the read location, and reading and writing packets.
CONSTRUCTORS
-
OrbConnection( std::shared_ptr<Orb> orb, Direction direction );
The OrbConnection constructor takes as arguments an Oorb::Orb(3) object
representing the orbserver(1) to which to connect, as well as an enum value of READ
or WRITE indicating the intended direction of the dataflow. The constructor
does not actually execute an orbopen(3) call on the target orbserver(1).
The application programmer must call the open() method separately.
METHODS
-
bool open( void );
The open method opens the orb connection via orbopen(3), returning a boolean
value to indicate whether the call was successful. Any @ character is stripped from the end of the OrbConnection's orb name, so that persistent connection
attempts can be handled at a higher level than this OrbConnection, i.e. in the calling routine or above. The connections are always opened in continuous-reopen mode, i.e. with r& or w& permission arguments to
the underlying orbopen(3).
-
bool isOpen( void );
The isOpen method returns a boolean value indicating whether the
OrbConnection is open at the moment or not.
-
void close( void );
The close method closes the orb connection with orbclose(3).
-
int select( std::string match );
The select method calls orbselect(3) on the underlying orb connection in
order to filter the srcname streams read from the target orbserver(1).
-
int reject( std::string reject );
The reject method calls orbreject(3) on the underlying orb connection in
order to filter the srcname streams read from the target orbserver(1).
-
void smartReposition( std::string taskName, double starttime );
The smartReposition method queries the Oorb::StateMgrTask(3) object, via
Oorb::Master(3), in order to reposition the orb(3) connection based
on state information if any state information is available.
-
std::shared_ptr<OrbPacket> reap_timeout( double maxseconds );
The reap_timeout method reads the next packet from the OrbConnection, with a
maximum timeout of maxseconds. The method will return a nullptr if the
underlying orbreap_timeout(3) receives an incomplete packet or times out. If
orbreap_timeout(3) returns an ORB_EOF, the reap_timeout method throws
an Oorb::EOFException(3). If the underlying orbreap_timeout(3) returns
-1, indicating an error, reap_timeout throws an Oorb::Exception.
-
int put( std::shared_ptr<OrbPacket> op, bool acknowledge = false );
The put method puts the given Oorb::OrbPacket(3) op on the
orbserver(1) via the orbput(3) function. If acknowledge is true,
orbputx(3) is used instead, requiring the receiving orbserver(1) to
confirm receipt of the packet. The put method will throw an
Oorb::Exception(3) for a variety of failures due to closed connection, null packet, or malformed packet.
-
int getNewestPktid( void );
The getNewestPktid function will return the packet-id of the newest packet on the
target orbserver(1).
LIBRARY
-loorb $(ORBLIBS)
ATTRIBUTES
MT-Safe
SEE ALSO
Oorb(3), OorbBasics(3), Oorb::Orb(3), Oorb::OrbPacket(3),
Oorb::OrbConnectionTask(3)
BUGS AND CAVEATS
The
Connection class is not to be confused with the
Oorb::OrbConnectionTask(3) class. The former essentially
just represents the open socket to the
orbserver(1).
The latter manages reading and writing across that socket, as well
as disposition of the acquired or sent packets.
AUTHOR
Kent Lindquist