VMCFCore: Core Functions and Interfaces


Defines

#define CORBA_FALSE   (CORBA_boolean)0
#define CORBA_OBJECT_NIL   (CORBA_Object)0
#define CORBA_TRUE   (CORBA_boolean)1
#define VMCF_ASSERT_ALLOC(ptr, env, onfail)
#define VMCF_ASSERT_ARG(test, env, onfail)
#define VMCF_BREAK_ON_EXCEPTION(env)   { if (VMCF_EXCEPTION_RAISED(env)) break; }
#define VMCF_CHAIN_TO_SUPER_IMPL(function, args)   VMCF_CHAIN_TO_SUPER(, Impl_ ## function, args)
#define VMCF_CHAIN_TO_SUPER_SERVER(function, args)   VMCF_CHAIN_TO_SUPER(server_, _ ## function, args)
#define VMCF_DECLARE_CLASS(klass, initArgs)
#define VMCF_DEFINE_CHAINED_GET_NAME   _VMCF_DEFINE_CHAINED_GET_NAME(VMCF_THISCLASS)
#define VMCF_DEFINE_CHAINED_PROBE   _VMCF_DEFINE_CHAINED_PROBE(VMCF_THISCLASS)
#define VMCF_DEFINE_CLASS
#define VMCF_DEFINE_FINI_BEGIN
#define VMCF_DEFINE_FINI_END
#define VMCF_EXCEPTION_RAISED(env)   ((env)->_major != CORBA_NO_EXCEPTION)
#define VMCF_EXTERN
 Tags a function for export in a shared library.
#define VMCF_GET_SELF_DATA(self)   VMCF_GET_SUBINSTANCE_DATA(VMCF_USER_DATA(self))
#define VMCF_GET_SUBINSTANCE_DATA(data)   VMCF_CHAIN_TO_SUPER_IMPL(getSubinstanceData, (data))
#define VMCF_INIT_EPILOGUE(self, activate, env)
 Epilogue for initialization functions.
#define VMCF_INSTANCE_TYPE   _VMCF_INSTANCE_TYPE(VMCF_THISCLASS)
#define VMCF_IS_EMPTY(str)   ((str) == NULL || *(str) == '\0')
#define VMCF_PROTO_INIT(args)   _VMCF_PROTO_INIT(VMCF_THISCLASS, args)
 Defines the prototype of the 'initializer' function.
#define VMCF_USER_DATA(self)   (((ILU_C_Object *)(self))->instanceData)

Typedefs

typedef
VMCFCore_CFObject(* 
VMCFCore_CFObject_CreateFn )(CORBA_string name, VMCFServer server, CORBA_boolean bind, VMCFCore_CFObject parent, CORBA_Environment *env)
typedef struct
VMCFServer_s * 
VMCFServer

Functions

CORBA_string server_VMCFCore_CFObject__get_name (VMCFCore_CFObject self, CORBA_Environment *env)
void server_VMCFCore_CFObject_probe (VMCFCore_CFObject self, CORBA_Environment *env)
VMCFCore_CFObject VMCFCore_CFObjectImpl_addChild (VMCFCore_CFObject parent, VMCFCore_CFObject child)
void VMCFCore_CFObjectImpl_alloc (VMCFCore_CFObject self, size_t extraInstanceDataSize, CORBA_string name, void *server, VMCFCore_CFObject parent, CORBA_Environment *env)
VMCFCore_CFObject VMCFCore_CFObjectImpl_create (CORBA_string name, void *server, CORBA_boolean bind, VMCFCore_CFObject parent, CORBA_Environment *env)
void VMCFCore_CFObjectImpl_finalize (void *instData)
VMCFCore_CFObject VMCFCore_CFObjectImpl_getChild (VMCFCore_CFObject parent, CORBA_string name)
time_t VMCFCore_CFObjectImpl_getLastProbeTime (VMCFCore_CFObject self)
VMCFCore_CFObject VMCFCore_CFObjectImpl_getParent (VMCFCore_CFObject self)
VMCFServer VMCFCore_CFObjectImpl_getServer (VMCFCore_CFObject self)
CORBA_unsigned_long VMCFCore_CFObjectImpl_getState (VMCFCore_CFObject self)
void * VMCFCore_CFObjectImpl_getSubinstanceData (void *instData)
CORBA_boolean VMCFCore_CFObjectImpl_lock (VMCFCore_CFObject self)
CORBA_boolean VMCFCore_CFObjectImpl_removeChild (VMCFCore_CFObject parent, CORBA_string name)
CORBA_unsigned_long VMCFCore_CFObjectImpl_setState (VMCFCore_CFObject self, CORBA_unsigned_long state)
void VMCFCore_CFObjectImpl_unlock (VMCFCore_CFObject self)
void VMCFCoreImpl_closeServer (VMCFServer server, CORBA_Environment *env)
VMCFServer VMCFCoreImpl_createServer (char *ainfo, void *serverCtx, CORBA_Environment *env)
CORBA_Object VMCFCoreImpl_getORB (void)
CORBA_boolean VMCFCoreImpl_init (CORBA_boolean sslEnabled, void *clientCtx)
void VMCFCoreImpl_lock (void)
void VMCFCoreImpl_raiseInvalidArguments (CORBA_Environment *env, CORBA_string msg)
void VMCFCoreImpl_releaseObject (void *obj)
CORBA_string VMCFCoreImpl_strdup (const CORBA_string src)
void VMCFCoreImpl_unlock (void)

