22 #include <menuConvert.h> 31 #define CATCH(RET) catch(alarm_exception& e) {\ 32 (void)recGblSetSevr(prec, e.status(), e.severity());\ 34 } catch(std::exception& e) {\ 35 (void)recGblSetSevr(prec, COMM_ALARM, INVALID_ALARM);\ 36 epicsPrintf("%s: error: %s\n", prec->name, e.what());\ 42 template<
typename REC>
45 dset_cast(
long (*fn)(REC*))
52 dset_cast(
long (*fn)(
int,dbCommon*,IOSCANPVT*))
59 dset_cast(
long (*fn)(
int))
66 template<
typename REC>
69 dsxt_cast(
long (*fn)(REC*))
93 epicsShareExtern
const 98 mrf::auto_ptr<mrf::property<T> >
P;
101 epicsShareExtern
const 105 template<
typename Rec>
109 set((dbCommon*)prec);
114 void set(dbCommon* prec);
119 long init_dset(
int i)
121 if (i==0) devExtend(D);
126 long init_record_empty(
void *)
132 long init_record_return2(
void *)
138 long del_record_empty(dbCommon*)
144 static long add_record_property(
150 if(lnk->type!=INST_IO)
153 mrf::auto_ptr<addr<P> > a;
161 a->obj[0] = a->prop[0] = a->klass[0] = a->parent[0] =
'\0';
164 lnk->value.instio.string, 0)) {
165 errlogPrintf(
"%s: Invalid Input link", prec->name);
172 args[
"PARENT"] = a->parent;
173 o = Object::getCreateObject(a->obj, a->klass, args);
175 }
catch(std::exception& e) {
176 errlogPrintf(
"%s: failed to find/create object '%s' : %s\n", prec->name, a->obj, e.what());
180 mrf::auto_ptr<property<P> > prop = o->
getProperty<P>(a->prop);
182 errlogPrintf(
"%s: '%s' lacks property '%s' of required type %s\n",
183 prec->name, o->
name().c_str(), a->prop,
typeid(P).name());
188 a->P = PTRMOVE(prop);
190 prec->dpvt = (
void*)a.release();
193 }
catch (std::exception& e) {
194 errlogPrintf(
"%s: add_record failed: %s\n", prec->name, e.what());
199 template<
typename REC,
typename T>
201 long add_record_inp(dbCommon *pcom)
203 REC *prec=(REC*)pcom;
204 return add_record_property<T>(pcom, &prec->inp);
207 template<
typename REC,
typename T>
209 long add_record_out(dbCommon *pcom)
211 REC *prec=(REC*)pcom;
212 return add_record_property<T>(pcom, &prec->out);
215 template<
typename DT>
217 long del_record_delete(dbCommon* prec)
219 DT *prop=
static_cast<DT*
>(prec->dpvt);
228 long del_record_property(dbCommon* prec)
239 static inline long get_ioint_info_property(
int, dbCommon* prec, IOSCANPVT* io)
242 if (!prec->dpvt) {(void)recGblSetSevr(prec, COMM_ALARM, INVALID_ALARM);
return -1; }
246 mrf::auto_ptr<property<IOSCANPVT> > up = prop->
O->
getProperty<IOSCANPVT>(prop->
prop);
251 errlogPrintf(
"%s Warning: I/O Intr not supported by PROP=%s\n", prec->name, prop->
prop);
255 }
catch(std::exception& e) {
256 recGblRecordError(S_db_noMemory, (
void*)prec, e.what());
257 return S_db_noMemory;
261 #define OBJECT_DSET(NAME, ADD, DEL, INIT, WRITE, LINR) \ 262 dsxt dxt ## NAME={ADD,DEL}; \ 263 static common_dset dev ## NAME = { \ 265 dset_cast(&init_dset<&dxt ## NAME>), \ 267 (DEVSUPFUN) &get_ioint_info_property, \ 271 #define OBJECT_DSET_EXPORT(NAME) epicsExportAddress(dset,dev ## NAME) std::map< std::string, std::string > create_args_t
DEVSUPFUN special_linconv
int epicsShareAPI linkOptionsStore(const linkOptionDef *opts, void *user, const char *str, int options)
Parse a string a store the result.
const std::string & name() const
mrf::auto_ptr< property< P > > getProperty(const char *pname)
epicsShareExtern const linkOptionEnumType readbackEnum[]
epicsShareExtern const linkOptionDef objdef[]
Hardware link parsing and storage.
mrf::auto_ptr< mrf::property< T > > P
long(* DSXTFUN)(dbCommon *)