cis_config: /root/cis_interface/cis_interface/cis_interface/interface/CisInterface.hpp Source File

cis_config

CisInterface.hpp
1
2 #ifndef CISINTERFACE_HPP_
3 #define CISINTERFACE_HPP_
4
5 #include "CisInterface.h"
6
7
16 class CisInput {
17 cisInput_t _pi;
18 public:
19
25 CisInput(const char *name) : _pi(cisInput(name)) {}
26
28 CisInput(cisInput_t x) : _pi(x) {}
29
36 CisInput(const char *name, const char *fmt) : _pi(cisInputFmt(name, fmt)) {}
37
41 void _destroy_pi() { cis_free(&_pi); }
42
47 ~CisInput() { _destroy_pi(); }
48
53 cisInput_t pi() {
54 return _pi;
55 };
56
66 int recv(char *data, const size_t len) { return cis_recv(_pi, data, len); }
67
78 int recv(const int nargs, ...) {
79 // if (nargs != _pi._nfmt) {
80 // cislog_error("CisInput(%s).recv: %d args provided, but format expects %d.\n",
81 // _pi._name, nargs, _pi._nfmt);
82 // return -1;
83 // }
84 va_list va;
85 va_start(va, nargs);
86 int ret = vcisRecv(_pi, va);
87 va_end(va);
88 return ret;
89 }
90
100 int recv_nolimit(char **data, const size_t len) {
101 return cis_recv_nolimit(_pi, data, len);
102 }
103
114 int recv_nolimit(const int nargs, ...) {
115 // if (nargs != _pi._nfmt) {
116 // cislog_error("CisInput(%s).recv: %d args provided, but format expects %d.\n",
117 // _pi._name, nargs, _pi._nfmt);
118 // return -1;
119 // }
120 va_list va;
121 va_start(va, nargs);
122 int ret = vcisRecv_nolimit(_pi, va);
123 va_end(va);
124 return ret;
125 }
126
127 };
128
129
138 class CisOutput {
139 cisOutput_t _pi;
140 public:
141
147 CisOutput(const char *name) : _pi(cisOutput(name)) {}
148
155 CisOutput(const char *name, const char *fmt) : _pi(cisOutputFmt(name, fmt)) {}
156
158 CisOutput(cisOutput_t x) : _pi(x) {}
159
163 void _destroy_pi() { cis_free(&_pi); }
164
169 ~CisOutput() { _destroy_pi(); }
170
175 cisOutput_t pi() {
176 return _pi;
177 };
178
187 int send(const char *data, const size_t len) {
188 return cis_send(_pi, data, len);
189 }
190
199 int send(const int nargs, ...) {
200 // if (nargs != _pi._nfmt) {
201 // cislog_error("CisOutput(%s).send: %d args provided, but format expects %d.\n",
202 // _pi._name, nargs, _pi._nfmt);
203 // return -1;
204 // }
205 va_list va;
206 va_start(va, nargs);
207 int ret = vcisSend(_pi, va);
208 va_end(va);
209 return ret;
210 }
211
219 int send_nolimit(const char *data, const size_t len) {
220 return cis_send_nolimit(_pi, data, len);
221 }
222
231 int send_nolimit(const int nargs, ...) {
232 // if (nargs != _pi._nfmt) {
233 // cislog_error("CisOutput(%s).send: %d args provided, but format expects %d.\n",
234 // _pi._name, nargs, _pi._nfmt);
235 // return -1;
236 // }
237 va_list va;
238 va_start(va, nargs);
239 int ret = vcisSend_nolimit(_pi, va);
240 va_end(va);
241 return ret;
242 }
243
248 int send_eof() { return cis_send_eof(_pi); }
249 };
250
251
260 class CisRpc {
261 cisRpc_t _pi;
262 public:
263
272 CisRpc(const char *name, const char *outFormat, const char *inFormat) :
273 _pi(cisRpc(name, outFormat, inFormat)) {}
274
276 CisRpc(cisRpc_t x) : _pi(x) {}
277
281 void _destroy_pi() { cis_free(&_pi); }
282
287 ~CisRpc() { _destroy_pi(); }
288
293 cisRpc_t pi() {
294 return _pi;
295 };
296
305 int send(const int nargs, ...) {
306 va_list va;
307 va_start(va, nargs);
308 int ret = vrpcSend(_pi, va);
309 va_end(va);
310 return ret;
311 }
312
323 int recv(const int nargs, ...) {
324 va_list va;
325 va_start(va, nargs);
326 int ret = vrpcRecv(_pi, va);
327 va_end(va);
328 return ret;
329 }
330 };
331
332
340 class CisRpcServer : public CisRpc {
341 public:
342
352 CisRpcServer(const char *name, const char *inFormat, const char *outFormat) :
353 CisRpc(cisRpcServer(name, inFormat, outFormat)) {}
354
359 ~CisRpcServer() { _destroy_pi(); }
360
361 };
362
363
371 class CisRpcClient : public CisRpc {
372 public:
373
383 CisRpcClient(const char *name, const char *outFormat, const char *inFormat) :
384 CisRpc(cisRpcClient(name, outFormat, inFormat)) {}
385
390 ~CisRpcClient() { _destroy_pi(); }
391
404 int call(const int nargs, ...) {
405 cisRpc_t _cpi = pi();
406 va_list va;
407 va_start(va, nargs);
408 int ret = vrpcCall(_cpi, va);
409 va_end(va);
410 return ret;
411 }
412
413 };
414
415
423 class CisAsciiFileOutput : public CisOutput {
424 public:
425
430 CisAsciiFileOutput(const char *name) :
431 CisOutput(cisAsciiFileOutput(name)) {}
432
434 CisAsciiFileOutput(cisOutput_t x) :
435 CisOutput(x) {}
436
442 int send_line(const char *line) { return send(line, strlen(line)); }
443
444 };
445
446
454 class CisAsciiFileOutput_local : public CisAsciiFileOutput {
455 public:
456
461 CisAsciiFileOutput_local(const char *name) :
462 CisAsciiFileOutput(cisAsciiFileOutput_local(name)) {}
463
464 };
465
466
474 class CisAsciiFileInput : public CisInput {
475 public:
476
481 CisAsciiFileInput(const char *name) :
482 CisInput(cisAsciiFileInput(name)) {}
483
485 CisAsciiFileInput(cisInput_t x) :
486 CisInput(x) {}
487
497 int recv_line(char *line, const size_t n) { return recv(line, n); }
498
499 };
500
501
509 class CisAsciiFileInput_local : public CisAsciiFileInput {
510 public:
511
516 CisAsciiFileInput_local(const char *name) :
517 CisAsciiFileInput(cisAsciiFileInput_local(name)) {}
518
519 };
520
521
530 class CisAsciiTableOutput : public CisAsciiFileOutput {
531 public:
532
539 CisAsciiTableOutput(const char *name, const char *format_str) :
540 CisAsciiFileOutput(cisAsciiTableOutput(name, format_str)) {}
541
542 };
543
544
553 class CisAsciiTableOutput_local : public CisAsciiFileOutput {
554 public:
555
562 CisAsciiTableOutput_local(const char *name, const char *format_str) :
563 CisAsciiFileOutput(cisAsciiTableOutput_local(name, format_str)) {}
564
565 };
566
567
576 class CisAsciiArrayOutput : public CisAsciiFileOutput {
577 public:
578
585 CisAsciiArrayOutput(const char *name, const char *format_str) :
586 CisAsciiFileOutput(cisAsciiArrayOutput(name, format_str)) {}
587
588 };
589
590
599 class CisAsciiArrayOutput_local : public CisAsciiFileOutput {
600 public:
601
608 CisAsciiArrayOutput_local(const char *name, const char *format_str) :
609 CisAsciiFileOutput(cisAsciiArrayOutput_local(name, format_str)) {}
610
611 };
612
613
622 class CisAsciiTableInput : public CisAsciiFileInput {
623 public:
624
632 CisAsciiTableInput(const char *name) :
633 CisAsciiFileInput(cisAsciiTableInput(name)) {}
634
635 };
636
645 class CisAsciiTableInput_local : public CisAsciiFileInput {
646 public:
647
655 CisAsciiTableInput_local(const char *name) :
656 CisAsciiFileInput(cisAsciiTableInput_local(name)) {}
657
658 };
659
668 class CisAsciiArrayInput : public CisAsciiFileInput {
669 public:
670
678 CisAsciiArrayInput(const char *name) :
679 CisAsciiFileInput(cisAsciiArrayInput(name)) {}
680
681 };
682
692 class CisAsciiArrayInput_local : public CisAsciiFileInput {
693 public:
694
702 CisAsciiArrayInput_local(const char *name) :
703 CisAsciiFileInput(cisAsciiArrayInput_local(name)) {}
704
705 };
706
707
715 class CisPlyOutput : public CisOutput {
716 public:
717
722 CisPlyOutput(const char *name) :
723 CisOutput(cisPlyOutput(name)) {}
724
726 CisPlyOutput(cisOutput_t x) :
727 CisOutput(x) {}
728
729 };
730
731
739 class CisPlyInput : public CisInput {
740 public:
741
746 CisPlyInput(const char *name) :
747 CisInput(cisPlyInput(name)) {}
748
750 CisPlyInput(cisInput_t x) :
751 CisInput(x) {}
752
753 };
754
755
763 class CisObjOutput : public CisOutput {
764 public:
765
770 CisObjOutput(const char *name) :
771 CisOutput(cisObjOutput(name)) {}
772
774 CisObjOutput(cisOutput_t x) :
775 CisOutput(x) {}
776
777 };
778
779
787 class CisObjInput : public CisInput {
788 public:
789
794 CisObjInput(const char *name) :
795 CisInput(cisObjInput(name)) {}
796
798 CisObjInput(cisInput_t x) :
799 CisInput(x) {}
800
801 };
802
803
804 #endif /*CISINTERFACE_HPP_*/
CisInput::recv_nolimit
int recv_nolimit(char **data, const size_t len)
Receive a message larger than CIS_MSG_MAX from the input queue. See cis_recv_nolimit in CisInterface...
Definition: CisInterface.hpp:100
CisAsciiArrayInput
C++ interface to cisAsciiTableInput_t functionality for arrays.
Definition: CisInterface.hpp:668
CisPlyOutput::CisPlyOutput
CisPlyOutput(cisOutput_t x)
Empty constructor for inheritance.
Definition: CisInterface.hpp:726
CisRpc::CisRpc
CisRpc(const char *name, const char *outFormat, const char *inFormat)
Constructor for CisRpc.
Definition: CisInterface.hpp:272
CisOutput::CisOutput
CisOutput(const char *name)
Constructor for CisOutput.
Definition: CisInterface.hpp:147
CisAsciiArrayOutput::CisAsciiArrayOutput
CisAsciiArrayOutput(const char *name, const char *format_str)
Constructor for CisAsciiArrayOutput.
Definition: CisInterface.hpp:585
CisOutput::CisOutput
CisOutput(const char *name, const char *fmt)
Constructor for CisOutput with format.
Definition: CisInterface.hpp:155
CisAsciiTableInput::CisAsciiTableInput
CisAsciiTableInput(const char *name)
Constructor for CisAsciiTableInput. Due to issues with the C++ version of vsscanf, flags and precision indicators for floating point format specifiers (e.g. e, f), must be removed so that table input can be properly parsed.
Definition: CisInterface.hpp:632
CisOutput::~CisOutput
~CisOutput()
Destructor for CisOutput. See cis_free in CisInterface.h for details.
Definition: CisInterface.hpp:169
CisInput::recv
int recv(char *data, const size_t len)
Receive a message shorter than CIS_MSG_MAX from the input queue. See cis_recv in CisInterface.h for additional details.
Definition: CisInterface.hpp:66
CisRpc
C++ interface to cisRpc_t functionality.
Definition: CisInterface.hpp:260
CisObjInput::CisObjInput
CisObjInput(const char *name)
Constructor for CisObjInput.
Definition: CisInterface.hpp:794
CisInput::CisInput
CisInput(cisInput_t x)
Empty constructor for inheritance.
Definition: CisInterface.hpp:28
CisAsciiFileInput::recv_line
int recv_line(char *line, const size_t n)
Receive a single line from an associated file or queue. See af_recv_line in CisInterface.h for details.
Definition: CisInterface.hpp:497
CisRpc::~CisRpc
~CisRpc()
Destructor for CisRpc. See cis_free in CisInterface.h for details.
Definition: CisInterface.hpp:287
CisPlyInput::CisPlyInput
CisPlyInput(cisInput_t x)
Empty constructor for inheritance.
Definition: CisInterface.hpp:750
CisObjOutput::CisObjOutput
CisObjOutput(const char *name)
Constructor for CisObjOutput.
Definition: CisInterface.hpp:770
CisOutput::CisOutput
CisOutput(cisOutput_t x)
Empty constructor for inheritance.
Definition: CisInterface.hpp:158
CisAsciiFileInput_local
C++ interface to cisAsciiFileInput_t functionality for local files. The CisAsciiFileInput_local class...
Definition: CisInterface.hpp:509
CisRpc::pi
cisRpc_t pi()
Return the cisRpc_t structure.
Definition: CisInterface.hpp:293
CisInput::CisInput
CisInput(const char *name)
Constructor for CisInput.
Definition: CisInterface.hpp:25
CisRpcServer::CisRpcServer
CisRpcServer(const char *name, const char *inFormat, const char *outFormat)
Constructor for CisRpcServer.
Definition: CisInterface.hpp:352
CisAsciiArrayOutput_local
C++ interface to cisAsciiTableOutput_t functionality for local files.
Definition: CisInterface.hpp:599
CisAsciiTableOutput_local::CisAsciiTableOutput_local
CisAsciiTableOutput_local(const char *name, const char *format_str)
Constructor for CisAsciiTableOutput for local files.
Definition: CisInterface.hpp:562
CisPlyOutput::CisPlyOutput
CisPlyOutput(const char *name)
Constructor for CisPlyOutput.
Definition: CisInterface.hpp:722
CisAsciiFileOutput::CisAsciiFileOutput
CisAsciiFileOutput(const char *name)
Constructor for CisAsciiFileOutput.
Definition: CisInterface.hpp:430
CisObjInput
C++ interface to cisObjInput_t functionality. The CisObjInput class is a basic wrapper around the C c...
Definition: CisInterface.hpp:787
CisInput::pi
cisInput_t pi()
Return the cisInput_t structure.
Definition: CisInterface.hpp:53
CisRpc::CisRpc
CisRpc(cisRpc_t x)
Empty constructor for inheritance.
Definition: CisInterface.hpp:276
CisPlyInput
C++ interface to cisPlyInput_t functionality. The CisPlyInput class is a basic wrapper around the C c...
Definition: CisInterface.hpp:739
CisAsciiArrayOutput_local::CisAsciiArrayOutput_local
CisAsciiArrayOutput_local(const char *name, const char *format_str)
Constructor for CisAsciiArrayOutput for local files.
Definition: CisInterface.hpp:608
CisAsciiTableInput_local::CisAsciiTableInput_local
CisAsciiTableInput_local(const char *name)
Constructor for CisAsciiTableInput_local. Due to issues with the C++ version of vsscanf, flags and precision indicators for floating point format specifiers (e.g. e, f), must be removed so that table input can be properly parsed.
Definition: CisInterface.hpp:655
CisRpcClient::call
int call(const int nargs,...)
Send request to an RPC server from the client and wait for a response. See rpcCall in CisInterface...
Definition: CisInterface.hpp:404
CisInput::_destroy_pi
void _destroy_pi()
Alias to allow freeing of underlying C struct at the class level.
Definition: CisInterface.hpp:41
CisAsciiArrayInput_local
C++ interface to cisAsciiTableInput_t functionality for local files as arrays.
Definition: CisInterface.hpp:692
CisRpc::_destroy_pi
void _destroy_pi()
Alias to allow freeing of underlying C struct at the class level.
Definition: CisInterface.hpp:281
CisAsciiFileOutput
C++ interface to cisAsciiFileOutput_t functionality. The CisAsciiFileOutput class is a basic wrapper ...
Definition: CisInterface.hpp:423
CisInput::~CisInput
~CisInput()
Destructor for CisInput. See cis_free in CisInterface.h for details.
Definition: CisInterface.hpp:47
CisOutput::pi
cisOutput_t pi()
Return the cisOutput_t structure.
Definition: CisInterface.hpp:175
CisAsciiTableInput
C++ interface to cisAsciiTableInput_t functionality.
Definition: CisInterface.hpp:622
CisAsciiArrayOutput
C++ interface to cisAsciiTableOutput_t functionality with arrays.
Definition: CisInterface.hpp:576
CisInput::recv
int recv(const int nargs,...)
Receive and parse a message shorter than CIS_MSG_MAX from the input queue. See cisRecv from CisInterf...
Definition: CisInterface.hpp:78
CisAsciiFileOutput::send_line
int send_line(const char *line)
Send a single line to a file or queue.
Definition: CisInterface.hpp:442
CisAsciiTableOutput::CisAsciiTableOutput
CisAsciiTableOutput(const char *name, const char *format_str)
Constructor for CisAsciiTableOutput.
Definition: CisInterface.hpp:539
CisAsciiTableInput_local
C++ interface to cisAsciiTableInput_t functionality for local files.
Definition: CisInterface.hpp:645
CisOutput::send_nolimit
int send_nolimit(const int nargs,...)
Format and send a message larger than CIS_MSG_MAX to the output queue. See cisSend from CisInterface...
Definition: CisInterface.hpp:231
CisAsciiFileOutput_local
C++ interface to cisAsciiFileOutput_t functionality for local files. The CisAsciiFileOutput_local cla...
Definition: CisInterface.hpp:454
CisInput::CisInput
CisInput(const char *name, const char *fmt)
Constructor for CisInput with format.
Definition: CisInterface.hpp:36
CisAsciiFileInput_local::CisAsciiFileInput_local
CisAsciiFileInput_local(const char *name)
Constructor for CisAsciiFileInput_local.
Definition: CisInterface.hpp:516
CisAsciiFileOutput_local::CisAsciiFileOutput_local
CisAsciiFileOutput_local(const char *name)
Constructor for CisAsciiFileOutput.
Definition: CisInterface.hpp:461
CisAsciiFileInput::CisAsciiFileInput
CisAsciiFileInput(cisInput_t x)
Empty constructor for inheritance.
Definition: CisInterface.hpp:485
CisOutput::send_eof
int send_eof()
Send EOF message to output file, closing it.
Definition: CisInterface.hpp:248
CisAsciiTableOutput_local
C++ interface to cisAsciiTableOutput_t functionality for local files.
Definition: CisInterface.hpp:553
CisObjInput::CisObjInput
CisObjInput(cisInput_t x)
Empty constructor for inheritance.
Definition: CisInterface.hpp:798
CisAsciiFileInput::CisAsciiFileInput
CisAsciiFileInput(const char *name)
Constructor for CisAsciiFileInput.
Definition: CisInterface.hpp:481
CisInput
Flag for checking if CisInterface.hpp has already been included.
Definition: CisInterface.hpp:16
CisAsciiFileInput
C++ interface to cisAsciiFileInput_t functionality. The CisAsciiFileInput class is a basic wrapper ar...
Definition: CisInterface.hpp:474
CisAsciiArrayInput::CisAsciiArrayInput
CisAsciiArrayInput(const char *name)
Constructor for CisAsciiArrayInput. Due to issues with the C++ version of vsscanf, flags and precision indicators for floating point format specifiers (e.g. e, f), must be removed so that table input can be properly parsed.
Definition: CisInterface.hpp:678
CisInput::recv_nolimit
int recv_nolimit(const int nargs,...)
Receive and parse a message larger than CIS_MSG_MAX from the input queue. See cisRecv_nolimit from Ci...
Definition: CisInterface.hpp:114
CisOutput
C++ interface to cisOutput_t functionality.
Definition: CisInterface.hpp:138
CisRpcServer
C++ interface to cisRpc_t server-side functionality. The CisRpcServer class is a basic wrapper around...
Definition: CisInterface.hpp:340
CisRpcClient::~CisRpcClient
~CisRpcClient()
Destructor for CisRpcClient. See cis_free in CisInterface.h for details.
Definition: CisInterface.hpp:390
CisRpc::send
int send(const int nargs,...)
Format and send a message to an RPC output queue. See rpcSend from CisInterface.h for details...
Definition: CisInterface.hpp:305
CisOutput::_destroy_pi
void _destroy_pi()
Alias to allow freeing of underlying C struct at the class level.
Definition: CisInterface.hpp:163
CisAsciiFileOutput::CisAsciiFileOutput
CisAsciiFileOutput(cisOutput_t x)
Empty constructor for inheritance.
Definition: CisInterface.hpp:434
CisObjOutput::CisObjOutput
CisObjOutput(cisOutput_t x)
Empty constructor for inheritance.
Definition: CisInterface.hpp:774
CisRpcClient::CisRpcClient
CisRpcClient(const char *name, const char *outFormat, const char *inFormat)
Constructor for CisRpcClient.
Definition: CisInterface.hpp:383
CisAsciiArrayInput_local::CisAsciiArrayInput_local
CisAsciiArrayInput_local(const char *name)
Constructor for CisAsciiArrayInput_local. Due to issues with the C++ version of vsscanf, flags and precision indicators for floating point format specifiers (e.g. e, f), must be removed so that table input can be properly parsed.
Definition: CisInterface.hpp:702
CisOutput::send_nolimit
int send_nolimit(const char *data, const size_t len)
Send a message larger than CIS_MSG_MAX to the output queue. See cis_send_nolimit in CisInterface...
Definition: CisInterface.hpp:219
CisAsciiTableOutput
C++ interface to cisAsciiTableOutput_t functionality.
Definition: CisInterface.hpp:530
CisOutput::send
int send(const char *data, const size_t len)
Send a message smaller than CIS_MSG_MAX to the output queue. If the message is larger than CIS_MSG_MA...
Definition: CisInterface.hpp:187
CisRpcServer::~CisRpcServer
~CisRpcServer()
Destructor for CisRpcServer. See cis_free in CisInterface.h for details.
Definition: CisInterface.hpp:359
CisOutput::send
int send(const int nargs,...)
Format and send a message smaller than CIS_MSG_MAX to the output queue. See cisSend from CisInterface...
Definition: CisInterface.hpp:199
CisPlyOutput
C++ interface to cisPlyOutput_t functionality. The CisPlyOutput class is a basic wrapper around the C...
Definition: CisInterface.hpp:715
CisRpcClient
C++ interface to cisRpc_t client-side functionality. The CisRpcClient class is a basic wrapper around...
Definition: CisInterface.hpp:371
CisObjOutput
C++ interface to cisObjOutput_t functionality. The CisObjOutput class is a basic wrapper around the C...
Definition: CisInterface.hpp:763
CisRpc::recv
int recv(const int nargs,...)
Receive and parse a message from an RPC input queue. See rpcRecv from CisInterface.h for details.
Definition: CisInterface.hpp:323
CisPlyInput::CisPlyInput
CisPlyInput(const char *name)
Constructor for CisPlyInput.
Definition: CisInterface.hpp:746