FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents

The standard mechanism for attaching external processes to a FARGOS/VISTA Object Management Environment. More...

#include <OMEapi.h>

Public Member Functions

 OMEapi (const OMEassoc &acl, const char *dest) NONNULL_CLASS_PARAMETERS(3)
 
 OMEapi (const OMEassoc &acl, const OMEstring &dest)
 
 ~OMEapi ()
 
int establishConnection (OMEtype &authentication)
 
int invokeMethod (const OMEtype &dest, const OMEtype &methodName, const OMEtype &args, const OMEtype *fromObj=nullptr, const OMEassoc *context=nullptr)
 
int importInvocation (OMEtype &methodName, OMEtype &argv, OMEtype *fromObj=nullptr, OMEtype *destObj=nullptr, OMEtype *context=nullptr, OMEtype *user=nullptr)
 Receives a message from a remote object that is accessible via the set of interconnected FARGOS/VISTA Object Management Environment peers. More...
 
void setContext (const OMEassoc &env)
 
void setUserInfo ()
 
int getPeerObject (OMEtype &obj)
 
int getThisObject (OMEtype &obj)
 
OMEioDescriptorgetDescriptor () const
 
int getHandle () const
 

Static Public Member Functions

static OMEassocmakeACL (const OMEstring &userName)
 

Private Attributes

OMEoidthisObject
 
OMEstring destination
 
OMEconnectionconn
 
OMEassoc defaultContext
 
OMEstring userInfo
 

Static Private Attributes

static int connectionCount
 

Detailed Description

The standard mechanism for attaching external processes to a FARGOS/VISTA Object Management Environment.

New or pre-existing applications can access and be integrated into a FARGOS/VISTA Object Management Environment using the OMEapi.

Constructor & Destructor Documentation

◆ OMEapi() [1/2]

OMEapi::OMEapi ( const OMEassoc acl,
const char *  dest 
)

Constructs a new OMEapi connection and defines the access control list and transport address of the remote peer. An actual connection attempt is made by establishConnection(). Any stream-oriented transport supported by OMEioDescriptor can be used.

References OMEoidID::birthplace, OMEoidID::classHashIndex, OMEoidID::classVersionID, conn, connectionCount, OMEthisProcessInfo::id, OMEoidID::instanceIndex, OMEcurrentProcessInfo, OMEhash(), and thisObject.

◆ OMEapi() [2/2]

OMEapi::OMEapi ( const OMEassoc acl,
const OMEstring dest 
)

◆ ~OMEapi()

OMEapi::~OMEapi ( )

References conn, and thisObject.

Member Function Documentation

◆ establishConnection()

int OMEapi::establishConnection ( OMEtype authentication)

Attempt to establish a peer connection to the remote FARGOS/VISTA Object Management Environment.

Return values
-1is returned if the connection attempt was not successful.
0indicates success.

References conn, destination, OMEconnection::establishConnection(), and thisObject.

◆ getDescriptor()

OMEioDescriptor* OMEapi::getDescriptor ( ) const
inline
Returns
If connected, the pointer to the OMEioDescriptor that provides I/O transport facilities for this OMEapi object is returned.
Return values
0if not connected, a null pointer is returned.

References conn, and OMEconnection::getDescriptor().

◆ getHandle()

int OMEapi::getHandle ( ) const
inline

Similar to getDescriptor(), getHandle() returns the file descriptor or handle maintained by the underlying native operating system for an open I/O port/connection.

Returns
If connected, the file descriptor/handle is returned.
Return values
-1is returned if not connected.

References conn, and OMEconnection::getHandle().

◆ getPeerObject()

int OMEapi::getPeerObject ( OMEtype obj)
inline
Returns
The Id of the peer object (typically a PeerConnection) that maintains the other end of the connection is stored in the
  • obj argument, which is passed by reference.
Return values
-1if not connected.
0indicates success.

References conn, and OMEconnection::getPeerObject().

◆ getThisObject()

