Commit c7c26a62 authored by Éric Thiébaut's avatar Éric Thiébaut
Browse files

wait_output and wait_command are common to all remote objects

parent a9b7f0da
......@@ -106,24 +106,6 @@ tao_shmid tao_remote_camera_get_image_shmid(
return shmid;
}
tao_serial tao_remote_camera_wait_output(
tao_remote_camera* cam,
tao_serial num,
double secs)
{
return tao_remote_object_wait_output(
tao_remote_object_cast(cam), num, secs);
}
tao_status tao_remote_camera_wait_command(
tao_remote_camera* cam,
tao_serial num,
double secs)
{
return tao_remote_object_wait_command(
tao_remote_object_cast(cam), num, secs);
}
tao_status tao_remote_camera_get_information(
const tao_remote_camera* src,
tao_camera_info* dst)
......@@ -255,5 +237,5 @@ GETTER(tao_encoding, info.config, bufferencoding, TAO_ENCODING_UNKNOWN)
// Generic shared object methods.
#define TYPE remote_camera
#define MAGIC TAO_REMOTE_CAMERA
#define IS_REMOTE_OBJECT 1
#define REMOTE_OBJECT 2 // sub-type of remote object type
#include "./shared-methods.c"
......@@ -171,11 +171,6 @@ tao_remote_mirror* tao_remote_mirror_create(
return obj;
}
#define TYPE remote_mirror
#define MAGIC TAO_REMOTE_MIRROR
#define IS_REMOTE_OBJECT 1
#include "./shared-methods.c"
tao_serial tao_remote_mirror_get_mark(
const tao_remote_mirror* obj)
{
......@@ -359,24 +354,6 @@ tao_serial tao_remote_mirror_send_commands(
return num;
}
tao_serial tao_remote_mirror_wait_output(
tao_remote_mirror* obj,
tao_serial num,
double secs)
{
return tao_remote_object_wait_output(
tao_remote_object_cast(obj), num, secs);
}
tao_status tao_remote_mirror_wait_command(
tao_remote_mirror* obj,
tao_serial num,
double secs)
{
return tao_remote_object_wait_command(
tao_remote_object_cast(obj), num, secs);
}
// FIXME: check running?
tao_status tao_remote_mirror_fetch_data(
const tao_remote_mirror* obj,
......@@ -647,3 +624,8 @@ tao_status tao_remote_mirror_run_loop(
}
return status;
}
#define TYPE remote_mirror
#define MAGIC TAO_REMOTE_MIRROR
#define REMOTE_OBJECT 2 // sub-type of remote object type
#include "./shared-methods.c"
......@@ -117,7 +117,7 @@ tao_remote_object* tao_remote_object_attach(
// Basic methods.
#define TYPE remote_object
#define IS_REMOTE_OBJECT 1
#define REMOTE_OBJECT 1 // basic remote object type
#include "./shared-methods.c"
// Check whether the server owning the remote object is alive.
......
......@@ -47,13 +47,13 @@ tao_status tao_remote_sensor_check_config(
return TAO_OK;
}
#define TYPE remote_sensor
#define MAGIC TAO_REMOTE_SENSOR
#define IS_REMOTE_OBJECT 1
#include "./shared-methods.c"
tao_serial tao_remote_sensor_get_mark(
const tao_remote_sensor* wfs)
{
return (wfs == NULL) ? 0 : wfs->mark;
}
#define TYPE remote_sensor
#define MAGIC TAO_REMOTE_SENSOR
#define REMOTE_OBJECT 2 // sub-type of remote object type
#include "./shared-methods.c"
......@@ -51,5 +51,5 @@ tao_rwlocked_object* tao_rwlocked_object_attach(
}
#define TYPE rwlocked_object
#define IS_RWLOCKED_OBJECT 1
#define RWLOCKED_OBJECT 1 // basic r/w locked object type
#include "./shared-methods.c"
......@@ -208,5 +208,5 @@ tao_shared_array* tao_shared_array_fill(
// Generic shared object methods.
#define TYPE shared_array
#define MAGIC TAO_SHARED_ARRAY
#define IS_RWLOCKED_OBJECT 1
#define RWLOCKED_OBJECT 2 // sub-type of r/w locked object type
#include "./shared-methods.c"
......@@ -9,16 +9,19 @@
// generate code to attach objects of this type (not for basic shared,
// remote, and rwlocked object types).
//
// - IS_REMOTE_OBJECT should be defined to non-zero for types derived from
// tao_remote_object and left undefined or defined to zero for other types.
// - REMOTE_OBJECT should be defined to non-zero for types derived from
// tao_remote_object (1 for a the basic type and 2 for sub-types) and left
// undefined or defined to zero for other types.
//
// - IS_RWLOCKED_OBJECT should be defined to non-zero for types derived from
// tao_rwlocked_object and left undefined or defined to zero for other types.
// - RWLOCKED_OBJECT should be defined to non-zero for types derived from
// tao_rwlocked_object (1 for a the basic type and 2 for sub-types) and left
// undefined or defined to zero for other types.
//
// - IS_SHARED_OBJECT should be defined to non-zero for types derived from
// tao_shared_object and left undefined or defined to zero for other types.
// If IS_REMOTE_OBJECT or IS_RWLOCKED_OBJECT is defined and non-zero,
// IS_SHARED_OBJECT is automatically defined to non-zero.
// - SHARED_OBJECT should be defined to non-zero for types derived from
// tao_shared_object (1 for a the basic type and 2 for sub-types) and left
// undefined or defined to zero for other types. If one of REMOTE_OBJECT or
// RWLOCKED_OBJECT is defined and non-zero, SHARED_OBJECT is automatically
// defined to 2 because the type must be a sub-type of tao_shared_object.
//
// These macros are undefined at the end of this file so taht mutiple include's
// are allowed.
......@@ -34,24 +37,31 @@
# error Macro TYPE must be defined
#endif
#ifndef IS_RWLOCKED_OBJECT
# define IS_RWLOCKED_OBJECT 0
#ifndef RWLOCKED_OBJECT
# define RWLOCKED_OBJECT 0
#endif
#define IS_RWLOCKED_OBJECT (RWLOCKED_OBJECT > 0)
#ifndef IS_REMOTE_OBJECT
# define IS_REMOTE_OBJECT 0
#ifndef REMOTE_OBJECT
# define REMOTE_OBJECT 0
#endif
#ifndef IS_SHARED_OBJECT
# define IS_SHARED_OBJECT (IS_RWLOCKED_OBJECT || IS_REMOTE_OBJECT)
#define IS_REMOTE_OBJECT (REMOTE_OBJECT > 0)
#ifndef SHARED_OBJECT
# if (IS_RWLOCKED_OBJECT || IS_REMOTE_OBJECT)
# define SHARED_OBJECT 2 // must be a sub-type
# else
# define SHARED_OBJECT 0
# endif
#endif
#define IS_SHARED_OBJECT (SHARED_OBJECT > 0)
#if IS_RWLOCKED_OBJECT && IS_REMOTE_OBJECT
# error Macros IS_RWLOCKED_OBJECT and IS_REMOTE_OBJECT are exclusive
# error Macros RWLOCKED_OBJECT > 0 and REMOTE_OBJECT > 0 are exclusive
#endif
#if (IS_RWLOCKED_OBJECT || IS_REMOTE_OBJECT) && ! IS_SHARED_OBJECT
# error Macro IS_SHARED_OBJECT must be true if IS_RWLOCKED_OBJECT or IS_REMOTE_OBJECT is true
#if (IS_RWLOCKED_OBJECT || IS_REMOTE_OBJECT) && SHARED_OBJECT != 2
# error Macro SHARED_OBJECT must be undefined or set to 2 for sub-types
#endif
#ifdef MAGIC
......@@ -547,6 +557,28 @@ int TAO_XJOIN3(tao_,TYPE,_is_alive)(
tao_remote_object_cast(obj)->state != TAO_STATE_UNREACHABLE);
}
#if REMOTE_OBJECT > 1 // Is it a sub-type of tao_remote_object?
tao_serial TAO_XJOIN3(tao_,TYPE,_wait_output)(
TAO_XJOIN2(tao_,TYPE)* obj,
tao_serial num,
double secs)
{
return tao_remote_object_wait_output(
tao_remote_object_cast(obj), num, secs);
}
#endif
#if REMOTE_OBJECT > 1 // Is it a sub-type of tao_remote_object?
tao_status TAO_XJOIN3(tao_,TYPE,_wait_command)(
TAO_XJOIN2(tao_,TYPE)* obj,
tao_serial num,
double secs)
{
return tao_remote_object_wait_command(
tao_remote_object_cast(obj), num, secs);
}
#endif
#endif /* IS_REMOTE_OBJECT */
#undef TYPE
......
......@@ -321,5 +321,5 @@ tao_status tao_shared_object_detach(
}
#define TYPE shared_object
#define IS_SHARED_OBJECT 1
#define SHARED_OBJECT 1 // basic shared object type
#include "./shared-methods.c"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment