FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
OME Utility Functions

Utility functions for the FARGOS/VISTA Object Management Environment and attached applications. More...

Classes

class  OMEentityID
 Identifies an instance of an OME process. More...
 
class  OMEthisProcessInfo
 Uniquely identifies an OME process. More...
 

Macros

#define OME_MUTEX_TYPE   pthread_mutex_t
 
#define OME_CONDITION_TYPE   pthread_cond_t
 
#define OME_MAX_CPUS_PERMITTED   128
 
#define OMEgetCPUticks()   get_CPU_ticks()
 

Typedefs

typedef void *(* OMEnativeTaskFP) (void *)
 

Enumerations

enum  eOMEcriticalSectionLabel {
  OME_CRITICAL_SECTION_METHOD_INVOKE, OME_CRITICAL_SECTION_THREAD_QUEUE, OME_CRITICAL_SECTION_OID_REFERENCE, OME_CRITICAL_SECTION_EVENT_TABLE,
  OME_CRITICAL_SECTION_KERNEL_THREAD, OME_CRITICAL_SECTION_OMETYPE_OP, OME_CRITICAL_SECTION_IO_TABLE, OME_CRITICAL_SECTION_MISCELLANEOUS,
  OME_CRITICAL_SECTION_OMETYPE_REF, OME_CRITICAL_SECTION_TOTAL
}
 

Functions

OME_DLL_EXPORT uint32_t OMEhash (const unsigned char *data, const uint32_t len) NONNULL_PARAMETERS(1)
 Fast 32-bit hash over a buffer. More...
 
OME_DLL_EXPORT uint32_t OMEhash (const OMEstring &data)
 Fast 32-bit hash of an OMEstring. More...
 
OME_DLL_EXPORT uint32_t OMEmethodSignature (const int argc, const uint32_t types[], uint32_t *anyMask=nullptr)
 Compute 32-bit signature of a method's arguments. More...
 
OME_DLL_EXPORT OMEstringOMEfindFileInPathSpec (const OMEstring &fileName, const OMEstring &path)
 Search for a file located within a set of directories specified by a string path. More...
 
OME_DLL_EXPORT OMEstringOMEfindFileInDirectory (const OMEstring &fileName, const OMEarray &dirList)
 Search for a file located within a list of directories specified as elements of an OMEarray. More...
 
OME_DLL_EXPORT OMEarrayOMEparsePathSpecification (const OMEstring &pathSpec)
 Parse a list of directories specified by a string path into an sequence of OMEarray elements. More...
 
OME_DLL_EXPORT OMEarrayOMElistDirectory (const OMEstring &dirName, int *errRet=nullptr)
 List all files within a filesystem directory. More...
 
OME_DLL_EXPORT int OMEconvertLocalRelativeTimeToAbsolute (OMEtype &result, uint32_t tArg, int asGMT)
 Convert a local relative time to an OME absolute time reference. More...
 
OME_DLL_EXPORT uint32_t OMEconvertAbsoluteToLocalRelativeTime (const OMEtype &tData)
 Convert an OME absolute time reference to a local relative time. More...
 
OME_DLL_EXPORT int OMErfc1123Date (OMEtype &result, const OMEtype &argData)
 Format an OME absolute time reference as a data and time in RFC 1123 format. More...
 
OME_DLL_EXPORT int OMEiso8601Date (OMEtype &result, const OMEtype &argData)
 Format an OME absolute time reference as a date and time in ISO 8601 format. More...
 
OME_DLL_EXPORT int OMEconvertRFC1123date (OMEtype &result, const OMEtype &timeString)
 Convert a text string in RFC 1123 format into an OME absolute time reference. More...
 
OME_DLL_EXPORT int OMEtimeDifference (const OMEtype &time1, const OMEtype &time2)
 Compute difference between two OME absolute time references. More...
 