Define Documentation

#define CORBA_FALSE   (CORBA_boolean)0

#define CORBA_OBJECT_NIL   (CORBA_Object)0

#define CORBA_TRUE   (CORBA_boolean)1

#define VMCF_ASSERT_ALLOC ( ptr,
env,
onfail   ) 

Value:

{                        \
   if ((ptr) == NULL) {                                              \
      CORBA_exception_set((env), CORBA_USER_EXCEPTION,               \
                          ex_VMCFCore_NoResources, NULL);            \
      onfail;                                                        \
   }                                                                 \
}
Raises a VMCFCore::NoResources exception if the given pointer is NULL.

Parameters:
[in] ptr The pointer to test.
[out] env The environment where the exception will be set on failure.
[in] onfail Optional code statement to execute when the test fails.

#define VMCF_ASSERT_ARG ( test,
env,
onfail   ) 

Value:

{                         \
   if (!(test)) {                                                    \
      VMCFCoreImpl_raiseInvalidArguments(env, NULL);                 \
      onfail;                                                        \
   }                                                                 \
}
Raises a VMCFCore::InvalidArguments exception if the given test fails.

Parameters:
[in] test The condition to test.
[out] env The environment where the exception will be set on failure.
[in] onfail Optional code statement to execute when the test fails.

#define VMCF_BREAK_ON_EXCEPTION ( env   )     { if (VMCF_EXCEPTION_RAISED(env)) break; }

Breaks out of a ('do') loop, if the last call raised an exception.

#define VMCF_CHAIN_TO_SUPER_IMPL ( function,
args   )     VMCF_CHAIN_TO_SUPER(, Impl_ ## function, args)

Macro to call an implementation function in the super class.

Parameters:
[in] function Name of the function (without the class name prefix).
[in] args The arguments to pass to the call (enclosed in parentheses).

#define VMCF_CHAIN_TO_SUPER_SERVER ( function,
args   )     VMCF_CHAIN_TO_SUPER(server_, _ ## function, args)

Macro to call a "server" function in the super class.

Parameters:
[in] function Name of the function (without the "server_" and class name prefixes).
[in] args The arguments to pass to the call (enclosed in parentheses).

#define VMCF_DECLARE_CLASS ( klass,
initArgs   ) 

Value:

VMCF_EXTERN VMCF_PROTO_ALLOC(klass);            \
                                                \
VMCF_EXTERN VMCF_PROTO_FINI(klass);             \
                                                \
VMCF_EXTERN VMCF_PROTO_SUBINST(klass);          \
                                                \
VMCF_EXTERN VMCF_PROTO_CTOR(klass);             \
                                                \
VMCF_EXTERN _VMCF_PROTO_INIT(klass, initArgs);
Declares the prototypes of functions in a VMCF class. Used in header files.

Parameters:
[in] klass Name of the class being created.
[in] initArgs Argument list for the init() function.