int OMEapi::getThisObject ( OMEtype obj)
inline
Returns
The object Id of the globally unique Id that identifies this instance of the OMEapi is stored in the
  • obj which is passed by reference. This can be provided to any entity attached to the set of interconnected FARGOS/VISTA Object Management Environments.
Return values
-1if not connected.
0indicates success.

References conn, and thisObject.

◆ importInvocation()

int OMEapi::importInvocation ( OMEtype methodName,
OMEtype argv,
OMEtype fromObj = nullptr,
OMEtype destObj = nullptr,
OMEtype context = nullptr,
OMEtype user = nullptr 
)

Receives a message from a remote object that is accessible via the set of interconnected FARGOS/VISTA Object Management Environment peers.

Parameters
methodNameidentifies the name of the method which is to be invoked.
argvis an array of arguments for the method. The first argument, if any, starts at subscript 0. The OMEtype::indexExists() function can be used to determine if an argument is present.
fromObjis an optional argument. If provided, the object id of the sender will be saved; otherwise, this information will be discarded.
destObjis an optional argument. If provided, the object Id of the intended target will be saved; otherwise, this information will be discarded. Usually, destObj will be identical to that returned by getThisObject(); however, since it is possible to have a given OMEapi() connection maintain access to multiple objects, some applications will need this information to select a specific object.
contextis an optional associative array that enables a specific thread context to be set for the method invocation. If not provided, the default context (set by setContext() ) is used.
useris an optional argument. If provided, information about the identity of the user requesting the operation will be stored.
Return values
-1is returned on error.
0indicates success.

References ARGV_SUBSCRIPT, conn, CONTEXT_SUBSCRIPT, OMEdebugEvents, OMEdebugFlag, OMEdebugMethodInvocations, OMEconnection::receiveMessage(), and USERINFO_SUBSCRIPT.

◆ invokeMethod()

int OMEapi::invokeMethod ( const OMEtype dest,
const OMEtype methodName,
const OMEtype args,
const OMEtype fromObj = nullptr,
const OMEassoc context = nullptr 
)

Sends a message to a remote object that is accessible via the set of interconnected FARGOS/VISTA Object Management Environment peers.

Parameters
destidentifies the target of the message. Usually this is an object Id, but it can be a string name that identifies a named service. Name services are resolved to object Ids by the connected FARGOS/VISTA Object Management Environment.
methodNameidentifies the name of the method to be invoked.
argsis an array of arguments for the method. The first argument, if any, starts at subscript 0. The count of the number of arguments is performed automatically, so there is no need nor provision for providing this information.
fromObjis an optional argument, which defaults to the object Id assigned to this instance of the OMEapi (which can be retrieved by getThisObject() ).
contextis an optional associative array that enables a specific thread context to be set for the method invocation. If not provided, the default context (set by setContext() ) is used.
Return values
-1is returned on error.
0indicates success.

References ARGV_SUBSCRIPT, conn, CONTEXT_SUBSCRIPT, defaultContext, FORWARD_CMD, OME_ARRAY, OME_NIL, OMEdebugFlag, OMEdebugMethodInvocations, OMEconnection::sendMessage(), thisObject, OMEtype::type, userInfo, and USERINFO_SUBSCRIPT.

◆ makeACL()

OMEassoc * OMEapi::makeACL ( const OMEstring userName)
static

References OMEmakeACL().

◆ setContext()

void OMEapi::setContext ( const OMEassoc env)
inline

Sets the default thread context

References defaultContext.

◆ setUserInfo()

void OMEapi::setUserInfo ( )

Member Data Documentation

◆ conn

◆ connectionCount

int OMEapi::connectionCount
staticprivate

Referenced by OMEapi().

◆ defaultContext

OMEassoc OMEapi::defaultContext
private

Referenced by invokeMethod(), and setContext().

◆ destination

OMEstring OMEapi::destination
private

Referenced by establishConnection().

◆ thisObject

OMEoid* OMEapi::thisObject
private

◆ userInfo

OMEstring OMEapi::userInfo
private

Referenced by invokeMethod().


The documentation for this class was generated from the following files:
Generated: Fri Jul 31 2020 18:19:16
Support Information