mrfioc2  2.3.0
devObj.cpp
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2011 Brookhaven Science Associates, as Operator of
3 * Brookhaven National Laboratory.
4 * mrfioc2 is distributed subject to a Software License Agreement found
5 * in file LICENSE that is included with this distribution.
6 \*************************************************************************/
7 
8 #include <stdexcept>
9 
10 #include <epicsThread.h>
11 
12 #include "devObj.h"
13 
14 const
15 linkOptionEnumType readbackEnum[] = { {"No",0}, {"Yes",1} };
16 
17 const
19 {
20  linkString (addrBase, obj , "OBJ" , 1, 0),
21  linkString (addrBase, prop , "PROP" , 1, 0),
22  linkEnum (addrBase, rbv, "RB" , 0, 0, readbackEnum),
23  linkString (addrBase, klass , "CLASS" , 0, 0),
24  linkString (addrBase, parent , "PARENT" , 0, 0),
26 };
27 
28 static
29 struct CurrentID_t {
30  epicsThreadPrivateId id;
31  CurrentID_t()
32  :id(epicsThreadPrivateCreate())
33  {
34  if(!id)
35  throw std::bad_alloc();
36  }
37 } CurrentID;
38 
39 void CurrentRecord::set(dbCommon* prec)
40 {
41  epicsThreadPrivateSet(CurrentID.id, prec);
42 }
43 
45 {
46  set(0);
47 }
48 
49 dbCommon* CurrentRecord::get()
50 {
51  return (dbCommon*)epicsThreadPrivateGet(CurrentID.id);
52 }
#define linkOptionEnd
Definition: linkoptions.h:111
static dbCommon * get()
Definition: devObj.cpp:49
void set(dbCommon *prec)
Definition: devObj.cpp:39
#define linkEnum(Struct, Member, Name, Req, Over, Enums)
Definition: linkoptions.h:108
const linkOptionEnumType readbackEnum[]
Definition: devObj.cpp:15
const linkOptionDef objdef[]
Definition: devObj.cpp:18
#define linkString(Struct, Member, Name, Req, Over)
Definition: linkoptions.h:105
~CurrentRecord()
Definition: devObj.cpp:44