#define VMCF_DEFINE_CHAINED_GET_NAME   _VMCF_DEFINE_CHAINED_GET_NAME(VMCF_THISCLASS)

Create the server function to chain a call to the super class's "_get_name()" attribute getter (method).

Parameters:
[in] klass Name of the class.

#define VMCF_DEFINE_CHAINED_PROBE   _VMCF_DEFINE_CHAINED_PROBE(VMCF_THISCLASS)

Create the server function to chain a call to the super class's "probe()" method.

Parameters:
[in] klass Name of the class.

#define VMCF_DEFINE_CLASS

Value:

VMCF_DEFINE_CTOR       \
   VMCF_DEFINE_ALLOC      \
   VMCF_DEFINE_SUBINST
Macro to define the implementations of a class' "create", "alloc" and "getSubinstanceData".

#define VMCF_DEFINE_FINI_BEGIN

Value:

VMCF_PROTO_FINI(VMCF_THISCLASS)                                      \
{                                                                    \
   VMCF_INSTANCE_TYPE *inst = VMCF_GET_SUBINSTANCE_DATA((instData)); \
   if (!inst) {                                                      \
      return;                                                        \
   }
Defines the start of the finalizer function for a class. A finalizer should be implemented in the following way:

    VMCF_DEFINE_FINI_BEGIN {
       // Finalizer implementation. "inst" is a variable pointing
       // to the instance's private data. It's guaranteed to be
       // not NULL, and shouldn't be freed here.
    } VMCF_DEFINE_FINI_END;

See also:
VMCF_DEFINE_FINI_END

#define VMCF_DEFINE_FINI_END

Value:

VMCF_CHAIN_TO_SUPER_IMPL(finalize, (instData)); \
}
Defines the end of a finalizer function for a class. Takes care of chaining the finalization up the inheritance chain.

See also:
VMCF_PROTO_FINI

#define VMCF_EXCEPTION_RAISED ( env   )     ((env)->_major != CORBA_NO_EXCEPTION)

Returns non-zero if an exception was raised.

#define VMCF_EXTERN

Tags a function for export in a shared library.

Add this tag to any functions that need to be exported. In the .c file implementing the functions, define the "VMCF_IMPL" pre-processor variable before including this header file, and undef it after the inclusion.

#define VMCF_GET_SELF_DATA ( self   )     VMCF_GET_SUBINSTANCE_DATA(VMCF_USER_DATA(self))

A shorthand macro to get an instance's private data, given a pointer to the instance object.

Parameters:
[in] self Pointer to the class's instance.

#define VMCF_GET_SUBINSTANCE_DATA ( data   )     VMCF_CHAIN_TO_SUPER_IMPL(getSubinstanceData, (data))

A shorthand macro to get a subinstance's private data, given the root pointer for the instance's private data.

Parameters:
[in] data Pointer to the class's private data.

#define VMCF_INIT_EPILOGUE ( self,
activate,
env   ) 

Value:

{           \
   if (self) {                                              \
      if (VMCF_EXCEPTION_RAISED((env))) {                   \
         CORBA_Environment _lenv = { CORBA_NO_EXCEPTION };  \
         CORBA_Object_release((self), &_lenv);              \
         CORBA_exception_free(&_lenv);                      \
      } else if (activate) {                                \
         ilu_ActivateObject(self->iluco_ko);                \
      }                                                     \
   }                                                        \
}
Epilogue for initialization functions.

Checks whether an exception was raised and releases the object if so. This should be called from the class's _init() function, after it has checked for the super class's successful initialization. Note that the second argument ('activate') in the 'super' call should be FALSE to ensure object activation happens only on complete initialization. For example:

    VMCF_CHAIN_TO_SUPER_IMPL(init, (self, CORBA_FALSE, env));

    if (!VMCF_EXCEPTION_RAISED(env)) {
       // Perform class initialization.
       VMCF_INIT_EPILOGUE(self, activate, env);
    }

#define VMCF_INSTANCE_TYPE   _VMCF_INSTANCE_TYPE(VMCF_THISCLASS)

Macro to generate an instance type name, based on the implemented class. Implementations should use this to define the data type for their private data:

typedef [private data type] VMCF_INSTANCE_TYPE;

#define VMCF_IS_EMPTY ( str   )     ((str) == NULL || *(str) == '\0')

