00001
#ifndef ENUM_IMPL_H
00002
#define ENUM_IMPL_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __cplusplus
00018
#error This is a C++ include file and cannot be used from plain C
00019
#endif
00020
00021
#include <baciDB.h>
00022
#include <logging.h>
00023
#include <baciROpattern.h>
00024
#include <baciRecovery.h>
00025
#include <enumpropAlarm.h>
00026
#include <baciErrTypeProperty.h>
00027
#include <baciCharacteristicModelImpl.h>
00028
#include "enumpropAlarmSystemMonitorEnumProp.h"
00029
00030 #define HISTORY_SIZE 32
00031
00032
00033 #define ACS_ENUM_T(T) T, T##CB, T##Seq, T##Seq_out, T##Alarm
00034 #define ACS_ENUM_C class T, class TCB, class TSeq, class TSeq_out, class TAlarm, class SK
00035
00038
template <ACS_ENUM_C>
00039 class ROEnumImpl:
public virtual PortableServer::
RefCountServantBase,
00040
public SK,
00041
public baci::CharacteristicModelImpl,
00042
public baci::PropertyImplementator,
00043
public baci::ActionImplementator
00044 {
00045
00046
public:
00047
00048
00054
ROEnumImpl(
const ACE_CString&
name,
baci::BACIComponent *cob,
DevIO<T> *devIO=0,
bool flagdeldevIO=
false);
00055
00059
virtual ~ROEnumImpl();
00060
00067 virtual int initialization() {
return initialization_m; }
00068
00073 CORBA::Object_ptr
getCORBAReference()
const
00074
{
00075
return reference_mp;
00076 }
00077
00081 baci::BACIProperty*
getProperty()
const
00082
{
00083
return property_mp;
00084 }
00085
00089 DevIO<T>*
getDevIO()
const
00090
{
00091
return devIO_mp;
00092 }
00099
virtual void destroy();
00100
00101
00102
00103
00104
virtual baci::ActionRequest
getValueAction(
baci::BACIComponent* cob,
const int& callbackID,
00105
const CBDescIn& descIn,
baci::BACIValue* value,
00106
Completion& completion,
CBDescOut& descOut);
00107
00108
00109
00127
virtual baci::ActionRequest
invokeAction(
int function,
00128
baci::BACIComponent* cob,
const int& callbackID,
00129
const CBDescIn& descIn,
baci::BACIValue* value,
00130
Completion& completion,
CBDescOut& descOut);
00131
00132
00133
00141
virtual void getValue(
baci::BACIProperty* property,
00142
baci::BACIValue* value,
00143
Completion &completion,
00144
CBDescOut& descOut);
00145
00146
00147
00148
00149
00150
00151
00152
virtual char *
name ();
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
virtual char *
characteristic_component_name ();
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
virtual char *
description ();
00179
00180
virtual char *
format ();
00181
00182
virtual char *
units ();
00183
00184
virtual ACS::pattern
resolution ();
00185
00186
virtual CORBA::Boolean
initialize_devio ();
00187
00188
00189
virtual ACS::TimeInterval
default_timer_trigger ();
00190
00191
virtual ACS::TimeInterval
min_timer_trigger ();
00192
00193
virtual T
default_value ();
00194
00195
virtual T
get_sync (ACSErr::Completion_out c);
00196
00197
virtual void get_async (
00198
CBpattern* cb,
00199
const ACS::CBDescIn & desc
00200 );
00201
00202
virtual CORBA::Long
get_history (
00203 CORBA::Long n_last_values,
00204 TSeq_out vs,
00205 ACS::TimeSeq_out ts
00206 );
00207
00208
virtual ACS::Monitorpattern*
create_monitor (
00209
CBpattern* cb,
00210
const ACS::CBDescIn & desc
00211 );
00212
00213
virtual ACS::Monitor*
create_postponed_monitor (
00214 ACS::Time start_time,
00215
CBpattern* cb,
00216
const ACS::CBDescIn & desc
00217 );
00218
00219
virtual ACS::stringSeq *
statesDescription (
00220 );
00221
00222
virtual ACS::ConditionSeq *
condition (
00223 );
00224
00225
virtual TSeq *
allStates ();
00226
00227
00228
00229
virtual TSeq*
alarm_on ();
00230
00231
virtual TSeq*
alarm_off ();
00232
00233
virtual ACS::Subscription_ptr
new_subscription_AlarmEnum (
00234 ACS::Alarmpattern_ptr cb,
00235
const ACS::CBDescIn & desc
00236 );
00242
bool checkAlarm(T state);
00243
00244
protected:
00245
00251
virtual bool readCharacteristics();
00252
00253
00254
00255
void addValueToHistory(ACS::Time time, ACS::pattern value);
00256
00257
private:
00258
00262 T state;
00263
00267
00268
00269
00270
00272 int initialization_m;
00273
00275 bool destroyed_m;
00276
00278 CORBA::Object_ptr reference_mp;
00279
00281 baci::BACIProperty* property_mp;
00282
00284 baci::MonitorenumpropEventDispatcher *monitorEventDispatcher_mp;
00285
00287 baci::AlarmSystemMonitorEnumProp<T, ROEnumImpl<ACS_ENUM_T(T), SK> > *alarmSystemMonitorEnumProp_mp;
00288
00290 T historyValue_m[
HISTORY_SIZE];
00291
00293 ACS::Time historyTime_m[
HISTORY_SIZE];
00294
00296 int historyStart_m;
00297
00299 bool historyTurnaround_m;
00300
00304
00305
00306 ACE_CString m_description;
00307 ACE_CString format_m;
00308 ACE_CString units_m;
00309 ACS::pattern m_resolution;
00310 bool initializeDevIO_m;
00311
00312
00313 T defaultValue_m;
00314 ACS::TimeInterval defaultTimerTrig_m;
00315 ACS::TimeInterval minTimerTrig_m;
00316
00317 ACS::TimeInterval m_alarm_timer_trig;
00318
00319 ACS::stringSeq m_statesDescription;
00320 ACS::ConditionSeq m_condition;
00321
00322
00324 TSeq m_alarm_on;
00325
00327 TSeq m_alarm_off;
00328
00330 bool alarmRaised_m;
00331
00332
#ifdef MAKE_VXWORKS
00333
baci::AlarmenumpropEventStrategy<T, ROEnumImpl<ACS_ENUM_T(T), SK>, ACS::Alarmpattern> a;
00334
#endif
00335
00336 DevIO<T> *devIO_mp;
00337 bool deldevIO_m;
00338 T m_value;
00339 int m_enumLength;
00340 };
00341
00342
#include "enumpropROImpl.i"
00343
00344
#endif