3 #include <epicsStdio.h>
8 pvaLinkConfig::pvaLinkConfig()
20 pvaLinkConfig::~pvaLinkConfig() {}
25 using namespace pvalink;
47 jlink* pva_alloc_jlink(
short dbr)
53 }
catch(std::exception& e){
54 errlogPrintf(
"Error allocating pva link: %s\n", e.what());
59 #define TRY pvaLinkConfig *pvt = static_cast<pvaLinkConfig*>(pjlink); (void)pvt; try
60 #define CATCH(RET) catch(std::exception& e){ \
61 errlogPrintf("Error in %s link: %s\n", __FUNCTION__, e.what()); \
64 void pva_free_jlink(jlink *pjlink)
69 }
catch(std::exception& e){
70 errlogPrintf(
"Error freeing pva link: %s\n", e.what());
74 jlif_result pva_parse_null(jlink *pjlink)
77 TRACE(<<pvt->jkey<<
" ");
78 if(pvt->parseDepth!=1) {
80 }
else if(pvt->jkey ==
"proc") {
81 pvt->pp = pvaLinkConfig::Default;
82 }
else if(pvt->jkey ==
"sevr") {
83 pvt->ms = pvaLinkConfig::NMS;
84 }
else if(pvt->jkey ==
"local") {
86 }
else if(pvt->debug) {
87 printf(
"pva link parsing unknown none depth=%u key=\"%s\"\n",
88 pvt->parseDepth, pvt->jkey.c_str());
96 jlif_result pva_parse_bool(jlink *pjlink,
int val)
99 TRACE(<<pvt->jkey<<
" "<<(val?
"true":
"false"));
100 if(pvt->parseDepth!=1) {
102 }
else if(pvt->jkey ==
"proc") {
103 pvt->pp = val ? pvaLinkConfig::PP : pvaLinkConfig::NPP;
104 }
else if(pvt->jkey ==
"sevr") {
105 pvt->ms = val ? pvaLinkConfig::MS : pvaLinkConfig::NMS;
106 }
else if(pvt->jkey ==
"defer") {
108 }
else if(pvt->jkey ==
"pipeline") {
109 pvt->pipeline = !!val;
110 }
else if(pvt->jkey ==
"time") {
112 }
else if(pvt->jkey ==
"retry") {
114 }
else if(pvt->jkey ==
"local") {
116 }
else if(pvt->jkey ==
"always") {
118 }
else if(pvt->debug) {
119 printf(
"pva link parsing unknown integer depth=%u key=\"%s\" value=%s\n",
120 pvt->parseDepth, pvt->jkey.c_str(), val ?
"true" :
"false");
124 return jlif_continue;
128 jlif_result pva_parse_integer(jlink *pjlink,
long long val)
131 TRACE(<<pvt->jkey<<
" "<<val);
132 if(pvt->parseDepth!=1) {
134 }
else if(pvt->jkey ==
"Q") {
135 pvt->queueSize = val < 1 ? 1 : size_t(val);
136 }
else if(pvt->jkey ==
"monorder") {
137 pvt->monorder = std::max(-1024, std::min(
int(val), 1024));
138 }
else if(pvt->debug) {
139 printf(
"pva link parsing unknown integer depth=%u key=\"%s\" value=%lld\n",
140 pvt->parseDepth, pvt->jkey.c_str(), val);
144 return jlif_continue;
148 jlif_result pva_parse_string(jlink *pjlink,
const char *val,
size_t len)
151 std::string sval(val, len);
152 TRACE(<<pvt->jkey<<
" "<<sval);
153 if(pvt->parseDepth==0 || (pvt->parseDepth==1 && pvt->jkey==
"pv")) {
154 pvt->channelName = sval;
156 }
else if(pvt->parseDepth > 1) {
159 }
else if(pvt->jkey==
"field") {
160 pvt->fieldName = sval;
162 }
else if(pvt->jkey==
"proc") {
164 pvt->pp = pvaLinkConfig::Default;
165 }
else if(sval==
"CP") {
166 pvt->pp = pvaLinkConfig::CP;
167 }
else if(sval==
"CPP") {
168 pvt->pp = pvaLinkConfig::CPP;
169 }
else if(sval==
"PP") {
170 pvt->pp = pvaLinkConfig::PP;
171 }
else if(sval==
"NPP") {
172 pvt->pp = pvaLinkConfig::NPP;
173 }
else if(pvt->debug) {
174 printf(
"pva link parsing unknown proc depth=%u key=\"%s\" value=\"%s\"\n",
175 pvt->parseDepth, pvt->jkey.c_str(), sval.c_str());
178 }
else if(pvt->jkey==
"sevr") {
180 pvt->ms = pvaLinkConfig::NMS;
181 }
else if(sval==
"MS") {
182 pvt->ms = pvaLinkConfig::MS;
183 }
else if(sval==
"MSI") {
184 pvt->ms = pvaLinkConfig::MSI;
185 }
else if(sval==
"MSS") {
189 pvt->ms = pvaLinkConfig::MS;
190 }
else if(pvt->debug) {
191 printf(
"pva link parsing unknown sevr depth=%u key=\"%s\" value=\"%s\"\n",
192 pvt->parseDepth, pvt->jkey.c_str(), sval.c_str());
195 }
else if(pvt->debug) {
196 printf(
"pva link parsing unknown string depth=%u key=\"%s\" value=\"%s\"\n",
197 pvt->parseDepth, pvt->jkey.c_str(), sval.c_str());
201 return jlif_continue;
205 jlif_key_result pva_parse_start_map(jlink *pjlink)
209 return jlif_key_continue;
210 }CATCH(jlif_key_stop)
213 jlif_result pva_parse_key_map(jlink *pjlink,
const char *key,
size_t len)
216 std::string sval(key, len);
220 return jlif_continue;
224 jlif_result pva_parse_end_map(jlink *pjlink)
228 return jlif_continue;
232 struct lset* pva_get_lset(
const jlink *pjlink)
238 void pva_report(
const jlink *rpjlink,
int lvl,
int indent)
243 printf(
"%*s'pva': %s", indent,
"", pval->
channelName.c_str());
248 case pvaLinkConfig::NPP: printf(
" NPP");
break;
249 case pvaLinkConfig::Default: printf(
" Def");
break;
250 case pvaLinkConfig::PP: printf(
" PP");
break;
251 case pvaLinkConfig::CP: printf(
" CP");
break;
252 case pvaLinkConfig::CPP: printf(
" CPP");
break;
255 case pvaLinkConfig::NMS: printf(
" NMS");
break;
256 case pvaLinkConfig::MS: printf(
" MS");
break;
257 case pvaLinkConfig::MSI: printf(
" MSI");
break;
260 printf(
" Q=%u pipe=%c defer=%c time=%c retry=%c morder=%d",
261 unsigned(pval->queueSize),
262 pval->pipeline ?
'T' :
'F',
263 pval->defer ?
'T' :
'F',
264 pval->time ?
'T' :
'F',
265 pval->retry ?
'T' :
'F',
271 Guard G(pval->lchan->lock);
273 printf(
" conn=%c", pval->lchan->connected ?
'T' :
'F');
274 if(pval->lchan->op_put.valid()) {
279 printf(
" #disconn=%zu prov=%s", pval->lchan->num_disconnect, pval->lchan->providerName.c_str());
283 pval->lchan->queued?
'T':
'F');
286 std::ostringstream strm;
287 pval->lchan->chan.show(strm);
288 printf(
"\n%*s CH: %s", indent,
"", strm.str().c_str());
291 printf(
" No Channel");
310 &pva_parse_start_map,
std::string channelName
Channel (aka PV) name string.
std::string fieldName
sub-field within addressed PVStructure