Returns whether a CORBA string is empty or not.

Parameters:
str The string to test.

#define VMCF_PROTO_INIT ( args   )     _VMCF_PROTO_INIT(VMCF_THISCLASS, args)

Defines the prototype of the 'initializer' function.

This function is called to perform custom initialization of CFObject instances, after they've been allocated by calling 'create'.

This function can have a custom signature depending on the object, but as a convention the first parameter should always be the instance pointer, and the last parameter a pointer to a CORBA_Environment.

Implementations are responsible for chaining the call to the super class's initializer function. The code calling @ _init() shouldn't try to use the object if an exception is raised, since it might have been freed by the runtime.

Parameters:
[in] args The function signature.

#define VMCF_USER_DATA ( self   )     (((ILU_C_Object *)(self))->instanceData)

Macro used to get a pointer to the entire (root) instance data. This returns a pointer to the private data of the base class in the inheritance chain, not to the private data of the current instance.


Typedef Documentation

typedef VMCFCore_CFObject(* VMCFCore_CFObject_CreateFn)(CORBA_string name, VMCFServer server, CORBA_boolean bind, VMCFCore_CFObject parent, CORBA_Environment *env)

[FullyQualifiedClass]_create function signature.

typedef struct VMCFServer_s* VMCFServer


Function Documentation

CORBA_string server_VMCFCore_CFObject__get_name ( VMCFCore_CFObject  self,
CORBA_Environment *  env 
)

See also:
VMCFCore::CFObject::name.

void server_VMCFCore_CFObject_probe ( VMCFCore_CFObject  self,
CORBA_Environment *  env 
)

See also:
VMCFCore::CFObject::probe().

VMCFCore_CFObject VMCFCore_CFObjectImpl_addChild ( VMCFCore_CFObject  parent,
VMCFCore_CFObject  child 
)

Adds a child to its parent's list of children.

Parameters:
[in] parent The parent object.
[in] child The child object.
Returns:
The "child" argument on success, NULL otherwise.

void VMCFCore_CFObjectImpl_alloc ( VMCFCore_CFObject  self,
size_t  extraInstanceDataSize,
CORBA_string  name,
void *  server,
VMCFCore_CFObject  parent,
CORBA_Environment *  env 
)

VMCFCore_CFObject VMCFCore_CFObjectImpl_create ( CORBA_string  name,
void *  server,
CORBA_boolean  bind,
VMCFCore_CFObject  parent,
CORBA_Environment *  env 
)

void VMCFCore_CFObjectImpl_finalize ( void *  instData  ) 

VMCFCore_CFObject VMCFCore_CFObjectImpl_getChild ( VMCFCore_CFObject  parent,
CORBA_string  name 
)

Gets a child from its parent's list of children.

Parameters:
[in] parent The parent object.
[in] name The child's name.
Returns:
The "child" object on success, NULL otherwise.

time_t VMCFCore_CFObjectImpl_getLastProbeTime ( VMCFCore_CFObject  self  ) 

Returns the time this object was last probed.

Parameters:
[in] self 
Returns:
Time in seconds.

VMCFCore_CFObject VMCFCore_CFObjectImpl_getParent ( VMCFCore_CFObject  self  ) 

Returns the object's parent.

Parameters:
[in] self 
Returns:
This object's parent.

VMCFServer VMCFCore_CFObjectImpl_getServer ( VMCFCore_CFObject  self  ) 

Returns the server serving this object.

Parameters:
[in] self 
Returns:
Server

CORBA_unsigned_long VMCFCore_CFObjectImpl_getState ( VMCFCore_CFObject  self  ) 

Returns the current CFObject state value.

Parameters:
[in] self 
Returns:
Current state value.

void * VMCFCore_CFObjectImpl_getSubinstanceData ( void *  instData  ) 

CORBA_boolean VMCFCore_CFObjectImpl_lock ( VMCFCore_CFObject  self  ) 

Locks an object's instance data.

Parameters:
[in] self Object to lock.
Returns:
TRUE if the operation was successful, FALSE otherwise.

CORBA_boolean VMCFCore_CFObjectImpl_removeChild ( VMCFCore_CFObject  parent,
CORBA_string  name 
)

Removes a child from its parent's list of children.

Parameters:
[in] parent The parent object.
[in] name The child's name.
Returns:
TRUE is the child was found and removed, FALSE otherwise.

CORBA_unsigned_long VMCFCore_CFObjectImpl_setState ( VMCFCore_CFObject  self,
CORBA_unsigned_long  state 
)

Sets the current CFObject state value.

Parameters:
[in] self 
[in] state New object state.
Returns:
Previous state value.

void VMCFCore_CFObjectImpl_unlock ( VMCFCore_CFObject  self  ) 

Unlocks an object's instance data.

Parameters:
[in] self Object to unlock.

void VMCFCoreImpl_closeServer ( VMCFServer  server,
CORBA_Environment *  env 
)

Closes (stops and releases) the specified server.

Parameters:
[in] server Server to close.
[out] env 
Exceptions:
VMCFCore::InvalidArguments If NULL arguments were passed.
CORBA::SystemException If an internal ORB error occured.

VMCFServer VMCFCoreImpl_createServer ( char *  ainfo,
void *  serverCtx,
CORBA_Environment *  env 
)

Creates a server that can be used to instantiate objects. If the serverCtx parameter is provided, then it is used by the SSL transport that this server uses (if configured). If SSL transport is requested, then serverCtx must be valid and VMCFCoreImpl_init() must have been called before with 'sslEnabled' set to CORBA_TRUE. For non-SSL transport configurations, serverCtx is ignored.

'serverCtx' is owned by the created server. The application must not modify serverCtx once it has been passed to VMCF.

The server may be closed (destroyed) by calling VMCFCoreImpl_closeServer().

Parameters:
[in] ainfo Addressing information. Eg. "corbaloc:iiops:127.0.0.1:1001".
[in] serverCtx Optional SSL context of type SSL_CTX *.
[out] env CORBA environment.
Exceptions:
VMCFCore::InvalidArguments If invalid arguments were passed.

CORBA_Object VMCFCoreImpl_getORB ( void   ) 

Retrieves the ORB singleton.

Returns:
The ORB object, or CORBA_OBJECT_NIL if the ORB was not initialized.

CORBA_boolean VMCFCoreImpl_init ( CORBA_boolean  sslEnabled,
void *  clientCtx 
)

VMCF global initializer.

This function initializes global state and must be called while the process is still single threaded. If SSL capabilities are desired, then 'sslEnabled' must be set and SSL libraries (libssl.so, libcrypto.so or libeay.dll, ssleay.dll) must be loaded already. If a clientCtx is given, it is used as the common global SSL context, used in client mode(SSL_connect end) connections. If the client is expected to make invocations on objects hosted on SSL servers, then clientCtx must be given.

'clientCtx' is owned by VMCF once passed to this function. The application must not modify clientCtx after this function returns.

After this function returns, the application is multi-threaded. So all single threaded initialization must be performed before calling this.

Parameters:
[in] sslEnabled Whether SSL initiatlization should be done.
[in] clientCtx Optional user defined SSL context of type SSL_CTX *.
Returns:
Initialization status.

void VMCFCoreImpl_lock ( void   ) 

Acquires the VMCF global mutex.

void VMCFCoreImpl_raiseInvalidArguments ( CORBA_Environment *  env,
CORBA_string  msg 
)

Raises an InvalidArguments exception.

Parameters:
[out] env Environment where to set the exception.
[in] msg String for the exception message (may be NULL).
Exceptions:
VMCFCore::NoResources If can't allocate memory for the exception information.

void VMCFCoreImpl_releaseObject ( void *  obj  ) 

Releases a CORBA_Object, ignoring any errors. This function is useful for callbacks that only accept one opaque argument.

Parameters:
[in] obj The object to be released (may be NULL).

CORBA_string VMCFCoreImpl_strdup ( const CORBA_string  src  ) 

Returns a copy of the given string.

Use CORBA_free() to dispose of the result.

Parameters:
[in] src The string to copy.
Returns:
A copy of the string, or NULL on error.

void VMCFCoreImpl_unlock ( void   ) 

Releases the VMCF global mutex.


Generated on Tue Dec 22 15:48:41 2009 for VMCF by  doxygen 1.5.3