OME_DLL_EXPORT int OMEtransportToSockaddr (union sockBigEnough *sock, uint_fast16_t *sockLen, int *sockMode, const char *url, uint_fast16_t urlLen) NONNULL_PARAMETERS(1
 
OME_DLL_EXPORT int OME_DLL_EXPORT OMEstringOMEdisplayableAddress (const struct sockaddr *sock, const int len, const uint32_t openMode) NONNULL_PARAMETERS(1)
 Convert sockaddr data into a text string. More...
 
OME_DLL_EXPORT int OMEgetInterfaces (OMEtype &result)
 
OME_DLL_EXPORT void OMEstartCriticalSection (eOMEcriticalSectionLabel regionID)
 
OME_DLL_EXPORT void OMEendCriticalSection (eOMEcriticalSectionLabel regionID)
 
OME_DLL_EXPORT bool OMEinitStandardCriticalSectionMutexes ()
 
OME_DLL_EXPORT bool OMEinitCriticalSectionMutex (OME_MUTEX_TYPE *, bool recursive=false) NONNULL_PARAMETERS(1)
 
OME_DLL_EXPORT int OMEdestroyCriticalSectionMutex (OME_MUTEX_TYPE *) NONNULL_PARAMETERS(1)
 
OME_DLL_EXPORT uint32_t OMEgetMiscellaneousMutex () OME_CONST_FUNCTION
 
OME_DLL_EXPORT int OMEinitConditionVariable (OME_CONDITION_TYPE *)
 
OME_DLL_EXPORT int OMEdestroyConditionVariable (OME_CONDITION_TYPE *) NONNULL_PARAMETERS(1)
 
OME_DLL_EXPORT int OMEwaitForCondition (OME_CONDITION_TYPE *, eOMEcriticalSectionLabel mutexId) NONNULL_PARAMETERS(1)
 
OME_DLL_EXPORT int OMEsetConditionVariable (OME_CONDITION_TYPE *) NONNULL_PARAMETERS(1)
 
OME_DLL_EXPORT uint64_t OMEcallWithNativeThread (OMEnativeTaskFP func, void *functionArg)
 
OME_DLL_EXPORT int OMEwaitForNativeThread (uint64_t pid, void **retValue)
 
template<typename STREAMTYPE >
STREAMTYPE & operator<< (STREAMTYPE &outputStream, const OMEentityID &data)
 
OME_DLL_EXPORT OMEstringOMEgetUserName ()
 Return the name of the user associated with the process. More...
 
OME_DLL_EXPORT int64_t OMErelativeMilliseconds ()
 Return a monotonically-increasing count of elapsed milliseconds. More...
 
OME_DLL_EXPORT int64_t OMEmillisecondsSinceBoot ()
 Obtain the number of milliseconds since boot of local FARGOS/VISTA Object Management Environment process. More...
 
OME_DLL_EXPORT int64_t OMEticksSinceBoot ()
 Obtain the number of CPU ticks since boot of local FARGOS/VISTA Object Management Environment process. More...
 

Variables

OME_DLL_EXPORT OMEthisProcessInfo OMEcurrentProcessInfo
 Automatic instantiation of OMEthisProcessInfo. When properly linked, the C++ static constructor mechanism enables the automatic creation of the OMEcurrentProcessInfo variable within applications that link against the FARGOS/VISTA types library. More...
 

Detailed Description

Utility functions for the FARGOS/VISTA Object Management Environment and attached applications.

Macro Definition Documentation

◆ OME_CONDITION_TYPE

#define OME_CONDITION_TYPE   pthread_cond_t

◆ OME_MAX_CPUS_PERMITTED

#define OME_MAX_CPUS_PERMITTED   128

◆ OME_MUTEX_TYPE

#define OME_MUTEX_TYPE   pthread_mutex_t

◆ OMEgetCPUticks

#define OMEgetCPUticks ( )    get_CPU_ticks()

Typedef Documentation

◆ OMEnativeTaskFP

typedef void*(* OMEnativeTaskFP) (void *)

Enumeration Type Documentation

◆ eOMEcriticalSectionLabel

Enumerator
OME_CRITICAL_SECTION_METHOD_INVOKE 
OME_CRITICAL_SECTION_THREAD_QUEUE 
OME_CRITICAL_SECTION_OID_REFERENCE 
OME_CRITICAL_SECTION_EVENT_TABLE 
OME_CRITICAL_SECTION_KERNEL_THREAD 
OME_CRITICAL_SECTION_OMETYPE_OP 
OME_CRITICAL_SECTION_IO_TABLE 
OME_CRITICAL_SECTION_MISCELLANEOUS 
OME_CRITICAL_SECTION_OMETYPE_REF 
OME_CRITICAL_SECTION_TOTAL 

count of critical sections...

Function Documentation

◆ OMEcallWithNativeThread()

OME_DLL_EXPORT uint64_t OMEcallWithNativeThread ( OMEnativeTaskFP  func,
void *  functionArg 
)

References NULL.

◆ OMEconvertAbsoluteToLocalRelativeTime()

OME_DLL_EXPORT uint32_t OMEconvertAbsoluteToLocalRelativeTime ( const OMEtype tData)

Convert an OME absolute time reference to a local relative time.

Parameters
tDataspecifies the OME absolute time reference.
Returns
The converted time as local relative time is returned.
Return values
~0indicates an invalid absolute data was specified.

References OMEtype::assoc, GMT_OFFSET, LOCALtime, OME_ASSOC, OMEtype::type, and OMEtype::value.

Referenced by convertAbsoluteToLocalRelativeTime(), and OMEtimeDifference().

◆ OMEconvertLocalRelativeTimeToAbsolute()

OME_DLL_EXPORT int OMEconvertLocalRelativeTimeToAbsolute ( OMEtype result,
uint32_t  tArg,
int  asGMT 
)

Convert a local relative time to an OME absolute time reference.

Parameters
resultwill hold the converted OME absolute time reference.
tArgspecifies the local relative time.
asGMTis a Boolean flag that indicates if the absolute time reference should be in GMT or the local time zone.
Returns
Always returns zero.

References GMT_OFFSET, OMEtype::initializeAsType(), LOCALtime, OME_ASSOC, and TIMEZONE_NAME.

Referenced by convertLocalRelativeTimeToAbsolute(), and main().

◆ OMEconvertRFC1123date()

OME_DLL_EXPORT int OMEconvertRFC1123date ( OMEtype result,
const OMEtype timeString 
)

Convert a text string in RFC 1123 format into an OME absolute time reference.

Parameters
resultwill hold the converted absolute time reference.
timeStringspecifies a time and date in RFC 1123 format.
Returns
Always returns zero. If the time cannot be parsed, result will be set to an integer value of 0.

References OME_STRING, OMEtype::s, OMEtype::type, and OMEtype::value.

Referenced by convertRFC1123date().

◆ OMEdestroyConditionVariable()

OME_DLL_EXPORT int OMEdestroyConditionVariable ( OME_CONDITION_TYPE )

◆ OMEdestroyCriticalSectionMutex()

OME_DLL_EXPORT int OMEdestroyCriticalSectionMutex ( OME_MUTEX_TYPE )

◆ OMEdisplayableAddress()

OME_DLL_EXPORT int OME_DLL_EXPORT OMEstring* OMEdisplayableAddress ( const struct sockaddr *  sock,
const int  len,
const uint32_t  openMode 
)

Convert sockaddr data into a text string.

Parameters
sockpoints to the sockaddr structure
lenindicates the length of the sockaddr data.
openModeis a bit mask indicating special attributes. OME_IO_RAW and OME_IO_DATAGRAM are the flags currently tested.
Returns
A pointer to the OMEstring holding the textual representation of the sockaddr data.
See also
OMEtransportToSockaddr()

References if_indextoname(), ntohs, OME_IO_DATAGRAM, OME_IO_RAW, OUR_sockaddr_in6, and sock.

Referenced by OMEsocketDescriptor::getLocalAddress(), OMEsocketDescriptor::getPeerAddress(), OMEgetInterfaces(), and OMEsocketDescriptor::openSocket().

◆ OMEendCriticalSection()

◆ OMEfindFileInDirectory()

OME_DLL_EXPORT OMEstring* OMEfindFileInDirectory ( const OMEstring fileName,
const OMEarray dirNames 
)

Search for a file located within a list of directories specified as elements of an OMEarray.

Parameters
fileNamespecifies the base name of the file.
dirNamesspecifies a list of directories to be searched.
Returns
A pointer to an OMEstring holding the full name of the file. The recipient is responsible for deleting the OMEstring when no longer needed.
Return values
0indicates the file was not found.

References OMEstring::determineCharacterSet(), OMEarray::indexExists(), OMEstring::length(), NATIVE_DIR_SEP, OME_STRING, OMEtype::s, OMEtype::type, and OMEtype::value.

Referenced by OMEnlmCatalog::findCatalogFile(), OMEfindFileInPathSpec(), and OMEreadLicenseFile().

◆ OMEfindFileInPathSpec()

OME_DLL_EXPORT OMEstring* OMEfindFileInPathSpec ( const OMEstring fileName,
const OMEstring path 
)

Search for a file located within a set of directories specified by a string path.

Directory names can be separated by colon (":") or semi-colon (";") characters, which are the respective conventions for Unix and Microsoft Windows systems. The colon-separated paths can be used in conjunction with drive letters without concern. For example, the following path specifications will be correctly parsed:

* /bin:/usr/bin:/usr/local/bin
* C:\Program Files\VISTA:D:\HOME\user\bin
* /bin;/usr/bin;/usr/local/bin
* C:\Program Files\VISTA;D:\HOME\user\bin
* 
Returns
A pointer to an OMEstring holding the full name of the file. The recipient is responsible for deleting the OMEstring when no longer needed.
Return values
0indicates the file was not found.
See also
OMEfindFileInDirectory()
OMEparsePathSpecification()

References OMEfindFileInDirectory(), and OMEparsePathSpecification().

◆ OMEgetInterfaces()

◆ OMEgetMiscellaneousMutex()

OME_DLL_EXPORT uint32_t OMEgetMiscellaneousMutex ( )

◆ OMEgetUserName()

OME_DLL_EXPORT OMEstring* OMEgetUserName ( )

Return the name of the user associated with the process.

Returns
A pointer to an OMEstring containing the user's name is returned; it must be deleted by the caller to recover the storage.

Referenced by main(), OMEconnection::OMEconnection(), OMEgetLicenseAttribute(), OMEgetLocalizedData(), and OMEreadLicenseFile().

◆ OMEhash() [1/2]

OME_DLL_EXPORT uint32_t OMEhash ( const OMEstring key)

Fast 32-bit hash of an OMEstring.

Parameters
keyholds the data to be hashed.
Returns
A 32-bit hash of the buffer.

References OMEstring::length(), and OMEhash().

◆ OMEhash() [2/2]

OME_DLL_EXPORT uint32_t OMEhash ( const unsigned char *  key,
const uint32_t  len 
)

Fast 32-bit hash over a buffer.

Parameters
keypoints to the buffer to be hashed.
lenindicates the length of the buffer.
Returns
A 32-bit hash of the buffer.

Referenced by OMEnameSpaceGroup::addClass(), OMEclass::addMethodName(), OMEassocStorage::deleteIndex(), OMEnameSpaceGroup::findClass(), OMEclass::findMethod(), OMEassocStorage::indexExists(), OMEapi::OMEapi(), OMEgetSigningFile(), OMEhash(), and OMEassocStorage::operator[]().

◆ OMEinitConditionVariable()

OME_DLL_EXPORT int OMEinitConditionVariable ( OME_CONDITION_TYPE )

References NULL.

◆ OMEinitCriticalSectionMutex()

OME_DLL_EXPORT bool OMEinitCriticalSectionMutex ( OME_MUTEX_TYPE ,
bool  recursive = false 
)

◆ OMEinitStandardCriticalSectionMutexes()

OME_DLL_EXPORT bool OMEinitStandardCriticalSectionMutexes ( )

◆ OMEiso8601Date()

OME_DLL_EXPORT int OMEiso8601Date ( OMEtype result,
const OMEtype argData 
)

Format an OME absolute time reference as a date and time in ISO 8601 format.

Parameters
resultwill hold the resulting formatted string.
argDataholds the OME absolute time reference.
Returns
Always returns zero.
See also
OMErfc1123Date()

References OMEtype::assoc, OME_ASSOC, OMEtype::type, and OMEtype::value.

Referenced by iso8601Date().

◆ OMElistDirectory()

OME_DLL_EXPORT OMEarray* OMElistDirectory ( const OMEstring dirName,
int *  errRet 
)

List all files within a filesystem directory.

Parameters
dirNamespecifies the name of the directory.
errRetpoints to an integer storage location into which an error code will be stored. If a null pointer is provided (the default) then no error code will be made available.
Returns
An OMEarray containing the names of the files. The recipient is responsible for deleting the OMEarray when it is no longer needed.
Return values
0indicates an error, almost always a result of the directory being unreadable. Most probably this is because the indicated directory did not exist; however, lack of permission can also be the cause.

References OMEstring::length().

Referenced by listDirectory().

◆ OMEmethodSignature()

OME_DLL_EXPORT uint32_t OMEmethodSignature ( const int  argc,
const uint32_t  types[],
uint32_t *  maskPtr 
)

Compute 32-bit signature of a method's arguments.

Parameters
argcindicates the number of arguments in the types array.
typesholds type information for each argument.
maskPtris an optional pointer to an 32-bit storage location into which the mask of any arguments whose type was declared as ANY will be placed.
Returns
A 32-bit method signature is returned.

References OME_ANY.

Referenced by OMEobjectInstance::findRoutine().

◆ OMEmillisecondsSinceBoot()

OME_DLL_EXPORT int64_t OMEmillisecondsSinceBoot ( )

Obtain the number of milliseconds since boot of local FARGOS/VISTA Object Management Environment process.

Returns
The number of milliseconds since the process started.

References OMErelativeMilliseconds().

Referenced by OMEthread::callMethodWithSetArgument(), and OMEobjectInstance::invokeMethod().

◆ OMEparsePathSpecification()

OME_DLL_EXPORT OMEarray* OMEparsePathSpecification ( const OMEstring spec)

Parse a list of directories specified by a string path into an sequence of OMEarray elements.

Parameters
specspecifies a set of directory names.

Directory names can be separated by colon (":") or semi-colon (";") characters, which are the respective conventions for Unix and Microsoft Windows systems. The colon-separated paths can be used in conjunction with drive letters without concern. For example, the following path specifications will be correctly parsed:

* /bin:/usr/bin:/usr/local/bin
* C:\Program Files\VISTA:D:\HOME\user\bin
* /bin;/usr/bin;/usr/local/bin
* C:\Program Files\VISTA;D:\HOME\user\bin
* 
Returns
A pointer to an OMEarray holding the names of the directories. The recipient is responsible for deleting the OMEarray when it is no longer needed.

References ALT_DIR_SEP, OMEstring::determineCharacterSet(), OMEstring::length(), NATIVE_DIR_SEP, and s.

Referenced by OMEnlmCatalog::findCatalogFile(), OMEfindFileInPathSpec(), and OMEreadLicenseFile().

◆ OMErelativeMilliseconds()

OME_DLL_EXPORT int64_t OMErelativeMilliseconds ( )

Return a monotonically-increasing count of elapsed milliseconds.

Note
The initial value does not necessarily start at 0. The difference between the values returned by two distinct calls should be examined, not the raw values themselves.
Returns
The relative milliseconds is returned as a 64-bit integer.

Referenced by getRelativeMilliseconds(), and OMEmillisecondsSinceBoot().

◆ OMErfc1123Date()

OME_DLL_EXPORT int OMErfc1123Date ( OMEtype result,
const OMEtype argData 
)

Format an OME absolute time reference as a data and time in RFC 1123 format.

Parameters
resultwill hold the resulting formatted string.
argDataholds the OME absolute time reference.
Returns
Always returns zero.
See also
OMEiso8601Data()

References OMEtype::assoc, OME_ASSOC, OMEtype::type, and OMEtype::value.

Referenced by rfc1123Date().

◆ OMEsetConditionVariable()

OME_DLL_EXPORT int OMEsetConditionVariable ( OME_CONDITION_TYPE )

◆ OMEstartCriticalSection()

◆ OMEticksSinceBoot()

OME_DLL_EXPORT int64_t OMEticksSinceBoot ( )

Obtain the number of CPU ticks since boot of local FARGOS/VISTA Object Management Environment process.

Returns
The number of CPU ticks since the process started.

References OMEgetCPUticks.

Referenced by getTicksSinceBoot().

◆ OMEtimeDifference()

OME_DLL_EXPORT int OMEtimeDifference ( const OMEtype time1,
const OMEtype time2 
)

Compute difference between two OME absolute time references.

Parameters
time1is an absolute time reference.
time2is an absolute time reference.
Returns
The number of seconds between the two time references is returned.

References OMEconvertAbsoluteToLocalRelativeTime().

Referenced by timeDifference().

◆ OMEtransportToSockaddr()

OME_DLL_EXPORT int OMEtransportToSockaddr ( union sockBigEnough *  sock,
uint_fast16_t *  sockLen,
int *  sockMode,
const char *  url,
uint_fast16_t  urlLen 
)

◆ OMEwaitForCondition()

◆ OMEwaitForNativeThread()

OME_DLL_EXPORT int OMEwaitForNativeThread ( uint64_t  pid,
void **  retValue 
)

◆ operator<<()

template<typename STREAMTYPE >
STREAMTYPE& operator<< ( STREAMTYPE &  outputStream,
const OMEentityID data 
)
inline

Variable Documentation

◆ OMEcurrentProcessInfo

OME_DLL_EXPORT OMEthisProcessInfo OMEcurrentProcessInfo

Automatic instantiation of OMEthisProcessInfo. When properly linked, the C++ static constructor mechanism enables the automatic creation of the OMEcurrentProcessInfo variable within applications that link against the FARGOS/VISTA types library.

Referenced by main(), OMEapi::OMEapi(), OMEgetLicenseAttribute(), OMEgetLocalizedData(), OMEgetSigningFile(), OMEobject::OMEobject(), OMEreadLicenseFile(), and OMEobject::~OMEobject().

Generated: Tue Jul 28 2020 16:03:26
Support Information