Initial commit

This commit is contained in:
2017-09-19 08:27:10 +02:00
commit 3b2e49f7b7
138 changed files with 199299 additions and 0 deletions

19
.gitignore vendored Normal file
View File

@@ -0,0 +1,19 @@
*~
*.bak
aclocal.m4
autom4te.cache
config.*
configure
depcomp
install-sh
ltmain.sh
m4
makefile.in
missing
src/*.o
src/*.lo
src/*.la
src/.deps/*
src/.libs/*
doc

1
AUTHORS Normal file
View File

@@ -0,0 +1 @@

340
COPYING Normal file
View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

1
ChangeLog Normal file
View File

@@ -0,0 +1 @@

1519
Doxyfile.cfg Normal file

File diff suppressed because it is too large Load Diff

365
INSTALL Normal file
View File

@@ -0,0 +1,365 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
privileges.
5. Optionally, type `make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'. This
is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo' tool if you have problems.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
to try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of all of the options to `configure', and exit.
`--help=short'
`--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
`--no-create'
`-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

40
MakefileWin/Makefile Normal file
View File

@@ -0,0 +1,40 @@
INCLUDES = -IC:\CAFE\cafe-1.0.0-beta-3\cpp\include -IC:\local\boost_1_63_0\boost \
-IC:\local\boost_1_63_0 -IC:\EPICS\base-3.14.12.5\include -IC:\EPICS\base-3.14.12.5\include\os\WIN32 \
-IC:\Qt\qt-4.8.6-x64-msvc2010\include -Ic:\Qt\qt-4.8.6-x64-msvc2010\include -Ic:\Qt\qt-4.8.6-x64-msvc2010\include\QtCore \
-IC:\Qt\qt-4.8.6-msvc2010\include\QtXml
#-IC:\Users\chrin\AppData\Local\Continuum\Anaconda3\envs\py345\include
LIB_DEST=lib\cafe
CXX=cl
CXXFLAGS = /W4 /EHsc /c /MT /DHAVE_LIBQTXML
OUTPUT_OPTION = /o "$@"
LIB_LOCAL = C:\epics\base-3.14.12.5\lib\windows-x64\Com.lib C:\epics\base-3.14.12.5\lib\windows-x64\ca.lib \
C:\Qt\qt-4.8.6-x64-msvc2010\lib\QtCore4.lib C:\Qt\qt-4.8.6-x64-msvc2010\lib\QtXml4.lib \
C:\local\boost_1_63_0\lib64-msvc-10.0\libboost_thread-vc100-mt-s-1_63.lib \
C:\local\boost_1_63_0\lib64-msvc-10.0\libboost_system-vc100-mt-s-1_63.lib
#C:\Users\chrin\AppData\Local\Continuum\Anaconda3\envs\py345\libs\python34.lib \
OBJS= cafeCache.obj cafeGroup.obj cafe.obj cafeVectors.obj \
callbackHandlerCreate.obj callbackHandlerMonitor.obj conduitGroup.obj conduit.obj \
connectCallbacks.obj connectGroup.obj \
connect.obj exceptionsHelper.obj granules.obj handleHelper.obj helper.obj \
methodCallbacks.obj policyHelper.obj transpose.obj \
cafeXML.obj loadCollectionXMLParser.obj loadGroupXMLParser.obj \
restorePVGroupXMLParser.obj $(LIB_LOCAL)
$(LIB_DEST)\cafe.lib: $(OBJS)
LIB $(OBJS) /out:$(LIB_DEST)\cafe.lib
%.obj: src\%.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) $(OUTPUT_OPTION) $<
clean:
del *.obj

View File

@@ -0,0 +1,40 @@
INCLUDES = -IC:\CAFE\cafe-1.0.0-beta-3\cpp\include -IC:\local\boost_1_63_0\boost \
-IC:\local\boost_1_63_0 -IC:\EPICS\base-3.14.12.5\include -IC:\EPICS\base-3.14.12.5\include\os\WIN32 \
-IC:\Qt\qt-4.8.6-x64-msvc2010\include -Ic:\Qt\qt-4.8.6-x64-msvc2010\include -Ic:\Qt\qt-4.8.6-x64-msvc2010\include\QtCore \
-IC:\Qt\qt-4.8.6-msvc2010\include\QtXml \
-IC:\Users\chrin\AppData\Local\Continuum\Anaconda3\envs\py345\include
LIB_DEST=lib\py3cafe
CXX=cl
CXXFLAGS = /W4 /EHsc /c /MT /DHAVE_LIBQTXML /DHAVE_PYTHON_H
OUTPUT_OPTION = /o "$@"
LIB_LOCAL = C:\epics\base-3.14.12.5\lib\windows-x64\Com.lib C:\epics\base-3.14.12.5\lib\windows-x64\ca.lib \
C:\Qt\qt-4.8.6-x64-msvc2010\lib\QtCore4.lib C:\Qt\qt-4.8.6-x64-msvc2010\lib\QtXml4.lib \
C:\Users\chrin\AppData\Local\Continuum\Anaconda3\envs\py345\libs\python34.lib \
C:\local\boost_1_63_0\lib64-msvc-10.0\libboost_thread-vc100-mt-s-1_63.lib \
C:\local\boost_1_63_0\lib64-msvc-10.0\libboost_system-vc100-mt-s-1_63.lib
OBJS= cafeCache.obj cafeGroup.obj cafe.obj cafeVectors.obj \
callbackHandlerCreate.obj callbackHandlerMonitor.obj conduitGroup.obj conduit.obj \
connectCallbacks.obj connectGroup.obj \
connect.obj exceptionsHelper.obj granules.obj handleHelper.obj helper.obj \
methodCallbacks.obj policyHelper.obj transpose.obj \
cafeXML.obj loadCollectionXMLParser.obj loadGroupXMLParser.obj \
restorePVGroupXMLParser.obj $(LIB_LOCAL)
$(LIB_DEST)\cafe.lib: $(OBJS)
LIB $(OBJS) /out:$(LIB_DEST)\cafe.lib
%.obj: src\%.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) $(OUTPUT_OPTION) $<
clean:
del *.obj

39
MakefileWin/Makefile_noqt Normal file
View File

@@ -0,0 +1,39 @@
INCLUDES = -IC:\CAFE\cafe-1.0.0-beta-3\cpp\include -IC:\local\boost_1_63_0\boost \
-IC:\local\boost_1_63_0 -IC:\EPICS\base-3.14.12.5\include -IC:\EPICS\base-3.14.12.5\include\os\WIN32
#-IC:\Qt\qt-4.8.6-x64-msvc2010\include -Ic:\Qt\qt-4.8.6-x64-msvc2010\include -Ic:\Qt\qt-4.8.6-x64-msvc2010\include\QtCore \
#-IC:\Qt\qt-4.8.6-msvc2010\include\QtXml
#-IC:\Users\chrin\AppData\Local\Continuum\Anaconda3\envs\py345\include
LIB_DEST=lib\cafe-noqt
CXX=cl
CXXFLAGS = /W4 /EHsc /c /MT
OUTPUT_OPTION = /o "$@"
LIB_LOCAL = C:\epics\base-3.14.12.5\lib\windows-x64\Com.lib C:\epics\base-3.14.12.5\lib\windows-x64\ca.lib \
C:\local\boost_1_63_0\lib64-msvc-10.0\libboost_thread-vc100-mt-s-1_63.lib \
C:\local\boost_1_63_0\lib64-msvc-10.0\libboost_system-vc100-mt-s-1_63.lib
#C:\Qt\qt-4.8.6-x64-msvc2010\lib\QtCore4.lib C:\Qt\qt-4.8.6-x64-msvc2010\lib\QtXml4.lib \
#C:\Users\chrin\AppData\Local\Continuum\Anaconda3\envs\py345\libs\python34.lib
OBJS= cafeCache.obj cafeGroup.obj cafe.obj cafeVectors.obj \
callbackHandlerCreate.obj callbackHandlerMonitor.obj conduitGroup.obj conduit.obj \
connectCallbacks.obj connectGroup.obj \
connect.obj exceptionsHelper.obj granules.obj handleHelper.obj helper.obj \
methodCallbacks.obj policyHelper.obj transpose.obj \
cafeXML.obj loadCollectionXMLParser.obj loadGroupXMLParser.obj \
restorePVGroupXMLParser.obj $(LIB_LOCAL)
$(LIB_DEST)\cafe.lib: $(OBJS)
LIB $(OBJS) /out:$(LIB_DEST)\cafe.lib
%.obj: src\%.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) $(OUTPUT_OPTION) $<
clean:
del *.obj

1
NEWS Normal file
View File

@@ -0,0 +1 @@

25
README Normal file
View File

@@ -0,0 +1,25 @@
## --------------------------------------------------------------------------
## autogen.sh
##
## --prefix: This is the prefix to the include sub-directory to which the
## cafe include files are installed
##
## --libdir: This is the directory to which the cafe shared objects are
## installed
## --with-boost: base directory for the boost header files
## --with-epics: epics top level directory
## Note that configure.ac assume that the architecture is
## base/lib/${EPICS_HOST_ARCH}
## --with-qt-inc Qt include directory (optional)
## --with-qt-lib Qt lib directory (optional)
## --with-python-inc Python include directory, if building PyCafe
## --with-python-lib Python lib directory, if bulding PyCafe
## --------------------------------------------------------------------------
1) Modify autogen.sh according to above
2) 'source autogen.sh'
3) 'make install' This installs cafe headers/libraries to the directories
specified by --prefix/--libdir in the above

1
autogen.sh Symbolic link
View File

@@ -0,0 +1 @@
autogen_cafepy3_release.sh

49
autogen_cafe3z_release.sh Normal file
View File

@@ -0,0 +1,49 @@
#source usePy3
aclocal --force -I m4
libtoolize --force --copy
autoconf --force
autoheader --force
automake --force --add-missing --copy
autoreconf
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
EB=$(readlink ${EPICS}/base)
echo 'EPICS BASE IS=' $EB
EB1=$(echo $EB | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#--enable-boost --with-boost=/afs/psi.ch/intranet/Controls/BD/deps/boost_1_57_0 \
CYCAFE_VERSION=cafez-1.3.0-alpha-1
./configure \
--prefix=/opt/gfa/cafe/cpp/${CYCAFE_VERSION}/ \
--libdir=/opt/gfa/cafe/cpp/${CYCAFE_VERSION}/lib \
--enable-boost-inc --with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--enable-epics --with-epics=${EPICS}/base \
--enable-qt4-lib --with-qt4-lib=/usr/lib64 \
--enable-qt4-inc --with-qt4-inc=/usr/include \
--enable-zeromq-inc --with-zeromq-inc=/opt/gfa/zmq/zeromq-4.1.5/include \
--enable-zeromq-lib --with-zeromq-lib=/opt/gfa/zmq/zeromq-4.1.5/lib \
--enable-json-inc --with-json-inc=/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/include \
--enable-json-lib --with-json-lib=/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/libs/linux-gcc-4.4.7
unset CAFE_EPICS_V_MAJOR
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_PATCH
cp include/config.h include/os/Linux/cafe/config.h

44
autogen_cafepy3.sh Normal file
View File

@@ -0,0 +1,44 @@
aclocal --force -I m4
libtoolize --force --copy
autoconf --force
autoheader --force
automake --force --add-missing --copy
autoreconf
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
EB=$(readlink ${EPICS}/base)
echo 'EPICS BASE IS=' $EB
EB1=$(echo $EB | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#--enable-boost --with-boost=/afs/psi.ch/intranet/Controls/BD/deps/boost_1_57_0 \
CAFE_VERSION=cafepy3-1.7.0-alpha
#CAFE_VERSION=cafe-1.1.0
./configure \
--prefix=/afs/psi.ch/intranet/Controls/cafe/CAFE/cafe/${CAFE_VERSION} \
--libdir=/afs/psi.ch/intranet/Controls/cafe/CAFE/cafe/${CAFE_VERSION}/lib/${EPICS_HOST_ARCH} \
--enable-boost --with-boost=/afs/psi.ch/intranet/Controls/cafe/CAFE/boost/boost_1_57_0 \
--enable-epics --with-epics=${EPICS} \
--enable-qt4-lib --with-qt4-lib=/usr/lib64 \
--enable-qt4-inc --with-qt4-inc=/usr/include \
--enable-python-inc --with-python-inc=/opt/gfa/python-3.5/latest/include/python3.5m \
--enable-python-lib --with-python-lib=/opt/gfa/python-3.5/latest/lib
unset CAFE_EPICS_V_MAJOR
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_PATCH

View File

@@ -0,0 +1,46 @@
source usePy3
aclocal --force -I m4
libtoolize --force --copy
autoconf --force
autoheader --force
automake --force --add-missing --copy
autoreconf
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
EB=$(readlink ${EPICS}/base)
echo 'EPICS BASE IS=' $EB
EB1=$(echo $EB | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#--enable-boost --with-boost=/afs/psi.ch/intranet/Controls/BD/deps/boost_1_57_0 \
CYCAFE_VERSION=pycafe-1.3.0-final-1
./configure \
--prefix=/opt/gfa/cafe/python/python-3.5/${CYCAFE_VERSION}/ \
--libdir=/opt/gfa/cafe/python/python-3.5/${CYCAFE_VERSION}/lib \
--enable-boost-inc --with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--enable-epics --with-epics=${EPICS}/base \
--enable-qt4-lib --with-qt4-lib=/usr/lib64 \
--enable-qt4-inc --with-qt4-inc=/usr/include \
--enable-python-inc --with-python-inc=/opt/gfa/python-3.5/latest/include/python3.5m \
--enable-python-lib --with-python-lib=/opt/gfa/python-3.5/latest/lib
unset CAFE_EPICS_V_MAJOR
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_PATCH
cp include/config.h include/os/Linux/pycafe35/config.h

View File

@@ -0,0 +1,45 @@
source usePy3
aclocal --force -I m4
libtoolize --force --copy
autoconf --force
autoheader --force
automake --force --add-missing --copy
autoreconf
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
EB=$(readlink ${EPICS}/base)
echo 'EPICS BASE IS=' $EB
EB1=$(echo $EB | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#--enable-boost --with-boost=/afs/psi.ch/intranet/Controls/BD/deps/boost_1_57_0 \
CAFE_VERSION=cafe-1.0.0-beta-1
CYCAFE_VERSION=pycafe-noqt-1.0.0-beta-1
./configure \
--prefix=/opt/gfa/cafe/python/python-3.5/${CYCAFE_VERSION}/ \
--libdir=/opt/gfa/cafe/python/python-3.5/${CYCAFE_VERSION}/lib \
--enable-boost --with-boost=/opt/gfa/cafe/boost/boost_1_57_0 \
--enable-epics --with-epics=${EPICS} \
--enable-python-inc --with-python-inc=/opt/gfa/python-3.5/latest/include/python3.5m \
--enable-python-lib --with-python-lib=/opt/gfa/python-3.5/latest/lib
unset CAFE_EPICS_V_MAJOR
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_PATCH
#--enable-qt4-lib --with-qt4-lib=/usr/lib64 \
#--enable-qt4-inc --with-qt4-inc=/usr/include \

View File

@@ -0,0 +1,53 @@
source usePy3
aclocal --force -I m4
libtoolize --force --copy
autoconf --force
autoheader --force
automake --force --add-missing --copy
autoreconf
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
EB=$(readlink ${EPICS}/base)
echo 'EPICS BASE IS=' $EB
EB1=$(echo $EB | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#--enable-boost --with-boost=/afs/psi.ch/intranet/Controls/BD/deps/boost_1_57_0 \
CYCAFE_VERSION=pyzcafe-1.3.0-alpha-1
./configure \
--prefix=/opt/gfa/cafe/python/python-3.5/${CYCAFE_VERSION}/ \
--libdir=/opt/gfa/cafe/python/python-3.5/${CYCAFE_VERSION}/lib \
--enable-boost-inc --with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--enable-epics --with-epics=${EPICS}/base \
--enable-qt4-lib --with-qt4-lib=/usr/lib64 \
--enable-qt4-inc --with-qt4-inc=/usr/include \
--enable-python-inc --with-python-inc=/opt/gfa/python-3.5/latest/include/python3.5m \
--enable-python-lib --with-python-lib=/opt/gfa/python-3.5/latest/lib \
--enable-zeromq-inc --with-zeromq-inc=/opt/gfa/zmq/zeromq-4.1.5/include \
--enable-zeromq-lib --with-zeromq-lib=/opt/gfa/zmq/zeromq-4.1.5/lib \
--enable-json-inc --with-json-inc=/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/include \
--enable-json-lib --with-json-lib=/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/libs/linux-gcc-4.4.7 \
--enable-curl-inc --with-curl-inc=/opt/gfa/python-3.5/2.4.1/include \
--enable-curl-lib --with-curl-lib=/opt/gfa/python-3.5/2.4.1/lib
unset CAFE_EPICS_V_MAJOR
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_PATCH
cp include/config.h include/os/Linux/pycafe35/config.h

48
autogen_rel.sh Normal file
View File

@@ -0,0 +1,48 @@
aclocal --force -I m4
libtoolize --force --copy
autoconf --force
autoheader --force
automake --force --add-missing --copy
autoreconf
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
EB=$(readlink ${EPICS}/base)
echo 'EPICS BASE IS=' $EB
EB1=$(echo $EB | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
CAFE_VERSION=cafe-1.3.0-final-1
./configure \
--prefix=/opt/gfa/cafe/cpp/${CAFE_VERSION} \
--libdir=/opt/gfa/cafe/cpp/${CAFE_VERSION}/lib \
--enable-boost-inc --with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--enable-epics --with-epics=${EPICS}/base \
--enable-qt4-lib --with-qt4-lib=/usr/lib64 \
--enable-qt4-inc --with-qt4-inc=/usr/include
# --enable-boost-lib --with-boost-lib=/opt/gfa/cafe/boost/boost_1_61_0/lib
unset CAFE_EPICS_V_MAJOR
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_PATCH
cp include/config.h include/os/Linux/cafe/config.h

45
autogen_rel_noqt.sh Normal file
View File

@@ -0,0 +1,45 @@
aclocal --force -I m4
libtoolize --force --copy
autoconf --force
autoheader --force
automake --force --add-missing --copy
autoreconf
#Check what the EPICS RELEASE IS from ${EPICS}/base
#Used by ./configure
#Assumes format ${EPICS}/base-3.14.12
EB=$(readlink ${EPICS}/base)
echo 'EPICS BASE IS=' $EB
EB1=$(echo $EB | sed -e "s/[a-zA-Z]*-//g")
EBMAJ=$(echo $EB1 | sed -e "s/[[:punct:]].*//g")
EBMIN1=$(echo $EB1 | sed -e "s/^[[:digit:]]*[[:punct:]]//g")
EBMIN=$(echo $EBMIN1 | sed -e "s/[[:punct:]][[:digit:]]*//g")
EBPAT=$(echo $EB1 | sed -e "s/[[:digit:]]*[[:punct:]]//g")
echo EPICS_MAJOR=$EBMAJ
echo EPICS_MINOR=$EBMIN
echo EPICS_PATCH=$EBPAT
export CAFE_EPICS_V_MAJOR=$EBMAJ
export CAFE_EPICS_V_MINOR=$EBMIN
export CAFE_EPICS_V_PATCH=$EBPAT
#--enable-boost --with-boost=/afs/psi.ch/intranet/Controls/BD/deps/boost_1_57_0 \
CAFE_VERSION=cafe-noqt-1.1.0-final-1
./configure \
--prefix=/opt/gfa/cafe/cpp/${CAFE_VERSION} \
--libdir=/opt/gfa/cafe/cpp/${CAFE_VERSION}/lib \
--enable-boost-inc --with-boost-inc=/opt/gfa/cafe/boost/boost_1_61_0/include \
--enable-epics --with-epics=${EPICS}/base
unset CAFE_EPICS_V_MAJOR
unset CAFE_EPICS_V_MINOR
unset CAFE_EPICS_V_PATCH
cp include/config.h include/os/Linux/cafe-noqt/config.h

1
configure.ac Symbolic link
View File

@@ -0,0 +1 @@
configure6064d.ac

671
configure6064d.ac Normal file
View File

@@ -0,0 +1,671 @@
## CAFE (Channel Access interFacE)
## Author: Jan Chrin, GFA, PSI
##
## configure.ac is processed by autoconf
##
## output: configure.in file for building the cafe library
##
# Standard macros
AC_PREREQ(2.63)
AC_COPYRIGHT([CAFE,Jan Chrin, 2013])
AC_INIT([CAFE], [1.0.0], [Bug reports to: jan.chrin@psi.ch])
AC_CONFIG_AUX_DIR(./)
AC_CONFIG_MACRO_DIR([m4])
m4_pattern_allow([AC_CONFIG_MACRO])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([./include/cafe.h])
AC_LANG_CPLUSPLUS
AC_CONFIG_HEADER([./include/config.h:./include/config.in])
AC_PROG_CXX
# library creation
AC_PROG_LIBTOOL
LT_INIT
AC_DEFINE_UNQUOTED(HAVE_LINUX, 1, [linux dependency (sleep)])
CPPFLAGS=" -fexceptions -fPIC"
#CPPFLAGS=" -pg"
# provide include directories
AC_SUBST([CAFE_CPPFLAGS], '-I$(top_srcdir)/include ')
##---------------------------------------------------------------------------
##-- EPICS -- path and options
##
EPICS_PREFIX=""
EPICS_INCL_PATH=""
EPICS_LIB_PATH=""
## Add epics release
EPICS_MAJOR_DEFAULT="3"
EPICS_MINOR_DEFAULT="14"
EPICS_PATCH_DEFAULT="12"
EPICS_MAJOR_REL=${EPICS_MAJOR_DEFAULT}
EPICS_MINOR_REL=${EPICS_MINOR_DEFAULT}
EPICS_PATCH_REL=${EPICS_PATCH_DEFAULT}
#overwrite default with actual if determined
if test "${CAFE_EPICS_V_MAJOR}" != ""; then
EPICS_MAJOR_REL=${CAFE_EPICS_V_MAJOR}
fi
if test "${CAFE_EPICS_V_MINOR}" != ""; then
EPICS_MINOR_REL=${CAFE_EPICS_V_MINOR}
fi
if test "${CAFE_EPICS_V_PATCH}" != ""; then
EPICS_PATCH_REL=${CAFE_EPICS_V_PATCH}
fi
AC_ARG_ENABLE(
[epics],
AC_HELP_STRING([--enable-epics],
[enable epics use [default=no]]),
[HAVE_EPICS=true],
[HAVE_EPICS=false])
AC_ARG_WITH(
epics,
AC_HELP_STRING(
[--with-epics location of EPICS],
[prefix where the epics libraries and include files are to be found]),
[HAVE_EPICS=true
EPICS_PREFIX=$withval
EPICS_INCL_PATH="-I"${EPICS_PREFIX}"/include/ -I"${EPICS_PREFIX}"/include/os/Linux"
EPICS_LIB_PATH=${EPICS_PREFIX}"/lib/"${EPICS_HOST_ARCH}])
#echo "TEST ", $EPICS_LIB_PATH
##
##-- end EPICS -- path and options
##---------------------------------------------------------------------------
##===========================================================================
##== Check for header files and libraries.
##===========================================================================
##---------------------------------------------------------------------------
##-- EPICS -- check header files and libs
##
AC_LANG_PUSH([C++])
if test $HAVE_EPICS == true; then
# Change flags: if all tests are successfull, accept this changes; if
# the tests are not successfull, use the old flags.
if test "${EPICS_PREFIX}" != "" ; then
TEMP_CPPFLAGS=${CPPFLAGS}
CPPFLAGS=${CPPFLAGS}" "${EPICS_INCL_PATH}
TEMP_LDFLAGS=${LDFLAGS}
LDFLAGS=${LDFLAGS}" -L"${EPICS_LIB_PATH}" -Wl,-rpath,"${EPICS_LIB_PATH}
fi
if test x$HAVE_EPICS == xtrue ; then
AC_CHECK_HEADERS(
[cadef.h],
[HAVE_EPICS=true],
[HAVE_EPICS=false
AC_MSG_WARN(cadef.h not found!)],
[])
fi
if test x$HAVE_EPICS == xtrue ; then
AC_CHECK_HEADERS(
[epicsTypes.h],
[HAVE_EPICS=true],
[HAVE_EPICS=false
AC_MSG_WARN(epicsTypes.h not found!)],
[])
fi
if test x$HAVE_EPICS == xtrue ; then
AC_CHECK_LIB(ca,[main],
[HAVE_EPICS=true],
[HAVE_EPICS=false
AC_MSG_WARN(libca either not found or not operational!)])
fi
if test x$HAVE_EPICS == xtrue ; then
AC_CHECK_LIB(Com,[main],
[HAVE_EPICS=true],
[HAVE_EPICS=false
AC_MSG_WARN(libCom either not found or not operational!)])
fi
if test x$HAVE_EPICS == xtrue ; then
AC_CHECK_LIB(dl,[main],
[HAVE_EPICS=true],
[HAVE_EPICS=false
AC_MSG_WARN(libdl either not found or not operational!)])
fi
#echo " HAVE EPICS? " $HAVE_EPICS x$HAVE_EPICS
# If all checks are OK we add rlog to the CXXFLAGS.
if test x$HAVE_EPICS != xtrue ; then
if test "${EPICS_PREFIX}" != "" ; then
CPPFLAGS=${TEMP_CPPFLAGS}
LDFLAGS=${TEMP_LDFLAGS}
fi
fi
echo "LDFLAGS__> $LDFLAGS "
if test x$HAVE_EPICS == xtrue ; then
AC_DEFINE_UNQUOTED(HAVE_EPICS, ${EPICS_MAJOR_REL}.${EPICS_MINOR_REL}.${EPICS_PATCH_REL}, [epics version])
AC_DEFINE_UNQUOTED(EPICS_MAJOR, ${EPICS_MAJOR_REL}, [epics major release])
AC_DEFINE_UNQUOTED(EPICS_MINOR, ${EPICS_MINOR_REL}, [epics minor release])
AC_DEFINE_UNQUOTED(EPICS_PATCH, ${EPICS_PATCH_REL}, [epics patch release])
fi
fi
AC_LANG_POP
##
##-- end EPICS -- check header files and libs
##---------------------------------------------------------------------------
##---------------------------------------------------------------------------
##-- BOOST -- path and options -
##-- Boost libraries are mainly header-only, i.e. they consist of header files
##-- containing templates and inline functions, and require no separately-compiled
##-- library binaries or special treatment when linking
##
BOOST_PREFIX=""
BOOST_INCL_PATH=""
BOOST_LIB_PATH=""
BOOST_OPTION=""
AC_ARG_ENABLE(
[boost-inc],
AC_HELP_STRING([--enable-boost-inc],
[enable boost use [default=no]]),
[HAVE_BOOST_=true],
[HAVE_BOOST_=false])
AC_ARG_WITH(
boost-inc,
AC_HELP_STRING(
[--with-boost-inc = location of BOOST],
[prefix giving the boost base directory]),
[HAVE_BOOST_=true
BOOST_PREFIX=$withval
BOOST_INCL_PATH="-I"${BOOST_PREFIX}"/boost -I"${BOOST_PREFIX}
#BOOST_LIB_PATH=${BOOST_PREFIX}"/lib "
])
AC_ARG_ENABLE(
[boost-lib],
AC_HELP_STRING([--enable-boost-lib],
[enable boost lib use [default=no]]),
[HAVE_BOOST_LIB_=true],
[HAVE_BOOST_LIB_=false])
AC_ARG_WITH(
boost-lib,
AC_HELP_STRING(
[--with-boost-lib = location of BOOST],
[prefix giving the boost base directory]),
[HAVE_BOOST_LIB=true
BOOST_LIB_PATH=$withval
])
##
##-- end BOOST -- path and options
##---------------------------------------------------------
##---------------------------------------------------------------------------
##-- BOOST -- check header files (and lib if selected) only
##
AC_LANG_PUSH([C++])
if test $HAVE_BOOST_LIB_ == true ; then
TEMP_LDFLAGS=${LDFLAGS}
LDFLAGS=${LDFLAGS}" -L"${BOOST_LIB_PATH}" -Wl,-rpath,"${BOOST_LIB_PATH}
echo ${BOOST_LIB_PATH}
echo ${LDFLAGS}
if test x$HAVE_BOOST_LIB_ == xtrue ; then
AC_CHECK_LIB(boost_thread,[main],
[],
[HAVE_BOOST_LIB=false
AC_MSG_WARN(boost_thread not found!)])
fi
# If all checks are OK we add boost lib version to the FLAGS.
if test x$HAVE_BOOST_LIB_ != xtrue ; then
LDFLAGS=${TEMP_LDFLAGS}
fi
if test x$HAVE_BOOST_LIB_ == xtrue ; then
AC_DEFINE_UNQUOTED(HAVE_BOOST_THREAD, 1, [boost thread library])
fi
fi
#if test x$HAVE_BOOST_LIB_ != xtrue ; then
# AC_DEFINE_UNQUOTED(HAVE_LINUX, 1, [linux dependency (sleep)])
# fi
if test $HAVE_BOOST_ == true ; then
# Change flags: if all tests are successful, accept these additions,
# else use the old flags.
if test "${BOOST_PREFIX}" != "" ; then
TEMP_CPPFLAGS=${CPPFLAGS}
CPPFLAGS=${CPPFLAGS}" "${BOOST_INCL_PATH}
echo ${BOOST_INCL_PATH}
echo ${CPPFLAGS}
fi
if test x$HAVE_BOOST_ == xtrue ; then
AC_CHECK_HEADERS(
[multi_index_container.hpp],
[HAVE_BOOST_=true],
[HAVE_BOOST_=false
AC_MSG_WARN(multi_index_container.hpp not found!)],
[])
fi
if test x$HAVE_BOOST_ != xtrue ; then
if test "${BOOST_PREFIX}" != "" ; then
CPPFLAGS=${TEMP_CPPFLAGS}
echo ${CPPFLAGS}
fi
fi
if test x$HAVE_BOOST_ == xtrue ; then
AC_DEFINE_UNQUOTED(HAVE_BOOST, 1, [Availability of boost])
fi
fi
AC_LANG_POP
##
##-- end BOOST-- check header files only
##-----------------------------
##---------------------------------------------------------------------------
##-- Qt4 -- path and options
##
QT4_PREFIX=""
QT4_INCL_PATH=""
QT4_LIB_PATH=""
AC_ARG_ENABLE(
[qt4-inc],
AC_HELP_STRING([--enable-qt4-inc],
[enable Qt version 4 use [default=no]]),
[HAVE_QT4_=true],
[HAVE_QT4_=false])
AC_ARG_ENABLE(
[qt4-lib],
AC_HELP_STRING([--enable-qt4-lib],
[enable Qt version 4 use [default=no]]),
[HAVE_QT4_=true],
[HAVE_QT4_=false])
#Only if enable flag is set
if test $HAVE_QT4_ == true ; then
AC_ARG_WITH(
qt4-inc,
AC_HELP_STRING([--with-qt4-inc=PREFIX],
[prefix, parent directory where the Qt version 4 library is installed]),
[HAVE_QT4_=true
QT4_PREFIX=$withval
QT4_INCL_PATH=${QT4_INCL_PATH}" -I"${QT4_PREFIX}"/QtCore "
QT4_INCL_PATH=${QT4_INCL_PATH}" -I"${QT4_PREFIX}"/QtXml "
])
AC_ARG_WITH(
qt4-lib,
AC_HELP_STRING([--with-qt4-lib=PREFIX],
[prefix, parent directory where the Qt version 4 library is installed]),
[HAVE_QT4_=true
QT4_LIB_PATH=$withval
QT4_LIB_PATH=${QT4_LIB_PATH}
])
fi
##
##---------------------------------------------------------------------------
##---------------------------------------------------------------------------
##-- Qt version 4 -- check header files and libs
##
AC_LANG_PUSH([C++])
if test $HAVE_QT4_ == true ; then
# Change flags: if all tests are successfull, accept this changes; if
# the tests are not successfull, use the old flags.
if test "${QT4_PREFIX}" != "" ; then
TEMP_CPPFLAGS=${CPPFLAGS}
CPPFLAGS=${CPPFLAGS}" "${QT4_INCL_PATH}
TEMP_LDFLAGS=${LDFLAGS}
LDFLAGS=${LDFLAGS}" -L"${QT4_LIB_PATH}" -Wl,-rpath,"${QT4_LIB_PATH}
fi
if test x$HAVE_QT4_ == xtrue ; then
AC_CHECK_HEADERS(
[qxml.h],
[HAVE_QT4_=true],
[HAVE_QT4_=false
AC_MSG_WARN(qxml.h not found!)],
[])
fi
if test x$HAVE_QT4_ == xtrue ; then
AC_CHECK_LIB(QtCore,[main],
[],
[HAVE_QT4_=false
AC_MSG_WARN(libQtCore not found!)])
fi
if test x$HAVE_QT4_ == xtrue ; then
AC_CHECK_LIB(QtXml,[main],
[],
[HAVE_QT4=false
AC_MSG_WARN(libQtXml not found!)])
fi
# If all checks are OK we add Qt version 4 to the FLAGS.
if test x$HAVE_QT4_ != xtrue ; then
if test "${QT4_PREFIX}" != "" ; then
CPPFLAGS=${TEMP_CPPFLAGS}
LDFLAGS=${TEMP_LDFLAGS}
fi
fi
if test x$HAVE_QT4_ == xtrue ; then
AC_DEFINE_UNQUOTED(HAVE_QT4, 1,[Availability of Qt version 4 confirmed])
fi
fi
AC_LANG_POP
##
##-- end QT4 -- check header files and libs
##---------------------------------------------------------------------------
##---------------------------------------------------------------------------
##-- Python -- path and options -
##-- Python header files required for callback
##
PYTHON_PREFIX=""
PYTHON_INCL_PATH=""
PYTHON_LIB_PATH=""
PYTHON_OPTION=""
AC_ARG_ENABLE(
[python-inc],
AC_HELP_STRING([--enable-python-inc],
[enable python use [default=no]]),
[HAVE_PYTHON_=true],
[HAVE_PYTHON_=false])
AC_ARG_WITH(
python-inc,
AC_HELP_STRING(
[--with-python-inc = location of python],
[prefix giving the python base directory]),
[HAVE_PYTHON_=true
PYTHON_PREFIX=$withval
PYTHON_INCL_PATH="-I"${PYTHON_PREFIX}
])
AC_ARG_ENABLE(
[python-lib],
AC_HELP_STRING([--enable-python-lib],
[enable python use [default=no]]),
[HAVE_PYTHON_=true],
[HAVE_PYTHON_=false])
AC_ARG_WITH(
python-lib,
AC_HELP_STRING([--with-python-lib=PREFIX],
[prefix, parent directory where the python version library is installed]),
[HAVE_PYTHON_=true
PYTHON_LIB_PATH=$withval
PYTHON_LIB_PATH=${PYTHON_LIB_PATH}
])
##
##-- end PYTHON -- path and options
##---------------------------------------------------------
##---------------------------------------------------------------------------
##-- PYTHON -- check header files only
##
AC_LANG_PUSH([C++])
if test $HAVE_PYTHON_ == true ; then
# Change flags: if all tests are successful, accept these additions,
# else use the old flags.
if test "${PYTHON_PREFIX}" != "" ; then
TEMP_CPPFLAGS=${CPPFLAGS}
CPPFLAGS=${CPPFLAGS}" "${PYTHON_INCL_PATH}
TEMP_LDFLAGS=${LDFLAGS}
LDFLAGS=${LDFLAGS}" -L"${PYTHON_LIB_PATH}" -Wl,-rpath,"${PYTHON_LIB_PATH}
echo ${PYTHON_INCL_PATH}
echo ${CPPFLAGS}
fi
if test x$HAVE_PYTHON_ == xtrue ; then
AC_CHECK_HEADERS(
[Python.h],
[HAVE_PYTHON_=true],
[HAVE_PYTHON_=false
AC_MSG_WARN(Python.h not found!)],
[])
fi
if test x$HAVE_PYTHON_ == xtrue ; then
AC_CHECK_LIB(python3.5m,[main],
[],
[HAVE_PYTHON=false
AC_MSG_WARN(libpython3.5m not found!)])
fi
# If all checks are OK we add Qt version 4 to the FLAGS.
if test x$HAVE_PYTHON_ != xtrue ; then
if test "${PYTHON_PREFIX}" != "" ; then
CPPFLAGS=${TEMP_CPPFLAGS}
LDFLAGS=${TEMP_LDFLAGS}
echo ${CPPFLAGS}
fi
fi
if test x$HAVE_PYTHON_ == xtrue ; then
AC_DEFINE_UNQUOTED(HAVE_PYTHON, 1, [Availability of python])
##_PYCAFE_EXT IF FLAG SET ELSE USE DEFAULT PYCAFE_API_H
AC_DEFINE_UNQUOTED(HAVE_PYCAFE_EXT, 0, [pycafe extern C])
fi
fi
AC_LANG_POP
##
##-- end PYTHON-- check header files only
##-----------------------------
##---------------------------------------------------------------------------
##---------------------------------------------------------------------------
##-- Python2 -- path and options -
##-- Python2 header files required for callback
##
PYTHON2_PREFIX=""
PYTHON2_INCL_PATH=""
PYTHON2_LIB_PATH=""
PYTHON2_OPTION=""
AC_ARG_ENABLE(
[python2-inc],
AC_HELP_STRING([--enable-python2-inc],
[enable python2 use [default=no]]),
[HAVE_PYTHON2_=true],
[HAVE_PYTHON2_=false])
AC_ARG_WITH(
python2-inc,
AC_HELP_STRING(
[--with-python2-inc = location of python2],
[prefix giving the python2 base directory]),
[HAVE_PYTHON2_=true
PYTHON2_PREFIX=$withval
PYTHON2_INCL_PATH="-I"${PYTHON2_PREFIX}
])
AC_ARG_ENABLE(
[python2-lib],
AC_HELP_STRING([--enable-python2-lib],
[enable python2 use [default=no]]),
[HAVE_PYTHON2_=true],
[HAVE_PYTHON2_=false])
AC_ARG_WITH(
python2-lib,
AC_HELP_STRING([--with-python2-lib=PREFIX],
[prefix, parent directory where the python2 version library is installed]),
[HAVE_PYTHON2_=true
PYTHON2_LIB_PATH=$withval
PYTHON2_LIB_PATH=${PYTHON2_LIB_PATH}
])
##
##-- end PYTHON2 -- path and options
##---------------------------------------------------------
##---------------------------------------------------------------------------
##-- PYTHON2 -- check header files only
##
AC_LANG_PUSH([C++])
if test $HAVE_PYTHON2_ == true ; then
# Change flags: if all tests are successful, accept these additions,
# else use the old flags.
if test "${PYTHON2_PREFIX}" != "" ; then
TEMP_CPPFLAGS=${CPPFLAGS}
CPPFLAGS=${CPPFLAGS}" "${PYTHON2_INCL_PATH}
TEMP_LDFLAGS=${LDFLAGS}
LDFLAGS=${LDFLAGS}" -L"${PYTHON2_LIB_PATH}" -Wl,-rpath,"${PYTHON2_LIB_PATH}
echo ${PYTHON2_INCL_PATH}
echo ${CPPFLAGS}
fi
if test x$HAVE_PYTHON2_ == xtrue ; then
AC_CHECK_HEADERS(
[Python.h],
[HAVE_PYTHON2_=true],
[HAVE_PYTHON2_=false
AC_MSG_WARN(Python.h not found!)],
[])
fi
if test x$HAVE_PYTHON2_ == xtrue ; then
AC_CHECK_LIB(python2.7,[main],
[],
[HAVE_PYTHON2=false
AC_MSG_WARN(libpython2.7 not found!)])
fi
# If all checks are OK we add Qt version 4 to the FLAGS.
if test x$HAVE_PYTHON2_ != xtrue ; then
if test "${PYTHON2_PREFIX}" != "" ; then
CPPFLAGS=${TEMP_CPPFLAGS}
LDFLAGS=${TEMP_LDFLAGS}
echo ${CPPFLAGS}
fi
fi
if test x$HAVE_PYTHON2_ == xtrue ; then
AC_DEFINE_UNQUOTED(HAVE_PYTHON, 1, [Availability of python2])
##_PYCAFE_EXT IF FLAG SET ELSE USE DEFAULT PYCAFE_API_H
AC_DEFINE_UNQUOTED(HAVE_PYCAFE_EXT, 0, [pycafe extern C])
fi
fi
AC_LANG_POP
##
##-- end PYTHON-- check header files only
##-----------------------------
CPPFLAGS=$CPPFLAGS
echo "REPORTING -> current CPPFLAGS = "$CPPFLAGS
LDFLAGS=$LDFLAGS
echo "REPORTING -> current LDFLAGS = "$LDFLAGS
##
##-- end Qt Check
##--
# Generate makefiles
AC_SUBST(AM_CPPFLAGS, $CPPFLAGS)
AC_SUBST(AM_LDFLAGS, $LDFLAGS)
AM_CONDITIONAL(HAVE_PYTHON_, test x$HAVE_PYTHON_ == xtrue)
AM_CONDITIONAL(HAVE_PYCAFE_EXT, test x$HAVE_PYCAFE_EXT == xtrue)
AC_CONFIG_FILES([makefile
src/makefile
include/makefile])
AC_OUTPUT

1036
configure6064z.ac Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
<cafe:config
xmlns:cafe="http://slsbd.psi.ch">
<!-- Note: The namespace URI is not used by the parser to look up information -->
<!-- The purpose is to give the namespace a unique name -->
<!-- However, often projects use the namespace as a pointer to a web page -->
<!-- containing namespace information -->
<!-- group id is the NAME of the collection -->
<!-- CAFE convention is to begin collection name with c -->
<!-- Order must be X - Y - I and ENABLE -->
<cafe:group id="gDBPM">
<cafe:description>BPM agent configuration</cafe:description>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>X1</cafe:attribute>
<cafe:collectivetype>CAFE_DOUBLE</cafe:collectivetype>
</cafe:collection>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>Y1</cafe:attribute>
<cafe:collectivetype>CAFE_DOUBLE</cafe:collectivetype>
</cafe:collection>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>Q1</cafe:attribute>
<cafe:collectivetype>CAFE_DOUBLE</cafe:collectivetype>
</cafe:collection>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>X1-VALID</cafe:attribute>
<cafe:collectivetype>CAFE_DOUBLE</cafe:collectivetype>
</cafe:collection>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>Q1-VALID</cafe:attribute>
<cafe:collectivetype>CAFE_DOUBLE</cafe:collectivetype>
</cafe:collection>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>ENERGY</cafe:attribute>
<cafe:collectivetype>CAFE_DOUBLE</cafe:collectivetype>
</cafe:collection>
</cafe:group>
</cafe:config>

View File

@@ -0,0 +1 @@
outAramis.xml

View File

@@ -0,0 +1,380 @@
<cafe:config xmlns:cafe="http://xfel.web.psi.ch">
<cafe:collection id="cDBPM">
<cafe:description>Collection of Nodes for SwissFEL</cafe:description>
<cafe:attributes>
<cafe:attribute>X</cafe:attribute>
<cafe:attribute>Y</cafe:attribute>
<cafe:attribute>X0</cafe:attribute>
<cafe:attribute>Y0</cafe:attribute>
<cafe:attribute>REF-X</cafe:attribute>
<cafe:attribute>REF-Y</cafe:attribute>
<cafe:attribute>REFOFF-X</cafe:attribute>
<cafe:attribute>REFOFF-Y</cafe:attribute>
<cafe:attribute>REFORB-X</cafe:attribute>
<cafe:attribute>REFORB-Y</cafe:attribute>
<cafe:attribute>SET-GAIN</cafe:attribute>
<cafe:attribute>I</cafe:attribute>
<cafe:attribute>FB-STAT</cafe:attribute>
<cafe:attribute>FB-ENABLE</cafe:attribute>
<cafe:attribute>STAT</cafe:attribute>
<cafe:attribute>ENABLE</cafe:attribute>
</cafe:attributes>
<cafe:member pos=" 3.0149">
<cafe:device>SINEG01-DBPM340</cafe:device>
</cafe:member>
<cafe:member pos=" 7.9459">
<cafe:device>SINSB01-DBPM150</cafe:device>
</cafe:member>
<cafe:member pos=" 12.9489">
<cafe:device>SINSB02-DBPM150</cafe:device>
</cafe:member>
<cafe:member pos=" 14.5560">
<cafe:device>SINLH01-DBPM060</cafe:device>
</cafe:member>
<cafe:member pos=" 16.4806">
<cafe:device>SINLH02-DBPM210</cafe:device>
</cafe:member>
<cafe:member pos=" 17.4826">
<cafe:device>SINLH02-DBPM240</cafe:device>
</cafe:member>
<cafe:member pos=" 19.2172">
<cafe:device>SINLH03-DBPM010</cafe:device>
</cafe:member>
<cafe:member pos=" 20.4632">
<cafe:device>SINLH03-DBPM050</cafe:device>
</cafe:member>
<cafe:member pos=" 21.6002">
<cafe:device>SINLH03-DBPM090</cafe:device>
</cafe:member>
<cafe:member pos=" 26.9202">
<cafe:device>SINSB03-DBPM120</cafe:device>
</cafe:member>
<cafe:member pos=" 32.4202">
<cafe:device>SINSB03-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 37.9202">
<cafe:device>SINSB04-DBPM120</cafe:device>
</cafe:member>
<cafe:member pos=" 43.4202">
<cafe:device>SINSB04-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 48.9202">
<cafe:device>SINSB05-DBPM120</cafe:device>
</cafe:member>
<cafe:member pos=" 54.4202">
<cafe:device>SINSB05-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 56.2420">
<cafe:device>SINXB01-DBPM120</cafe:device>
</cafe:member>
<cafe:member pos=" 60.2912">
<cafe:device>SINBC01-DBPM010</cafe:device>
</cafe:member>
<cafe:member pos=" 61.0912">
<cafe:device>SINBC01-DBPM030</cafe:device>
</cafe:member>
<cafe:member pos=" 64.4172">
<cafe:device>SINBC01-DBPM080</cafe:device>
</cafe:member>
<cafe:member pos=" 65.9432">
<cafe:device>SINBC01-DBPM100</cafe:device>
</cafe:member>
<cafe:member pos=" 69.3739">
<cafe:device>SINBC02-DBPM140</cafe:device>
</cafe:member>
<cafe:member pos=" 77.5610">
<cafe:device>SINBC02-DBPM320</cafe:device>
</cafe:member>
<cafe:member pos=" 82.0967">
<cafe:device>SINDI01-DBPM010</cafe:device>
</cafe:member>
<cafe:member pos=" 83.5117">
<cafe:device>SINDI01-DBPM060</cafe:device>
</cafe:member>
<cafe:member pos=" 86.0767">
<cafe:device>SINDI02-DBPM010</cafe:device>
</cafe:member>
<cafe:member pos=" 88.3857">
<cafe:device>SINDI02-DBPM040</cafe:device>
</cafe:member>
<cafe:member pos=" 90.6297">
<cafe:device>SINDI02-DBPM080</cafe:device>
</cafe:member>
<cafe:member pos=" 95.3947">
<cafe:device>S10CB01-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 100.2947">
<cafe:device>S10CB01-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 105.1947">
<cafe:device>S10CB02-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 110.0947">
<cafe:device>S10CB02-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 114.6628">
<cafe:device>S10BD01-DBPM020</cafe:device>
</cafe:member>
<cafe:member pos=" 114.9947">
<cafe:device>S10DI01-DBPM110</cafe:device>
</cafe:member>
<cafe:member pos=" 119.8947">
<cafe:device>S10CB03-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 124.7947">
<cafe:device>S10CB03-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 129.6947">
<cafe:device>S10CB04-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 134.5947">
<cafe:device>S10CB04-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 139.4947">
<cafe:device>S10CB05-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 144.3947">
<cafe:device>S10CB05-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 149.2947">
<cafe:device>S10CB06-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 154.1947">
<cafe:device>S10CB06-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 159.0947">
<cafe:device>S10CB07-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 163.9947">
<cafe:device>S10CB07-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 168.8947">
<cafe:device>S10CB08-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 173.7947">
<cafe:device>S10CB08-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 178.6947">
<cafe:device>S10CB09-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 183.5947">
<cafe:device>S10BC01-DBPM010</cafe:device>
</cafe:member>
<cafe:member pos=" 187.8307">
<cafe:device>S10BC01-DBPM050</cafe:device>
</cafe:member>
<cafe:member pos=" 192.2847">
<cafe:device>S10BC01-DBPM090</cafe:device>
</cafe:member>
<cafe:member pos=" 196.7798">
<cafe:device>S10BC02-DBPM140</cafe:device>
</cafe:member>
<cafe:member pos=" 206.5399">
<cafe:device>S10BC02-DBPM320</cafe:device>
</cafe:member>
<cafe:member pos=" 211.2940">
<cafe:device>S10MA01-DBPM010</cafe:device>
</cafe:member>
<cafe:member pos=" 215.6600">
<cafe:device>S10MA01-DBPM060</cafe:device>
</cafe:member>
<cafe:member pos=" 220.1200">
<cafe:device>S10MA01-DBPM120</cafe:device>
</cafe:member>
<cafe:member pos=" 229.0850">
<cafe:device>S20CB01-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 238.1850">
<cafe:device>S20CB02-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 247.2850">
<cafe:device>S20CB03-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 256.3850">
<cafe:device>S20SY01-DBPM010</cafe:device>
</cafe:member>
<cafe:member pos=" 262.5020">
<cafe:device>S20SY01-DBPM040</cafe:device>
</cafe:member>
<cafe:member pos=" 263.6280">
<cafe:device>S20SY01-DBPM060</cafe:device>
</cafe:member>
<cafe:member pos=" 269.1300">
<cafe:device>S20SY02-DBPM080</cafe:device>
</cafe:member>
<cafe:member pos=" 271.0800">
<cafe:device>S20SY02-DBPM120</cafe:device>
</cafe:member>
<cafe:member pos=" 272.7600">
<cafe:device>S20SY02-DBPM150</cafe:device>
</cafe:member>
<cafe:member pos=" 280.6200">
<cafe:device>S20SY03-DBPM010</cafe:device>
</cafe:member>
<cafe:member pos=" 286.9200">
<cafe:device>S20SY03-DBPM040</cafe:device>
</cafe:member>
<cafe:member pos=" 294.3800">
<cafe:device>S20SY03-DBPM080</cafe:device>
</cafe:member>
<cafe:member pos=" 303.8150">
<cafe:device>S30CB01-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 312.9150">
<cafe:device>S30CB02-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 322.0150">
<cafe:device>S30CB03-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 331.1150">
<cafe:device>S30CB04-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 340.2150">
<cafe:device>S30CB05-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 349.3150">
<cafe:device>S30CB06-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 358.4150">
<cafe:device>S30CB07-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 367.5150">
<cafe:device>S30CB08-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 376.6150">
<cafe:device>S30CB09-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 385.7150">
<cafe:device>S30CB10-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 394.8150">
<cafe:device>S30CB11-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 403.9150">
<cafe:device>S30CB12-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 413.0150">
<cafe:device>S30CB13-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 422.1150">
<cafe:device>S30CB14-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 431.2150">
<cafe:device>S30CB15-DBPM420</cafe:device>
</cafe:member>
<cafe:member pos=" 440.3150">
<cafe:device>SARCL01-DBPM010</cafe:device>
</cafe:member>
<cafe:member pos=" 444.6750">
<cafe:device>SARCL01-DBPM060</cafe:device>
</cafe:member>
<cafe:member pos=" 450.7750">
<cafe:device>SARCL01-DBPM120</cafe:device>
</cafe:member>
<cafe:member pos=" 452.1510">
<cafe:device>SARCL01-DBPM150</cafe:device>
</cafe:member>
<cafe:member pos=" 456.9100">
<cafe:device>SARCL02-DBPM110</cafe:device>
</cafe:member>
<cafe:member pos=" 460.9609">
<cafe:device>SARCL02-DBPM220</cafe:device>
</cafe:member>
<cafe:member pos=" 462.7569">
<cafe:device>SARCL02-DBPM260</cafe:device>
</cafe:member>
<cafe:member pos=" 466.6909">
<cafe:device>SARCL02-DBPM330</cafe:device>
</cafe:member>
<cafe:member pos=" 471.1067">
<cafe:device>SARCL02-DBPM470</cafe:device>
</cafe:member>
<cafe:member pos=" 476.4267">
<cafe:device>SARMA01-DBPM040</cafe:device>
</cafe:member>
<cafe:member pos=" 483.2767">
<cafe:device>SARMA01-DBPM100</cafe:device>
</cafe:member>
<cafe:member pos=" 487.9617">
<cafe:device>SARMA02-DBPM010</cafe:device>
</cafe:member>
<cafe:member pos=" 490.0107">
<cafe:device>SARMA02-DBPM020</cafe:device>
</cafe:member>
<cafe:member pos=" 492.0597">
<cafe:device>SARMA02-DBPM040</cafe:device>
</cafe:member>
<cafe:member pos=" 496.8097">
<cafe:device>SARMA02-DBPM110</cafe:device>
</cafe:member>
<cafe:member pos=" 501.5597">
<cafe:device>SARUN01-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 506.3097">
<cafe:device>SARUN02-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 511.0597">
<cafe:device>SARUN03-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 515.8097">
<cafe:device>SARUN04-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 520.5597">
<cafe:device>SARUN05-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 525.3097">
<cafe:device>SARUN06-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 530.0597">
<cafe:device>SARUN07-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 534.8097">
<cafe:device>SARUN08-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 539.5597">
<cafe:device>SARUN09-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 544.3097">
<cafe:device>SARUN10-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 549.0597">
<cafe:device>SARUN11-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 553.8097">
<cafe:device>SARUN12-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 558.5597">
<cafe:device>SARUN13-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 563.3097">
<cafe:device>SARUN14-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 568.0597">
<cafe:device>SARUN15-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 572.8097">
<cafe:device>SARUN16-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 577.5597">
<cafe:device>SARUN17-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 582.3097">
<cafe:device>SARUN18-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 587.0597">
<cafe:device>SARUN19-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 591.8097">
<cafe:device>SARUN20-DBPM070</cafe:device>
</cafe:member>
<cafe:member pos=" 593.9132">
<cafe:device>SARBD01-DBPM040</cafe:device>
</cafe:member>
<cafe:member pos=" 596.9584">
<cafe:device>SARBD02-DBPM010</cafe:device>
</cafe:member>
<cafe:member pos=" 598.3943">
<cafe:device>SARBD02-DBPM040</cafe:device>
</cafe:member>
</cafe:collection>
</cafe:config>

BIN
examples/cafeTest/cafeTest Executable file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,186 @@
//
// callbacks.h
//
void callbackHandlerMonitor( struct event_handler_args args) {
#define __METHOD__ "callbackHandlerMonitor"
if (args.status !=ECA_NORMAL) {
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
cout << "Status=" << args.status << " for channel " << ca_name (args.chid) << endl;
return;
}
unsigned int _handle = (unsigned long) ca_puser(args.chid);// args.usr; // ca_puser(args.chid);
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find((unsigned int)_handle);
if (it_handle != handle_index.end()) {
//cout << (*it_handle).getPV() << " " << (*it_handle).getHandle() << endl;
if(MUTEX){cafeMutex.lock();}
handle_index.modify(it_handle, change_eventHandlerArgs (args));
if(MUTEX){cafeMutex.unlock();}
//**** ADD USER CODE HERE ***//
if (args.type < DBR_GR_STRING) {
PVDataHolder pvd(args.count);
(*it_handle).getPVDataHolder(pvd);
pvd.print();
cout << "val/D//= " << pvd.getAsString(0) << endl;
}
else if (args.type < DBR_PUT_ACKT) {
PVCtrlHolder pvc(args.count);
(*it_handle).getPVCtrlHolder(pvc);
pvc.print();
cout << "val/C/= " << pvc.getAsString(0) << endl;
}
vector<MonitorPolicy> mpV = (*it_handle).getMonitorPolicyVector();
cout << args.usr << endl;
cout << (*it_handle).getUsrArgs() << endl;
for (int i=0; i<mpV.size(); ++i) {
cout << " i " << i << endl;
cout << mpV[i].getUserArgs() << endl;
mpV[i].print();
}
//**** END USER CODE ***//
}
else {
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
}
return;
#undef __METHOD__
};
/**
* Callback function for when putWithCallback method is invoked
* \param args input: event handler_args structure
*/
void handlerPut( struct event_handler_args args) {
#define __METHOD__ "handlerPut"
if (args.status !=ECA_NORMAL) {
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
cout << "Status=" << args.status << " for channel " << ca_name (args.chid) << endl;
return;
}
unsigned int _handle = (unsigned long) args.usr;
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find((unsigned int) _handle);
if (it_handle != handle_index.end()) {
if(MUTEX)cafeMutex.lock();
ChannelRequestStatus channelRequestStatusPut=(*it_handle).getChannelRequestStatusPut();
channelRequestStatusPut.setCallbackKind(false, true);
handle_index.modify(it_handle, change_channelRequestStatusPut(channelRequestStatusPut));
cout << __METHOD__ << " WITH_CALLBACK_USER_SUPLLIED for PUT done " << (*it_handle).getChannelRequestStatusPut().getCallbackProgressKind() << endl;
if(MUTEX)cafeMutex.unlock();
//**** ADD USER CODE HERE ***//
}
else {
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
}
return;
#undef __METHOD__
};
/**
* Callback function for getCallback method is invoked
* with a pointer to the retrieved value
* \param args input: event handler arguments
*/
void handlerGet( struct event_handler_args args) {
#define __METHOD__ "handlerGet"
if (args.status !=ECA_NORMAL) {
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
cout << "Status=" << args.status << " for channel " << ca_name (args.chid) << endl;
return;
}
unsigned int _handle = (unsigned long) args.usr; // ca_puser(args.chid);
cafeConduit_set_by_handle & handle_index = cs.get<by_handle> ();
cafeConduit_set_by_handle::iterator it_handle;
it_handle = handle_index.find(_handle);
if (it_handle != handle_index.end()) {
ChannelRequestStatus channelRequestStatusGet=(*it_handle).getChannelRequestStatusGet();
channelRequestStatusGet.setCallbackKind(false, true);
if(MUTEX){cafeMutex.lock();}
handle_index.modify(it_handle, change_eventHandlerArgs (args));
handle_index.modify(it_handle, change_channelRequestStatusGet(channelRequestStatusGet));
//cout << __METHOD__ << " GET CALLBACK DONE " << (*it_handle).getChannelRequestStatusGet().getCallbackProgressKind() << endl;
if(MUTEX){cafeMutex.unlock();}
if (args.type < DBR_GR_STRING) {
PVDataHolder pvd(args.count);
(*it_handle).getPVDataHolder(pvd);
pvd.print();
cout << "val/D//= " << pvd.getAsString(0) << endl;
}
else if (args.type < DBR_PUT_ACKT) {
PVCtrlHolder pvc(args.count);
(*it_handle).getPVCtrlHolder(pvc);
pvc.print();
cout << "val/C/= " << pvc.getAsString(0) << endl;
}
}
else {
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
cout << " Internal CAFE ERROR! Unknown Handle! handle=" << _handle << endl;
}
return;
#undef __METHOD__
};

View File

@@ -0,0 +1,39 @@
<cafe:config>
<!-- group id is the NAME of the group -->
<!-- CAFE convention is to begin the group name with g -->
<cafe:group id="gDBPM">
<cafe:description>DBPM configuration</cafe:description>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>X1</cafe:attribute>
</cafe:collection>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>Y1</cafe:attribute>
</cafe:collection>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>Q1</cafe:attribute>
</cafe:collection>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>X1-VALID</cafe:attribute>
</cafe:collection>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>Y1-VALID</cafe:attribute>
</cafe:collection>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>Q1-VALID</cafe:attribute>
</cafe:collection>
<cafe:collection>
<cafe:id>cDBPM</cafe:id>
<cafe:attribute>ENERGY</cafe:attribute>
</cafe:collection>
</cafe:group>
</cafe:config>

View File

@@ -0,0 +1,241 @@
{"channels":[
{"name":"SINEG01-DBPM340:X1","backend":"sf-databuffer"},
{"name":"SINEG01-DBPM340:Y1","backend":"sf-databuffer"},
{"name":"SINSB01-DBPM150:Y1","backend":"sf-databuffer"},
{"name":"SINSB02-DBPM150:Y1","backend":"sf-databuffer"},
{"name":"SINLH01-DBPM060:Y1","backend":"sf-databuffer"},
{"name":"SINLH02-DBPM210:Y1","backend":"sf-databuffer"},
{"name":"SINLH02-DBPM240:Y1","backend":"sf-databuffer"},
{"name":"SINLH03-DBPM010:Y1","backend":"sf-databuffer"},
{"name":"SINLH03-DBPM050:Y1","backend":"sf-databuffer"},
{"name":"SINLH03-DBPM090:Y1","backend":"sf-databuffer"},
{"name":"SINSB03-DBPM120:Y1","backend":"sf-databuffer"},
{"name":"SINSB03-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"SINSB04-DBPM120:Y1","backend":"sf-databuffer"},
{"name":"SINSB04-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"SINSB05-DBPM120:Y1","backend":"sf-databuffer"},
{"name":"SINSB05-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"SINXB01-DBPM120:Y1","backend":"sf-databuffer"},
{"name":"SINBC01-DBPM010:Y1","backend":"sf-databuffer"},
{"name":"SINBC01-DBPM030:Y1","backend":"sf-databuffer"},
{"name":"SINBC01-DBPM080:Y1","backend":"sf-databuffer"},
{"name":"SINBC01-DBPM100:Y1","backend":"sf-databuffer"},
{"name":"SINBC02-DBPM140:Y1","backend":"sf-databuffer"},
{"name":"SINBC02-DBPM320:Y1","backend":"sf-databuffer"},
{"name":"SINDI01-DBPM010:Y1","backend":"sf-databuffer"},
{"name":"SINDI01-DBPM060:Y1","backend":"sf-databuffer"},
{"name":"SINDI02-DBPM010:Y1","backend":"sf-databuffer"},
{"name":"SINDI02-DBPM040:Y1","backend":"sf-databuffer"},
{"name":"SINDI02-DBPM080:Y1","backend":"sf-databuffer"},
{"name":"S10CB01-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"S10CB01-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S10CB02-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"S10CB02-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S10DI01-DBPM110:Y1","backend":"sf-databuffer"},
{"name":"S10CB03-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"S10CB03-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S10CB04-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"S10CB04-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S10CB05-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"S10CB05-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S10CB06-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"S10CB06-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S10CB07-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"S10CB07-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S10CB08-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"S10CB08-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S10CB09-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"S10BC01-DBPM010:Y1","backend":"sf-databuffer"},
{"name":"S10BC01-DBPM050:Y1","backend":"sf-databuffer"},
{"name":"S10BC01-DBPM090:Y1","backend":"sf-databuffer"},
{"name":"S10BC02-DBPM140:Y1","backend":"sf-databuffer"},
{"name":"S10BC02-DBPM320:Y1","backend":"sf-databuffer"},
{"name":"S10MA01-DBPM010:Y1","backend":"sf-databuffer"},
{"name":"S10MA01-DBPM060:Y1","backend":"sf-databuffer"},
{"name":"S10MA01-DBPM120:Y1","backend":"sf-databuffer"},
{"name":"S20CB01-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S20CB02-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S20CB03-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S20SY01-DBPM010:Y1","backend":"sf-databuffer"},
{"name":"S20SY01-DBPM040:Y1","backend":"sf-databuffer"},
{"name":"S20SY01-DBPM060:Y1","backend":"sf-databuffer"},
{"name":"S20SY02-DBPM080:Y1","backend":"sf-databuffer"},
{"name":"S20SY02-DBPM120:Y1","backend":"sf-databuffer"},
{"name":"S20SY02-DBPM150:Y1","backend":"sf-databuffer"},
{"name":"S20SY03-DBPM010:Y1","backend":"sf-databuffer"},
{"name":"S20SY03-DBPM040:Y1","backend":"sf-databuffer"},
{"name":"S20SY03-DBPM080:Y1","backend":"sf-databuffer"},
{"name":"S30CB01-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB02-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB03-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB04-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB05-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB06-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB07-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB08-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB09-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB10-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB11-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB12-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB13-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB14-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"S30CB15-DBPM420:Y1","backend":"sf-databuffer"},
{"name":"SARCL01-DBPM010:Y1","backend":"sf-databuffer"},
{"name":"SARCL01-DBPM060:Y1","backend":"sf-databuffer"},
{"name":"SARCL01-DBPM120:Y1","backend":"sf-databuffer"},
{"name":"SARCL01-DBPM150:Y1","backend":"sf-databuffer"},
{"name":"SARCL02-DBPM110:Y1","backend":"sf-databuffer"},
{"name":"SARCL02-DBPM220:Y1","backend":"sf-databuffer"},
{"name":"SARCL02-DBPM260:Y1","backend":"sf-databuffer"},
{"name":"SARCL02-DBPM330:Y1","backend":"sf-databuffer"},
{"name":"SARCL02-DBPM470:Y1","backend":"sf-databuffer"},
{"name":"SARMA01-DBPM040:Y1","backend":"sf-databuffer"},
{"name":"SARMA01-DBPM100:Y1","backend":"sf-databuffer"},
{"name":"SARMA02-DBPM010:Y1","backend":"sf-databuffer"},
{"name":"SARMA02-DBPM020:Y1","backend":"sf-databuffer"},
{"name":"SARMA02-DBPM040:Y1","backend":"sf-databuffer"},
{"name":"SARMA02-DBPM110:Y1","backend":"sf-databuffer"},
{"name":"SARUN01-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN02-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN03-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN04-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN05-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN06-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN07-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN09-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN10-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN11-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN12-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN13-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN14-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN15-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN16-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN17-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN18-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN19-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"SARUN20-DBPM070:Y1","backend":"sf-databuffer"},
{"name":"S10BD01-DBPM020:Y1","backend":"sf-databuffer"},
{"name":"SARBD01-DBPM040:Y1","backend":"sf-databuffer"},
{"name":"SARBD02-DBPM010:Y1","backend":"sf-databuffer"},
{"name":"SARBD02-DBPM040:Y1","backend":"sf-databuffer"},
{"name":"SINEG01-DBPM340:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINSB01-DBPM150:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINSB02-DBPM150:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINLH01-DBPM060:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINLH02-DBPM210:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINLH02-DBPM240:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINLH03-DBPM010:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINLH03-DBPM050:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINLH03-DBPM090:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINSB03-DBPM120:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINSB03-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINSB04-DBPM120:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINSB04-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINSB05-DBPM120:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINSB05-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINXB01-DBPM120:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINBC01-DBPM010:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINBC01-DBPM030:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINBC01-DBPM080:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINBC01-DBPM100:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINBC02-DBPM140:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINBC02-DBPM320:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINDI01-DBPM010:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINDI01-DBPM060:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINDI02-DBPM010:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINDI02-DBPM040:Y1-VALID","backend":"sf-databuffer"},
{"name":"SINDI02-DBPM080:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB01-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB01-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB02-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB02-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10DI01-DBPM110:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB03-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB03-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB04-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB04-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB05-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB05-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB06-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB06-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB07-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB07-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB08-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB08-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10CB09-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10BC01-DBPM010:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10BC01-DBPM050:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10BC01-DBPM090:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10BC02-DBPM140:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10BC02-DBPM320:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10MA01-DBPM010:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10MA01-DBPM060:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10MA01-DBPM120:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20CB01-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20CB02-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20CB03-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20SY01-DBPM010:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20SY01-DBPM040:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20SY01-DBPM060:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20SY02-DBPM080:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20SY02-DBPM120:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20SY02-DBPM150:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20SY03-DBPM010:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20SY03-DBPM040:Y1-VALID","backend":"sf-databuffer"},
{"name":"S20SY03-DBPM080:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB01-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB02-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB03-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB04-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB05-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB06-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB07-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB08-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB09-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB10-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB11-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB12-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB13-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB14-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"S30CB15-DBPM420:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARCL01-DBPM010:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARCL01-DBPM060:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARCL01-DBPM120:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARCL01-DBPM150:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARCL02-DBPM110:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARCL02-DBPM220:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARCL02-DBPM260:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARCL02-DBPM330:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARCL02-DBPM470:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARMA01-DBPM040:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARMA01-DBPM100:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARMA02-DBPM010:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARMA02-DBPM020:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARMA02-DBPM040:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARMA02-DBPM110:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN01-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN02-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN03-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN04-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN05-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN06-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN07-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN09-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN10-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN11-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN12-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN13-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN14-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN15-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN16-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN17-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN18-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN19-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARUN20-DBPM070:Y1-VALID","backend":"sf-databuffer"},
{"name":"S10BD01-DBPM020:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARBD01-DBPM040:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARBD02-DBPM010:Y1-VALID","backend":"sf-databuffer"},
{"name":"SARBD02-DBPM040:Y1-VALID","backend":"sf-databuffer"}],
"mapping":{"incomplete":"fill-null"},
"channelValidation":{"inconsistency":"keep-as-is"},
"sendBehaviour":{"strategy":"complete-latest"}}

View File

@@ -0,0 +1,6 @@
g++ cafePush.cpp -o cafePush -I/opt/gfa/zmq/zeromq-4.1.5/include -I/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/include -L/opt/gfa/zmq/zeromq-4.1.5/lib -Wl,-rpath,/opt/gfa/zmq/zeromq-4.1.5/lib -L/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/libs/linux-gcc-4.4.7 -Wl,-rpath,/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/libs/linux-gcc-4.4.7 -lzmq -ljson_linux-gcc-4.4.7_libmt
g++ cafePush.cpp -o cafePush -I/opt/gfa/zmq/zeromq-4.1.5/include -L/opt/gfa/zmq/zeromq-4.1.5/lib -Wl,-rpath,/opt/gfa/zmq/zeromq-4.1.5/lib -lzmq

View File

@@ -0,0 +1,42 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build a simple C++ cafe client
#
#CAFE version to link to
CAFE_VERSION=cafe-1.2.0-final-1
#PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
#PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/cpp
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE)
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib
LIBS += -lcafe -lca -lCom
cafeTest: cafeTest.cc callbacks.h
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -0,0 +1,52 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build C++ cafe client
#
# For cafeClient that needs loadSFGroups we need to
# link in python libraries
#CAFE version to link to
#CAFE_VERSION=cafe-1.0.0-final-2
PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/afs/psi.ch/project/cafe/gitworkspace/CAFE
#CAFE_CPP_BASE=${CAFE_BASE}/python/python-3.5
CAFE_CPP_BASE=${CAFE_BASE}/cpp
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE) #\
# -I${PYTHON_INCLUDE}
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/src/.libs \
-Wl,-rpath,$(CAFE_CPP_BASE)/src/.libs #\
# -L$(PYTHON_LIB) -Wl,-rpath,$(PYTHON_LIB) -L/usr/lib64
# -L$(CAFE_CPP_BASE)/src/libs/pycafe \
#LIBS += -lpython3.5m
LIBS += -lcafe -lca -lCom
cafeTest: cafeTest.cc
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -0,0 +1,23 @@
INCLUDES = -Ic:\CAFE\CAFE\cpp\include -Ic:\CAFE\CAFE\cpp -Ic:\local\boost_1_62_0 \
-Ic:\local\boost_1_62_0\boost -Ic:\epics\base-3.14.12.5\include -Ic:\epics\base-3.14.12.5\include\os\WIN32 \
-Ic:\Qt\4.8.4\include
CXX=cl
CXXFLAGS = /W4 /EHsc
OUTPUT_OPTION = /o $@
LIB_LOCAL = C:\epics\base-3.14.12.5\lib\windows-x64\Com.lib C:\epics\base-3.14.12.5\lib\windows-x64\ca.lib \
C:\CAFE\CAFE\cpp\cafe.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_thread-vc100-mt-s-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_system-vc100-mt-s-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_date_time-vc100-mt-s-1_62.lib \
C:\local\boost_1_62_0\lib64-msvc-10.0\libboost_chrono-vc100-mt-s-1_62.lib \
C:\Qt\4.8.4\lib\QtCore4.lib C:\Qt\4.8.4\lib\QtXml4.lib
cafeTest: cafeTest.obj
$(CXX) cafeTest.obj $(LIB_LOCAL)
cafeTest.obj: cafeTest.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) /c cafeTest.cpp
#"C:\Program Files (x86)\GnuWin32\bin\make"

View File

@@ -0,0 +1,51 @@
#
# Jan Chrin
# November 2015
#
# Makefile to build C++ cafe client
#CAFE version to link to
CAFE_VERSION=latest
PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/cpp
BOOST_BASE=${CAFE_BASE}/boost/boost_1_57_0
#INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
INCLUDE_PATH += -I/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp \
-I/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE) \
-I${PYTHON_INCLUDE}
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
-Wl,-rpath,/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
-L$(PYTHON_LIB) -Wl,-rpath,$(PYTHON_LIB)
# -L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
# -Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib
#LIBS += -lpython2.6
LIBS += -lcafe -lca -lCom -lpython3.5m
cafeTest: cafeTest.cc
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -0,0 +1,54 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build C++ cafe client
#
# For cafeClient that needs loadSFGroups we need to
# link in python libraries
#CAFE version to link to
CAFE_VERSION=pycafe-1.0.0-alpha-4
PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/python/python-3.5
BOOST_BASE=${CAFE_BASE}/boost/boost_1_57_0
#INCLUDE_PATH += -I/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE) \
-I${PYTHON_INCLUDE}
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-L$(PYTHON_LIB) -Wl,-rpath,$(PYTHON_LIB)
# -L/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
# -Wl,-rpath,/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
#LIBS += -lpython2.6
LIBS += -lcafe -lca -lCom -lpython3.5m
cafeTest: cafeTest.cc
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -0,0 +1,54 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build C++ cafe client
#
# For cafeClient that needs loadSFGroups we need to
# link in python libraries
#CAFE version to link to
CAFE_VERSION=latest
PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/python/python-3.5
BOOST_BASE=${CAFE_BASE}/boost/boost_1_57_0
#INCLUDE_PATH += -I/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE) \
-I${PYTHON_INCLUDE}
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-L$(PYTHON_LIB) -Wl,-rpath,$(PYTHON_LIB)
# -L/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
# -Wl,-rpath,/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
#LIBS += -lpython2.6
LIBS += -lcafe -lca -lCom -lpython3.5m
cafeTest: cafeTest.cc
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -0,0 +1,55 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build C++ cafe client
#
# For cafeClient that needs loadSFGroups we need to
# link in python libraries
#CAFE version to link to
CAFE_VERSION=pycafe-1.0.0-beta-1
CAFE_VERSION_OTHER=pycafe-noqt-1.0.0-beta-1
PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
#python/python-3.5
CAFE_CPP_BASE=${CAFE_BASE}/python/python-3.5
BOOST_BASE=${CAFE_BASE}/boost/boost_1_57_0
#INCLUDE_PATH += -I/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE) \
-I${PYTHON_INCLUDE}
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-L$(PYTHON_LIB) -Wl,-rpath,$(PYTHON_LIB)
# -L/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
# -Wl,-rpath,/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
#LIBS += -lpython2.6
LIBS += -lcafe -lca -lCom -lpython3.5m
cafeTest: cafeTest.cc
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -0,0 +1,55 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build C++ cafe client
#
# For cafeClient that needs loadSFGroups we need to
# link in python libraries
#CAFE version to link to
CAFE_VERSION=pycafe-1.0.0-final-1
PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/python/python-3.5
#CAFE_CPP_BASE=${CAFE_BASE}/cpp/
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
#INCLUDE_PATH += -I/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE) \
-I${PYTHON_INCLUDE}
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-L$(PYTHON_LIB) -Wl,-rpath,$(PYTHON_LIB) -L/usr/lib64
# -L/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
# -Wl,-rpath,/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
LIBS += -lpython3.5m
LIBS += -lcafe -lca -lCom
cafeTest: cafeTest.cc
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -0,0 +1,69 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build C++ cafe client
#
# For cafeClient that needs loadSFGroups we need to
# link in python libraries
#CAFE version to link to
CAFE_VERSION=pyzcafe-1.3.0-alpha-1
PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/python/python-3.5
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
ZEROMQ_BASE=/opt/gfa/zmq/zeromq-4.1.5
#INCLUDE_PATH += -I/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/include
#-I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE) -I$(ZEROMQ_BASE)/include \
-I/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/include \
-I/opt/gfa/zmq/curl-7.54.1/include \
-I${PYTHON_INCLUDE}
#-I$(BOOST_BASE)/boost
# -L/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
# -Wl,-rpath,/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-L$(ZEROMQ_BASE)/lib \
-Wl,-rpath,$(ZEROMQ_BASE)/lib \
-L/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/libs/linux-gcc-4.4.7 \
-Wl,-rpath,/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/libs/linux-gcc-4.4.7 \
-L/opt/gfa/zmq/curl-7.54.1/lib/.libs \
-Wl,-rpath,/opt/gfa/zmq/curl-7.54.1/lib/.libs \
-L$(PYTHON_LIB) -Wl,-rpath,$(PYTHON_LIB) -L/usr/lib64
# -L/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
# -Wl,-rpath,/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
LIBS += -lpython3.5m
LIBS += -lcafe -lca -lCom -lzmq -ljson_linux-gcc-4.4.7_libmt -lcurl
cafeTest: cafeTest.cc
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

View File

@@ -0,0 +1,75 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build C++ cafe client
#
# For cafeClient that needs loadSFGroups we need to
# link in python libraries
#CAFE version to link to
CAFE_VERSION=pycafe-1.0.0-beta-4
PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/python/python-3.5
#CAFE_CPP_BASE=${CAFE_BASE}/cpp
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
#INCLUDE_PATH += -I/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE) \
-I${PYTHON_INCLUDE}
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-L$(PYTHON_LIB) -Wl,-rpath,$(PYTHON_LIB) -L/usr/lib64
# -L/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
# -Wl,-rpath,/afs/psi.ch/project/cafe/gitworkspace/CAFE/cpp/src/.libs \
LIBS += -lpython3.5m
LIBS += -lcafe -lca -lCom
#cafeTest: cafeTest.cc
# g++ cafeTest.cc -o cafeTest \
# $(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
#cafeTest: cafeTest.cc
# g++ cafeTest.cc -o cafeTest \
# $(INCLUDE_PATH) -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
# -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
# $(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib/libcafe.a -lca -lCom
## -L$(PYTHON_LIB)/libpython3.5m.so
cafeTest: cafeTest.cc
g++ cafeTest.cc -o cafeTest \
-I$(BOOST_BASE) -I${PYTHON_INCLUDE} -I/usr/include/Qt \
-I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib/libcafe.a \
$(EPICS_BASE)/lib/${EPICS_HOST_ARCH}/libca.a \
$(EPICS_BASE)/lib/${EPICS_HOST_ARCH}/libCom.a \
-L$(PYTHON_LIB) -Wl,-rpath,$(PYTHON_LIB) \
-L/usr/lib64 -ldl -lpthread -lreadline -lrt -lpython3.5m -lQtCore -lQtXml
clean:
rm -f cafeTest.o cafeTest

View File

@@ -0,0 +1,22 @@
#
# Jan Chrin
# June 2016
#
##### CHANGE AS APPROPRIATE #################
#Cafe CPP Version to install
CAFE_VERSION=cafe-1.0.0-alpha-1
#CAFE project base
CAFE_BASE=/opt/gfa/cafe/cpp
CAFE_ACTUAL=${CAFE_BASE}/${CAFE_VERSION}
EXAMPLES_INSTALL_PATH= $(CAFE_ACTUAL)/examples/cafeTest
#############################################
install:
mkdir -p $(EXAMPLES_INSTALL_PATH)
cp makefile $(EXAMPLES_INSTALL_PATH)
cp cafeTest.cc $(EXAMPLES_INSTALL_PATH)

View File

@@ -0,0 +1,48 @@
#
# Jan Chrin
# June 2016
#
# Makefile to build a simple C++ cafe client
#
#CAFE version to link to
CAFE_VERSION=cafez-1.3.0-alpha-1
#PYTHON_INCLUDE=/opt/gfa/python-3.5/latest/include/python3.5m
#PYTHON_LIB=/opt/gfa/python-3.5/latest/lib
EPICS_BASE=${EPICS}/base
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_CPP_BASE=${CAFE_BASE}/cpp
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
ZEROMQ_BASE=/opt/gfa/zmq/zeromq-4.1.5
INCLUDE_PATH += -I$(CAFE_CPP_BASE)/$(CAFE_VERSION)/include \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(BOOST_BASE) -I$(ZEROMQ_BASE)/include -I/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/include
#-I$(BOOST_BASE)/boost
LIB_DIR += -L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} \
-L$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-Wl,-rpath,$(CAFE_CPP_BASE)/$(CAFE_VERSION)/lib \
-L$(ZEROMQ_BASE)/lib \
-Wl,-rpath,$(ZEROMQ_BASE)/lib \
-L/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/libs/linux-gcc-4.4.7 \
-Wl,-rpath,/opt/gfa/zmsglog/json/jsoncpp-src-0.6.0-rc2/libs/linux-gcc-4.4.7
LIBS += -lcafe -lca -lCom -lzmq -ljson_linux-gcc-4.4.7_libmt
cafeTest: cafeTest.cc callbacks.h
g++ cafeTest.cc -o cafeTest \
$(INCLUDE_PATH) $(LIB_DIR) $(LIBS)
clean:
rm -f cafeTest.o cafeTest

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
{
"channels":
[
{
"name":"S10BC01-DBPM010:X1",
"backend":"sf-databuffer",
"modulo":1,
"offset":0
},
{
"name":"S10BC01-DBPM010:X1-VALID",
"backend":"sf-databuffer",
"modulo":1,
"offset":0
}
],
"mapping":{
"incomplete":"fill-null"
},
"channelValidation":{
"inconsistency":"keep-as-is"
},
"sendBehaviour":{
"strategy":"complete-all"
}
}

File diff suppressed because it is too large Load Diff

8061
examples/cafeTest/test.xml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,174 @@
/* =====================================================================
zhelpers.h
Helper header file for example applications.
=====================================================================
*/
#ifndef __ZHELPERS_H_INCLUDED__
#define __ZHELPERS_H_INCLUDED__
// Include a bunch of headers that we will need in the examples
#include <zmq.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#if (defined (WIN32))
# include <time.h>
#else
# include <sys/time.h>
#endif
#include <assert.h>
#include <signal.h>
// Version checking, and patch up missing constants to match 2.1
#if ZMQ_VERSION_MAJOR == 2
# error "Please upgrade to ZeroMQ/3.2 for these examples"
#endif
// Provide random number from 0..(num-1)
#if (defined (WIN32))
# define randof(num) (int) ((float) (num) * rand () / (RAND_MAX + 1.0))
#else
# define randof(num) (int) ((float) (num) * random () / (RAND_MAX + 1.0))
#endif
// Receive 0MQ string from socket and convert into C string
// Caller must free returned string. Returns NULL if the context
// is being terminated.
static char *
s_recv (void *socket) {
char buffer [256];
int size = zmq_recv (socket, buffer, 255, 0); //ZMQ_DONTWAIT);
if (size == -1)
return NULL;
if (size > 255)
size = 255;
buffer [size] = 0;
return strdup (buffer);
}
// Convert C string to 0MQ string and send to socket
static int
s_send (void *socket, char *string) {
int size = zmq_send (socket, string, strlen (string), 0);
return size;
}
// Sends string as 0MQ string, as multipart non-terminal
static int
s_sendmore (void *socket, char *string) {
int size = zmq_send (socket, string, strlen (string), ZMQ_SNDMORE);
return size;
}
// Receives all message parts from socket, prints neatly
//
static void
s_dump (void *socket)
{
puts ("----------------------------------------");
while (1) {
// Process all parts of the message
zmq_msg_t message;
zmq_msg_init (&message);
int size = zmq_msg_recv (&message, socket, 0);
// Dump the message as text or binary
char *data = (char*)zmq_msg_data (&message);
int is_text = 1;
int char_nbr;
for (char_nbr = 0; char_nbr < size; char_nbr++)
if ((unsigned char) data [char_nbr] < 32
|| (unsigned char) data [char_nbr] > 127)
is_text = 0;
printf ("[%03d] ", size);
for (char_nbr = 0; char_nbr < size; char_nbr++) {
if (is_text)
printf ("%c", data [char_nbr]);
else
printf ("%02X", (unsigned char) data [char_nbr]);
}
printf ("\n");
int64_t more; // Multipart detection
more = 0;
size_t more_size = sizeof (more);
zmq_getsockopt (socket, ZMQ_RCVMORE, &more, &more_size);
zmq_msg_close (&message);
if (!more)
break; // Last message part
}
}
// Set simple random printable identity on socket
//
static void
s_set_id (void *socket)
{
char identity [10];
sprintf (identity, "%04X-%04X", randof (0x10000), randof (0x10000));
zmq_setsockopt (socket, ZMQ_IDENTITY, identity, strlen (identity));
}
/*
// Sleep for a number of milliseconds
static void
s_sleep (int msecs)
{
#if (defined (WIN32))
Sleep (msecs);
#else
struct timespec t;
t.tv_sec = msecs / 1000;
t.tv_nsec = (msecs % 1000) * 1000000;
nanosleep (&t, NULL);
#endif
}
*/
// Return current system clock as milliseconds
static int64_t
s_clock (void)
{
#if (defined (WIN32))
SYSTEMTIME st;
GetSystemTime (&st);
return (int64_t) st.wSecond * 1000 + st.wMilliseconds;
#else
struct timeval tv;
gettimeofday (&tv, NULL);
return (int64_t) (tv.tv_sec * 1000 + tv.tv_usec / 1000);
#endif
}
// Print formatted string to stdout, prefixed by date/time and
// terminated with a newline.
/*
static void
s_console (const char *format, ...)
{
time_t curtime = time (NULL);
struct tm *loctime = localtime (&curtime);
char *formatted = (char*)malloc (20);
strftime (formatted, 20, "%y-%m-%d %H:%M:%S ", loctime);
printf ("%s", formatted);
free (formatted);
va_list argptr;
va_start (argptr, format);
vprintf (format, argptr);
va_end (argptr);
printf ("\n");
}
*/
#endif // __ZHELPERS_H_INCLUDED__

299
include/PVCtrlHolder.h Normal file
View File

@@ -0,0 +1,299 @@
///
/// \file PVCtrlHolder.h
/// \author Jan Chrin, PSI
/// \date November 2014
/// \version CAFE 1.0.0
///
#ifndef PVCTRLHOLDER_H
#define PVCTRLHOLDER_H
#include <PVHolder.h>
/**
* \class PVCtrlHolder
* \brief This class is the holder of values associated with the
* EPICS DBR_CTRL_(dataType) control structure of a given handle/pv
*/
class PVCtrlHolder : public PVHolder {
friend class CAFE;
friend class Connect;
friend class Conduit;
friend struct change_dataBufferPVCtrlHolder;
friend struct change_dataBufferSize_CTRL;
friend struct change_connectionHandlerArgs;
friend struct change_pvAlias;
private:
short precision;
char units[MAX_UNITS_SIZE];
CAFE_DATATYPE_UNION RISC_pad;
CAFE_DATATYPE_UNION upperDispLimit;
CAFE_DATATYPE_UNION lowerDispLimit;
CAFE_DATATYPE_UNION upperAlarmLimit;
CAFE_DATATYPE_UNION upperWarningLimit;
CAFE_DATATYPE_UNION lowerWarningLimit;
CAFE_DATATYPE_UNION lowerAlarmLimit;
CAFE_DATATYPE_UNION upperCtrlLimit;
CAFE_DATATYPE_UNION lowerCtrlLimit;
Helper helper;
public:
PVCtrlHolder(){
alarmStatus=0; alarmSeverity=0; precision=0; status=ECA_NORMAL;
nelem=1; size=1; rule=true; beamEventNo=0;
hasAlarm=true;
noStr=0; dataType=(CAFE_DATATYPE) CAFE_NO_ACCESS;
dataTypeNative=(CAFE_DATATYPE) CAFE_NO_ACCESS;
strcpy(pv,""); strcpy(pvAlias,"");strcpy(device,""); strcpy(attrib,""); strcpy(units,"");
val.reset( new CAFE_DATATYPE_UNION[nelem] );
val[0].d=0.00;
};
PVCtrlHolder(unsigned int _sizeOfArray) {
alarmStatus=0; alarmSeverity=0; precision=0; status=ECA_NORMAL;
nelem=_sizeOfArray; size=_sizeOfArray; rule=true; beamEventNo=0;
hasAlarm=true;
noStr=0; dataType=(CAFE_DATATYPE) CAFE_NO_ACCESS;
dataTypeNative=(CAFE_DATATYPE) CAFE_NO_ACCESS;
strcpy(pv,""); strcpy(pvAlias,"");strcpy(device,""); strcpy(attrib,""); strcpy(units,"");
val.reset( new CAFE_DATATYPE_UNION[nelem] );
for (unsigned int i=0; i<nelem; ++i) {
val[i].d=0.0;
};
};
~PVCtrlHolder() {val.reset();};
void setHasAlarm(bool a) {
hasAlarm=a;
return;
};
unsigned int setNelem (unsigned int _nelem) {
_nelem>0 ? nelem=_nelem : nelem=1;
if (_nelem>size) {
size=_nelem;
val.reset( new CAFE_DATATYPE_UNION[size] );
}
return nelem;
};
short getPrecision() const {return precision;}
const char * getUnits() const {return units;}
string getUnitsAsString() const {return (string) units;}
short getNoEnumStrings () const {return noStr;};
char * getEnumString(short indx) const {return (char *) strs[indx];};
vector<std::string> getEnumStrings() const {
vector<std::string> vEnumStrings;
vEnumStrings.reserve(noStr>0?noStr:1);
for ( short i=0; i<noStr; ++i) {
vEnumStrings.push_back(strs[i]);
}
return vEnumStrings;
};
short getEnumFromString(string enumString){
short returnValue=-1;
for ( short i=0; i<noStr; ++i) {
if (strcmp(enumString.c_str(), strs[i])==0) {
return i;
}
}
char pvStripped[MAX_ENUM_STRING_SIZE];
helper.removeLeadingAndTrailingSpaces((char *) enumString.c_str(), pvStripped);
for ( short i=0; i<noStr; ++i) {
if (strcmp(pvStripped, strs[i])==0) {
return i;
}
}
cout << "*** WARNING FROM PvCtrlHolder.h ***" << endl;
cout << "*** Method getEnumFromString(string enumString) ***" << endl;
cout << "The given input string '" << enumString << "' was not recognized! " << endl;
cout << "Valid values are: " << endl;
for ( short i=0; i<noStr; ++i) {
cout << i << ":" << strs[i] << endl;
}
return returnValue;
}
string getStringFromEnum(unsigned short enumValue) const{
string returnValue="";
if (enumValue<noStr) {
return (string) strs[enumValue];
}
else {
cout << "*** WARNING FROM PvCtrlHolder.h ***" << endl;
cout << "*** Method getStringFromEnum(unsigned short enumValue) ***" << endl;
cout << "The given input index " << enumValue << " exceeds the number of enum states " << noStr << endl;
cout << "Valid values are: " << endl;
for ( short i=0; i<noStr; ++i) {
cout << i << ":" << strs[i] << endl;
}
if (enumValue<MAX_ENUM_STATES) {
return (string) strs[enumValue];
}
else {
return returnValue;
}
}
}
CafeDataTypeHelper getRISC_pad() {CafeDataTypeHelper cdth(RISC_pad, dataType); return cdth;}
CafeDataTypeHelper getUpperDispLimit() {CafeDataTypeHelper cdth(upperDispLimit, dataType); return cdth;}
CafeDataTypeHelper getLowerDispLimit() {CafeDataTypeHelper cdth(lowerDispLimit, dataType); return cdth;}
CafeDataTypeHelper getUpperAlarmLimit() {CafeDataTypeHelper cdth(upperAlarmLimit, dataType); return cdth;}
CafeDataTypeHelper getUpperWarningLimit() {CafeDataTypeHelper cdth(upperWarningLimit, dataType); return cdth;}
CafeDataTypeHelper getLowerWarningLimit() {CafeDataTypeHelper cdth(lowerWarningLimit, dataType); return cdth;}
CafeDataTypeHelper getLowerAlarmLimit() {CafeDataTypeHelper cdth(lowerAlarmLimit, dataType); return cdth;}
CafeDataTypeHelper getUpperCtrlLimit() {CafeDataTypeHelper cdth(upperCtrlLimit, dataType); return cdth;}
CafeDataTypeHelper getLowerCtrlLimit() {CafeDataTypeHelper cdth(lowerCtrlLimit, dataType); return cdth;}
string getUpperDispLimit_AsString() { return getAsString(upperDispLimit); }
string getLowerDispLimit_AsString() { return getAsString(lowerDispLimit); }
string getUpperAlarmLimit_AsString() { return getAsString(upperAlarmLimit); }
string getUpperWarningLimit_AsString() { return getAsString(upperWarningLimit); }
string getLowerWarningLimit_AsString() { return getAsString(lowerWarningLimit); }
string getLowerAlarmLimit_AsString() { return getAsString(lowerAlarmLimit); }
string getUpperCtrlLimit_AsString() { return getAsString(upperCtrlLimit); }
string getLowerCtrlLimit_AsString() { return getAsString(lowerCtrlLimit); }
double getUpperDispLimit_AsDouble() { return getAsDouble(upperDispLimit); }
double getLowerDispLimit_AsDouble() { return getAsDouble(lowerDispLimit); }
double getUpperAlarmLimit_AsDouble() { return getAsDouble(upperAlarmLimit); }
double getUpperWarningLimit_AsDouble() { return getAsDouble(upperWarningLimit); }
double getLowerWarningLimit_AsDouble() { return getAsDouble(lowerWarningLimit); }
double getLowerAlarmLimit_AsDouble() { return getAsDouble(lowerAlarmLimit); }
double getUpperCtrlLimit_AsDouble() { return getAsDouble(upperCtrlLimit); }
double getLowerCtrlLimit_AsDouble() { return getAsDouble(lowerCtrlLimit); }
void print() {
print(nelem) ;
}
void print(unsigned int nelemToPrint) {
nelemToPrint=min(nelemToPrint,nelem);
std::cout << "------------------------------------------" << std::endl;
std::cout << "PVCtrlHolder:" << std::endl;
std::cout << "processVariable= " << pv << std::endl;
if (strcmp(pvAlias,pv)) {
std::cout << "pvAlias = " << pvAlias << std::endl;
}
std::cout << "device = " << device << std::endl;
std::cout << "attrib = " << attrib << std::endl;
std::cout << "dataType = " << cafeDataTypeCode.message(dataType).c_str()
<< " (" << dataType << ") " << std::endl;
std::cout << "dbrTypeRequest = " << dbr_type_to_text(dbrDataType)<< std::endl;
if (dataType!=CAFE_NO_ACCESS || dataType != CAFE_TYPENOTCONN) {
std::cout << "nelem = " << nelem << std::endl;
std::cout << "alarmStatus = " << alarmStatus << std::endl;
std::cout << "alarmSeverity = " << alarmSeverity << std::endl;
std::cout << "precision = " << precision << std::endl;
std::cout << "units = " << units << std::endl;
/*
if (dataType==CAFE_DOUBLE){
std::cout << "RISC_Pad0 = " << (dbr_short_t) RISC_pad.d << std::endl
// in dbr_ctrl_double this is a RISC_pad
}
else if (dataType==CAFE_CHAR) {
std::cout << "RISC_Pad = " << (unsigned short) RISC_pad.ch << std::endl;
}
else if (dataType==CAFE_FLOAT) {
std::cout << "RISC_Pad = " << (dbr_short_t) RISC_pad.f << std::endl;
}
*/
if (dataType!=CAFE_ENUM) {
std::cout << "upperDispLimit = " << getAsString(upperDispLimit) << std::endl;
std::cout << "lowerDispLimit = " << getAsString(lowerDispLimit) << std::endl;
std::cout << "upperAlarmLimit= " << getAsString(upperAlarmLimit) << std::endl;
std::cout << "upperWarnLimit = " << getAsString(upperWarningLimit) << std::endl;
std::cout << "lowerWarnLimit = " << getAsString(lowerWarningLimit) << std::endl;
std::cout << "lowerAlarmLimit= " << getAsString(lowerAlarmLimit) << std::endl;
if(dbr_type_is_CTRL(dbrDataType)) {
std::cout << "upperCtrlLimit = " << getAsString(upperCtrlLimit) << std::endl;
std::cout << "lowerCtrlLimit = " << getAsString(lowerCtrlLimit) << std::endl;
}
}
else {
std::cout << "NoStr (ENUM) = " << noStr << std::endl;
std::cout << "strs (ENUM) = " ;
for (short i=0; i< noStr; ++i) {std::cout << "{" << strs[i] << "} " ;}
cout <<std::endl;
}
std::cout << "status = " << cafeStatusCode.message(status).c_str() << std::endl;
if(nelem>0) {std::cout << "value(s) = " ;}
switch (dataType) {
case CAFE_STRING:
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << val[i].str << " [" << i << "] " ;}
break;
case CAFE_SHORT:
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << val[i].s << " [" << i << "] " ;}
break;
case CAFE_FLOAT:
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << val[i].f << " [" << i << "] " ;}
break;
case CAFE_ENUM:
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout <<
getAsString(i) << " (" << val[i].us << ")" << " [" << i << "] " ;}
break;
case CAFE_CHAR:
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << (unsigned short) val[i].ch << " [" << i << "] " ;}
break;
case CAFE_LONG:
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << val[i].l << " [" << i << "] " ;}
break;
case CAFE_DOUBLE:
for (unsigned int i=0; i <nelemToPrint; ++i ) {std::cout << val[i].d << " [" << i << "] " ;}
break;
case CAFE_NO_ACCESS:
default:
std::cout << "DATA_TYPE NOT YET DEFINED " << endl;
break;
}
std::cout << std::endl;
}
std::cout << "------------------------------------------" << std::endl;
};
};
#endif // PVCTRLHOLDER_H

236
include/PVDataHolder.h Normal file
View File

@@ -0,0 +1,236 @@
///
/// \file PVDataHolder.h
/// \author Jan Chrin, PSI
/// \date November 2014
/// \version CAFE 1.0.0
///
#ifndef PVDATAHOLDER_H
#define PVDATAHOLDER_H
#include <PVHolder.h>
/**
* \class PVDataHolder
* \brief This class is the holder of data values associated with
* the EPICS DBR_TIME_(dataType) structure of a given handle/pv
*/
class PVDataHolder : public PVHolder {
friend class CAFE;
friend class PVGroup;
friend class Connect;
friend class Conduit;
//if HAVE_LIBQTXML
friend class loadCollectionXMLParser;
friend class restorePVGroupXMLParser;
//endif
friend struct change_dataBufferPVDataHolder;
friend struct change_dataBufferSize_TIME;
friend struct change_connectionHandlerArgs;
friend struct change_pvAlias;
//private:
//epicsTimeStamp ts;
//bool hasTS;
public:
epicsTimeStamp ts;
bool hasTS;
//Derived class does not inherit constructors
PVDataHolder(unsigned int _sizeOfArray) {
alarmStatus=0; alarmSeverity=0; status=ECAFE_NODATA;
nelem= _sizeOfArray > 0 ? _sizeOfArray : 1;
size = _sizeOfArray > 0 ? _sizeOfArray : 1;
dataType=(CAFE_DATATYPE) CAFE_NO_ACCESS;
dataTypeNative=(CAFE_DATATYPE) CAFE_NO_ACCESS;
rule=true; beamEventNo=0; userNo=0; ts.nsec=0; ts.secPastEpoch=0;
hasAlarm=true; hasTS=true;
strcpy(pv,""); strcpy(pvAlias,""); strcpy(device,""); strcpy(attrib,"");
val.reset( new CAFE_DATATYPE_UNION[nelem] );
for (unsigned int i=0; i<nelem; ++i) {
val[i].d=0.0;
};
};
PVDataHolder(){
alarmStatus=0; alarmSeverity=0; status=ECAFE_NODATA; nelem=1; size=1;
dataType=(CAFE_DATATYPE) CAFE_NO_ACCESS;
dataTypeNative=(CAFE_DATATYPE) CAFE_NO_ACCESS;
rule=true; beamEventNo=0; userNo=0; ts.nsec=0; ts.secPastEpoch =0;
hasAlarm=true; hasTS=true;
strcpy(pv,""); strcpy(pvAlias,""); strcpy(device,""); strcpy(attrib,"");
val.reset( new CAFE_DATATYPE_UNION[nelem] );
val[0].d=0.00;
};
~PVDataHolder() {
val.reset();
};
void valReset() {
val.reset();
}
void setHasAlarm(bool a) {
hasAlarm=a;
return;
};
void setHasTS(bool t){
hasTS=t;
if (t) {hasAlarm=t;} //TS will also retrieve alarmStatus
return;
}
bool getHasTS(){
return hasTS;
}
unsigned int setNelem (unsigned int _nelem) {
_nelem>0 ? nelem=_nelem : nelem=1;
if (nelem>size) {
size=nelem;
val.reset( new CAFE_DATATYPE_UNION[size] );
}
return nelem;
};
epicsTimeStamp getEpicsTimeStamp() const {return ts;};
struct etsNorm{ unsigned int secPastEpoch; unsigned int nsec;} _etsNorm;
struct etsDate{ unsigned short year; unsigned short mon; unsigned short day;
unsigned short hour; unsigned short min; unsigned short sec; unsigned int nsec;} _etsDate ;
etsNorm getEpicsTimeStampAsUInt32() {
_etsNorm.secPastEpoch=ts.secPastEpoch;
_etsNorm.nsec=(unsigned long) ts.nsec;
return _etsNorm;};
etsDate getEpicsTimeStampAsDate() {
ts.nsec=(unsigned int) ts.nsec;
//This may happen in timeouts; epicsTime convertor will report overflow error
//However this possibility is now captured in conduitFriend.h and other
if(ts.nsec >= 1000000000) {
cout << "OVERFLOW IN gets.nsec CORRECTED for epicsTime converter " << endl; ts.nsec=0;
}
epicsTime time(ts);
local_tm_nano_sec local = (local_tm_nano_sec) time;
_etsDate.year = local.ansi_tm.tm_year + 1900;
_etsDate.mon = local.ansi_tm.tm_mon + 1;
_etsDate.day = local.ansi_tm.tm_mday;
_etsDate.hour = local.ansi_tm.tm_hour;
_etsDate.min = local.ansi_tm.tm_min;
_etsDate.sec = local.ansi_tm.tm_sec;
_etsDate.nsec = (unsigned long) ts.nsec;
return _etsDate;
}
void print() {
print(nelem) ;
}
void print(unsigned int nelemToPrint) {
nelemToPrint=min(nelemToPrint,nelem);
if (pv==NULL) {
std::cout << "Process Variable NOT ASSIGNED!" << std::endl;
std::cout << "Variable has not been applied to a get operation!" << std::endl;
return;
}
std::cout << "------------------------------------------" << std::endl;
//std::cout << "PVDataHolder:" << std::endl;
std::cout << "processVariable= " << pv << std::endl;
if (strcmp(pvAlias,pv) && strcmp(pvAlias,"")) {
std::cout << "pvAlias = " << pvAlias << std::endl;
}
std::cout << "device = " << device << std::endl;
std::cout << "attrib = " << attrib << std::endl;
std::cout << "dataType = " << cafeDataTypeCode.message(dataType).c_str()
<< " (" << dataType << ") " << std::endl;
std::cout << "dbrTypeRequest = " << dbr_type_to_text(dbrDataType)<< std::endl;
//std::cout << "dataType = " << CAFEDataTypeCode.message(dataType).c_str() << std::endl;
if (dataType != CAFE_NO_ACCESS && dataType != CAFE_TYPENOTCONN) {
std::cout << "nelem = ";
}
else {
std::cout << "nelem = ";
}
std::cout << nelem; std::cout << std::endl;
if(!rule) {
std::cout << "rule (0=false) = " << rule <<std::endl;
}
if (dbr_type_is_STS(dbrDataType) || dbr_type_is_TIME(dbrDataType) ) {
std::cout << "alarmStatus = " << alarmStatus << std::endl;
std::cout << "alarmSeverity = " << alarmSeverity << std::endl;
if (dbr_type_is_TIME(dbrDataType)) {
std::cout << "epicsTimeStamp = " << ts.secPastEpoch << " sec. and " << ts.nsec << " nsec" << std::endl;
}
}
if(beamEventNo!=0) {std::cout << "beamEventNo = " << beamEventNo << std::endl;};
std::cout << "status = " << cafeStatusCode.message(status).c_str() << std::endl;
std::cout << "value(s) = " ;
switch (dataType) {
case CAFE_STRING:
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].str << " [" << i << "] " ;
break;
case CAFE_SHORT:
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].s << " [" << i << "] " ;
break;
case CAFE_FLOAT:
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].f << " [" << i << "] " ;
break;
case CAFE_ENUM:
for (unsigned int i=0; i <nelemToPrint; ++i ) { std::cout <<
getAsString(i) << " (" << val[i].us << ")" << " [" << i << "] " ;}
break;
case CAFE_CHAR:
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << (unsigned short) val[i].ch << " [" << i << "] " ;
break;
case CAFE_LONG:
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].l << " [" << i << "] " ;
break;
case CAFE_DOUBLE:
for (unsigned int i=0; i <nelemToPrint; ++i ) std::cout << val[i].d << " [" << i << "] " ;
break;
case CAFE_NO_ACCESS:
std::cout << "DATA_TYPE NOT YET DEFINED " << endl;
default:
break;
};
std::cout << std::endl;
std::cout << "------------------------------------------" << std::endl;
};
};
#endif //PVDATAHOLDER_H

196
include/PVGroup.h Normal file
View File

@@ -0,0 +1,196 @@
///
/// \file PVGroup.h
///
/// \author Jan Chrin
/// \date November 2014
///
#ifndef PVGROUP_H
#define PVGROUP_H
#include <PVDataHolder.h>
/**
* class MemberMap
* maps string to index
*/
class MemberMap {
typedef std::map<long, std::string> mapLongString;
private:
mapLongString mapNameIndex;
mapLongString::iterator pos;
Helper helper;
public:
MemberMap(){};
~MemberMap(){};
void insert(int a, std::string _Name) {
mapNameIndex.insert(std::make_pair(a, _Name));
};
std::string getPV (int i) {
pos = mapNameIndex.find(i);
if (pos != mapNameIndex.end()) return pos->second;
cout << "Index " << i << " not found! Size of group vector is " << mapNameIndex.size() << endl;
return "";
};
int getIndex (std::string _Name) {
char pvStripped[PVNAME_SIZE];
helper.removeLeadingAndTrailingSpaces(_Name.c_str(), pvStripped);
string Name=pvStripped;
for (pos=mapNameIndex.begin(); pos != mapNameIndex.end(); ++pos) {
if (pos->second==Name) {return pos->first;}
// String searches such as s.find(s1) return string::npos on failure
//else if ( (pos->second).find(Name) != std::string::npos) return pos->first;
}
cout << "PV: " << Name << " IS NOT A MEMBER OF THIS LIST " << endl;
return -1;
};
};
/**
* class PVGroup
* This class is the holder of PVDataHolder objects associated with
* of group of handles
*/
class PVGroup {
friend class Connect;
friend class CAFE;
//if HAVE_LIBQTXML
friend class restorePVGroupXMLParser;
//endif
private:
PVDataHolder * pvdata;
unsigned int npv;
char name [PVGROUP_PSEUDO_SIZE];
int statusGroup;
unsigned int groupHandle;
bool isIndexOutOfRange (unsigned int idx) {
return (idx >= npv) ? true:false;
};
MemberMap memberMap;
public:
//Initialize 1st two to avoid compiler warning messages
PVGroup(){npv=0; pvdata=NULL; statusGroup=ICAFE_NORMAL; groupHandle=0; strcpy(name,"");};
~PVGroup(){};
MemberMap getMemberMap() const {return memberMap;};
PVDataHolder * getPVData() const {return pvdata;};
PVDataHolder getPVData(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx <<
" to PVGroup.pvdata() is out of range. Valid range is from 0 to " << npv-1;
throw std::out_of_range(oss.str());
}
return pvdata[idx];
};
void setHasAlarm(bool h){ for (unsigned int i=0; i<npv; ++i) {pvdata[i].setHasAlarm(h);} }
void setHasTS(bool h){ for (unsigned int i=0; i<npv; ++i) {pvdata[i].setHasTS(h);} }
unsigned int getNPV() const {return npv;};
string getNameAsString() const {return name;};
const char * getName() const {return (const char *) name;};
int getStatusGroup() const {return statusGroup;};
int getGroupStatus() const {return statusGroup;};
unsigned int getGroupHandle() const {return groupHandle;};
int PV2Index(std::string _pv) const {return getMemberMap().getIndex(_pv);}
string Index2PV(unsigned int _idx) const {return getMemberMap().getPV(_idx);}
void setPVData(PVDataHolder * _pvdata) {
//We do not need to make a deep copy
/*
for (unsigned int i=0; i<npv; ++i) {
pvdata[i].alarmStatus=_pvdata[i].alarmStatus;
pvdata[i].alarmSeverity=_pvdata[i].alarmSeverity;
pvdata[i].status=_pvdata[i].status;
pvdata[i].nelem=_pvdata[i].nelem;
pvdata[i].size=_pvdata[i].size;
pvdata[i].dataType=_pvdata[i].dataType;
pvdata[i].dataTypeNative=_pvdata[i].dataTypeNative;
pvdata[i].rule=_pvdata[i].rule;
pvdata[i].beamEventNo=_pvdata[i].beamEventNo;
pvdata[i].userNo=_pvdata[i].userNo;
pvdata[i].ts.nsec=_pvdata[i].ts.nsec;
pvdata[i].ts.secPastEpoch=_pvdata[i].ts.secPastEpoch;
strcpy(pvdata[i].pv,_pvdata[i].pv);
strcpy(pvdata[i].pvAlias,_pvdata[i].pvAlias);
strcpy(pvdata[i].device,_pvdata[i].device);
strcpy(pvdata[i].attrib,_pvdata[i].attrib);
}
*/
//Shallow copy will do
pvdata=_pvdata;
};
void set(unsigned int _npv) {npv=_npv;};
void setName(const char * _name) {strcpy(name, _name);};
void setName(string _name) {strcpy(name,_name.c_str());};
void setStatusGroup(int _sg) {statusGroup=_sg;}
void show() {print(npv) ;}
void showMax(unsigned int npvToPrint){print(npvToPrint);}
void showMaxMax(unsigned int npvToPrint, unsigned int maxNelemWF){
print(npvToPrint, maxNelemWF);}
void print() {print(npv) ;}
void print(unsigned int npvToPrint) {
npvToPrint=min(npvToPrint,npv);
std::cout << "------------ PVGroup Handle = " << groupHandle << " ------------ "<< std::endl;
std::cout << "PVGROUP: " << name << " HAS " << npv << " MEMBERS " << std::endl;
std::cout << "PRINTING THE REQUESTED " << npvToPrint << " MEMBERS " << std::endl;
std::cout << "OVERALL STATUS OF GROUP REPORTS " << statusGroup << std::endl;
if (statusGroup!=ICAFE_NORMAL) {
CAFEStatus cstat; cstat.report(statusGroup);
}
for (unsigned int i=0; i<npvToPrint; ++i) {
pvdata[i].print();
}
}
void print(unsigned int npvToPrint, unsigned int maxNelemWF) {
npvToPrint=min(npvToPrint,npv);
std::cout << "------------ PVGroup Handle = " << groupHandle << " ------------ "<< std::endl;
std::cout << "PVGROUP: " << name << " HAS " << npv << " MEMBERS " << std::endl;
std::cout << "PRINTING THE REQUESTED " << npvToPrint << " MEMBERS " << std::endl;
std::cout << "OVERALL STATUS OF GROUP REPORTS " << statusGroup << std::endl;
if (statusGroup!=ICAFE_NORMAL) {
CAFEStatus cstat; cstat.report(statusGroup);
}
for (unsigned int i=0; i<npvToPrint; ++i) {
pvdata[i].print(min(maxNelemWF,pvdata[i].getNelem()));
}
}
void printIfError() {
unsigned int npvToPrint=npv;
bool iErrorFound=false;
for (unsigned int i=0; i<npvToPrint; ++i) {
if (pvdata[i].getStatus() != ICAFE_NORMAL) {
if(!iErrorFound) {
std::cout << "PVGROUP: " << name << " HAS " << npv << " MEMBERS " << std::endl;
std::cout << "PRINTING PV TRANSACTIONS WITH ERRORS " << std::endl;
iErrorFound=true;
}
cout << "------------------------------------------------------------" << endl;
cout << "Element [" << i << "] of " << npv << " in group: " << name << endl;
pvdata[i].print();
}
}
}
};
#endif //PVGROUP_H

889
include/PVHolder.h Normal file
View File

@@ -0,0 +1,889 @@
///
/// \file PVHolder.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef PVHOLDER_H
#define PVHOLDER_H
#include <stdexcept>
#include <cstring>
#include <limits>
#include <cafeConvert.h>
#include <statusCodes.h>
#include <helper.h>
#include <defines.h>
#include <cafeDataTypeHelper.h>
#include <boost/smart_ptr/shared_ptr.hpp>
//include <boost/smart_ptr/make_unique.hpp> boost 1.57
//include <boost/interprocess/smart_ptr/unique_ptr.hpp>
#include <vector>
/**
* \class PVHolder
* \brief The base class from which the PVDataHolder and PVCtrlHolder
* classes are derived
*/
class PVHolder {
protected:
char pv [PVNAME_SIZE];
char pvAlias[PVNAME_SIZE];
char device [PVNAME_SIZE];
char attrib [PVNAME_SIZE];
CAFE_DATATYPE dataTypeNative; //enum
CAFE_DATATYPE dataType; //enum
CAFEDataTypeCode cafeDataTypeCode; //class enum<->string mapping
CAFEStatusCode cafeStatusCode;
chtype dbrDataType; //dbrTypeRequest_DataBuffer;
unsigned int size;
unsigned int nelem;
//unsigned int nelemNative;
short alarmStatus; //alarm.h 0-22 0=NO_ALARM
short alarmSeverity; //alarm.h 0=NO_ALARM 1=MINOR 2=MAJOR 3=INVALID
unsigned int userNo; //e.g. add handle
unsigned int beamEventNo;
//rule is used for synchronous groups only
bool rule; // to set/get or not to set/get channel; default: true (i.e. set)
bool hasAlarm;
int status;
short noStr; // for enum
char strs [MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE];
CAFEConvert<double> renderDouble;
CAFEConvert<float> renderFloat;
CAFEConvert<short> renderShort;
CAFEConvert<int> renderLong;
CAFEConvert<unsigned short> renderEnum;
CAFEConvert<unsigned char> renderUChar;
CAFEConvert<dbr_string_t> renderString;
CAFEConvert<char> renderChar;
CAFEConvert<unsigned int> renderULong;
CAFEConvert<long long> renderLongLong;
CAFEConvert<unsigned long long> renderULongLong;
CAFEConvert<int> renderInt;
CAFEConvert<unsigned int> renderUInt;
void verifyIndex(unsigned int idx) {
if(idx >= size) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
};
bool isIndexOutOfRange (unsigned int idx) {
return (idx >= size) ? true:false;
};
public:
typedef boost::shared_ptr<CAFE_DATATYPE_UNION []> ValPtr;
ValPtr val;
boost::shared_ptr<vector<double> > ValVD_ptr;
boost::shared_ptr<vector<float> > ValVF_ptr;
//boost::shared_ptr<vector<short> > ValVS_ptr;
boost::shared_ptr<vector<int> > ValVI_ptr;
//boost::shared_ptr<vector<unsigned char> > ValVC_ptr;
//boost::shared_ptr<vector<unsigned short> > ValVUS_ptr;
boost::shared_ptr<vector<string> > ValVStr_ptr;
typedef boost::shared_ptr<double []> ValDPtr;
typedef boost::shared_ptr<float []> ValFPtr;
typedef boost::shared_ptr<short []> ValSPtr;
typedef boost::shared_ptr<int []> ValIPtr;
typedef boost::shared_ptr<unsigned char []> ValChPtr;
typedef boost::shared_ptr<unsigned short []> ValUSPtr;
typedef boost::shared_ptr<dbr_string_t []> ValStrPtr;
ValDPtr ValD_ptr;
ValFPtr ValF_ptr;
ValSPtr ValS_ptr;
ValIPtr ValI_ptr;
ValChPtr ValCh_ptr;
ValUSPtr ValUS_ptr;
ValStrPtr ValStr_ptr;
void setUserNo(unsigned int un) {
userNo=un;
return;
}
unsigned int getUserNo() {
return userNo;
}
void setRule(bool r) {
rule=r;
return;
};
const char * getPV() const {return pv;};
const char * getPVName() const {return pv;};
const char * getPVAlias() const {return pvAlias;};
const char * getDevice() const {return device;};
const char * getAttribute() const {return attrib;};
unsigned int getNelem() const {return nelem;};
//unsigned int getNelemNative() const {return nelemNative;};
const unsigned int getSize() const {return size;};
CAFE_DATATYPE_UNION_SEQ getVal() const {return val.get();};
short getAlarmStatus() const {return alarmStatus;};
short getAlarmSeverity() const {return alarmSeverity;};
unsigned int getBeamEventNo() const {return beamEventNo;};
bool getRule() const {return rule;};
bool getHasAlarm() const{return hasAlarm;};
int getStatus() const {return status;};
CAFE_DATATYPE getDataTypeClient() const {return dataType;};
CAFE_DATATYPE getDataType() const {return dataType;};
CAFEStatusCode getStatusCode() const {return cafeStatusCode;};
short getNoEnumStrings () const {return noStr;};
char * getEnumString(short indx) const {return (char *) strs[indx]; }
void setDataType(CAFE_DATATYPE cdt){
if (cdt > CAFE_DOUBLE || cdt < CAFE_STRING) {
cout << "WARNING: INPUT VALUE NOT A VALID CAFE DATATYPE " << endl;
return;
} else {dataType=cdt; return;}};
void set(double d) {val[0].d=d; dataType=CAFE_DOUBLE;};
void set(float f) {val[0].f=f; dataType=CAFE_FLOAT;};
void set(short s) {val[0].s=s; dataType=CAFE_SHORT;};
void set(long long l) {
if (l > std::numeric_limits<dbr_long_t>::max()) {
cout << "WARNING: INPUT VALUE GREATER THAN MAX LIMIT OF dbr_long_t " << endl;
cout << "TYPE CASTING TO DOUBLE! " << endl;
val[0].d= (double) l; dataType=CAFE_DOUBLE;}
else {
val[0].l= (int) l; dataType=CAFE_LONG;};
}
void set(int l) {val[0].l=l; dataType=CAFE_LONG;};
void set(unsigned long long l) {
if (l > (unsigned long long) std::numeric_limits<dbr_long_t>::max()) {
cout << "WARNING: INPUT VALUE GREATER THAN MAX LIMIT OF dbr_long_t " << endl;
cout << "TYPE CASTING TO DOUBLE! " << endl;
val[0].d= (double) l; dataType=CAFE_DOUBLE;}
else {
val[0].l= (int) l; dataType=CAFE_LONG;};
}
//For Cython
void setString(std::string str) {strcpy(val[0].str,str.c_str()); dataType=CAFE_STRING;};
void setDouble(double d) {val[0].d=d; dataType=CAFE_DOUBLE;};
void setInt(int l) {val[0].l=l; dataType=CAFE_LONG;};
void setVString(vector<std::string> Vstr) {
if(Vstr.size()!=nelem) {nelem=Vstr.size();}
for (unsigned int i=0; i<nelem; ++ i) {
strcpy(val[i].str,Vstr[i].c_str());} dataType=CAFE_STRING;};
void setVDouble(vector<double> Vd) {
if(Vd.size()!=nelem) {nelem=Vd.size();}
for (unsigned int i=0; i<nelem; ++ i) {
val[i].d=Vd[i];} dataType=CAFE_DOUBLE;};
void setVInt (vector<int> Vl) {
if(Vl.size()!=nelem) {nelem=Vl.size();}
for (unsigned int i=0; i<nelem; ++ i) {
val[i].l=Vl[i];} dataType=CAFE_LONG;};
void set(unsigned int l) {val[0].l= (int) l; dataType=CAFE_LONG;};
void set(unsigned short us) {val[0].us=us; dataType=CAFE_ENUM;};
void set(unsigned char ch) {val[0].ch=ch; dataType=CAFE_CHAR;};
void set(dbr_string_t str) {strcpy(val[0].str,str); dataType=CAFE_STRING;};
void set(std::string str) {strcpy(val[0].str,str.c_str()); dataType=CAFE_STRING;};
void set(double * d) {for (unsigned int i=0; i<nelem; ++ i) {val[i].d=d[i];} dataType=CAFE_DOUBLE;};
void set(float * f) {for (unsigned int i=0; i<nelem; ++ i) {val[i].f=f[i];} dataType=CAFE_FLOAT;};
void set(short * s) {for (unsigned int i=0; i<nelem; ++ i) {val[i].s=s[i];} dataType=CAFE_SHORT;};
//Examine this!
void set(long long * l) {
for (unsigned int i=0; i<nelem; ++ i) {val[i].l=(int)l[i];} dataType=CAFE_LONG;
};
void set(int * l) {for (unsigned int i=0; i<nelem; ++ i) {val[i].l=l[i];} dataType=CAFE_LONG;};
void set(unsigned int * l) {for (unsigned int i=0; i<nelem; ++ i)
{val[i].l= (int) l[i];} dataType=CAFE_LONG;};
void set(unsigned short * us) {for (unsigned int i=0; i<nelem; ++ i)
{val[i].us=us[i];} dataType=CAFE_ENUM;};
void set(unsigned char * ch) {for (unsigned int i=0; i<nelem; ++ i)
{val[i].ch=ch[i];} dataType=CAFE_CHAR;};
void set(dbr_string_t * str) {for (unsigned int i=0; i<nelem; ++ i)
{strcpy(val[i].str,str[i]);} dataType=CAFE_STRING;};
void set(std::string * str) {for (unsigned int i=0; i<nelem; ++ i)
{strcpy(val[i].str,str[i].c_str());} dataType=CAFE_STRING;};
std::string concatToString(){
std::string psWF = "";
if (dataTypeNative==CAFE_CHAR) {
for (unsigned int i=0; i<nelem; ++i) {
if (val[i].ch != '\0') {
psWF.append(1, (dbr_char_t) val[i].ch);
}
}
}
return psWF;
}
std::string getWFAsString(){
std::string psWF = "";
if (dataTypeNative==CAFE_CHAR) {
for (unsigned int i=0; i<nelem; ++i) {
if (val[i].ch != '\0') {
psWF.append(1, (dbr_char_t) val[i].ch);
}
}
}
return psWF;
}
double getDouble(unsigned int idx) {return (double) val[idx].d;}
float getFloat (unsigned int idx) {return (float) val[idx].f;}
short getShort (unsigned int idx) {return (short) val[idx].s;}
int getInt (unsigned int idx) {return (int) val[idx].l;}
int getLong (unsigned int idx) {return (int) val[idx].l;}
unsigned short getEnum (unsigned int idx) {return (unsigned short) val[idx].us;}
unsigned short getUShort(unsigned int idx) {return (unsigned short) val[idx].us;}
unsigned char getChar (unsigned int idx) {return (unsigned char ) val[idx].ch;}
dbr_string_t * getString(unsigned int idx) {
#define __METHOD__ "PVHolder::getString "
if (dataType!=CAFE_STRING) {
cout << "******* WARNING *******" << endl;
cout << __METHOD__ << __LINE__ << endl;
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
" hence getString method is invalid! " << endl;
cout << "Use getAsString method if you wish to retrieve the data as a string! " << endl;
cout << "**********************" << endl;
//strcpy(val[idx].str, "");
return (dbr_string_t *) "";
}
return (dbr_string_t *) val[idx].str;
#undef __METHOD__
}
boost::shared_ptr<vector<double> > getAsVDouble(){
#define __METHOD__ "PVHolder::getVDouble "
ValVD_ptr.reset(new vector<double>());
switch (dataType)
{
case CAFE_DOUBLE:
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].d);}
break;
case CAFE_FLOAT:
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].f);}
break;
case CAFE_LONG:
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].l);}
break;
case CAFE_SHORT:
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].s);}
break;
case CAFE_ENUM:
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].us);}
break;
case CAFE_CHAR:
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back(val[i].ch);}
break;
case CAFE_STRING:
default:
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back( getAsDouble(i));}
break;
}
return ValVD_ptr;
#undef __METHOD__
}
boost::shared_ptr<vector<float> > getAsVFloat(){
#define __METHOD__ "PVHolder::getVFloat "
ValVF_ptr.reset(new vector<float>());
switch (dataType)
{
case CAFE_DOUBLE:
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back((float) val[i].d);}
break;
case CAFE_FLOAT:
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back(val[i].f);}
break;
case CAFE_LONG:
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back(val[i].l);}
break;
case CAFE_SHORT:
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back(val[i].s);}
break;
case CAFE_ENUM:
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back(val[i].us);}
break;
case CAFE_CHAR:
for (unsigned i=0; i<nelem; ++i) {ValVF_ptr->push_back(val[i].ch);}
break;
case CAFE_STRING:
default:
for (unsigned i=0; i<nelem; ++i) {ValVD_ptr->push_back( getAsFloat(i));}
break;
}
//How to index shared pointer for <vector<float> >
//vector<float> * vf= ValVF_ptr.get();
//cout << "size/// " << vf[0].size() << endl;
//cout << vf[0][0] << " val " << val[0].f << endl;
//cout << vf[0][1] << " val " << val[1].f << endl;
return ValVF_ptr;
#undef __METHOD__
}
boost::shared_ptr<vector<int> > getAsVInt(){
#define __METHOD__ "PVHolder::getVInt "
ValVI_ptr.reset(new vector<int>());
switch (dataType)
{
case CAFE_DOUBLE:
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back((int) val[i].d);}
break;
case CAFE_FLOAT:
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back((int) val[i].f);}
break;
case CAFE_LONG:
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back(val[i].l);}
break;
case CAFE_SHORT:
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back(val[i].s);}
break;
case CAFE_ENUM:
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back(val[i].us);}
break;
case CAFE_CHAR:
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back(val[i].ch);}
break;
case CAFE_STRING:
default:
for (unsigned i=0; i<nelem; ++i) {ValVI_ptr->push_back( getAsInt(i));}
break;
}
return ValVI_ptr;
#undef __METHOD__
}
boost::shared_ptr<vector<string> > getAsVString(){
#define __METHOD__ "PVHolder::getVString "
ValVStr_ptr.reset(new vector<string>());
for (unsigned i=0; i<nelem; ++i) {ValVStr_ptr->push_back( getAsString(i));}
return ValVStr_ptr;
#undef __METHOD__
}
ValDPtr getDouble(){
#define __METHOD__ "PVHolder::getDouble "
if (dataType!=CAFE_DOUBLE) {
cout << "******* WARNING *******" << endl;
cout << __METHOD__ << __LINE__ << endl;
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
" hence getDouble method is invalid! " << endl;
cout << "Use getAsDouble method if you wish to retrieve the data as a double! " << endl;
cout << "**********************" << endl;
}
ValD_ptr.reset(new double[nelem]);
for (unsigned i=0; i<nelem; ++i) {
ValD_ptr[i] = val[i].d;
}
return ValD_ptr;
#undef __METHOD__
}
ValFPtr getFloat() {
#define __METHOD__ "PVHolder::getFloat "
if (dataType!=CAFE_FLOAT) {
cout << "******* WARNING *******" << endl;
cout << __METHOD__ << __LINE__ << endl;
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
" hence getFloat method is invalid! " << endl;
cout << "Use getAsFloat method if you wish to retrieve the data as a float! " << endl;
cout << "**********************" << endl;
}
ValF_ptr.reset(new float[nelem]);
for (unsigned i=0; i<nelem; ++i) {
ValF_ptr[i] = val[i].f;
}
return ValF_ptr;
//return (float *) val.get();
#undef __METHOD__
}
ValSPtr getShort() {
#define __METHOD__ "PVHolder::getShort "
if (dataType==CAFE_SHORT) {
cout << "******* WARNING *******" << endl;
cout << __METHOD__ << __LINE__ << endl;
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
" hence getShort method is invalid! " << endl;
cout << "Use getAsShort method if you wish to retrieve the data as a short! " << endl;
cout << "**********************" << endl;
}
ValS_ptr.reset(new short[nelem]);
for (unsigned i=0; i<nelem; ++i) {
ValS_ptr[i] = val[i].s;
}
return ValS_ptr;
#undef __METHOD__
}
ValIPtr getInt(){
#define __METHOD__ "PVHolder::getInt (meaning dbr_long_t) "
if (dataType!=CAFE_LONG) {
cout << "******* WARNING *******" << endl;
cout << __METHOD__ << __LINE__ << endl;
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
" hence getInt method is invalid! " << endl;
cout << "Use getAsInt method if you wish to retrieve the data as a int! " << endl;
cout << "**********************" << endl;
}
ValI_ptr.reset(new int[nelem]);
for (unsigned i=0; i<nelem; ++i) {
ValI_ptr[i] = val[i].l;
}
return ValI_ptr;
#undef __METHOD__
}
ValIPtr getLong(){
#define __METHOD__ "PVHolder::getLong (meaning dbr_long_t) "
if (dataType!=CAFE_LONG) {
cout << "******* WARNING *******" << endl;
cout << __METHOD__ << __LINE__ << endl;
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
" hence getLong method is invalid! " << endl;
cout << "Use getAsLong method if you wish to retrieve the data as a dbr_long_t! " << endl;
cout << "**********************" << endl;
}
ValI_ptr.reset(new int[nelem]);
for (unsigned i=0; i<nelem; ++i) {
ValI_ptr[i] = val[i].l;
}
return ValI_ptr;
#undef __METHOD__
}
ValUSPtr getEnum(){
#define __METHOD__ "PVHolder::getEnum "
if (dataType!=CAFE_ENUM) {
cout << "******* WARNING *******" << endl;
cout << __METHOD__ << __LINE__ << endl;
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
" hence getEnum method is invalid! " << endl;
cout << "Use getAsEnum method if you wish to retrieve the data as an enum (unsigned short)! " << endl;
cout << "**********************" << endl;
}
ValUS_ptr.reset(new unsigned short[nelem]);
for (unsigned i=0; i<nelem; ++i) {
ValUS_ptr[i] = val[i].us;
}
return ValUS_ptr;
#undef __METHOD__
}
ValUSPtr getUShort(){
#define __METHOD__ "PVHolder::getUShort "
if (dataType!=CAFE_USHORT) {
cout << "******* WARNING *******" << endl;
cout << __METHOD__ << __LINE__ << endl;
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
" hence getUShort method is invalid! " << endl;
cout << "Use getAsUSHort method if you wish to retrieve the data as an unsigned short! " << endl;
cout << "**********************" << endl;
}
ValUS_ptr.reset(new unsigned short[nelem]);
for (unsigned i=0; i<nelem; ++i) {
ValUS_ptr[i] = val[i].us;
}
return ValUS_ptr;
#undef __METHOD__
}
ValChPtr getChar(){
#define __METHOD__ "PVHolder::getChar "
if (dataType!=CAFE_CHAR) {
cout << "******* WARNING *******" << endl;
cout << __METHOD__ << __LINE__ << endl;
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
" hence getChar method is invalid! " << endl;
cout << "Use getAsChar method if you wish to retrieve the data as a char! " << endl;
cout << "**********************" << endl;
}
ValCh_ptr.reset(new unsigned char[nelem]);
for (unsigned i=0; i<nelem; ++i) {
ValCh_ptr[i] = val[i].ch;
}
return ValCh_ptr;
#undef __METHOD__
}
ValStrPtr getString() {
#define __METHOD__ "PVHolder::getString "
if (dataType!=CAFE_STRING) {
cout << "******* WARNING *******" << endl;
cout << __METHOD__ << __LINE__ << endl;
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
" hence getString method is invalid! " << endl;
cout << "Use getAsString method if you wish to retrieve the data as a string! " << endl;
cout << "**********************" << endl;
//return (dbr_string_t *) "";
}
ValStr_ptr.reset(new dbr_string_t[nelem]);
for (unsigned i=0; i<nelem; ++i) {
strcpy(ValStr_ptr[i] , val[i].str);
}
return ValStr_ptr;
#undef __METHOD__
}
double getAsDouble () {
return (double) renderDouble.get(0, dataType, val.get())[0];
}
double getAsDouble(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (double) renderDouble.get(idx, dataType, val.get())[0];
}
float getAsFloat () {
return (float) renderFloat.get(0, dataType, val.get())[0];
}
float getAsFloat(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (float) renderFloat.get(idx, dataType, val.get())[0];
}
short getAsShort () {
return (short) renderShort.get(0, dataType, val.get())[0];
}
short getAsShort(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (short) renderShort.get(idx, dataType, val.get())[0];
}
int getAsLong () {
return (int) renderLong.get(0, dataType, val.get())[0];
}
int getAsLong(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (int) renderLong.get(idx, dataType, val.get())[0];
}
unsigned short getAsEnum () {
return (unsigned short) renderEnum.get(0, dataType, val.get())[0];
}
unsigned short getAsEnum(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (unsigned short) renderEnum.get(idx, dataType, val.get())[0];
}
unsigned short getAsUShort () {
return (unsigned short) renderEnum.get(0, dataType, val.get())[0];
}
unsigned short getAsUShort(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (unsigned short) renderEnum.get(idx, dataType, val.get())[0];
}
unsigned char getAsChar () {
return (char) renderChar.get(0, dataType, val.get())[0];
}
unsigned char getAsChar(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (char) renderChar.get(idx, dataType, val.get())[0];
}
unsigned char getAsUChar () {
return (unsigned char) renderUChar.get(0, dataType, val.get())[0];
}
unsigned char getAsUChar(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (unsigned char) renderUChar.get(idx, dataType, val.get())[0];
}
unsigned int getAsULong () {
return (unsigned int) renderULong.get(0, dataType, val.get())[0];
}
unsigned int getAsULong(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (unsigned int) renderULong.get(idx, dataType, val.get())[0];
}
long long getAsLongLong () {
return (long long) renderLongLong.get(0, dataType, val.get())[0];
}
long long getAsLongLong(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (long long) renderLongLong.get(idx, dataType, val.get())[0];
}
unsigned long long getAsULongLong () {
return (unsigned long long) renderULongLong.get(0, dataType, val.get())[0];
}
unsigned long long getAsULongLong(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (unsigned long long) renderULongLong.get(idx, dataType, val.get())[0];
}
int getAsInt () {
return (int) renderInt.get(0, dataType, val.get())[0];
}
int getAsInt(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (int) renderInt.get(idx, dataType, val.get())[0];
}
unsigned int getAsUInt () {
return (unsigned int) renderInt.get(0, dataType, val.get())[0];
}
unsigned int getAsUInt(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
return (unsigned int) renderInt.get(idx, dataType, val.get())[0];
}
//getEnumAsNumberedString
string getEnumIntegerValueAsString() {
#define __METHOD__ "PVHolder::getEnumIntegerValueAsString"
if (dataType!=CAFE_ENUM) {
cout << "******* WARNING *******" << endl;
cout << __METHOD__ << __LINE__ << endl;
cout << "DataType is " << (cafeDataTypeCode.message((CAFE_DATATYPE)dataType)).c_str() <<
" hence getEnumIntegerValueAsString method is invalid! " << endl;
cout << "Use getAsString method if you want the string equilavent of the ENUM value!" << endl;
cout << "**********************" << endl;
}
return (string) renderString.getString(0, dataType, val.get())[0];
#undef __METHOD__
}
string getAsString() {
if(dataTypeNative==DBR_ENUM && dataType==DBR_ENUM) {
return (string) renderString.getStringFromEnum(0, noStr, val.get(), strs)[0];
}
else {
return (string) renderString.getString(0, dataType, val.get())[0];
}
}
string getAsString(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
if(dataTypeNative==DBR_ENUM && dataType==CAFE_ENUM) {
return (string) renderString.getStringFromEnum(idx, noStr, val.get(), strs)[0];
}
else {
return (string) renderString.getString(idx, dataType, val.get())[0];
}
}
char * getAsDbr_string_t() {
if(dataTypeNative==DBR_ENUM && dataType==CAFE_ENUM) {
return (char *) renderString.getStringFromEnum(0, noStr, val.get(), strs)[0];
}
else {
return (char *) renderString.getString(0, dataType, val.get())[0];
}
}
char * getAsDbr_string_t(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
if(dataTypeNative==DBR_ENUM && dataType==CAFE_ENUM) {
return (char *) renderString.getStringFromEnum(idx, noStr, val.get(), strs)[0];
}
else {
return (char *) renderString.getString(idx, dataType, val.get())[0];
}
}
/*
dbr_string_t * getAsDbr_string_t(unsigned int idx) throw(std::out_of_range){
if(isIndexOutOfRange(idx)) {
std::ostringstream oss;
oss << "Exception! Index " << idx
<< " to PVHolder method is out of range. Valid range is from 0 to " << size-1;
throw std::out_of_range(oss.str());
}
if(dataTypeNative==DBR_ENUM && dataType==CAFE_ENUM) {
return (dbr_string_t *) renderString.getStringFromEnum(idx, val.get(), strs);
}
else {
return (dbr_string_t *) renderString.getString(idx, dataType, val.get());
}
}
*/
//used by PVCtrlHolder
double getAsDouble(CAFE_DATATYPE_UNION cdu) {
return (double) renderDouble.get(0, dataType, &cdu)[0];
}
float getAsFloat(CAFE_DATATYPE_UNION cdu) {
return (float) renderFloat.get(0, dataType, &cdu)[0];
}
short getAsShort(CAFE_DATATYPE_UNION cdu) {
return (short) renderShort.get(0, dataType, &cdu)[0];
}
int getAsLong(CAFE_DATATYPE_UNION cdu) {
return (int) renderLong.get(0, dataType, &cdu)[0];
}
unsigned short getAsEnum(CAFE_DATATYPE_UNION cdu) {
return (unsigned short) renderEnum.get(0, dataType, &cdu)[0];
}
unsigned short getAsUShort(CAFE_DATATYPE_UNION cdu) {
return (unsigned short) renderEnum.get(0, dataType, &cdu)[0];
}
char getAsChar(CAFE_DATATYPE_UNION cdu) {
char * ans = renderChar.get(0, dataType, &cdu);
return (char ) ans[0];
}
unsigned char getAsUChar(CAFE_DATATYPE_UNION cdu) {
unsigned char * ans = renderUChar.get(0, dataType, &cdu);
return (unsigned char ) ans[0];
}
string getAsString(CAFE_DATATYPE_UNION cdu) {
return (string) renderString.getString(dataType, cdu)[0];
}
char * getAsDbr_string_t(CAFE_DATATYPE_UNION cdu) {
return (char *) renderString.getString(0, dataType, &cdu)[0];
}
};
#endif //PVHOLDER_H

32
include/PyCafe.h Normal file
View File

@@ -0,0 +1,32 @@
#ifndef __PYX_HAVE__PyCafe
#define __PYX_HAVE__PyCafe
#ifndef __PYX_HAVE_API__PyCafe
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(_T) _T
#endif
__PYX_EXTERN_C DL_IMPORT(void) py_cb_wrapper(PVDataHolder, unsigned int, std::string);
__PYX_EXTERN_C DL_IMPORT(void) py_cb_ctrl_wrapper(PVCtrlHolder, unsigned int, std::string);
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_wrapper(unsigned int);
__PYX_EXTERN_C DL_IMPORT(void) py_cb_handle_monid_wrapper(unsigned int, unsigned long);
#endif /* !__PYX_HAVE_API__PyCafe */
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initPyCafe(void);
#else
PyMODINIT_FUNC PyInit_PyCafe(void);
#endif
#endif /* !__PYX_HAVE__PyCafe */

115
include/PyCafe3_api.h Normal file
View File

@@ -0,0 +1,115 @@
/* Generated by Cython 0.23.4 */
#ifndef __PYX_HAVE_API__PyCafe
#define __PYX_HAVE_API__PyCafe
#include "Python.h"
static void (*__pyx_api_f_6PyCafe_py_cb_wrapper)(PVDataHolder, unsigned int, std::string) = 0;
#define py_cb_wrapper __pyx_api_f_6PyCafe_py_cb_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_ctrl_wrapper)(PVCtrlHolder, unsigned int, std::string) = 0;
#define py_cb_ctrl_wrapper __pyx_api_f_6PyCafe_py_cb_ctrl_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_handle_wrapper)(unsigned int) = 0;
#define py_cb_handle_wrapper __pyx_api_f_6PyCafe_py_cb_handle_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_handle_monid_wrapper)(unsigned int, unsigned long) = 0;
#define py_cb_handle_monid_wrapper __pyx_api_f_6PyCafe_py_cb_handle_monid_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_handle_get_wrapper)(unsigned int) = 0;
#define py_cb_handle_get_wrapper __pyx_api_f_6PyCafe_py_cb_handle_get_wrapper
static void (*__pyx_api_f_6PyCafe_py_cb_handle_put_wrapper)(unsigned int) = 0;
#define py_cb_handle_put_wrapper __pyx_api_f_6PyCafe_py_cb_handle_put_wrapper
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
#define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif
#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
PyObject *py_name = 0;
PyObject *py_module = 0;
py_name = __Pyx_PyIdentifier_FromString(name);
if (!py_name)
goto bad;
py_module = PyImport_Import(py_name);
Py_DECREF(py_name);
return py_module;
bad:
Py_XDECREF(py_name);
return 0;
}
#endif
#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
PyObject *d = 0;
PyObject *cobj = 0;
union {
void (*fp)(void);
void *p;
} tmp;
d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
if (!d)
goto bad;
cobj = PyDict_GetItemString(d, funcname);
if (!cobj) {
PyErr_Format(PyExc_ImportError,
"%.200s does not export expected C function %.200s",
PyModule_GetName(module), funcname);
goto bad;
}
#if PY_VERSION_HEX >= 0x02070000
if (!PyCapsule_IsValid(cobj, sig)) {
PyErr_Format(PyExc_TypeError,
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
goto bad;
}
tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
{const char *desc, *s1, *s2;
desc = (const char *)PyCObject_GetDesc(cobj);
if (!desc)
goto bad;
s1 = desc; s2 = sig;
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
if (*s1 != *s2) {
PyErr_Format(PyExc_TypeError,
"C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
PyModule_GetName(module), funcname, sig, desc);
goto bad;
}
tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
*f = tmp.fp;
if (!(*f))
goto bad;
Py_DECREF(d);
return 0;
bad:
Py_XDECREF(d);
return -1;
}
#endif
static int import_PyCafe(void) {
PyObject *module = 0;
module = __Pyx_ImportModule("PyCafe");
if (!module) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_wrapper, "void (PVDataHolder, unsigned int, std::string)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_ctrl_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_ctrl_wrapper, "void (PVCtrlHolder, unsigned int, std::string)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_wrapper, "void (unsigned int)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_monid_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_monid_wrapper, "void (unsigned int, unsigned long)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_get_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_get_wrapper, "void (unsigned int)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "py_cb_handle_put_wrapper", (void (**)(void))&__pyx_api_f_6PyCafe_py_cb_handle_put_wrapper, "void (unsigned int)") < 0) goto bad;
Py_DECREF(module); module = 0;
return 0;
bad:
Py_XDECREF(module);
return -1;
}
#endif /* !__PYX_HAVE_API__PyCafe */

1
include/PyCafe_api.h Symbolic link
View File

@@ -0,0 +1 @@
PyCafe3_api.h

1033
include/cafe.h Normal file

File diff suppressed because it is too large Load Diff

615
include/cafeCache.h Normal file
View File

@@ -0,0 +1,615 @@
///
/// \file cafeCache.h
/// \brief CAFE methods retrieving data from cache. (Belongs to cafe.h)
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CAFECACHE_H
#define CAFECACHE_H
int getPulseID(unsigned int * handle, unsigned int nelem, unsigned int * pulseID) {
int status=ICAFE_NORMAL; int statusLocal=ICAFE_NORMAL;
for (unsigned int i=0; i<nelem; ++i) {
statusLocal=handleHelper.getPulseID(handle[i], pulseID[i]);
if (statusLocal!=ICAFE_NORMAL && status==ICAFE_NORMAL) {
status=statusLocal;
}
}
return status;
}
int getPulseID(unsigned int handle, unsigned int &pulseID) {
pulseID=0;
return handleHelper.getPulseID(handle, pulseID);
}
int getPulseID(char * pv, unsigned int &pulseID) {
pulseID=0;
unsigned int handle=handleHelper.getHandleFromPV(pv);
return handleHelper.getPulseID(handle, pulseID);
}
unsigned int getPulseIDFromTS(epicsTimeStamp ts) {
return handleHelper.getPulseIDFromTS(ts);
}
vector<unsigned int>getPulseIDFromTS(PVDataHolder * pvd, unsigned int nelem) {
vector<unsigned int> vui;
vui.clear();
vui.reserve(nelem);
for (unsigned int i=0; i<nelem; ++i) {
vui.push_back( getPulseIDFromTS(pvd[i].getEpicsTimeStamp()));
}
return vui;
}
vector<unsigned int>getPulseIDFromTS(PVGroup pvg) {
vector<unsigned int> vui;
vui.clear();
vui.reserve(pvg.getNPV());
PVDataHolder * pvd=pvg.getPVData();
for (unsigned int i=0; i<pvg.getNPV(); ++i) {
vui.push_back( getPulseIDFromTS(pvd[i].getEpicsTimeStamp()));
}
return vui;
}
/*
int getCachePVArray (vector<unsigned int> handleV, PVDataHolder * pvd){
unsigned int * handleArray = new unsigned int [handleV.size()];
for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];}
status=getCache(handleArray, (unsigned int) handleV.size(), pvd);
delete [] handleArray; return status;
};
*/
int getCachePVArray (vector<unsigned int> handleV, PVDataHolder * pvd){
return getCache(&handleV[0], (unsigned int) handleV.size(), pvd);
};
int getCachePVArrayNoWait (vector<unsigned int> handleV, PVDataHolder * pvd){
int overallStatus=ICAFE_NORMAL;
for (size_t i=0; i< (size_t) handleV.size(); ++i) {
status=getCacheNoWait(handleV[i], pvd[i]);
//cout << "handle= " << handleV[i] << " pvFromHandle= " << CAFE::getPVFromHandle(handleV[i]) << " status= " << pvd[i].getStatus() << " val= " << pvd[i].getAsString() << endl;
if (status!=ICAFE_NORMAL) {
resetCallbackGet(handleV[i]);
if(overallStatus==ICAFE_NORMAL) {overallStatus=status;}
}
if (pvd[i].getStatus() !=ICAFE_NORMAL) {
if(overallStatus==ICAFE_NORMAL) {overallStatus=pvd[i].getStatus();}
}
}
return overallStatus;
};
/*
int getCachePVArrayNoWait (vector<unsigned int> handleV, PVDataHolder * pvd){
unsigned int * handleArray = new unsigned int [handleV.size()];
int overallStatus=ICAFE_NORMAL;
for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];
status=getCacheNoWait(handleArray[i], pvd[i]);
if (status!=ICAFE_NORMAL) {
resetCallbackGet(handleArray[i]);
if(overallStatus==ICAFE_NORMAL) {overallStatus=status;}
}
}
delete [] handleArray; return status;
};
*/
int resetCallbackGet(const unsigned int handle);
int resetCallbackPut(const unsigned int handle);
int getCacheNoWait(const unsigned int handle, PVDataHolder & pvd);
int getCache (const unsigned int handle, PVDataHolder & pvd);
int getCache (const unsigned int *handleArray, unsigned int nelem, PVDataHolder * pvd);
int getCtrlCache (const unsigned int handle, PVCtrlHolder & pvc);
int getCtrlCache (const unsigned int *handleArray, unsigned int nelem, PVCtrlHolder * pvc);
int getCache (const char * pv, PVDataHolder & pvd) {
unsigned int handle=handleHelper.getHandleFromPV(pv); return getCache(handle, pvd);}
int getCtrlCache (const char * pv, PVCtrlHolder & pvc) {
unsigned int handle=handleHelper.getHandleFromPV(pv); return getCtrlCache(handle, pvc);}
//6
int getCacheDoubleArray(const unsigned int handle, dbr_double_t * _val) {
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
};
int getCache(const unsigned int handle, dbr_double_t * _val) {
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
};
int getCache(const unsigned int handle, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeDoppio.getCache(handle, DBR_STS_DOUBLE, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeDoppio.getCache(handle, DBR_TIME_DOUBLE, _val, alarmStatus, alarmSeverity, ts);
};
//5+ long long
int getCache(const unsigned int handle, long long * _val);
int getCache(const unsigned int handle, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);
int getCache(const unsigned int handle, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
//5
int getCacheLongArray(const unsigned int handle, dbr_long_t * _val) {
return cafeLatte.getCache(handle, DBR_LONG, _val);
};
int getCache(const unsigned int handle, dbr_long_t * _val) {
return cafeLatte.getCache(handle, DBR_LONG, _val);
};
int getCache(const unsigned int handle, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeLatte.getCache(handle, DBR_STS_LONG, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeLatte.getCache(handle, DBR_TIME_LONG, _val, alarmStatus, alarmSeverity, ts);
};
//4
int getCache(const unsigned int handle, dbr_char_t * _val) {
return cafeCappuccino.getCache(handle, DBR_CHAR, _val);
};
int getCache(const unsigned int handle, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeCappuccino.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeCappuccino.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//3
int getCache(const unsigned int handle, dbr_enum_t * _val) {
return cafeEspresso.getCache(handle, DBR_ENUM, _val);
};
int getCache(const unsigned int handle, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeEspresso.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeEspresso.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//2
int getCacheFloatArray(const unsigned int handle, dbr_float_t * _val) {
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
};
int getCache(const unsigned int handle, dbr_float_t * _val) {
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
};
int getCache(const unsigned int handle, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeFrappuccino.getCache(handle, DBR_STS_FLOAT, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeFrappuccino.getCache(handle, DBR_TIME_FLOAT, _val, alarmStatus, alarmSeverity, ts);
};
//1
int getCacheShortArray(const unsigned int handle, dbr_short_t * _val) {
return cafeSchale.getCache(handle, DBR_SHORT, _val);
};
int getCache(const unsigned int handle, dbr_short_t * _val) {
return cafeSchale.getCache(handle, DBR_SHORT, _val);
};
int getCache(const unsigned int handle, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeSchale.getCache(handle, DBR_STS_SHORT, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeSchale.getCache(handle, DBR_TIME_SHORT, _val, alarmStatus, alarmSeverity, ts);
};
int getCacheDbrStringArray(const unsigned int handle, dbr_string_t * _val){
return cafeSoluble.getCache(handle, DBR_STRING, _val);
};
//0
int getCache(const unsigned int handle, dbr_string_t * _val) {
return cafeSoluble.getCache(handle, DBR_STRING, _val);
};
int getCache(const unsigned int handle, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
}
//0+
int getCacheStringArray(const unsigned int handle, string * valStr) {
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
};
int getCache(const unsigned int handle, string * valStr) {
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
};
int getCache(const unsigned int handle, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
};
int getCache(const unsigned int handle, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
}
//Single value
//0+
int getCacheString(const unsigned int handle, string & valStr){ //0
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
status=cafeSoluble.getCache(handle, DBR_STRING, val);
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, string & valStr){ //0
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
status=cafeSoluble.getCache(handle, DBR_STRING, val);
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){ //0
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
status=cafeSoluble.getCache(handle, DBR_STS_STRING, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, string & valStr,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts){ //0
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, dbr_string_t & val); //0
int getCache(const unsigned int handle, dbr_string_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0
int getCache(const unsigned int handle, dbr_string_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0
int getCache(const unsigned int handle, dbr_short_t & val); //1
int getCache(const unsigned int handle, dbr_short_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //1
int getCache(const unsigned int handle, dbr_short_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //1
int getCache(const unsigned int handle, dbr_float_t & val); //2
int getCache(const unsigned int handle, dbr_float_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //2
int getCache(const unsigned int handle, dbr_float_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //2
int getCache(const unsigned int handle, dbr_enum_t & val); //3
int getCache(const unsigned int handle, dbr_enum_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //3
int getCache(const unsigned int handle, dbr_enum_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //3
int getCache(const unsigned int handle, dbr_char_t & val); //4
int getCache(const unsigned int handle, dbr_char_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //4
int getCache(const unsigned int handle, dbr_char_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //4
int getCacheLong(const unsigned int handle, dbr_long_t & val) { return getCache(handle, val);}
int getCache(const unsigned int handle, dbr_long_t & val); //5
int getCache(const unsigned int handle, dbr_long_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5
int getCache(const unsigned int handle, dbr_long_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5
int getCache(const unsigned int handle, long long & val); //5+
int getCache(const unsigned int handle, long long & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5+
int getCache(const unsigned int handle, long long & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5+
int getCacheDouble(const unsigned int handle, dbr_double_t & val) {
return getCache(handle, val);
}
int getCache(const unsigned int handle, dbr_double_t & val); //6
int getCache(const unsigned int handle, dbr_double_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //6
int getCache(const unsigned int handle, dbr_double_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //6
//getCache by array of handles
//0+
int getCache(const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_TIME_STRING, val, statusArray,
alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
delete [] val; return status;
};
int getCache(const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_STS_STRING, val, statusArray,
alarmStatus, alarmSeverity);
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
delete [] val; return status;
};
int getCache (const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray) {
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_STRING, val, statusArray);
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
delete [] val; return status;
}
//0
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeSoluble.getCache(handleArray, nelem, DBR_TIME_STRING, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeSoluble.getCache(handleArray, nelem, DBR_STS_STRING, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray) {
return cafeSoluble.getCache(handleArray, nelem, DBR_STRING, val, statusArray);
}
//1
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeSchale.getCache(handleArray, nelem, DBR_TIME_SHORT, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeSchale.getCache(handleArray, nelem, DBR_STS_SHORT, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray) {
return cafeSchale.getCache(handleArray, nelem, DBR_SHORT, val, statusArray);
}
//2
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeFrappuccino.getCache(handleArray, nelem, DBR_TIME_FLOAT, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeFrappuccino.getCache(handleArray, nelem, DBR_STS_FLOAT, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray) {
return cafeFrappuccino.getCache(handleArray, nelem, DBR_FLOAT, val, statusArray);
}
//3
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeEspresso.getCache(handleArray, nelem, DBR_TIME_ENUM, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeEspresso.getCache(handleArray, nelem, DBR_STS_ENUM, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray) {
return cafeEspresso.getCache(handleArray, nelem, DBR_ENUM, val, statusArray);
}
//4
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeCappuccino.getCache(handleArray, nelem, DBR_TIME_CHAR, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeCappuccino.getCache(handleArray, nelem, DBR_STS_CHAR, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray) {
return cafeCappuccino.getCache(handleArray, nelem, DBR_CHAR, val, statusArray);
}
//5
int getCache(unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeLatte.getCache(handleArray, nelem, DBR_TIME_LONG, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeLatte.getCache(handleArray, nelem, DBR_STS_LONG, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray) {
return cafeLatte.getCache(handleArray, nelem, DBR_LONG, val, statusArray);
}
//5+ long long
int getCache(const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts);
int getCache(const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity);
int getCache (const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray);
//6
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeDoppio.getCache(handleArray, nelem, DBR_TIME_DOUBLE, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeDoppio.getCache(handleArray, nelem, DBR_STS_DOUBLE, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray) {
return cafeDoppio.getCache(handleArray, nelem, DBR_DOUBLE, val, statusArray);
}
////////////////////////////////////////////// by PV name ///////////////////////////////////
int getCache(const char * pv, string & valStr); //0+
int getCache(const char * pv, string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0+
int getCache(const char * pv, string & valStr,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0+
int getCache(const char * pv, dbr_string_t & val); //0
int getCache(const char * pv, dbr_string_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0
int getCache(const char * pv, dbr_string_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0
int getCache(const char * pv, dbr_short_t & val); //1
int getCache(const char * pv, dbr_short_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //1
int getCache(const char * pv, dbr_short_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //1
int getCache(const char * pv, dbr_float_t & val); //2
int getCache(const char * pv, dbr_float_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //2
int getCache(const char * pv, dbr_float_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //2
int getCache(const char * pv, dbr_enum_t & val); //3
int getCache(const char * pv, dbr_enum_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //3
int getCache(const char * pv, dbr_enum_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //3
int getCache(const char * pv, dbr_char_t & val); //4
int getCache(const char * pv, dbr_char_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //4
int getCache(const char * pv, dbr_char_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //4
int getCache(const char * pv, dbr_long_t & val); //5
int getCache(const char * pv, dbr_long_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5
int getCache(const char * pv, dbr_long_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5
int getCache(const char * pv, long long & val){ //5+
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, val);
}
int getCache(const char * pv, long long & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){ //5+
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, val, alarmStatus, alarmSeverity);
}
int getCache(const char * pv, long long & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts){ //5+
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, val, alarmStatus, alarmSeverity, ts);
}
int getCache(const char * pv, dbr_double_t & val); //6
int getCache(const char * pv, dbr_double_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //6
int getCache(const char * pv, dbr_double_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //6
//6
int getCache(const char * pv, dbr_double_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
};
int getCache(const char * pv, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeDoppio.getCache(handle, DBR_STS_DOUBLE, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeDoppio.getCache(handle, DBR_TIME_DOUBLE, _val, alarmStatus, alarmSeverity, ts);
};
//5+
int getCache(const char * pv, long long * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, _val);
};
int getCache(const char * pv, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, _val, alarmStatus, alarmSeverity, ts);
};
//5
int getCache(const char * pv, dbr_long_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeLatte.getCache(handle, DBR_LONG, _val);
};
int getCache(const char * pv, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeLatte.getCache(handle, DBR_STS_LONG, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeLatte.getCache(handle, DBR_TIME_LONG, _val, alarmStatus, alarmSeverity, ts);
};
//4
int getCache(const char * pv, dbr_char_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeCappuccino.getCache(handle, DBR_CHAR, _val);
};
int getCache(const char * pv, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeCappuccino.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeCappuccino.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//3
int getCache(const char * pv, dbr_enum_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeEspresso.getCache(handle, DBR_ENUM, _val);
};
int getCache(const char * pv, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeEspresso.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeEspresso.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//2
int getCache(const char * pv, dbr_float_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
};
int getCache(const char * pv, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeFrappuccino.getCache(handle, DBR_STS_FLOAT, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeFrappuccino.getCache(handle, DBR_TIME_FLOAT, _val, alarmStatus, alarmSeverity, ts);
};
//1
int getCache(const char * pv, dbr_short_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSchale.getCache(handle, DBR_SHORT, _val);
};
int getCache(const char * pv, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSchale.getCache(handle, DBR_STS_SHORT, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSchale.getCache(handle, DBR_TIME_SHORT, _val, alarmStatus, alarmSeverity, ts);
};
//0
int getCache(const char * pv, dbr_string_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSoluble.getCache(handle, DBR_STRING, _val);
};
int getCache(const char * pv, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
}
//0+
int getCache(const char * pv, string * valStr) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
};
int getCache(const char * pv, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
};
int getCache(const char * pv, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
}
#endif // CAFECACHE_H

591
include/cafeCache_backup.h Normal file
View File

@@ -0,0 +1,591 @@
///
/// \file cafeCache.h
/// \brief CAFE methods retrieving data from cache. (Belongs to cafe.h)
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CAFECACHE_H
#define CAFECACHE_H
int getPulseID(unsigned int * handle, unsigned int nelem, unsigned int * pulseID) {
int status=ICAFE_NORMAL; int statusLocal=ICAFE_NORMAL;
for (unsigned int i=0; i<nelem; ++i) {
statusLocal=handleHelper.getPulseID(handle[i], pulseID[i]);
if (statusLocal!=ICAFE_NORMAL && status==ICAFE_NORMAL) {
status=statusLocal;
}
}
return status;
}
int getPulseID(unsigned int handle, unsigned int &pulseID) {
pulseID=0;
return handleHelper.getPulseID(handle, pulseID);
}
int getPulseID(char * pv, unsigned int &pulseID) {
pulseID=0;
unsigned int handle=handleHelper.getHandleFromPV(pv);
return handleHelper.getPulseID(handle, pulseID);
}
unsigned int getPulseIDFromTS(epicsTimeStamp ts) {
return handleHelper.getPulseIDFromTS(ts);
}
vector<unsigned int>getPulseIDFromTS(PVDataHolder * pvd, unsigned int nelem) {
vector<unsigned int> vui;
vui.clear();
vui.reserve(nelem);
for (unsigned int i=0; i<nelem; ++i) {
vui.push_back( getPulseIDFromTS(pvd[i].getEpicsTimeStamp()));
}
return vui;
}
vector<unsigned int>getPulseIDFromTS(PVGroup pvg) {
vector<unsigned int> vui;
vui.clear();
vui.reserve(pvg.getNPV());
PVDataHolder * pvd=pvg.getPVData();
for (unsigned int i=0; i<pvg.getNPV(); ++i) {
vui.push_back( getPulseIDFromTS(pvd[i].getEpicsTimeStamp()));
}
return vui;
}
int getCachePVArray (vector<unsigned int> handleV, PVDataHolder * pvd){
unsigned int * handleArray = new unsigned int [handleV.size()];
for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];}
status=getCache(handleArray, (unsigned int) handleV.size(), pvd);
delete [] handleArray; return status;
};
int getCachePVArrayNoWait (vector<unsigned int> handleV, PVDataHolder * pvd){
unsigned int * handleArray = new unsigned int [handleV.size()];
int overallStatus=ICAFE_NORMAL;
for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];
status=getCacheNoWait(handleArray[i], pvd[i]);
if (status!=ICAFE_NORMAL) {
resetCallbackGet(handleArray[i]);
if(overallStatus==ICAFE_NORMAL) {overallStatus=status;}
}
}
delete [] handleArray; return status;
};
int resetCallbackGet(const unsigned int handle);
int resetCallbackPut(const unsigned int handle);
int getCacheNoWait(const unsigned int handle, PVDataHolder & pvd);
int getCache (const unsigned int handle, PVDataHolder & pvd);
int getCache (const unsigned int *handleArray, unsigned int nelem, PVDataHolder * pvd);
int getCtrlCache (const unsigned int handle, PVCtrlHolder & pvc);
int getCtrlCache (const unsigned int *handleArray, unsigned int nelem, PVCtrlHolder * pvc);
int getCache (const char * pv, PVDataHolder & pvd) {
unsigned int handle=handleHelper.getHandleFromPV(pv); return getCache(handle, pvd);}
int getCtrlCache (const char * pv, PVCtrlHolder & pvc) {
unsigned int handle=handleHelper.getHandleFromPV(pv); return getCtrlCache(handle, pvc);}
//6
int getCacheDoubleArray(const unsigned int handle, dbr_double_t * _val) {
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
};
int getCache(const unsigned int handle, dbr_double_t * _val) {
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
};
int getCache(const unsigned int handle, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeDoppio.getCache(handle, DBR_STS_DOUBLE, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeDoppio.getCache(handle, DBR_TIME_DOUBLE, _val, alarmStatus, alarmSeverity, ts);
};
//5+ long long
int getCache(const unsigned int handle, long long * _val);
int getCache(const unsigned int handle, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);
int getCache(const unsigned int handle, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
//5
int getCacheLongArray(const unsigned int handle, dbr_long_t * _val) {
return cafeLatte.getCache(handle, DBR_LONG, _val);
};
int getCache(const unsigned int handle, dbr_long_t * _val) {
return cafeLatte.getCache(handle, DBR_LONG, _val);
};
int getCache(const unsigned int handle, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeLatte.getCache(handle, DBR_STS_LONG, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeLatte.getCache(handle, DBR_TIME_LONG, _val, alarmStatus, alarmSeverity, ts);
};
//4
int getCache(const unsigned int handle, dbr_char_t * _val) {
return cafeCappuccino.getCache(handle, DBR_CHAR, _val);
};
int getCache(const unsigned int handle, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeCappuccino.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeCappuccino.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//3
int getCache(const unsigned int handle, dbr_enum_t * _val) {
return cafeEspresso.getCache(handle, DBR_ENUM, _val);
};
int getCache(const unsigned int handle, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeEspresso.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeEspresso.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//2
int getCacheFloatArray(const unsigned int handle, dbr_float_t * _val) {
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
};
int getCache(const unsigned int handle, dbr_float_t * _val) {
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
};
int getCache(const unsigned int handle, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeFrappuccino.getCache(handle, DBR_STS_FLOAT, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeFrappuccino.getCache(handle, DBR_TIME_FLOAT, _val, alarmStatus, alarmSeverity, ts);
};
//1
int getCache(const unsigned int handle, dbr_short_t * _val) {
return cafeSchale.getCache(handle, DBR_SHORT, _val);
};
int getCache(const unsigned int handle, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeSchale.getCache(handle, DBR_STS_SHORT, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeSchale.getCache(handle, DBR_TIME_SHORT, _val, alarmStatus, alarmSeverity, ts);
};
int getCacheDbrStringArray(const unsigned int handle, dbr_string_t * _val){
return cafeSoluble.getCache(handle, DBR_STRING, _val);
};
//0
int getCache(const unsigned int handle, dbr_string_t * _val) {
return cafeSoluble.getCache(handle, DBR_STRING, _val);
};
int getCache(const unsigned int handle, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
return cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
};
int getCache(const unsigned int handle, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
return cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
}
//0+
int getCacheStringArray(const unsigned int handle, string * valStr) {
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
};
int getCache(const unsigned int handle, string * valStr) {
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
};
int getCache(const unsigned int handle, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
};
int getCache(const unsigned int handle, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
}
//Single value
//0+
int getCacheString(const unsigned int handle, string & valStr){ //0
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
status=cafeSoluble.getCache(handle, DBR_STRING, val);
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, string & valStr){ //0
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
status=cafeSoluble.getCache(handle, DBR_STRING, val);
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){ //0
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
status=cafeSoluble.getCache(handle, DBR_STS_STRING, val, alarmStatus, alarmSeverity);
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, string & valStr,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts){ //0
unsigned int nelemPrevious=CAFE::setNelemToRetrieveFromCacheToOne(handle); dbr_string_t val[1]={""};
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, val, alarmStatus, alarmSeverity, ts);
if (status==ICAFE_NORMAL) {valStr=val[0];} CAFE::setNelemToRetrieveFromCacheToPrevious(handle, nelemPrevious);
return status;
}
int getCache(const unsigned int handle, dbr_string_t & val); //0
int getCache(const unsigned int handle, dbr_string_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0
int getCache(const unsigned int handle, dbr_string_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0
int getCache(const unsigned int handle, dbr_short_t & val); //1
int getCache(const unsigned int handle, dbr_short_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //1
int getCache(const unsigned int handle, dbr_short_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //1
int getCache(const unsigned int handle, dbr_float_t & val); //2
int getCache(const unsigned int handle, dbr_float_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //2
int getCache(const unsigned int handle, dbr_float_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //2
int getCache(const unsigned int handle, dbr_enum_t & val); //3
int getCache(const unsigned int handle, dbr_enum_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //3
int getCache(const unsigned int handle, dbr_enum_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //3
int getCache(const unsigned int handle, dbr_char_t & val); //4
int getCache(const unsigned int handle, dbr_char_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //4
int getCache(const unsigned int handle, dbr_char_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //4
int getCacheLong(const unsigned int handle, dbr_long_t & val) {
return getCache(handle, val);
}
int getCache(const unsigned int handle, dbr_long_t & val); //5
int getCache(const unsigned int handle, dbr_long_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5
int getCache(const unsigned int handle, dbr_long_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5
int getCache(const unsigned int handle, long long & val); //5+
int getCache(const unsigned int handle, long long & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5+
int getCache(const unsigned int handle, long long & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5+
int getCacheDouble(const unsigned int handle, dbr_double_t & val) {
return getCache(handle, val);
}
int getCache(const unsigned int handle, dbr_double_t & val); //6
int getCache(const unsigned int handle, dbr_double_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //6
int getCache(const unsigned int handle, dbr_double_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //6
//getCache by array of handles
//0+
int getCache(const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_TIME_STRING, val, statusArray,
alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
delete [] val; return status;
};
int getCache(const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_STS_STRING, val, statusArray,
alarmStatus, alarmSeverity);
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
delete [] val; return status;
};
int getCache (const unsigned int *handleArray, unsigned int nelem, string * valStr, int *statusArray) {
dbr_string_t * val = new dbr_string_t[nelem];
status=cafeSoluble.getCache(handleArray, nelem, DBR_STRING, val, statusArray);
for (unsigned int i=0; i< nelem; ++i) { valStr[i]=val[i]; }
delete [] val; return status;
}
//0
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeSoluble.getCache(handleArray, nelem, DBR_TIME_STRING, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeSoluble.getCache(handleArray, nelem, DBR_STS_STRING, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_string_t * val, int *statusArray) {
return cafeSoluble.getCache(handleArray, nelem, DBR_STRING, val, statusArray);
}
//1
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeSchale.getCache(handleArray, nelem, DBR_TIME_SHORT, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeSchale.getCache(handleArray, nelem, DBR_STS_SHORT, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_short_t * val, int *statusArray) {
return cafeSchale.getCache(handleArray, nelem, DBR_SHORT, val, statusArray);
}
//2
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeFrappuccino.getCache(handleArray, nelem, DBR_TIME_FLOAT, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeFrappuccino.getCache(handleArray, nelem, DBR_STS_FLOAT, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_float_t * val, int *statusArray) {
return cafeFrappuccino.getCache(handleArray, nelem, DBR_FLOAT, val, statusArray);
}
//3
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeEspresso.getCache(handleArray, nelem, DBR_TIME_ENUM, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeEspresso.getCache(handleArray, nelem, DBR_STS_ENUM, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_ushort_t * val, int *statusArray) {
return cafeEspresso.getCache(handleArray, nelem, DBR_ENUM, val, statusArray);
}
//4
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeCappuccino.getCache(handleArray, nelem, DBR_TIME_CHAR, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeCappuccino.getCache(handleArray, nelem, DBR_STS_CHAR, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_char_t * val, int *statusArray) {
return cafeCappuccino.getCache(handleArray, nelem, DBR_CHAR, val, statusArray);
}
//5
int getCache(unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeLatte.getCache(handleArray, nelem, DBR_TIME_LONG, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeLatte.getCache(handleArray, nelem, DBR_STS_LONG, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_long_t * val, int *statusArray) {
return cafeLatte.getCache(handleArray, nelem, DBR_LONG, val, statusArray);
}
//5+ long long
int getCache(const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts);
int getCache(const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity);
int getCache (const unsigned int *handleArray, unsigned int nelem, long long * val, int *statusArray);
//6
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts) {
return cafeDoppio.getCache(handleArray, nelem, DBR_TIME_DOUBLE, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity) {
return cafeDoppio.getCache(handleArray, nelem, DBR_STS_DOUBLE, val, statusArray,
alarmStatus, alarmSeverity);
};
int getCache (const unsigned int *handleArray, unsigned int nelem, dbr_double_t * val, int *statusArray) {
return cafeDoppio.getCache(handleArray, nelem, DBR_DOUBLE, val, statusArray);
}
////////////////////////////////////////////// by PV name ///////////////////////////////////
int getCache(const char * pv, string & valStr); //0+
int getCache(const char * pv, string & valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0+
int getCache(const char * pv, string & valStr,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0+
int getCache(const char * pv, dbr_string_t & val); //0
int getCache(const char * pv, dbr_string_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //0
int getCache(const char * pv, dbr_string_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //0
int getCache(const char * pv, dbr_short_t & val); //1
int getCache(const char * pv, dbr_short_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //1
int getCache(const char * pv, dbr_short_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //1
int getCache(const char * pv, dbr_float_t & val); //2
int getCache(const char * pv, dbr_float_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //2
int getCache(const char * pv, dbr_float_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //2
int getCache(const char * pv, dbr_enum_t & val); //3
int getCache(const char * pv, dbr_enum_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //3
int getCache(const char * pv, dbr_enum_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //3
int getCache(const char * pv, dbr_char_t & val); //4
int getCache(const char * pv, dbr_char_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //4
int getCache(const char * pv, dbr_char_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //4
int getCache(const char * pv, dbr_long_t & val); //5
int getCache(const char * pv, dbr_long_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //5
int getCache(const char * pv, dbr_long_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //5
int getCache(const char * pv, long long & val){ //5+
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, val);
}
int getCache(const char * pv, long long & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){ //5+
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, val, alarmStatus, alarmSeverity);
}
int getCache(const char * pv, long long & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts){ //5+
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, val, alarmStatus, alarmSeverity, ts);
}
int getCache(const char * pv, dbr_double_t & val); //6
int getCache(const char * pv, dbr_double_t & val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity); //6
int getCache(const char * pv, dbr_double_t & val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts); //6
//6
int getCache(const char * pv, dbr_double_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeDoppio.getCache(handle, DBR_DOUBLE, _val);
};
int getCache(const char * pv, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeDoppio.getCache(handle, DBR_STS_DOUBLE, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_double_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeDoppio.getCache(handle, DBR_TIME_DOUBLE, _val, alarmStatus, alarmSeverity, ts);
};
//5+
int getCache(const char * pv, long long * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, _val);
};
int getCache(const char * pv, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, long long * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return CAFE::getCache(handle, _val, alarmStatus, alarmSeverity, ts);
};
//5
int getCache(const char * pv, dbr_long_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeLatte.getCache(handle, DBR_LONG, _val);
};
int getCache(const char * pv, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeLatte.getCache(handle, DBR_STS_LONG, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_long_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeLatte.getCache(handle, DBR_TIME_LONG, _val, alarmStatus, alarmSeverity, ts);
};
//4
int getCache(const char * pv, dbr_char_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeCappuccino.getCache(handle, DBR_CHAR, _val);
};
int getCache(const char * pv, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeCappuccino.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_char_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeCappuccino.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//3
int getCache(const char * pv, dbr_enum_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeEspresso.getCache(handle, DBR_ENUM, _val);
};
int getCache(const char * pv, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeEspresso.getCache(handle, DBR_STS_ENUM, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_enum_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeEspresso.getCache(handle, DBR_TIME_ENUM, _val, alarmStatus, alarmSeverity, ts);
};
//2
int getCache(const char * pv, dbr_float_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeFrappuccino.getCache(handle, DBR_FLOAT, _val);
};
int getCache(const char * pv, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeFrappuccino.getCache(handle, DBR_STS_FLOAT, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_float_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeFrappuccino.getCache(handle, DBR_TIME_FLOAT, _val, alarmStatus, alarmSeverity, ts);
};
//1
int getCache(const char * pv, dbr_short_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSchale.getCache(handle, DBR_SHORT, _val);
};
int getCache(const char * pv, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSchale.getCache(handle, DBR_STS_SHORT, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_short_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSchale.getCache(handle, DBR_TIME_SHORT, _val, alarmStatus, alarmSeverity, ts);
};
//0
int getCache(const char * pv, dbr_string_t * _val) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSoluble.getCache(handle, DBR_STRING, _val);
};
int getCache(const char * pv, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
};
int getCache(const char * pv, dbr_string_t * _val, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
return cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
}
//0+
int getCache(const char * pv, string * valStr) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STRING, _val);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
};
int getCache(const char * pv, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_STS_STRING, _val, alarmStatus, alarmSeverity);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
};
int getCache(const char * pv, string * valStr, dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts) {
unsigned int handle=handleHelper.getHandleFromPV(pv);
dbr_string_t * _val = new dbr_string_t[handleHelper.getNelemRequest(handle)];
status=cafeSoluble.getCache(handle, DBR_TIME_STRING, _val, alarmStatus, alarmSeverity, ts);
for (unsigned int i=0; i< handleHelper.getNelemRequest(handle); ++i) { valStr[i]=_val[i]; }
delete [] _val; return status;
}
#endif // CAFECACHE_H

396
include/cafeConvert.h Normal file
View File

@@ -0,0 +1,396 @@
///
/// \file cafeConvert.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CAFECONVERT_H
#define CAFECONVERT_H
#include <cafeDataType.h>
#include <cstdlib> // g++ 4.4.4
#include <cstdio>
#include <boost/math/special_functions/fpclassify.hpp>
using namespace std;
/**
* CAFEConvert Template \n
* CTYPE is the input data type \n
* PVDataHolder methods use CAFEConvert as follows: \n
* method getAsDouble() converts CTYPE to double \n
* method getAsFloat () converts CTYPE to float \n
* method getAsShort () converts CTYPE to short \n
* method getAsEnum () converts CTYPE to enum \n
* method getAsChar () converts CTYPE to char \n
* method getAsLong () converts CTYPE to int \n
* method getAsString() converts CTYPE to string \n
*
*/
template <class CTYPE> class CAFEConvert {
private:
CTYPE returnVal[1];
public:
CAFEConvert (unsigned int nelem){};
CAFEConvert (){};
~CAFEConvert (){};
CTYPE * get(unsigned int index, CAFE_DATATYPE dt, CAFE_DATATYPE_UNION_SEQ val);
CTYPE * getString(unsigned int index, CAFE_DATATYPE dt, CAFE_DATATYPE_UNION_SEQ val);
CTYPE * getStringFromEnum(unsigned int index, unsigned int noStr, CAFE_DATATYPE_UNION_SEQ val, char stig[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE]);
CTYPE * get(CAFE_DATATYPE dt, CAFE_DATATYPE_UNION val);
CTYPE * getString(CAFE_DATATYPE dt, CAFE_DATATYPE_UNION val);
};
/**
* Converts from native type to CTYPE
* \param dt input: CAFE_DATATYPE
* \param val input: CAFE_DATATYPE_UNION
* \return CTYPE
*/
template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::get (CAFE_DATATYPE dt, CAFE_DATATYPE_UNION val)
{
#define __METHOD__ "CAFEConvert<CTYPE>::get(dt, val)"
// (boost::math::isnan) calls the Boost version of the isnan macro
// Valid for all types that have numeric_limits support
// (brackets required) to avoid compiler error should isnan also be a native macro
switch (dt) {
case CAFE_DOUBLE:
if ( (boost::math::isnan)((CTYPE) val.d) ) {
returnVal[0]= (CTYPE) val.d;
}
else {
returnVal[0]= (CTYPE) 0;
}
break;
case CAFE_FLOAT:
if ( (boost::math::isnan)((CTYPE) val.f) ) {
returnVal[0]= (CTYPE) val.f;
} else {
returnVal[0]= 0;
}
break;
case CAFE_LONG:
returnVal[0]= (CTYPE) val.l;
break;
case CAFE_SHORT:
returnVal[0]= (CTYPE) val.s;
break;
case CAFE_ENUM:
returnVal[0]= (CTYPE) val.us;
break;
case CAFE_CHAR:
returnVal[0]= (CTYPE) val.ch;
break;
case CAFE_STRING:
returnVal[0]= (CTYPE) strtod( val.str, NULL);
break;
case CAFE_TYPENOTCONN:
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
// << " CAFE_TYPENOTCONN: dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
case CAFE_NO_ACCESS:
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
// << " CAFE_NO_ACCESS: dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
case CAFE_INVALID_DATATYPE:
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
// << " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
case CAFE_NOT_REQUESTED:
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
// << " CAFE_NOT_REQUESTED: dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
case CAFE_NOT_SHOWN:
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
// << " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
default:
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
<< " CAFE INTERNAL ERROR: Unknown dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
}
return (CTYPE *) returnVal;
#undef __METHOD__
}
/**
* Converts from native type to CTYPE
* \param index input: index to val array
* \param dt input: CAFE_DATATYPE
* \param val input: CAFE_DATATYPE_UNION_SEQ
* \return CTYPE
*/
template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::get (unsigned int index, CAFE_DATATYPE dt, CAFE_DATATYPE_UNION_SEQ val)
{
#define __METHOD__ "CAFEConvert<CTYPE>::get(index, dt, val[])"
switch (dt) {
case CAFE_DOUBLE:
returnVal[0]= (CTYPE) val[index].d;
break;
case CAFE_FLOAT:
returnVal[0]= (CTYPE) val[index].f;
break;
case CAFE_LONG:
returnVal[0]= (CTYPE) val[index].l;
break;
case CAFE_SHORT:
returnVal[0]= (CTYPE) val[index].s;
break;
case CAFE_ENUM:
returnVal[0]= (CTYPE) val[index].us;
break;
case CAFE_CHAR:
returnVal[0]= (CTYPE) val[index].ch;
break;
case CAFE_STRING:
returnVal[0]= (CTYPE) strtod( val[index].str, NULL);
break;
case CAFE_TYPENOTCONN:
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
// << " CAFE_TYPENOTCONN: dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
case CAFE_NO_ACCESS:
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
// << " CAFE_NO_ACCESS: dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
case CAFE_INVALID_DATATYPE:
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
// << " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
case CAFE_NOT_REQUESTED:
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
// << " CAFE_NOT_REQUESTED: dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
case CAFE_NOT_SHOWN:
//cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
// << " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
default:
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__
<< " CAFE INTERNAL ERROR: Unknown dataType: " << dt << " " << endl;
returnVal[0]=0;
break;
}
return (CTYPE *) returnVal;
#undef __METHOD__
};
/**
* Converts from DBR_ENUM type to CTYPE=STRING
* \param index input: index to val array
* \param noStr input: number of enumerations
* \param val input: CAFE_DATATYPE_UNION_SEQ
* \param stig input: stig[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE] an array of enum choices
* \return CTYPE
*/
template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getStringFromEnum (unsigned int index, unsigned int noStr, CAFE_DATATYPE_UNION_SEQ val,
char stig[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE])
{
#define __METHOD__ "CAFEConvert<CTYPE>::getStringFromEnum(indx, noStr, val, stig)"
unsigned int noEmptyStrings=0;
//Check for empty strings:
for (unsigned int j=0; j<noStr; ++j) {
if (strcmp(stig[j],"")==0) {
++noEmptyStrings;
}
}
if (noStr==noEmptyStrings) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM STRING OPTIONS ARE ALL EMPTY! " << endl;
cout << "BADLY CONFIGURED EPICS RECORD. " << endl;
}
if (index < noStr && noStr!=noEmptyStrings) {
sprintf(returnVal[0], "%s", stig[val[index].us] );
}
else {
sprintf(returnVal[0], "%d", val[index].us );
if ( val[index].us>= noStr) {
cout << "*** WARNING FROM " << __METHOD__ << " *** " << endl;
cout << "ENUM UNSIGNED SHORT VALUE IS GREATER THAN THE NO OF ENUMERATED TYPES" << endl;
cout << "VALUE (unsigned short) = " << val[index].us << endl;
cout << "NO OF ENUMERATED STRINGS = " << noStr << " WITH VALUES: " << endl;
for (unsigned int j=0; j<noStr; ++j) {
cout << stig[j] << " [" <<j << "] ";
}
cout << endl;
}
}
return (CTYPE *) returnVal;
#undef __METHOD__
};
/**
* Converts from native type to CTYPE=STRING
* \param index input: index to val array
* \param dt input: CAFE_DATATYPE
* \param val input: CAFE_DATATYPE_UNION_SEQ
* \return CTYPE
*/
template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getString (unsigned int index, CAFE_DATATYPE dt, CAFE_DATATYPE_UNION_SEQ val)
{
#define __METHOD__ "CAFEConvert<CTYPE>::getString(nelem, dt, val[])"
switch (dt) {
case CAFE_STRING:
sprintf(returnVal[0], "%s", val[index].str);
break;
case CAFE_CHAR:
sprintf(returnVal[0], "%u", val[index].ch);
break;
case CAFE_FLOAT:
sprintf(returnVal[0], "%f", val[index].f); //floats offer a precision of 6
break;
case CAFE_DOUBLE:
sprintf(returnVal[0], "%.15f", val[index].d); //double offer a precicion of 15
break;
case CAFE_SHORT:
sprintf(returnVal[0], "%d", val[index].s);
break;
case CAFE_LONG:
sprintf(returnVal[0], "%d", val[index].l);
break;
case CAFE_ENUM:
sprintf(returnVal[0], "%u", val[index].us);
break;
case CAFE_TYPENOTCONN:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout << " ERROR CAFE_TYPENOTCONN: dataType: " << dt << " " << endl;
sprintf(returnVal[0], "%s", "0"); //CAFE_TYPENOTCONN");
break;
case CAFE_NO_ACCESS:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout << " CAFE_NO_ACCESS: dataType: " << dt << " " << endl;
sprintf(returnVal[0], "%s", "0"); //"CAFE_NO_ACCESS");
break;
case CAFE_INVALID_DATATYPE:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout<< " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
sprintf(returnVal[0], "%s", "0"); //"CAFE_INVALID_DATATYPE");
break;
case CAFE_NOT_REQUESTED:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout<< " CAFE_NOT_REQUESTED: dataType: " << dt << " " << endl;
sprintf(returnVal[0], "%s", "0"); //"");
break;
case CAFE_NOT_SHOWN:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout<< " CAFE_NOT_SHOWN: dataType: " << dt << " " << endl;
sprintf(returnVal[0], "%s", "0"); // "CAFE_NOT_SHOWN");
break;
default:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout<< " CAFE INTERNAL ERROR: Unknown dataType: "<< dt << " " << endl;
sprintf(returnVal[0], "%s", "0");// "Unknown dataType");
break;
}
return (CTYPE *) returnVal;
#undef __METHOD__
};
/**
* Converts from native type to CTYPE=STRING
* \param dt input: CAFE_DATATYPE
* \param val CAFE_DATATYPE_UNION input
* \return CTYPE
*/
template <class CTYPE> CTYPE * CAFEConvert<CTYPE>::getString (CAFE_DATATYPE dt, CAFE_DATATYPE_UNION val)
{
#define __METHOD__ "CAFEConvert<CTYPE>::getString(dt, val[])"
switch (dt) {
case CAFE_STRING:
sprintf(returnVal[0], "%s", val.str);
break;
case CAFE_CHAR:
sprintf(returnVal[0], "%u", val.ch);
break;
case CAFE_FLOAT:
sprintf(returnVal[0], "%f", val.f); //floats offer a precision of 6
break;
case CAFE_DOUBLE:
sprintf(returnVal[0], "%.15f", val.d); //double offer a precicion of 15
break;
case CAFE_SHORT:
sprintf(returnVal[0], "%d", val.s);
break;
case CAFE_LONG:
sprintf(returnVal[0], "%d", val.l);
break;
case CAFE_ENUM:
sprintf(returnVal[0], "%u", val.us);
break;
case CAFE_TYPENOTCONN:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout << " ERROR CAFE_TYPENOTCONN: dataType: " << dt << " " << endl;
sprintf(returnVal[0], "%s", "0"); //CAFE_TYPENOTCONN");
break;
case CAFE_NO_ACCESS:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout << " CAFE_NO_ACCESS: dataType: " << dt << " " << endl;
sprintf(returnVal[0], "%s", "0"); //"CAFE_NO_ACCESS");
break;
case CAFE_INVALID_DATATYPE:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout<< " CAFE_INVALID_DATATYPE: dataType: " << dt << " " << endl;
sprintf(returnVal[0], "%s", "0"); //"CAFE_INVALID_DATATYPE");
break;
case CAFE_NOT_REQUESTED:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout<< " CAFE_NOT_REQUESTED: dataType: " << dt << " " << endl;
sprintf(returnVal[0], "%s", "0"); //"");
break;
case CAFE_NOT_SHOWN:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout<< " CAFE_NOT_SHOWN: dataType: " << dt << " " << endl;
sprintf(returnVal[0], "%s", "0"); // "CAFE_NOT_SHOWN");
break;
default:
//cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
//cout<< " CAFE INTERNAL ERROR: Unknown dataType: "<< dt << " " << endl;
sprintf(returnVal[0], "%s", "0");// "Unknown dataType");
break;
}
return (CTYPE *) returnVal;
#undef __METHOD__
};
#endif

118
include/cafeDataType.h Normal file
View File

@@ -0,0 +1,118 @@
///
/// \file cafeDataType.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CAFEDATATYPE_H
#define CAFEDATATYPE_H
#include <cadef.h>
#include <iostream>
#include <string>
#include <map>
enum CAFE_DATATYPE {
CAFE_TYPENOTCONN = TYPENOTCONN, // -1 val returned by ca_field_type when channel not connected
CAFE_STRING = DBF_STRING, // 0
CAFE_SHORT = DBF_SHORT, // 1
CAFE_INT = DBF_INT, // 1
CAFE_FLOAT = DBF_FLOAT, // 2
CAFE_ENUM = DBF_ENUM, // 3
CAFE_USHORT = DBF_ENUM, // 3
CAFE_CHAR = DBF_CHAR, // 4
CAFE_LONG = DBF_LONG, // 5
CAFE_DOUBLE = DBF_DOUBLE, // 6
CAFE_NO_ACCESS = DBF_NO_ACCESS, //7
CAFE_INVALID_DATATYPE = 8,
CAFE_NOT_REQUESTED = 100,
CAFE_NOT_SHOWN = 101 // (in stop monitor)
};
/**
* Provides methods to convert between
* the CAFE_DATATYPES and text equivalent
*/
class CAFEDataTypeCode {
typedef std::map<int, std::string> mapLongString;
private:
mapLongString mapDataType;
mapLongString::iterator pos;
public:
CAFEDataTypeCode() {
mapDataType.insert(std::make_pair((int) CAFE_TYPENOTCONN, "CAFE_TYPENOTCONN" ));
mapDataType.insert(std::make_pair((int) CAFE_STRING, "DBF_STRING" ));
mapDataType.insert(std::make_pair((int) CAFE_SHORT, "DBF_SHORT" ));
mapDataType.insert(std::make_pair((int) CAFE_INT, "DBF_SHORT" ));
mapDataType.insert(std::make_pair((int) CAFE_FLOAT, "DBF_FLOAT" ));
mapDataType.insert(std::make_pair((int) CAFE_ENUM, "DBF_ENUM" ));
mapDataType.insert(std::make_pair((int) CAFE_CHAR, "DBF_CHAR" ));
mapDataType.insert(std::make_pair((int) CAFE_LONG, "DBF_LONG" ));
mapDataType.insert(std::make_pair((int) CAFE_DOUBLE, "DBF_DOUBLE" ));
mapDataType.insert(std::make_pair((int) CAFE_NO_ACCESS, "DBF_NO_ACCESS" ));
mapDataType.insert(std::make_pair((int) CAFE_INVALID_DATATYPE, "CAFE_INVALID_DATATYPE"));
mapDataType.insert(std::make_pair((int) CAFE_NOT_REQUESTED, "CAFE_NOT_REQUESTED"));
mapDataType.insert(std::make_pair((int) CAFE_NOT_SHOWN, "CAFE_NOT_SHOWN (IN STOP MONITOR)"));
};
~CAFEDataTypeCode() {};
std::string message (int i) {
pos = mapDataType.find(i);
if (pos != mapDataType.end()) return pos->second;
return "CAFE_DATATYPE_UNKNOWN";
};
std::string asString (int i) {
pos = mapDataType.find(i);
if (pos != mapDataType.end()) return pos->second;
return "CAFE_DATATYPE_UNKNOWN";
};
int enumIs (std::string message) {
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
if (pos->second==message) return pos->first;
return -1;
};
int asEnum (std::string message) {
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
if (pos->second==message) return pos->first;
return -1;
};
void show() {print();}
void print ( ) {
std::cout << "------------------" << std::endl;
std::cout << "CAFE_DATATYPE LIST" << std::endl;
std::cout << "-----------------" << std::endl;
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos) {
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "-----------------" << std::endl;
};
};
/**
* A union of CAFE primitive datatypes
*/
union CAFE_DATATYPE_UNION {
dbr_string_t str;
dbr_short_t s;
dbr_float_t f;
dbr_enum_t us; //unsigned short us;
dbr_char_t ch; //unsigned char ch;
dbr_long_t l; //int l;
dbr_double_t d;
};
typedef CAFE_DATATYPE_UNION * CAFE_DATATYPE_UNION_SEQ;
#endif

View File

@@ -0,0 +1,65 @@
///
/// \file cafeDataTypeHelper.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CAFEDATATYPEHELPER_H
#define CAFEDATATYPEHELP_H
#include <cadef.h>
#include <iostream>
#include <string>
#include <map>
#include <cafeDataType.h>
class CafeDataTypeHelper{
private:
CAFE_DATATYPE_UNION cdu;
CAFE_DATATYPE dataType;
public:
CafeDataTypeHelper(CAFE_DATATYPE_UNION _cdu, CAFE_DATATYPE _dataType){
cdu=_cdu;
dataType=_dataType;
};
~CafeDataTypeHelper(){};
CAFEConvert<double> renderDouble;
CAFEConvert<float> renderFloat;
CAFEConvert<short> renderShort;
//CAFEConvert<int> renderLong;
CAFEConvert<unsigned short> renderEnum;
CAFEConvert<unsigned char> renderUChar;
CAFEConvert<dbr_string_t> renderString;
CAFEConvert<char> renderChar;
//CAFEConvert<unsigned int> renderULong;
CAFEConvert<long long> renderLongLong;
CAFEConvert<unsigned long long> renderULongLong;
CAFEConvert<int> renderInt;
CAFEConvert<unsigned int> renderUInt;
std::string getAsString(){
return (std::string) renderString.getString(dataType, cdu)[0];
};
dbr_string_t * getAsDbr_string_t(){
return (dbr_string_t *) (renderString.getString(dataType, cdu)[0]);
};
double getAsDouble(){return (double) renderDouble.get(dataType, cdu)[0];};
float getAsFloat() {return (float) renderFloat.get (dataType, cdu)[0];};
short getAsShort() {return (short) renderShort.get(dataType, cdu)[0];};
dbr_enum_t getAsEnum(){return (dbr_enum_t) renderEnum.get(dataType, cdu)[0];};
unsigned short getAsUShort(){return (unsigned short) renderEnum.get(dataType, cdu)[0];};
int getAsInt() {return (int) renderInt.get(dataType, cdu)[0];};
unsigned int getAsUInt() {return (int) renderUInt.get(dataType, cdu)[0];};
char getAsChar() {return (char) renderChar.get(dataType, cdu)[0];};
unsigned char getAsUChar(){return (unsigned char) renderUChar.get(dataType, cdu)[0];};
long long getAsLongLong() {return (long long) renderLongLong.get(dataType, cdu)[0];};
unsigned int getAsULongLong() {return (unsigned long long) renderULongLong.get(dataType, cdu)[0];};
};
#endif

152
include/cafeEnum.h Normal file
View File

@@ -0,0 +1,152 @@
///
/// \file cafeEnum.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CAFEENUM_H
#define CAFEENUM_H
#include <cadef.h>
namespace CAFENUM {
/**
* Data request buffer types \n
* i.e. whether PRIMITIVE, STS, TIME, GR or CTRL
*/
enum DBR_TYPE {
DBR_PRIMITIVE,
DBR_PLAIN=DBR_PRIMITIVE,
DBR_STS,
DBR_TIME,
DBR_GR,
DBR_CTRL,
DBR_PUT, //DBR_PUT_ACKT and DBR_PUT_ACKS Write only - used from global alarm acknowledge.
DBR_STSACK, // is DBR_STSACK_STRING
DBR_CLASS, // is DBR_CLASS_NAME,
DBR_NONE // should not occur, but used internally within cafeVectors.h
};
/**
* Define enum type to flush io after creating channels
*/
enum ChannelFlushSendBufferPolicyKind {
WITH_FLUSH_IO,
WITH_PEND_IO, // needs timeout duration
WITH_PEND_EVENT, // needs timeout duration
WITH_POLL
};
/**
* Define enum type defining when to flush io after creating channels
*/
enum ChannelWhenToFlushSendBufferPolicyKind {
FLUSH_AUTOMATIC=0,
FLUSH_NOW=FLUSH_AUTOMATIC,
FLUSH_AFTER_EACH_CHANNEL_CREATION=FLUSH_NOW, // instantly
FLUSH_AFTER_EACH_CHANNEL_SUBSCRIPTION=FLUSH_NOW,
FLUSH_AFTER_EACH_MESSAGE=FLUSH_NOW,
FLUSH_AFTER_EACH_GROUP_CREATION=FLUSH_NOW,
FLUSH_DESIGNATED_TO_CLIENT //
};
/**
* Enum type defining ca server dispatch priority
* Note that specifying different priorities within the same program
* can increase resource consumption in thw client and server because
* an independent virtual circuit, and associated data structures, is
* created for each priority that is used on a particular server
*/
enum ChannelServerDispatchPriority {
CA_SERVER_DISPATCH_PRIORITY_MIN =CA_PRIORITY_MIN, //0
CA_SERVER_DISPATCH_PRIORITY_VERYLOW =CA_PRIORITY_MIN+1,
CA_SERVER_DISPATCH_PRIORITY_DEFAULT =CA_PRIORITY_MAX, //CA_SERVER_DISPATCH_PRIORITY_VERYLOW, //1
CA_SERVER_DISPATCH_PRIORITY_LOW =CA_PRIORITY_MIN+25,
CA_SERVER_DISPATCH_PRIORITY_MED =CA_PRIORITY_MIN+50,
CA_SERVER_DISPATCH_PRIORITY_HIGH =CA_PRIORITY_MIN+75,
CA_SERVER_DISPATCH_PRIORITY_VERYHIGH=CA_PRIORITY_MIN+98,
CA_SERVER_DISPATCH_PRIORITY_MAX =CA_PRIORITY_MAX
};
/**
* Enum type defining the wait/nowait modes for cache operations.
* Meant for use within callbacks to ensure that cache operations
* are never blocked
*/
enum ChannelGetCacheWaitPolicyKind {
GET_CACHE_NO_CHECK=0,
GET_CACHE_NO_WAIT,
GET_CACHE_NOW =GET_CACHE_NO_WAIT,
GET_CACHE_WAIT
};
/**
* Enum type defining the modes for get operations when a
* monitor is in place
*
*/
enum ChannelGetActionWhenMonitorPolicyKind {
GET_FROM_CACHE,
GET_FROM_IOC
};
/**
* Enum type defining the blocking modes for ca operations.
* Blocking can be achieved with or without callback.
* Callback can further be supplied by the user
*/
enum ChannelRequestPolicyKind {
WITHOUT_CALLBACK,
WITH_CALLBACK_DEFAULT,
WITH_CALLBACK_USER_SUPPLIED
};
/**
* Enum type defining level of datatype conversion at the IOC
*
*/
enum ChannelRequestDataTypePolicyKind {
NATIVE_DATATYPE,
LOWEST_DATATYPE // The smaller in byte size of type requested and native datatype
};
/**
* Enum type defining whether to wait for a response
* from a message sent with a callback, whether it be
* user supplied or the CAFE default.
*/
enum ChannelWaitForResponsePolicyKind {
BLOCKING=0,
WAIT=BLOCKING,
NON_BLOCKING=1,
NO_WAIT=NON_BLOCKING
};
enum StatusMessageKind {
NO_MESSAGE,
PRE_REQUEST,
FROM_REQUEST,
FROM_PEND,
FROM_CALLBACK,
FROM_MESSAGE
};
enum CallbackProgressKind {
NOT_INITIATED,
PENDING,
COMPLETE
};
}; //namespace CAFENUM
#endif // CAFEENUM_H

44
include/cafeEnumStrings.h Normal file
View File

@@ -0,0 +1,44 @@
///
/// \file cafeEnumStrings.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CAFEENUMSTRINGS_H
#define CAFEENUMSTRINGS_H
#include "cafeEnum.h"
#include "enumStrings.h"
template<> char const * enumStrings<CAFENUM::ChannelWaitForResponsePolicyKind>::data[]
= {"CAFENUM::WAIT", "CAFENUM::NO_WAIT"};
template<> char const * enumStrings<CAFENUM::ChannelRequestDataTypePolicyKind>::data[]
= {"CAFENUM::NATIVE_DATATYPE", "CAFENUM::LOWEST_DATATYPE"};
template<> char const * enumStrings<CAFENUM::ChannelFlushSendBufferPolicyKind>::data[]
= {"CAFENUM::WITH_FLUSH_IO","CAFENUM::WITH_PEND_IO","CAFENUM::WITH_PEND_EVENT", "CAFENUM::WITH_POLL"};
template<> char const * enumStrings<CAFENUM::ChannelWhenToFlushSendBufferPolicyKind>::data[]
= {"CAFENUM::FLUSH_AFTER_EACH_MESSAGE","CAFENUM::FLUSH_DESIGNATED_TO_CLIENT"};
template<> char const * enumStrings<CAFENUM::ChannelRequestPolicyKind>::data[]
= {"CAFENUM::WITHOUT_CALLBACK","CAFENUM::WITH_CALLBACK_DEFAULT","CAFENUM::WITH_CALLBACK_USER_SUPPLIED"};
template<> char const * enumStrings<CAFENUM::DBR_TYPE>::data[]
= {"CAFENUM::DBR_PRIMITIVE","CAFENUM::DBR_STS","CAFENUM::DBR_TIME", "CAFENUM::DBR_GR",
"CAFENUM::DBR_CTRL","CAFENUM::DBR_PUT", "CAFENUM::DBR_STSACK","CAFENUM::DBR_CLASS",
"CAFENUM::DBR_OTHER"};
template<> char const * enumStrings<CAFENUM::StatusMessageKind>::data[]
= {"CAFENUM::NO_MESSAGE","CAFENUM::PRE_REQUEST","CAFENUM::FROM_REQUEST","CAFENUM::FROM_PEND",
"CAFENUM::FROM_CALLBACK"};
template<> char const * enumStrings<CAFENUM::CallbackProgressKind>::data[]
= {"CAFENUM::NOT_INITIATED","CAFENUM::PENDING","CAFENUM::COMPLETE"};
#endif // CAFEENUMSTRINGS_H

505
include/cafeRoast.h Normal file
View File

@@ -0,0 +1,505 @@
///
/// \file cafeRoast.h
/// \author Jan Chrin, PSI
/// \date Release: January 2016
/// \version CAFE 1.3.0
///
/// Add Match methods
///
#ifndef CAFEROAST_H
#define CAFEROAST_H
int setAndGet (const unsigned int handleSet, dbr_double_t valSet, dbr_double_t &valGet) {
status=cafeDoppio.setAndGet((unsigned int) handleSet, DBR_DOUBLE, valSet, valGet);
return status;
}
int setAndGet (const unsigned int handleSet, dbr_float_t valSet, dbr_float_t &valGet) {
status=cafeFrappuccino.setAndGet((unsigned int) handleSet, DBR_FLOAT, valSet, valGet);
return status;
}
int setAndGet (const unsigned int handleSet, dbr_char_t valSet, dbr_char_t &valGet) {
status=cafeCappuccino.setAndGet((unsigned int) handleSet, DBR_CHAR, valSet, valGet);
return status;
}
int setAndGet (const unsigned int handleSet, dbr_enum_t valSet, dbr_enum_t &valGet) {
status=cafeEspresso.setAndGet((unsigned int) handleSet, DBR_ENUM, valSet, valGet);
return status;
}
int setAndGet (const unsigned int handleSet, dbr_short_t valSet, dbr_short_t &valGet) {
status=cafeSchale.setAndGet((unsigned int) handleSet, DBR_SHORT, valSet, valGet);
return status;
}
int setAndGet (const unsigned int handleSet, dbr_long_t valSet, dbr_long_t &valGet) {
status=cafeLatte.setAndGet((unsigned int) handleSet, DBR_LONG, valSet, valGet);
return status;
}
int setAndGet (const unsigned int handleSet, long long valSet, long long &valGet) {
double valSetD=valSet; double valGetD=0;
status=cafeDoppio.setAndGet((unsigned int) handleSet, DBR_DOUBLE, valSetD, valGetD);
valGet=(long long) valGetD;
return status;
}
int setAndGet (const unsigned int handleSet, dbr_string_t valSet, dbr_string_t &valGet) {
status=cafeSoluble.setAndGetDbrString((unsigned int) handleSet, valSet, valGet);
return status;
}
int setAndGet (const unsigned int handleSet, string valSet, string &valGet) {
status=cafeSoluble.setAndGetString((unsigned int) handleSet, valSet, valGet);
return status;
}
//
int match(dbr_double_t valSet, unsigned int handleMatch,
dbr_double_t tolerance, double timeout, bool printFlag){
return cafeDoppio.match(DBR_DOUBLE, valSet, handleMatch, tolerance, timeout, printFlag);
}
int match(dbr_float_t valSet, unsigned int handleMatch,
dbr_float_t tolerance, double timeout, bool printFlag){
return cafeFrappuccino.match(DBR_FLOAT, valSet, handleMatch, tolerance, timeout, printFlag);
}
int match(dbr_char_t valSet, unsigned int handleMatch,
dbr_char_t tolerance, double timeout, bool printFlag){
return cafeCappuccino.match(DBR_CHAR, valSet, handleMatch, tolerance, timeout, printFlag);
}
int match(dbr_enum_t valSet, unsigned int handleMatch,
dbr_enum_t tolerance, double timeout, bool printFlag){
return cafeEspresso.match(DBR_ENUM, valSet, handleMatch, tolerance, timeout, printFlag);
}
int match(dbr_short_t valSet, unsigned int handleMatch,
dbr_short_t tolerance, double timeout, bool printFlag){
return cafeSchale.match(DBR_SHORT, valSet, handleMatch, tolerance, timeout, printFlag);
}
int match(dbr_long_t valSet, unsigned int handleMatch,
dbr_long_t tolerance, double timeout, bool printFlag){
return cafeLatte.match(DBR_LONG, valSet, handleMatch, tolerance, timeout, printFlag);
}
int match(long long valSet, unsigned int handleMatch,
long long tolerance, double timeout, bool printFlag){
dbr_double_t valSetDouble=valSet;
dbr_double_t toleranceDouble = tolerance;
return cafeDoppio.match(DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
}
int match(string valSet, unsigned int handleMatch,
string tolerance, double timeout, bool printFlag){
#define __METHOD__ "match (string valSet, unsigned int handleMatch,\
string tolerance, double timeout, bool printFlag)"
istringstream ss;
dbr_double_t d=0; dbr_double_t valSetDouble=0; dbr_double_t toleranceDouble = 0;
ss.clear();
ss.str(valSet);
ss>>d;
if ( !ss.fail()) {
valSetDouble=d;
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << valSet;
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
d=0;
ss.clear();
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
toleranceDouble=d;
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << tolerance;
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
return cafeDoppio.match(DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
#undef __METHOD__
}
int match(dbr_string_t valSet, unsigned int handleMatch,
dbr_string_t tolerance, double timeout, bool printFlag){
#define __METHOD__ "match (dbr_string_t valSet, unsigned int handleMatch,\
dbr_string_t tolerance, double timeout, bool printFlag)"
istringstream ss;
dbr_double_t d=0; dbr_double_t valSetDouble=0; dbr_double_t toleranceDouble = 0;
ss.clear();
ss.str(valSet);
ss>>d;
if ( !ss.fail()) {
valSetDouble=d;
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << valSet;
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
d=0;
ss.clear();
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
toleranceDouble=d;
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << tolerance;
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
return cafeDoppio.match(DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
#undef __METHOD__
}
//
int matchMany(vector<dbr_double_t> valSet, vector<unsigned int> handleMatch,
dbr_double_t tolerance, double timeout, bool printFlag){
return cafeDoppio.matchMany(DBR_DOUBLE, valSet, handleMatch, tolerance, timeout, printFlag);
}
int matchMany(vector<dbr_float_t> valSet, vector<unsigned int> handleMatch,
dbr_float_t tolerance, double timeout, bool printFlag){
return cafeFrappuccino.matchMany(DBR_FLOAT, valSet, handleMatch, tolerance, timeout, printFlag);
}
int matchMany(vector<dbr_char_t> valSet, vector<unsigned int> handleMatch,
dbr_char_t tolerance, double timeout, bool printFlag){
return cafeCappuccino.matchMany(DBR_CHAR, valSet, handleMatch, tolerance, timeout, printFlag);
}
int matchMany(vector<dbr_enum_t> valSet, vector<unsigned int> handleMatch,
dbr_enum_t tolerance, double timeout, bool printFlag){
return cafeEspresso.matchMany(DBR_ENUM, valSet, handleMatch, tolerance, timeout, printFlag);
}
int matchMany(vector<dbr_short_t> valSet, vector<unsigned int> handleMatch,
dbr_short_t tolerance, double timeout, bool printFlag){
return cafeSchale.matchMany(DBR_SHORT, valSet, handleMatch, tolerance, timeout, printFlag);
}
int matchMany(vector<dbr_long_t> valSet, vector<unsigned int> handleMatch,
dbr_long_t tolerance, double timeout, bool printFlag){
return cafeLatte.matchMany(DBR_LONG, valSet, handleMatch, tolerance, timeout, printFlag);
}
int matchMany(vector<long long> valSet, vector<unsigned int> handleMatch,
long long tolerance, double timeout, bool printFlag){
vector<dbr_double_t> valSetDoubleV;
valSetDoubleV.reserve(valSet.size());
std::copy(valSet.begin(), valSet.end(),
std::back_inserter(valSetDoubleV));
dbr_double_t toleranceDouble = tolerance;
return cafeDoppio.matchMany(DBR_DOUBLE, valSetDoubleV, handleMatch, toleranceDouble, timeout, printFlag);
}
int matchMany(vector<string> valSetV, vector<unsigned int> handleMatchV,
string tolerance, double timeout, bool printFlag){
#define __METHOD__ "matchMany (vector<string> valSetV, vector<unsigned int> handleMatchV, \
string tolerance, double timeout, bool printFlag)"
vector<dbr_double_t> valSetDoubleV;
istringstream ss;
dbr_double_t d=0; dbr_double_t toleranceDouble = 0;
for (size_t i=0; i< valSetV.size(); ++i) {
d=0;
ss.clear();
ss.str(valSetV[i]);
ss>>d;
if ( !ss.fail()) {
valSetDoubleV.push_back(d);
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << valSetV[i];
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
}
d=0;
ss.clear();
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
toleranceDouble=d;
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << tolerance;
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
return cafeDoppio.matchMany(DBR_DOUBLE, valSetDoubleV, handleMatchV, toleranceDouble, timeout, printFlag);
#undef __METHOD__
}
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_double_t> valSet, vector<unsigned int> handleMatch,
dbr_double_t tolerance, double timeout, bool printFlag){
return cafeDoppio.setAndMatchMany(handleSet, DBR_DOUBLE, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_float_t> valSet, vector<unsigned int> handleMatch,
dbr_float_t tolerance, double timeout, bool printFlag){
return cafeFrappuccino.setAndMatchMany(handleSet, DBR_FLOAT, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_char_t> valSet, vector<unsigned int> handleMatch,
dbr_char_t tolerance, double timeout, bool printFlag){
return cafeCappuccino.setAndMatchMany(handleSet, DBR_CHAR, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_enum_t> valSet, vector<unsigned int> handleMatch,
dbr_enum_t tolerance, double timeout, bool printFlag){
return cafeEspresso.setAndMatchMany(handleSet, DBR_ENUM, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_short_t> valSet, vector<unsigned int> handleMatch,
dbr_short_t tolerance, double timeout, bool printFlag){
return cafeSchale.setAndMatchMany(handleSet, DBR_SHORT, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatchMany(vector<unsigned int> handleSet, vector<dbr_long_t> valSet, vector<unsigned int> handleMatch,
dbr_long_t tolerance, double timeout, bool printFlag){
return cafeLatte.setAndMatchMany(handleSet, DBR_LONG, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatchMany(vector<unsigned int> handleSet, vector<long long> valSet, vector<unsigned int> handleMatch,
long long tolerance, double timeout, bool printFlag){
vector<dbr_double_t> valSetDoubleV;
valSetDoubleV.reserve(valSet.size());
std::copy(valSet.begin(), valSet.end(),
std::back_inserter(valSetDoubleV));
dbr_double_t toleranceDouble = tolerance;
return cafeDoppio.setAndMatchMany(handleSet, DBR_DOUBLE, valSetDoubleV, handleMatch, toleranceDouble, timeout, printFlag);
}
int setAndMatchMany(vector<unsigned int> handleSetV, vector<string> valSetV, vector<unsigned int> handleMatchV,
string tolerance, double timeout, bool printFlag){
#define __METHOD__ "setAndMatchMany (vector<unsigned int> handleSetV, vector<string> valSetV, vector<unsigned int> handleMatchV, \
string tolerance, double timeout, bool printFlag)"
vector<dbr_double_t> valSetDoubleV;
istringstream ss;
dbr_double_t d=0; dbr_double_t toleranceDouble = 0;
for (size_t i=0; i< valSetV.size(); ++i) {
d=0;
ss.clear();
ss.str(valSetV[i]);
ss>>d;
if ( !ss.fail()) {
valSetDoubleV.push_back(d);
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << valSetV[i];
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
}
d=0;
ss.clear();
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
toleranceDouble=d;
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << tolerance;
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
return cafeDoppio.setAndMatchMany(handleSetV, DBR_DOUBLE, valSetDoubleV, handleMatchV, toleranceDouble, timeout, printFlag);
#undef __METHOD__
}
int setAndMatch(const unsigned int handleSet, dbr_double_t valSet, const unsigned int handleMatch,
dbr_double_t tolerance, double timeout, bool printFlag){
return cafeDoppio.setAndMatch(handleSet, DBR_DOUBLE, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatch(const unsigned int handleSet, dbr_float_t valSet, const unsigned int handleMatch,
dbr_float_t tolerance, double timeout, bool printFlag){
return cafeFrappuccino.setAndMatch(handleSet, DBR_FLOAT, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatch(const unsigned int handleSet, dbr_char_t valSet, const unsigned int handleMatch,
dbr_char_t tolerance, double timeout, bool printFlag){
return cafeCappuccino.setAndMatch(handleSet, DBR_CHAR, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatch(const unsigned int handleSet, dbr_enum_t valSet, const unsigned int handleMatch,
dbr_enum_t tolerance, double timeout, bool printFlag){
return cafeEspresso.setAndMatch(handleSet, DBR_ENUM, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatch(const unsigned int handleSet, dbr_short_t valSet, const unsigned int handleMatch,
dbr_short_t tolerance, double timeout, bool printFlag){
return cafeSchale.setAndMatch(handleSet, DBR_SHORT, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatch(const unsigned int handleSet, dbr_long_t valSet, const unsigned int handleMatch,
dbr_long_t tolerance, double timeout, bool printFlag){
return cafeLatte.setAndMatch(handleSet, DBR_LONG, valSet, handleMatch, tolerance, timeout, printFlag);
}
int setAndMatch(const unsigned int handleSet, long long valSet, const unsigned int handleMatch,
long long tolerance, double timeout, bool printFlag){
dbr_double_t valSetDouble=valSet;
dbr_double_t toleranceDouble = tolerance;
return cafeDoppio.setAndMatch(handleSet, DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
}
int setAndMatch(const unsigned int handleSet, dbr_string_t valSet, const unsigned int handleMatch,
dbr_string_t tolerance, double timeout, bool printFlag){
#define __METHOD__ "setAndMatch (dbr_string_t input)"
istringstream ss;
dbr_double_t d=0; dbr_double_t valSetDouble=0; dbr_double_t toleranceDouble = 0;
ss.clear();
ss.str(valSet);
ss>>d;
if ( !ss.fail()) {
valSetDouble=d;
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << valSet;
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
d=0;
ss.clear();
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
toleranceDouble=d;
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << tolerance;
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
return cafeDoppio.setAndMatch(handleSet, DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
#undef __METHOD__
}
int setAndMatch(const unsigned int handleSet, string valSet, const unsigned int handleMatch,
string tolerance, double timeout, bool printFlag){
#define __METHOD__ "setAndMatch (string input)"
istringstream ss;
dbr_double_t d=0; dbr_double_t valSetDouble=0; dbr_double_t toleranceDouble = 0;
ss.clear();
ss.str(valSet);
ss>>d;
if ( !ss.fail()) {
valSetDouble=d;
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << valSet;
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
d=0;
ss.clear();
ss.str(tolerance);
ss>>d;
if ( !ss.fail()) {
toleranceDouble=d;
}
else {
cout << __METHOD__ << __LINE__ << endl;
cout << "***WARNING*** NO STRING TO DBR_DOUBLE CONVERSION " << endl;
cout << "***WARNING*** COULD NOT CONVERT: ";
cout << tolerance;
cout << " TO DOUBLE!" << endl;
return ECAFE_NO_CONVERT;
}
return cafeDoppio.setAndMatch(handleSet, DBR_DOUBLE, valSetDouble, handleMatch, toleranceDouble, timeout, printFlag);
#undef __METHOD__
}
#endif // CAFEROAST_H

640
include/cafeService.h Normal file
View File

@@ -0,0 +1,640 @@
///
/// \file cafeService.h
/// \author Jan Chrin, PSI
/// \date Release July: 2017
/// \version CAFE 1.3.0
///
#ifndef CAFE_SERVICE_H
#define CAFE_SERVICE_H
#include <config.h>
#include <vector>
#include <PVDataHolder.h>
#include <statusCodes.h>
#include <global.h>
#if HAVE_ZEROMQ
//include <zhelpers.h>
#include <zmq.h>
#if HAVE_JSON
#include <json/json.h>
#endif
#if HAVE_CURL
#include <curl/curl.h>
#endif
#endif
/*
class BSData{
friend class CAFE;
private:
double val;
epicsTimeStamp ets;
int status;
public:
double getValue() {return val;}
epicsTimeStamp getEpicsTimeStamp() {return ets;}
int getStatus() { return status;}
BSData(){};
};
class RFData{
friend class CAFE;
private:
std::vector<BSData> phase;
std::vector<BSData> amplitude;
std::vector<std::string> pv;
std::vector<unsigned int> handle;
std::vector<std::string> device;
std::vector<float> s;
size_t nDevice;
size_t nPV;
}
*/
class DBPMData{
friend class CAFE;
private:
double val;
epicsTimeStamp ets;
int status;
public:
double getValue() {return val;}
epicsTimeStamp getEpicsTimeStamp() {return ets;}
int getStatus() { return status;}
DBPMData(){
//status=ECAFE_BPM_DATA_IS_INVALID;
};
};
class DBPMKeeper
{
friend class CAFE;
private:
std::vector<DBPMData> x;
std::vector<DBPMData> y;
std::vector<DBPMData> q;
std::vector<DBPMData> energy;
std::vector<double> offs_x;
std::vector<double> offs_y;
bool isAllXOK;
bool isAllYOK;
bool isAllQOK;
bool isAllEOK;
bool isAllOK;
std::vector<std::string> pv;
std::vector<unsigned int> handle;
std::vector<std::string> device;
std::vector<float> s;
size_t nDBPM;
size_t nPV;
bool isBS;
bool BSInitialized;
void *context;
void *receiver;
int rc;
#if HAVE_JSON
Json::Value parsedFromString;
Json::Reader reader;
bool parsingSuccessful;
#endif
public:
std::vector<DBPMData> getX() { return x;}
std::vector<DBPMData> getY() { return y;}
std::vector<DBPMData> getQ() { return q;}
std::vector<DBPMData> getEnergy() { return energy;}
std::vector<double> getOffsetX() { return offs_x;}
std::vector<double> getOffsetY() { return offs_y;}
bool getIsAllXOK() {return isAllXOK;}
bool getIsAllYOK() {return isAllYOK;}
bool getIsAllQOK() {return isAllQOK;}
bool getIsAllEOK() {return isAllEOK;}
bool getIsAllOK() {return isAllOK;}
std::vector<std::string> getPV(){ return pv;}
std::vector<unsigned int> getHandle() { return handle;}
std::vector<std::string> getDevice() { return device;}
std::vector<float> getS() { return s;}
size_t getNDBPM() {return nDBPM;}
size_t getNPV() {return nPV;}
int getStatus() {return status;}
int getPVIdx(string _pv) {
for (size_t i=0; i< pv.size(); ++i) {
if ( pv[i].compare(_pv) == 0) {
return i;
}
}
return -1;
}
PVDataHolder * pvd;
int status;
size_t xIdx;
size_t yIdx;
size_t qIdx;
size_t xValidIdx;
size_t yValidIdx;
size_t qValidIdx;
size_t energyIdx;
size_t endIdx;
void *subscriber;
//struct MemoryStruct {
// char *memory;
// size_t size;
//};
static size_t RecvResponseCallback(char * contents, size_t size, size_t nmemb, void * up) {
++nCBs;
cout << "Callback called: " << nCBs << endl;
///Json::Value parsedFromString;
///Json::Reader reader;
///bool parsingSuccessful;
///Json::FastWriter fastWriter;
cout << "SIZE No. of Bytes " << size*nmemb << endl;
string sLocal=contents;
std::size_t found = sLocal.find('\n');
if (found != std::string::npos) {
sLocal=sLocal.substr(0, found);
}
contentsS=contentsS+sLocal;
//if (nCBs%3==1) {
// return size*nmemb;
//}
//printf("value= %s\n", contents);
/*
if (contents != NULL) {
parsingSuccessful=reader.parse(contentsS.c_str(), parsedFromString);
if (parsingSuccessful) {
//Json::StyledWriter styledWriter;
cout << "STYLED: --------------------------------" << endl;
//cout << styledWriter.write(parsedFromString) << endl;
//cout << "----------------------------------" << endl;
cout << parsedFromString["stream"] << endl;
cout << "----------------------------------" << endl;
globalZmqStream = fastWriter.write(parsedFromString["stream"]).c_str();
cout << globalZmqStream << endl;
if ( parsedFromString["stream"].isNull() ) {
globalZmqStream.clear();
}
}
else {
cout << "PARSING IN CURL CALLBACK FUNCTION WAS UNSUCCESSFUL !!!" << endl;
cout << reader.getFormattedErrorMessages() << endl;
}
}
contentsS="";
*/
/*
size_t realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)data;
mem->memory = (char *) realloc(mem->memory, (mem->size + realsize + 1));
if(mem->memory == NULL) {
printf("not enough memory (realloc returned NULL)\n");
return 0;
}
memcpy(&(mem->memory[mem->size]), contents, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;
//return realsize;
printf("value= %s\n",mem->memory);
if (mem->memory != NULL) {
parsingSuccessful=reader.parse(mem->memory, parsedFromString);
if (parsingSuccessful) {
Json::StyledWriter styledWriter;
cout << "STYLED: --------------------------------" << endl;
cout << styledWriter.write(parsedFromString) << endl;
cout << "----------------------------------" << endl;
cout << parsedFromString["stream"] << endl;
cout << "----------------------------------" << endl;
}
}
*/
return (size_t) size * nmemb;
}
//
bool resetBS() {
closeBS();
return setBS(true);
}
bool setBS(bool BSFlag) {
if(MUTEX){cafeMutex.lock();}
if (BSFlag) {
#if HAVE_CURL
/*
//Complete all or complete latest
//const char * data="{\"channels\":[{\"name\":\"S10BC01-DBPM010:X1\",\"backend\":\"sf-databuffer\",\"modulo\":1,\"offset\":0}, \
{\"name\":\"S10BC01-DBPM010:X1-VALID\",\"backend\":\"sf-databuffer\",\"modulo\":1,\"offset\":0} \
],\"mapping\":{\"incomplete\":\"fill-null\"},\"channelValidation\":{\"inconsistency\":\"adjust-global\"},\"sendBehaviour\":{\"strategy\":\"complete-all\"}}";
*/
string dataChannels=string("{\"channels\":[");
vector<string> pvNew=pv;
#if HAVE_ZEROMQ
if (!BSInitialized) {
//pvNew.push_back("SINEG01-DBPM340:X1") ;
//pvNew.push_back("SINSB01-DBPM150:X1") ;
//pvNew.push_back("SINSB02-DBPM150:X1") ;
//pvNew.push_back("SINLH01-DBPM060:X1") ;
//pvNew.push_back("SINLH02-DBPM210:X1") ;
//pvNew.push_back("SINLH02-DBPM240:X1") ;
//pvNew.push_back("SINLH03-DBPM010:X1") ;
//pvNew.push_back("SINLH03-DBPM050:X1") ;
//pvNew.push_back("SINLH03-DBPM090:X1") ;
//pvNew.push_back("SINSB03-DBPM120:X1") ;
//pvNew.push_back("SINSB03-DBPM220:X1") ;
//pvNew.push_back("SINSB04-DBPM120:X1") ;
//pvNew.push_back("SINSB04-DBPM220:X1") ;
//pvNew.push_back("SINEG01-DBPM340:X1-VALID") ;
//pvNew.push_back("SINSB01-DBPM150:X1-VALID") ;
//pvNew.push_back("SINSB02-DBPM150:X1-VALID") ;
//pvNew.push_back("SINLH01-DBPM060:X1-VALID") ;
//pvNew.push_back("SINLH02-DBPM210:X1-VALID") ;
//pvNew.push_back("SINLH02-DBPM240:X1-VALID") ;
//pvNew.push_back("SINLH03-DBPM010:X1-VALID") ;
//pvNew.push_back("SINLH03-DBPM050:X1-VALID") ;
//pvNew.push_back("SINLH03-DBPM090:X1-VALID") ;
//pvNew.push_back("SINSB03-DBPM120:X1-VALID") ;
//pvNew.push_back("SINSB03-DBPM220:X1-VALID") ;
//pvNew.push_back("SINSB04-DBPM120:X1-VALID") ;
//pvNew.push_back("SINSB04-DBPM220:X1-VALID") ;
size_t found;
dataChannels= dataChannels + string("{\"name\":\"");
dataChannels= dataChannels + pvNew[0];
//dataChannels= dataChannels + string("\",\"backend\":\"sf-databuffer\"}" );
dataChannels= dataChannels + string("\",\"backend\":\"sf-databuffer\",\"modulo\":1,\"offset\":0}" );
for (size_t i=1; i < pvNew.size(); ++i) {
found = pvNew[i].find("SARUN08-DBPM210");
if (found != std::string::npos) continue;
found = pvNew[i].find("SARUN08-DBPM410");
if (found != std::string::npos) continue;
//found = pvNew[i].find("Y1");
//if (found != std::string::npos) continue;
//found = pvNew[i].find("X1");
//if (found != std::string::npos) continue;
found = pvNew[i].find("ENERGY");
if (found != std::string::npos) continue;
dataChannels= dataChannels + string(",{\"name\":\"");
dataChannels= dataChannels + pvNew[i];
//found = pv[i+1].find("ENERGY");
//if (found != std::string::npos) break;
//dataChannels= dataChannels + string("\",\"backend\":\"sf-databuffer\"}");
dataChannels= dataChannels + string("\",\"backend\":\"sf-databuffer\",\"modulo\":1,\"offset\":0}");
}
//dataChannels= dataChannels + string("{\"name\":\"");
//dataChannels= dataChannels + pv[pv.size()-1];
//dataChannels= dataChannels + string("\",\"backend\":\"sf-databuffer\"}],");
dataChannels= dataChannels + string("],");
dataChannels= dataChannels + "\"mapping\":{\"incomplete\":\"fill-null\"},\"channelValidation\":{\"inconsistency\":\"keep-as-is\"},\"sendBehaviour\":{\"strategy\":\"complete-all\"}}";
cout << dataChannels << endl;
//sleep(1);
const char * data = dataChannels.c_str();
///cout << "SIZE OF DATA --------------->" << sizeof(data) << endl;
CURL *curl;
CURLcode res;
struct curl_slist * slist;
slist = NULL;
slist = curl_slist_append(slist, "Content-Type: application/json");
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://dispatcher-api.psi.ch/sf/stream");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); //"-F file=@./request.json"); //data); //
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
cout << "WAITING FOR CALLBACK " << endl;
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &RecvResponseCallback);
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
cout << "curl_easy_perform failed " << curl_easy_strerror(res) << endl;
}
else {
cout << " CALLBACK DONE" << endl;
cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
curl_easy_cleanup(curl);
cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
curl=NULL;
curl_slist_free_all(slist);
cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
slist=NULL;
}
}
cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
curl_global_cleanup();
#endif
//cout << " //1// SHOW contentS " << endl;
//cout << contentsS.c_str() << endl;
//sleep(1);
Json::Value parsedFromString;
Json::Reader reader;
bool parsingSuccessful;
Json::FastWriter fastWriter;
//printf("value= %s\n", contentsS.c_str());
if (contentsS.size() > 2) {
parsingSuccessful=reader.parse(contentsS.c_str(), parsedFromString);
if (parsingSuccessful) {
//Json::StyledWriter styledWriter;
cout << "STYLED: --------------------------------" << endl;
//cout << styledWriter.write(parsedFromString) << endl;
//cout << "----------------------------------" << endl;
cout << parsedFromString["stream"] << endl;
cout << "----------------------------------" << endl;
globalZmqStream = fastWriter.write(parsedFromString["stream"]).c_str();
cout << globalZmqStream << endl;
if ( parsedFromString["stream"].isNull() ) {
globalZmqStream.clear();
}
}
else {
cout << "PARSING IN CURL CALLBACK FUNCTION WAS UNSUCCESSFUL !!!" << endl;
cout << contentsS.c_str() << endl;
cout << reader.getFormattedErrorMessages() << endl;
}
}
//
//#if HAVE_ZEROMQ
//if (!BSInitialized) {
cout << "TESTING STREAM... " << endl;
if (globalZmqStream.empty()) {
cout << "BS Data is not available " << endl;
return isBS=false;
}
// else {
// cout << globalZmqStream.c_str() << " is not empty " << endl;
// }
context = zmq_ctx_new ();
/// receiver = zmq_socket (context, ZMQ_PULL);
//HWM has no effect for PULL
//See documentation on zmq-socket
//WHEN PUSH Sender reachers HWM, then it blocks
/// int nhwm=10;
/// zmq_setsockopt (receiver,ZMQ_RCVHWM ,&nhwm, sizeof(int));
//rc = zmq_bind (receiver, "tcp://129.129.145.206:5558"); //ZMQ_PULL
/// rc = zmq_bind (receiver, "tcp://SIN-CVME-DBPM0421:9000");
/// assert (rc == 0);
subscriber = zmq_socket (context, ZMQ_SUB);
//rc = zmq_connect (subscriber, "tcp://129.129.145.206:5556");
//rc = zmq_connect (subscriber, "tcp://SIN-CVME-DBPM0421:9000");
globalZmqStream=globalZmqStream.substr(1,globalZmqStream.size()-3);
//cout << " globalZmqStream.c_str() " << globalZmqStream.c_str() << endl;
//sleep(1);
rc = zmq_connect (subscriber, (const char *) globalZmqStream.c_str()); // "tcp://sf-daqbuf-28.psi.ch:42465"); // //"tcp://sf-daqbuf-30.psi.ch:39927");
if (rc != 0 ) {
cout << " Error is " << zmq_errno() << " " << zmq_strerror(zmq_errno()) << endl;
}
//rc = zmq_connect (subscriber, "tcp://*:9999");
assert (rc == 0);
int nhwm=1;
int timeoutMS=400; //10; //-1 Wait for Ever
rc=zmq_setsockopt (subscriber,ZMQ_RCVHWM ,&nhwm, sizeof(int));
assert (rc == 0);
rc=zmq_setsockopt (subscriber,ZMQ_RCVTIMEO ,&timeoutMS, sizeof(int));
assert (rc == 0);
rc=zmq_setsockopt (subscriber,ZMQ_SUBSCRIBE,"",0);
assert (rc == 0);
BSInitialized=true;
}
if(MUTEX){cafeMutex.unlock();}
return isBS=BSFlag;
#else
if(MUTEX){cafeMutex.unlock();}
return isBS=false;
#endif
}
if(MUTEX){cafeMutex.unlock();}
return isBS=BSFlag;
}
bool setCA(bool CAFlag) {
return CAFlag;
}
void closeBS() {
if (BSInitialized && isBS) {
#if HAVE_ZEROMQ
zmq_close (subscriber);
zmq_ctx_destroy (context);
#endif
}
BSInitialized=false;
isBS=false;
}
bool getIsBS() { return isBS;}
DBPMKeeper() {};
DBPMKeeper(std::vector<string> _pv, std::vector<unsigned int> _handle, std::map<float, std::string> posDev):isBS(false),BSInitialized(false)
{
pv.assign (_pv.begin(), _pv.end());
handle.assign(_handle.begin(),_handle.end());
//fMap posDev;
std::map<float, std::string>::iterator pos;
for (pos =posDev.begin(); pos != posDev.end(); ++pos) {
s.push_back(pos->first); device.push_back(pos->second);
}
pvd = new PVDataHolder[handle.size()];
//for (int i=0; i< handle.size(); ++i) {
// pvd[i].setNelem(1);
//}
nDBPM=device.size();
nPV=_pv.size();
status=ICAFE_NORMAL;
xIdx = 0;
yIdx = nDBPM;
qIdx =2*nDBPM;
xValidIdx=3*nDBPM;
yValidIdx=4*nDBPM;
qValidIdx=5*nDBPM;
energyIdx=6*nDBPM;
endIdx =7*nDBPM;
}
DBPMKeeper(std::vector<string> _pv, std::vector<unsigned int> _handle, std::vector<std::string> _dev, std::vector<float> _pos):isBS(false),BSInitialized(false)
{
pv.assign (_pv.begin(), _pv.end());
handle.assign(_handle.begin(),_handle.end());
device.assign(_dev.begin(), _dev.end());
s.assign(_pos.begin(), _pos.end());
pvd = new PVDataHolder[handle.size()];
//for (int i=0; i< handle.size(); ++i) {
// pvd[i].setNelem(1);
//}
nDBPM=device.size();
nPV=_pv.size();
status=ICAFE_NORMAL;
xIdx = 0;
yIdx = nDBPM;
qIdx =2*nDBPM;
xValidIdx=3*nDBPM;
yValidIdx=4*nDBPM;
qValidIdx=5*nDBPM;
energyIdx=6*nDBPM;
endIdx =7*nDBPM;
}
};
#endif //CAFE_SERVICE_H

298
include/cafeVectors.h Normal file
View File

@@ -0,0 +1,298 @@
///
/// \file cafeVectors.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CAFEVECTORS_H
#define CAFEVECTORS_H
#include <string>
int get(const unsigned int _handle, vector<string> & V); //0
int get(const unsigned int _handle, vector<short> & V); //1
int get(const unsigned int _handle, vector<float> & V); //2
int get(const unsigned int _handle, vector<unsigned short> & V); //3
int get(const unsigned int _handle, vector<unsigned char> & V); //4
int get(const unsigned int _handle, vector<dbr_long_t> & V); //5
int get(const unsigned int _handle, vector<long long> & V); //5
int get(const unsigned int _handle, vector<double> & V); //6
int get(const unsigned int _handle, vector<string> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//0
int get(const unsigned int _handle, vector<short> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//1
int get(const unsigned int _handle, vector<float> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//2
int get(const unsigned int _handle, vector<unsigned short> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//3
int get(const unsigned int _handle, vector<unsigned char> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//4
int get(const unsigned int _handle, vector<dbr_long_t> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//5
int get(const unsigned int _handle, vector<long long> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//5
int get(const unsigned int _handle, vector<double> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//6
int get(const unsigned int _handle, vector<string> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//0
int get(const unsigned int _handle, vector<short> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//1
int get(const unsigned int _handle, vector<float> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//2
int get(const unsigned int _handle, vector<unsigned short> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//3
int get(const unsigned int _handle, vector<unsigned char> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//4
int get(const unsigned int _handle, vector<dbr_long_t> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//5
int get(const unsigned int _handle, vector<long long> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//5
int get(const unsigned int _handle, vector<double> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//
int getCache(const unsigned int _handle, vector<string> & V); //0
int getCache(const unsigned int _handle, vector<short> & V); //1
int getCache(const unsigned int _handle, vector<float> & V); //2
int getCache(const unsigned int _handle, vector<unsigned short> & V);//3
int getCache(const unsigned int _handle, vector<unsigned char> & V);//4
int getCache(const unsigned int _handle, vector<dbr_long_t> & V); //5
int getCache(const unsigned int _handle, vector<long long> & V); //5
int getCache(const unsigned int _handle, vector<double> & V); //6
int getCache(const unsigned int _handle, vector<string> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//0
int getCache(const unsigned int _handle, vector<short> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//1
int getCache(const unsigned int _handle, vector<float> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//2
int getCache(const unsigned int _handle, vector<unsigned short> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//3
int getCache(const unsigned int _handle, vector<unsigned char> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//4
int getCache(const unsigned int _handle, vector<dbr_long_t> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//5
int getCache(const unsigned int _handle, vector<long long> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//5
int getCache(const unsigned int _handle, vector<double> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity);//6
int getCache(const unsigned int _handle, vector<string> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//0
int getCache(const unsigned int _handle, vector<short> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//1
int getCache(const unsigned int _handle, vector<float> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//2
int getCache(const unsigned int _handle, vector<unsigned short> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//3
int getCache(const unsigned int _handle, vector<unsigned char> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//4
int getCache(const unsigned int _handle, vector<dbr_long_t> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//5
int getCache(const unsigned int _handle, vector<long long> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//5
int getCache(const unsigned int _handle, vector<double> & V,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);//6
int get(vector<unsigned int> handleV, vector<int> &statusV);
int getV(vector<unsigned int> handleV, vector<int> &statusV){
status=get(handleV, statusV); ca_flush_io(); //Yes let's flush here!
return status;}
int getScalars(vector<unsigned int> handleV, vector<string> & V, vector<int> &statusV){ //0
CAFE::get(handleV, statusV);
CAFE::waitForBundledEvents(handleV, statusV);
return CAFE::getCache(handleV, V, statusV);
}
int getScalars(vector<unsigned int> handleV, vector<dbr_short_t> & V, vector<int> &statusV){ //1
CAFE::get(handleV, statusV);
CAFE::waitForBundledEvents(handleV, statusV);
return CAFE::getCache(handleV, V, statusV);
}
int getScalars(vector<unsigned int> handleV, vector<dbr_float_t> & V, vector<int> &statusV){ //2
CAFE::get(handleV, statusV);
CAFE::waitForBundledEvents(handleV, statusV);
return CAFE::getCache(handleV, V, statusV);
}
int getScalars(vector<unsigned int> handleV, vector<dbr_enum_t> & V, vector<int> &statusV){ //3
CAFE::get(handleV, statusV);
CAFE::waitForBundledEvents(handleV, statusV);
return CAFE::getCache(handleV, V, statusV);
}
int getScalars(vector<unsigned int> handleV, vector<dbr_char_t> & V, vector<int> &statusV){ //4
CAFE::get(handleV, statusV);
CAFE::waitForBundledEvents(handleV, statusV);
return CAFE::getCache(handleV, V, statusV);
}
int getScalars(vector<unsigned int> handleV, vector<dbr_long_t> & V, vector<int> &statusV){ //5
CAFE::get(handleV, statusV);
CAFE::waitForBundledEvents(handleV, statusV);
return CAFE::getCache(handleV, V, statusV);
}
int getScalars(vector<unsigned int> handleV, vector<long long> & V, vector<int> &statusV) { //5
CAFE::get(handleV, statusV);
CAFE::waitForBundledEvents(handleV, statusV);
return CAFE::getCache(handleV, V, statusV);
}
int getScalars(vector<unsigned int> handleV, vector<dbr_double_t> & V, vector<int> &statusV) { //6
CAFE::get(handleV, statusV);
//for (size_t i=0; i< handleV.size(); ++i) { cout << "/Asyn/h=" << handleV[i] << "s=" << statusV[i] << " [" << i << "] " << endl;}
CAFE::waitForBundledEvents(handleV, statusV);
//for (size_t i=0; i< handleV.size(); ++i) { cout << "/Wait/h=" << handleV[i] << "s=" << statusV[i] << " [" << i << "] " << endl;}
status=CAFE::getCache(handleV, V, statusV);
//for (size_t i=0; i< handleV.size(); ++i) { cout << "/Cach/h=" << handleV[i] << "s=" << statusV[i] << " [" << i << "] " << endl;}
return status;
}
int getCacheVStr(vector<unsigned int> handleV, vector<string> & V, vector<int> &statusV){
return getCache(handleV, V, statusV);}
int getCacheVLong(vector<unsigned int> handleV, vector<dbr_long_t> & V, vector<int> &statusV){
return getCache(handleV, V, statusV);}
int getCacheVDouble(vector<unsigned int> handleV, vector<dbr_double_t> & V, vector<int> &statusV){
return getCache(handleV, V, statusV);}
int getCache(vector<unsigned int> handleV, vector<string> & V, vector<int> &statusV); //0
int getCache(vector<unsigned int> handleV, vector<dbr_short_t> & V, vector<int> &statusV); //1
int getCache(vector<unsigned int> handleV, vector<dbr_float_t> & V, vector<int> &statusV); //2
int getCache(vector<unsigned int> handleV, vector<dbr_enum_t> & V, vector<int> &statusV); //3
int getCache(vector<unsigned int> handleV, vector<dbr_char_t> & V, vector<int> &statusV); //4
int getCache(vector<unsigned int> handleV, vector<dbr_long_t> & V, vector<int> &statusV); //5
int getCache(vector<unsigned int> handleV, vector<long long> & V, vector<int> &statusV); //5
int getCache(vector<unsigned int> handleV, vector<dbr_double_t> & V, vector<int> &statusV); //6
int getCache(vector<unsigned int> handleV, vector<string> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //0
int getCache(vector<unsigned int> handleV, vector<dbr_short_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //1
int getCache(vector<unsigned int> handleV, vector<dbr_float_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //2
int getCache(vector<unsigned int> handleV, vector<dbr_enum_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //3
int getCache(vector<unsigned int> handleV, vector<dbr_char_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //4
int getCache(vector<unsigned int> handleV, vector<dbr_long_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //5
int getCache(vector<unsigned int> handleV, vector<long long> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //5
int getCache(vector<unsigned int> handleV, vector<dbr_double_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV); //6
//0
int getCache(vector<unsigned int> handleV, vector<string> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
vector<epicsTimeStamp> &tsV);
//1
int getCache(vector<unsigned int> handleV, vector<dbr_short_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
vector<epicsTimeStamp> &tsV);
//2
int getCache(vector<unsigned int> handleV, vector<dbr_float_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
vector<epicsTimeStamp> &tsV);
//3
int getCache(vector<unsigned int> handleV, vector<dbr_enum_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
vector<epicsTimeStamp> &tsV);
//4
int getCache(vector<unsigned int> handleV, vector<dbr_char_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
vector<epicsTimeStamp> &tsV);
//5
int getCache(vector<unsigned int> handleV, vector<dbr_long_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
vector<epicsTimeStamp> &tsV);
int getCache(vector<unsigned int> handleV, vector<long long> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
vector<epicsTimeStamp> &tsV);
//6
int getCache(vector<unsigned int> handleV, vector<dbr_double_t> & V, vector<int> &statusV,
vector<dbr_short_t> &alarmStatusV, vector<dbr_short_t> &alarmSeverityV,
vector<epicsTimeStamp> &tsV);
///////////////////////////////////////////////////////////////////////////////////////////
int set(const unsigned int handle, vector<string> V); //0
int set(const unsigned int handle, vector<dbr_short_t> V); //1
int set(const unsigned int handle, vector<dbr_float_t> V); //2
int set(const unsigned int handle, vector<dbr_enum_t> V);//3
int set(const unsigned int handle, vector<dbr_char_t> V);//4
int set(const unsigned int handle, vector<dbr_long_t> V); //5
int set(const unsigned int handle, vector<long long> V); //5+
int set(const unsigned int handle, vector<dbr_double_t> V); //6
int set(vector<unsigned int> handleV, vector<string> V, vector<int> &statusV); //0
int set(vector<unsigned int> handleV, vector<dbr_short_t> V, vector<int> &statusV); //1
int set(vector<unsigned int> handleV, vector<dbr_float_t> V, vector<int> &statusV); //2
int set(vector<unsigned int> handleV, vector<dbr_enum_t> V, vector<int> &statusV); //3
int set(vector<unsigned int> handleV, vector<dbr_char_t> V, vector<int> &statusV); //4
int set(vector<unsigned int> handleV, vector<dbr_long_t> V, vector<int> &statusV); //5
int set(vector<unsigned int> handleV, vector<long long> V, vector<int> &statusV); //5+
int set(vector<unsigned int> handleV, vector<dbr_double_t> V, vector<int> &statusV); //6
int get (vector<unsigned int> handleV, PVDataHolder * pvd){
return get(&handleV[0], (unsigned int) handleV.size(), pvd);
};
int getCache (vector<unsigned int> handleV, PVDataHolder * pvd){
return getCache(&handleV[0], (unsigned int) handleV.size(), pvd);
};
int getPVArray (vector<unsigned int> handleV, PVDataHolder * pvd){
//unsigned int * handleArray = new unsigned int [handleV.size()];
//for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];}
//status=get(handleArray, (unsigned int) handleV.size(), pvd);
//delete [] handleArray; return status;
return get(&handleV[0], (unsigned int) handleV.size(), pvd);
};
/*
int getPVArrayCache (vector<unsigned int> handleV, PVDataHolder * pvd){
//unsigned int * handleArray = new unsigned int [handleV.size()];
//for (size_t i=0; i< (size_t) handleV.size(); ++i) {handleArray[i]= (unsigned int) handleV[i];}
//status=getCache(handleArray, (unsigned int) handleV.size(), pvd);
//delete [] handleArray; return status;
return getCache(&handleV[0], (unsigned int) handleV.size(), pvd);
};
*/
//setPVArray is in cafeVectors.h and .cc
//For Cython
int setPVArray(vector<unsigned int> handleV, PVDataHolder * pvd);
int setVVString(vector<unsigned int> handleV, vector<string> V, vector<int> &statusV) {
return set(handleV, V, statusV);};
int setVVChar(vector<unsigned int> handleV, vector<dbr_char_t> V, vector<int> &statusV){
return set(handleV, V, statusV);};
int setVVLong(vector<unsigned int> handleV, vector<dbr_long_t> V, vector<int> &statusV){
return set(handleV, V, statusV);};
int setVVDouble(vector<unsigned int> handleV, vector<dbr_double_t> V, vector<int> &statusV){
return set(handleV, V, statusV);};
int setVString(const unsigned int handle, vector<string> V) {return set(handle, V);};
int setVChar (const unsigned int handle, vector<dbr_char_t> V) {return set(handle, V);};
int setVLong (const unsigned int handle, vector<dbr_long_t> V) {return set(handle, V);};
int setVShort (const unsigned int handle, vector<dbr_short_t> V) {return set(handle, V);};
int setVUShort(const unsigned int handle, vector<dbr_enum_t> V) {return set(handle, V);};
int setVFloat (const unsigned int handle, vector<dbr_float_t> V) {return set(handle, V);};
int setVDouble(const unsigned int handle, vector<dbr_double_t> V) {return set(handle, V);};
#endif // CAFEVECTORS_H

24
include/cafeXML.h Normal file
View File

@@ -0,0 +1,24 @@
///
/// \file cafeXML.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CAFEXML_H
#define CAFEXML_H
#include <config.h>
#if HAVE_LIBQTXML
int loadCollectionsFromXML(const char * collectionsFile);
int loadGroupsFromXML (const char * groupsFile);
int restoreFromXML(const char * snapshotFile);
#endif
int snapshot2XML (PVGroup pg);
void openGroupXMLFile(string fileName);
void closeGroupXMLFile(string fileName);
int group2XML (const char * grpName, string fileName);
#endif // CAFEXML_H

67
include/caopCodes.h Normal file
View File

@@ -0,0 +1,67 @@
///
/// \file caopCodes.h
/// \author Jan Chrin, PSI
/// \date Release: April 2015
/// \version CAFE 1.0.0
///
#ifndef CAOPCODES_H
#define CAOPCODES_H
#include <cadef.h>
#include <iostream>
#include <string>
#include <map>
/**
* Provides methods to convert between
* the CA_OP_xx and text equivalent
*/
class CAOPCodes {
typedef std::map<int, std::string> mapIntString;
private:
mapIntString mapDataType;
mapIntString::iterator pos;
public:
CAOPCodes() {
mapDataType.insert(std::make_pair((int) CA_OP_GET, "CA_OP_GET" ));
mapDataType.insert(std::make_pair((int) CA_OP_PUT, "CA_OP_PUT" ));
mapDataType.insert(std::make_pair((int) CA_OP_CREATE_CHANNEL, "CA_OP_CREATE_CHANNEL" ));
mapDataType.insert(std::make_pair((int) CA_OP_ADD_EVENT, "CA_OP_ADD_EVENT" ));
mapDataType.insert(std::make_pair((int) CA_OP_CLEAR_EVENT, "CA_OP_CLEAR_EVENT" ));
mapDataType.insert(std::make_pair((int) CA_OP_OTHER, "CA_OP_OTHER" ));
mapDataType.insert(std::make_pair((int) CA_OP_CONN_UP, "CA_OP_CONN_UP" ));
mapDataType.insert(std::make_pair((int) CA_OP_CONN_DOWN, "CA_OP_CONN_DOWN" ));
};
~CAOPCodes() {};
std::string message (int i) {
pos = mapDataType.find(i);
if (pos != mapDataType.end()) return pos->second;
return "CAFE_DATATYPE_UNKNOWN";
};
int enumIs (std::string message) {
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos)
if (pos->second==message) return pos->first;
return -1;
};
void show() {print();}
void print ( ) {
std::cout << "------------------" << std::endl;
std::cout << "CA_OP_LIST" << std::endl;
std::cout << "-----------------" << std::endl;
for (pos=mapDataType.begin(); pos != mapDataType.end(); ++pos) {
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "-----------------" << std::endl;
};
};
#endif

316
include/channelRegalia.h Normal file
View File

@@ -0,0 +1,316 @@
///
/// \file channelRegalia.h
///
/// Classes are:
/// ChannelRegalia
/// ChannelRequestMetaData
/// ChannelRequestMetaDataClient
/// ChannelRequestMetaDataRepository
/// ChannelRequestStatus
///
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CHANNELINFO_H
#define CHANNELINFO_H
#include <cstring>
#include <statusCodes.h>
#include <defines.h>
#include <cafeEnum.h>
using namespace std;
/**
* Struct defining channel properties and connection status for use in Conduit container
*
*/
class ChannelRegalia{
private:
CAFEStatus cafeStatus;
public:
friend struct change_accessRightsHandlerArgs;
friend struct change_accessRead;
friend struct change_accessWrite;
friend struct change_channelID;
friend struct change_connectionHandlerArgs;
friend struct change_eventHandlerArgs;
//friend struct change_channelRegalia;
//friend class Connect;
friend class HandleHelper;
friend class Conduit;
friend class ConduitGroup;
protected:
chid channelID; //
bool connectFlag;
const char * hostName;
unsigned int nelem; //native
chtype dataType; //native
unsigned short accessRead; //0 or 1
unsigned short accessWrite; //0 or 1
dbr_class_name_t className; //dbr_string_t
//connectionState as given by connection_handler args: CA_OP_CONN_UP or CA_OP_CONN_DOWN
int connectionState; //as given by CA_OP_
int cafeConnectionState; //as given by cafe_cs_state in statusCodes
//void setChannelID (chid id) {channelID=id;};
void setConnectFlag (bool c) {connectFlag=c;};
void setHostName (const char * h) {hostName=h;};
void setDataType (chtype d) {dataType=d;};
void setAccessRead (unsigned short r){accessRead=r;};
void setAccessWrite(unsigned short w){accessWrite=w;};
void setReadAccess (unsigned short r){accessRead=r;};
void setWriteAccess(unsigned short w){accessWrite=w;};
void setNelem (unsigned int n) {nelem=n;};
void setConnectionState (long cs) {connectionState=cs;};
void setCafeConnectionState (long ccs) {cafeConnectionState=ccs;};
public:
chid getChannelID() const {return channelID;};
bool getConnectFlag()const {return connectFlag;};
const char * getHostName() const {return hostName;};
string getHostNameAsString() {string h= hostName; return h;};
chtype getDataType() const {return dataType;};
const char * getClassName() const {return className;};
string getClassNameAsString() {string c=className; return c;};
unsigned short getAccessRead() const {return accessRead;};
unsigned short getAccessWrite()const {return accessWrite;};
unsigned short getReadAccess() const {return accessRead;};
unsigned short getWriteAccess()const {return accessWrite;};
unsigned int getNelem() const {return nelem;};
int getConnectionState() const {return connectionState;};
int getCafeConnectionState() const {return cafeConnectionState;};
string getConnectionStateAsString() {
if(connectionState==CA_OP_CONN_UP){return "CA_OP_CONN_UP";}
else if(connectionState==CA_OP_CONN_DOWN){return "CA_OP_CONN_DOWN"; }
else {return "CA_OP_CONN is UNKNOWN: THIS SHOULD NEVER APPEAR!";}};
string getCafeConnectionStateAsString() {
return cafeStatus.csc.message(cafeConnectionState);};
ChannelRegalia():channelID((chid) NULL), connectFlag(false), nelem((unsigned int) 1),
dataType((chtype) CAFE_TYPENOTCONN),
accessRead((unsigned short) 0), accessWrite((unsigned short) 0),
connectionState((int) CA_OP_CONN_DOWN), cafeConnectionState((int) ICAFE_CS_NEVER_CONN)
{strcpy(className, ""); hostName="";};
~ChannelRegalia(){};
};
/**
* Stores strings for Enum datatypes
*
*/
class ChannelEnumStrings{
public:
friend struct change_eventHandlerArgs;
private:
char options [MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE];
short noOptions;
public:
ChannelEnumStrings():noOptions( (short) 0){};
short getNoOptions() const {return noOptions;};
char getOptions() const {return options[MAX_ENUM_STATES][MAX_ENUM_STRING_SIZE];};
};
/**
* Stores device/attribute pairing
*
*/
class ChannelDeviceAttribute{
private:
std::string pv;
std::string device;
std::string attribute;
std::string deliminator;
public:
ChannelDeviceAttribute(){};
~ChannelDeviceAttribute(){};
int init(std::string _pv, std::string _deliminator)
{
pv=_pv;
deliminator=_deliminator;
short posOfSeparator=pv.find_first_of(deliminator);
if (posOfSeparator<0){
device="";
attribute="";
return ECAFE_DEVICE_ATTRIB_NOT_FOUND;
}
else {
device= pv.substr(0,posOfSeparator);
attribute=pv.substr(posOfSeparator+1,pv.size());
}
return ICAFE_NORMAL;
};
const char * getDeliminator() const {return deliminator.c_str();};
const char * getDevice() const {return device.c_str();};
const char * getAttribute() const {return attribute.c_str();};
const char * getAttrib() const {return attribute.c_str();};
std::string getDeliminatorAsString() const {return deliminator;};
std::string getDeviceAsString() const {return device;};
std::string getAttributeAsString() const {return attribute;};
};
/**
* 0. Struct defining channel datatype/nelem executed by CAFE for use in Conduit container
*
*/
class ChannelRequestMetaData{
public:
friend struct change_connectionHandlerArgs;
friend struct change_dataBufferSize_CTRL;
friend struct change_dataBufferSize_TIME;
friend struct change_dataBufferSize_PRIMITIVE;
friend struct change_dataBufferSize_STSACK;
friend struct change_eventHandlerArgs;
friend struct copy_channelRequestMetaDataToChannelRequestMetaDataRepository;
friend class Conduit;
friend class ConduitGroup;
protected:
chid channelID; //of requested item
unsigned int nelem; //depends on Policy
unsigned int nelemCache; //nelem To Retrieve From Cache
chtype dataType; //depends on Policy
chtype dbrDataType; //depends on Policy
CAFENUM::DBR_TYPE cafeDbrType;
void * usrArg; //from Conduit.usrArg
unsigned int byteSize; //data buffer (bytes) must be large enough to store data
unsigned int offset;
public:
void setNelem(unsigned int n){nelem= n > 0 ? n : 1;
//nelemCache= nelem > nelemCache ? nelemCache : nelem;
}; // byteSize=dbr_size_n(dbrDataType,nelem); };
void setNelemCache(unsigned int n){nelemCache= n > 0 ? n : 1;}
void setUsrArg(void * u){usrArg=u;};
void setDataType(chtype d){dataType=d;};
void setDbrDataType(chtype dbr){dbrDataType=dbr; }; //byteSize=dbr_size_n(dbrDataType,nelem);};
void setCafeDbrType(CAFENUM::DBR_TYPE cd){cafeDbrType=cd;};
void setDbrTypesFromCafeDbrType(CAFENUM::DBR_TYPE cd){
cafeDbrType=cd;
switch(cafeDbrType)
{
case CAFENUM::DBR_TIME:
dbrDataType = dbf_type_to_DBR_TIME(dataType);
break;
case CAFENUM::DBR_STS:
dbrDataType = dbf_type_to_DBR_STS(dataType);
break;
case CAFENUM::DBR_PRIMITIVE:
dbrDataType = dbf_type_to_DBR(dataType);
break;
default:
//Print Warning Message?
dbrDataType = dbf_type_to_DBR_TIME(dataType);
cafeDbrType = CAFENUM::DBR_TIME;
break;
}
};
void setByteSize(unsigned int b){ byteSize=b;};
unsigned int getNelem() const{return nelem;};
unsigned int getNelemCache() const{return nelemCache;};
void * getUsrArg() const{return usrArg;};
chtype getDataType() const { return dataType;};
chtype getDbrDataType() const { return dbrDataType;};
CAFENUM::DBR_TYPE getCafeDbrType() const {return cafeDbrType;};
unsigned int getByteSize() const {return byteSize;};
void setOffset(unsigned int o) {offset=o;};
unsigned int getOffset() const {return offset;};
//Constructors
ChannelRequestMetaData():channelID((chid) NULL), nelem((unsigned int) 1), nelemCache((unsigned int) 1),
dataType((chtype) DBF_NO_ACCESS), dbrDataType((chtype) TYPENOTCONN), //
cafeDbrType( (CAFENUM::DBR_TYPE) NULL),
usrArg((void *) NULL), byteSize((unsigned int) 0), offset((unsigned int) 0){
}; //CAStatus((long) ECA_NORMAL){};
~ChannelRequestMetaData(){};
};
/**
* -1. Struct defining channel datatype/nelem requested by client for use in Conduit container
*
*/
class ChannelRequestMetaDataClient: public ChannelRequestMetaData{
public:
//protected:
//unsigned int offset;
public:
//void setOffset(unsigned int o) {offset=o;};
//unsigned int getOffset() const {return offset;};
//Constructors
ChannelRequestMetaDataClient(){};//:offset((unsigned int) 0){};
~ChannelRequestMetaDataClient(){};
};
/**
* Gives status of the Request message \n
* messageStatus = requestStatus if requestStatus != ECA_NORMAL else \n
* messageStatus = requestStatus or messageStatus=callbackStatus (if policy WITH_CALLBACK)
*
*/
class ChannelRequestStatus{
private:
int preRequestStatus; // current status of channel
int requestStatus; // from get/put operation
int pendStatus; // from pend_io operation
int callbackStatus; // used by CAFE::waitForEvent() to record status of callback
int messageStatus; // overall status
CAFENUM::StatusMessageKind messageKind; // statusMessageKind indicating method status occuping overall messageStatus
bool hasCallbackInitiated;
bool hasCallbackTriggered;
CAFENUM::CallbackProgressKind callbackProgressKind;
public:
int getPreRequestStatus() const {return preRequestStatus;};
int getRequestStatus() const {return requestStatus;};
int getPendStatus() const {return pendStatus;};
int getCallbackStatus() const {return callbackStatus;};
int getMessageStatus() const {return messageStatus;};
CAFENUM::StatusMessageKind getMessageKind() const {return messageKind;};
CAFENUM::CallbackProgressKind getCallbackProgressKind() const {return callbackProgressKind;};
void setPreRequestStatus (int s) {preRequestStatus=s; messageStatus=s; messageKind=(CAFENUM::StatusMessageKind) CAFENUM::PRE_REQUEST;};
void setRequestStatus (int r) {requestStatus = r; messageStatus=r; messageKind=(CAFENUM::StatusMessageKind) CAFENUM::FROM_REQUEST;};
void setPendStatus (int p) {pendStatus = p; messageStatus=p; messageKind=(CAFENUM::StatusMessageKind) CAFENUM::FROM_PEND;};
void setCallbackStatus (int c) {callbackStatus= c; messageStatus=c; messageKind=(CAFENUM::StatusMessageKind) CAFENUM::FROM_CALLBACK;};
void setCallbackKind (bool hasInit, bool hasTrig) {
hasCallbackInitiated=hasInit; hasCallbackTriggered=hasTrig;
if ( hasInit && !hasTrig) {callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::PENDING;}
else if (!hasInit && hasTrig) {callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::COMPLETE;}
else if (!hasInit && !hasTrig) {callbackProgressKind=(CAFENUM::CallbackProgressKind) CAFENUM::NOT_INITIATED;}
else {std::cout << "CAFE INTERNAL POLICY ERROR" << std::endl;
std::cout << "ChannelRequestStatus::setCallbackKind gives an INVALID callbackProgressKind" << endl;}
};
//void setMessageStatus (long mstatus) {messageStatus = mstatus;};
// void setMessageKind (StatusMessageKind mkind) { if (mkind<=CAFENUM::FROM_CALLBACK && mkind >= CAFENUM::PRE_REQUEST)
// {messageKind = mkind;} else {cout<< mkind << " is an invalid statusMessageKind!" << endl;}};
ChannelRequestStatus():preRequestStatus(ICAFE_CS_NEVER_CONN),requestStatus(ICAFE_CS_NEVER_CONN),pendStatus(ICAFE_CS_NEVER_CONN),
callbackStatus(ICAFE_CS_NEVER_CONN),messageStatus(ICAFE_CS_NEVER_CONN),messageKind((CAFENUM::StatusMessageKind) CAFENUM::NO_MESSAGE),
hasCallbackInitiated(false),hasCallbackTriggered(false),callbackProgressKind((CAFENUM::CallbackProgressKind) CAFENUM::NOT_INITIATED){};
};
#endif // CHANNELINFO_H

361
include/conduit.h Normal file
View File

@@ -0,0 +1,361 @@
///
/// \file conduit.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CONDUIT_H
#define CONDUIT_H
#include <iostream>
#include <vector>
#include <config.h>
#include <cadef.h>
#include <channelRegalia.h>
#include <PVDataHolder.h>
#include <PVCtrlHolder.h>
#include <policies.h>
#if HAVE_PYTHON_H
#if HAVE_PYCAFE_EXT
#include <Python.h> //required for PyCafe.h
#include <PyCafe.h>
#else
#include <PyCafe_api.h>
#endif
#endif
/**
* Principal constructor has:\n
* \param _pv process variable
* \param _ccc ca_client_context
*/
class Conduit
{
public:
friend struct change_alarmStatus;
friend struct change_alarmSeverity;
friend struct change_epicsTimeStamp;
friend struct change_accessRightsHandlerArgs;
friend struct change_accessRead;
friend struct change_accessWrite;
friend struct change_channelDeviceAttribute;
friend struct change_channelID;
friend struct change_channelRegalia;
friend struct change_channelGetCacheWaitPolicy;
friend struct change_channelGetActionWhenMonitorPolicy;
friend struct change_channelRequestDataTypePolicy;
friend struct change_channelRequestMetaCtrl;
friend struct change_channelRequestMetaCtrlClient;
friend struct change_channelRequestMetaData;
friend struct change_channelRequestMetaDataClient;
friend struct change_channelRequestMetaPrimitive;
friend struct change_channelRequestPolicyPut;
friend struct change_channelRequestStatusPut;
friend struct change_channelRequestPolicyGet;
friend struct change_channelRequestStatusGet;
friend struct change_channelRequestPolicyGetCtrl;
friend struct change_channelRequestStatusGetCtrl;
friend struct change_channelRequestStatusGetSTSACK;
friend struct change_channelRequestStatusGetClassName;
friend struct change_channelTimeoutPolicyGet;
friend struct change_channelTimeoutPolicyPut;
friend struct change_connectionHandlerArgs;
friend struct change_dataBufferSize_PRIMITIVE;
friend struct change_dataBufferSize_TIME;
friend struct change_dataBufferSize_CTRL;
friend struct change_dataBufferSize_STSACK;
//friend struct change_dataBufferPVCtrlHolder;
//friend struct change_dataBufferPVDataHolder;
friend struct change_eventHandlerArgs;
friend struct change_hasNewData;
friend struct change_monitorAction;
friend struct change_monitorActionClear;
friend struct change_monitorActionErase;
friend struct change_monitorPolicyErase;
friend struct change_monitorPolicyInsert;
friend struct change_monitorPolicyInWaitingErase;
friend struct change_monitorPolicyInWaitingInsert;
//friend struct change_rule;
friend struct change_pvAlias;
friend struct change_status;
friend struct change_usrArgs;
friend struct free_dataBuffers;
friend class Connect;
friend class CAFE;
friend class Granules;
friend class ChannelCreatePolicy;
friend class ConduitGroup;
friend class MonitorPolicy;
//friend void CAFE_CALLBACK::PyHandlerPut;
//friend void CAFE_CALLBACK::PyHandlerGet;
//friend struct change_pyCafeFlag;
private:
//from alarmString.h
const char * epicsAlarmSeverityStrings[ALARM_SEVERITY_STRING_LENGTH];
const char * epicsAlarmConditionStrings[ALARM_STATUS_STRING_LENGTH];
static unsigned int handleNext;
ca_client_context * ccc;
union db_access_val * dataBuffer;
union db_access_val * ctrlBuffer;
union db_access_val * putBuffer;
union db_access_val * stsackBuffer;
short alarmStatus;
short alarmSeverity;
epicsTimeStamp ts;
void * usrArgs; //Filled in conduitEventHandlerArgs.h; used by getUsrArgsAsUInt in CyCafe
chtype dataType;
chtype dbrDataType;
CAFENUM::DBR_TYPE cafeDbrType;
//Reserved
unsigned int beamEventNo;
//bool rule;
bool pyCafeFlag;
std::string deviceAttributeDeliminator;
ChannelDeviceAttribute channelDeviceAttribute;
//PVCtrlHolder pvc;
//PVDataHolder pvd;
ChannelEnumStrings channelEnumStrings;
//ChannelPolicies
ChannelGetCacheWaitPolicy channelGetCacheWaitPolicy;
ChannelGetActionWhenMonitorPolicy channelGetActionWhenMonitorPolicy;
ChannelRequestDataTypePolicy channelRequestDataTypePolicy;
ChannelRequestPolicy channelRequestPolicyPut;
ChannelRequestStatus channelRequestStatusPut;
ChannelRequestPolicy channelRequestPolicyGet; //DATA
ChannelRequestStatus channelRequestStatusGet; //DATA
ChannelRequestPolicy channelRequestPolicyGetCtrl; //CTRL
ChannelRequestStatus channelRequestStatusGetCtrl; //CTRL
ChannelRequestStatus channelRequestStatusGetSTSACK; //STSACK
ChannelRequestStatus channelRequestStatusGetClassName;//ClassName
ChannelTimeoutPolicy channelTimeoutPolicyGet;
ChannelTimeoutPolicy channelTimeoutPolicyPut;
ChannelRegalia channelRegalia;
ChannelRequestMetaData channelRequestMetaData; //0 container for actual send
ChannelRequestMetaDataClient channelRequestMetaDataClient; //-1 //DATA
//ChannelRequestMetaDataRepository channelRequestMetaDataRepository; // (CAFENUM::DBR_TYPE DBR_TIME) ; //1
ChannelRequestMetaData channelRequestMetaCtrl; //0 container for actual send
ChannelRequestMetaDataClient channelRequestMetaCtrlClient; //-1 //CTRL
//ChannelRequestMetaDataRepository channelRequestMetaCtrlRepository; // (CAFENUM::DBR_TYPE DBR_CTRL); //1
ChannelRequestMetaData channelRequestMetaSTSACK;// (CAFENUM::DBR_TYPE DBR_STSACK);//1
ChannelRequestMetaData channelRequestMetaPrimitive; //Put operations
#if HAVE_PYTHON_H
void * PyEventHandler() const;
void * PyEventHandler(unsigned int) const;
void * PyDataEventHandler() const;
void * PyCtrlEventHandler() const;
#endif
int putWithCallback(pCallback callbackHandlerPut) const;
int put(void) const;
int get(void) const;
int getWithCallback(pCallback) const;
int getCtrl(void) const;
int getCtrlWithCallback(pCallback) const;
int getSTSACKWithCallback(pCallback) const;
int getClassNameWithCallback(pCallback) const;
//Monitor Policies
//map<evid,MonitorPolicy> emp;
//map<evid,MonitorPolicy>::iterator iemp;
//map<unsigned long,MonitorPolicy> lump;
//map<unsigned long,MonitorPolicy>::iterator ilump;
////MonitorPolicy mpBase;
vector<MonitorPolicy> mpV;
vector<MonitorPolicy> mpInWaitingV;
int monitorStart(MonitorPolicy &mp) const;
int monitorStop(evid eventID) const;
vector<std::string> monitorAction;
bool hasNewData; // used by HandleHelper.getMonitorAction();
public:
#if HAVE_PYTHON_H
void * PyGetHandler() const;
void * PyPutHandler() const;
#endif
Conduit(void );
Conduit(const char * _pv, ca_client_context *_ccc,
ChannelRequestPolicy _channelRequestPolicyPut, ChannelRequestPolicy _channelRequestPolicyGet,
ChannelGetActionWhenMonitorPolicy _channelGetActionWhenMonitorPolicy,
bool _pyCafeFlag);
//Conduit(const char * _pv, ca_client_context *_ccc, bool _pyCafeFlag);
//Conduit(const char * _pv, ca_client_context *_ccc);
virtual ~Conduit();
unsigned int groupHandle; // Group handle this pv handle belongs to!!
unsigned int handle;
chid channelID;
//evid eventID;
std::string pv;
std::string pvAlias;
int status;
friend std::ostream& operator<<(std::ostream& os, const Conduit& e)
{
os<< "handle=" << e.handle<<" pv=" << e.pv<< std::endl;
return os;
};
bool getPyCafe() const {return pyCafeFlag;};
bool operator<(const Conduit& c)const{return handle<c.handle;};
const char * getDevice(void) const {return channelDeviceAttribute.getDevice();};
const char * getAttribute(void) const {return channelDeviceAttribute.getAttribute();};
const char * getHostName(void) const {return channelRegalia.hostName;};
bool isConnected(void) const {return channelRegalia.connectFlag;};
epicsTimeStamp getTimeStamp(void) const{return ts;}
short getAlarmStatus(void) const{return alarmStatus;}
short getAlarmSeverity(void) const{return alarmSeverity;}
string getAlarmStatusAsString(void) const{
if (alarmStatus>-1 && alarmStatus<ALARM_STATUS_STRING_LENGTH) {
return (string) epicsAlarmConditionStrings[alarmStatus];}
else {
cout << "alarmStatusValue=" << alarmStatus << " is not within the valid range of 0-3!" << endl;
return (string) "ALARM_UNKNOWN";
}
}
string getAlarmSeverityAsString(void) const{
if (alarmSeverity>-1 && alarmSeverity<ALARM_SEVERITY_STRING_LENGTH) {
return (string) epicsAlarmSeverityStrings[alarmSeverity];}
else {
cout << "alarmStatusSeverity=" << alarmSeverity << " is not within the valid range of 0-21!" << endl;
return (string) "SEVERITY_UNKNOWN";
}
}
unsigned short getAccessRead(void) const{return channelRegalia.accessRead;};
unsigned short getAccessWrite(void) const{return channelRegalia.accessWrite;};
//Reserved
unsigned int getBeamEventNo(void) const {return beamEventNo;};
chid getChannelID(void) const {return channelRegalia.channelID;};
ChannelRegalia getChannelRegalia(void) const {return channelRegalia;};
ca_client_context * getClientContext(void) const {return ccc;};
unsigned int getGroupHandle(void) const {return groupHandle;};
unsigned int getHandle(void) const {return handle;};
const char * getPV(void) const {return pv.c_str();};
const char * getPVAlias(void) const {return pvAlias.c_str();};
int getStatus(void) const {return status;};
void * getUsrArgs(void) const {return usrArgs;};
chtype getDataType(void) const {return dataType;};
chtype getDbrDataType(void) const {return dbrDataType;};
CAFENUM::DBR_TYPE getCafeDbrType(void) const {return cafeDbrType;};
db_access_val * getCtrlBuffer(void) const {return ctrlBuffer;};
db_access_val * getDataBuffer(void) const {return dataBuffer;};
db_access_val * getPutBuffer(void) const {return putBuffer;};
int getPVDataHolder(PVDataHolder &) const ;
int getPVCtrlHolder(PVCtrlHolder &) const ;
//bool getRule(void) const {return rule;};
//RequestPolicy
ChannelGetCacheWaitPolicy getChannelGetCacheWaitPolicy(void) const { return channelGetCacheWaitPolicy;};
ChannelGetActionWhenMonitorPolicy getChannelGetActionWhenMonitorPolicy(void) const { return channelGetActionWhenMonitorPolicy;}
ChannelTimeoutPolicy getChannelTimeoutPolicyGet (void) const {return channelTimeoutPolicyGet;};
ChannelRequestPolicy getChannelRequestPolicyGet (void) const {return channelRequestPolicyGet;};
ChannelRequestStatus getChannelRequestStatusGet (void) const {return channelRequestStatusGet;};
ChannelRequestPolicy getChannelRequestPolicyGetCtrl (void) const {return channelRequestPolicyGetCtrl;};
ChannelRequestStatus getChannelRequestStatusGetCtrl (void) const {return channelRequestStatusGetCtrl;};
ChannelRequestStatus getChannelRequestStatusGetSTSACK (void) const {return channelRequestStatusGetSTSACK;};
ChannelRequestStatus getChannelRequestStatusGetClassName (void) const {return channelRequestStatusGetClassName;};
ChannelTimeoutPolicy getChannelTimeoutPolicyPut (void) const {return channelTimeoutPolicyPut;};
ChannelRequestPolicy getChannelRequestPolicyPut (void) const {return channelRequestPolicyPut;};
ChannelRequestStatus getChannelRequestStatusPut (void) const {return channelRequestStatusPut;};
ChannelRequestDataTypePolicy getChannelRequestDataTypePolicy(void) const { return channelRequestDataTypePolicy;};
ChannelRequestMetaData getChannelRequestMetaData(void) const {return channelRequestMetaData;}; //0
ChannelRequestMetaDataClient getChannelRequestMetaDataClient(void) const {return channelRequestMetaDataClient;}; //-1
ChannelRequestMetaData getChannelRequestMetaCtrl(void) const {return channelRequestMetaCtrl;}; //0
ChannelRequestMetaDataClient getChannelRequestMetaCtrlClient(void) const {return channelRequestMetaCtrlClient;}; //-1
ChannelRequestMetaData getChannelRequestMetaPrimitive(void) const {return channelRequestMetaPrimitive;}; //0
//ChannelRequestMetaDataRepository getChannelRequestMetaDataRepository (void) const {return channelRequestMetaDataRepository;}; //1
//ChannelRequestMetaDataRepository getChannelRequestMetaCtrlRepository (void) const {return channelRequestMetaCtrlRepository;}; //1
//ChannelRequestMetaDataRepository getChannelRequestMetaSTSACKRepository(void) const {return channelRequestMetaSTSACKRepository;}; //1
//ChannelRequestMetaDataRepository getChannelRequestMetaPrimitiveRepository(void) const {return channelRequestMetaPrimitiveRepository;}; //1
////MonitorPolicy getMonitorPolicy(void) const {return mpBase;};
vector<MonitorPolicy> getMonitorPolicyVector(void) const {return mpV;};
vector<MonitorPolicy> getMonitorPolicyInWaitingVector(void) const {return mpInWaitingV;};
vector<string> getMonitorAction(void) const {return monitorAction;};
bool getHasNewData(void) const {return hasNewData;};
};
#endif // CONDUIT_H

View File

@@ -0,0 +1,488 @@
///
/// \file conduitConnectionHandlerArgs.h
/// \author Jan Chrin, PSI
/// \date November 2014
/// \version CAFE 1.0.0
///
#ifndef CONDUITCONNECTIONHANDLERARGS_H
#define CONDUITCONNECTIONHANDLERARGS_H
#include <cstdio>
#include <conduit.h>
#include <statusCodes.h>
using namespace std;
/**
* Friend to Conduit/CAFEGroup records the connection_handler_args struct from callback fns
* in hash table
*/
struct change_connectionHandlerArgs
{
#define __METHOD__ "change_connectionHandlerArgs"
change_connectionHandlerArgs (const struct connection_handler_args & new_connectionHandlerArgs):
new_connectionHandlerArgs(new_connectionHandlerArgs){}
void operator() (Conduit& c) {
chtype nativeDataType = ca_field_type(new_connectionHandlerArgs.chid);
c.channelRegalia.connectionState=new_connectionHandlerArgs.op;
// Data type code will be one of DBF_. The constant TYPENOTCONN=-1 is
// returned if the channel is not connected
// but we do not overwrite it upon disconnect.
//connectFlag
if (new_connectionHandlerArgs.op == CA_OP_CONN_UP){
//cout << " change_connectionHandlerArgs: bytesize UP " << c.channelRequestMetaData.byteSize << endl;
//channelRegalia
c.channelRegalia.nelem = ca_element_count(new_connectionHandlerArgs.chid);
c.channelRegalia.connectFlag = true;
c.channelRegalia.hostName = (const char *) ca_host_name (new_connectionHandlerArgs.chid);
if (c.channelRegalia.channelID != new_connectionHandlerArgs.chid) {
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
cout << "Internal CAFE WARNING for handle : " << c.handle << endl;
cout << "Channel ID has changed from " << c.channelRegalia.channelID
<< " to " << new_connectionHandlerArgs.chid << " " << endl;
cout << "This is a rare occurence and happens when the ca message buffer " << endl;
cout << "is flushed ahead of schedule (does that when full) and this callback is " << endl;
cout << "consequently activated before channel ID is written to the hash table " << endl;
c.channelRegalia.channelID = new_connectionHandlerArgs.chid;
}
//Data type code will be one of DBF_. The constant TYPENOTCONN=-1 is
//returned if the channel is not connected.
//Does not get overwritten on channel disconnection
c.channelRegalia.dataType = nativeDataType;
// DATA BUFFER ------------------------------------------------------------------
// data buffer CLIENT
// Check if c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN or not!
if (c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN ) {
c.channelRequestMetaDataClient.channelID = new_connectionHandlerArgs.chid;
c.channelRequestMetaDataClient.nelem = c.channelRegalia.nelem;
c.channelRequestMetaDataClient.nelemCache = c.channelRegalia.nelem;
c.channelRequestMetaDataClient.dataType = nativeDataType;
//cafeDbrType first filled with CAFENUM:DBR_TIME on initialization
//but will be overwritten by whatever the client needs
switch (c.channelRequestMetaDataClient.cafeDbrType)
{
case CAFENUM::DBR_TIME:
c.channelRequestMetaDataClient.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
break;
case CAFENUM::DBR_STS:
c.channelRequestMetaDataClient.dbrDataType = dbf_type_to_DBR_STS(nativeDataType);
break;
case CAFENUM::DBR_PRIMITIVE:
c.channelRequestMetaDataClient.dbrDataType = dbf_type_to_DBR(nativeDataType);
break;
default:
c.channelRequestMetaDataClient.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
c.channelRequestMetaDataClient.cafeDbrType = CAFENUM::DBR_TIME;
break;
}
//What client is actutally requesting
c.channelRequestMetaDataClient.byteSize=dbr_size_n(
c.channelRequestMetaDataClient.dbrDataType,
//dbf_type_to_DBR_TIME(nativeDataType),
c.channelRequestMetaDataClient.nelem);
}
//data Buffer requested by Cafe
c.channelRequestMetaData.channelID = new_connectionHandlerArgs.chid;
c.channelRequestMetaData.nelem = c.channelRegalia.nelem;
c.channelRequestMetaData.nelemCache = c.channelRegalia.nelem;
c.channelRequestMetaData.dataType = nativeDataType;
//cafeDbrType first filled with CAFENUM:DBR_TIME on initialization
//cafeDbrType can only be overwritten by an explicit method invocation
switch (c.channelRequestMetaData.cafeDbrType)
{
case CAFENUM::DBR_TIME:
c.channelRequestMetaData.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
break;
case CAFENUM::DBR_STS:
c.channelRequestMetaData.dbrDataType = dbf_type_to_DBR_STS(nativeDataType);
break;
case CAFENUM::DBR_PRIMITIVE:
c.channelRequestMetaData.dbrDataType = dbf_type_to_DBR(nativeDataType);
break;
default:
c.channelRequestMetaData.dbrDataType = dbf_type_to_DBR_TIME(nativeDataType);
c.channelRequestMetaData.cafeDbrType = CAFENUM::DBR_TIME;
break;
}
// CTRL BUFFER ------------------------------------------------------------------
//No of elements for Ctrl Buffers
unsigned int nelem_ctrl_buffer=1;
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_CTRL_BUFFER) {
nelem_ctrl_buffer = DEFAULT_NELEM_FOR_CTRL_BUFFER;
}
else {
nelem_ctrl_buffer = c.channelRegalia.nelem;
}
//ctrl data CLIENT
//Ctrl data requested by Client
if (c.channelRegalia.cafeConnectionState == ICAFE_CS_NEVER_CONN ) {
c.channelRequestMetaCtrlClient.channelID = new_connectionHandlerArgs.chid;
c.channelRequestMetaCtrlClient.nelem = c.channelRegalia.nelem; //nelem_ctrl_buffer;
c.channelRequestMetaCtrlClient.nelemCache = c.channelRegalia.nelem;
c.channelRequestMetaCtrlClient.dataType = nativeDataType;
//cafeDbrType first filled with CAFENUM:DBR_CTRL on initialization
//but will be overwritten by whatever the client needs
switch (c.channelRequestMetaCtrlClient.cafeDbrType)
{
case CAFENUM::DBR_CTRL:
c.channelRequestMetaCtrlClient.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
break;
case CAFENUM::DBR_GR:
c.channelRequestMetaCtrlClient.dbrDataType = dbf_type_to_DBR_GR (nativeDataType);
break;
default:
c.channelRequestMetaCtrlClient.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
c.channelRequestMetaCtrlClient.cafeDbrType = CAFENUM::DBR_CTRL;
break;
}
c.channelRequestMetaCtrlClient.byteSize=dbr_size_n(
c.channelRequestMetaCtrlClient.dbrDataType,c.channelRequestMetaCtrlClient.nelem);
}
//ctrl Data requested by Cafe
c.channelRequestMetaCtrl.channelID = new_connectionHandlerArgs.chid;
c.channelRequestMetaCtrl.nelem = nelem_ctrl_buffer;
c.channelRequestMetaCtrl.nelemCache = nelem_ctrl_buffer;
c.channelRequestMetaCtrl.dataType = nativeDataType;
//cafeDbrType first filled with CAFENUM:DBR_CTRL on initialization
//cafeDbrType can only be overwritten by an explicit method invocation
switch (c.channelRequestMetaCtrl.cafeDbrType)
{
case CAFENUM::DBR_CTRL:
c.channelRequestMetaCtrl.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
break;
case CAFENUM::DBR_GR:
c.channelRequestMetaCtrl.dbrDataType = dbf_type_to_DBR_GR (nativeDataType);
break;
default:
c.channelRequestMetaCtrl.dbrDataType = dbf_type_to_DBR_CTRL(nativeDataType);
c.channelRequestMetaCtrl.cafeDbrType = CAFENUM::DBR_CTRL;
break;
}
// STSACK BUFFER ------------------------------------------------------------------
//No of elements for STSACK Buffers
unsigned int nelem_stsack_buffer;
if ( c.channelRegalia.nelem > MAX_NELEM_FOR_STSACK_BUFFER) {
nelem_stsack_buffer = DEFAULT_NELEM_FOR_STSACK_BUFFER;
}
else {
nelem_stsack_buffer = c.channelRegalia.nelem;
}
//STSACK Buffer Repository
c.channelRequestMetaSTSACK.channelID = new_connectionHandlerArgs.chid;
c.channelRequestMetaSTSACK.nelem = nelem_stsack_buffer;
c.channelRequestMetaSTSACK.nelemCache = nelem_stsack_buffer;
c.channelRequestMetaSTSACK.dataType = DBR_STRING;
c.channelRequestMetaSTSACK.dbrDataType = DBR_STSACK_STRING;
c.channelRequestMetaSTSACK.cafeDbrType = CAFENUM::DBR_STSACK;
//PRIMITIVE Buffer Repository
c.channelRequestMetaPrimitive.channelID = new_connectionHandlerArgs.chid;
c.channelRequestMetaPrimitive.nelem = c.channelRegalia.nelem;
c.channelRequestMetaPrimitive.dataType = nativeDataType;;
c.channelRequestMetaPrimitive.dbrDataType= dbf_type_to_DBR(nativeDataType);
c.channelRequestMetaPrimitive.cafeDbrType= CAFENUM::DBR_PRIMITIVE;
///////////////////////////////////////////////////////////////////////////
if ( c.channelRegalia.nelem>1) {
double tout= ((unsigned int) (c.channelRegalia.nelem*0.000001)); // 1 sec per million
c.channelRequestDataTypePolicy.setRequestKind(CAFENUM::LOWEST_DATATYPE);
c.channelTimeoutPolicyGet.setTimeout(std::max(DEFAULT_TIMEOUT_PEND_IO_WF , tout));
c.channelTimeoutPolicyPut.setTimeout(std::max(DEFAULT_TIMEOUT_PEND_IO_WF , tout));
c.channelTimeoutPolicyGet.setDefaultTimeout(DEFAULT_TIMEOUT_PEND_IO_WF);
c.channelTimeoutPolicyPut.setDefaultTimeout(DEFAULT_TIMEOUT_PEND_IO_WF);
}
c.channelRegalia.cafeConnectionState = ICAFE_CS_CONN;
c.status = ICAFE_CA_OP_CONN_UP;
}
else {
//nativeType not known on disconnect!!
//Also callback done
c.channelRequestStatusGet.setCallbackKind(false, true); //fake completion
c.channelRequestStatusPut.setCallbackKind(false, true); //fake completion
c.channelRegalia.cafeConnectionState =ICAFE_CS_DISCONN;
c.channelRegalia.connectFlag = false;
c.status = ICAFE_CA_OP_CONN_DOWN;
}
}
private:
connection_handler_args new_connectionHandlerArgs;
#undef __METHOD__
};
/**
* Friend to Conduit/CAFEGroup permitting fast modification to the ctrlBuffer
* This is the ctrlBuffer for _CTRL data requested through ca_get
*/
struct change_dataBufferSize_CTRL
{
#define __METHOD__ "change_dataBufferSize_CTRL"
change_dataBufferSize_CTRL (const chtype & new_ctrlTypeBuffer): new_ctrlTypeBuffer(new_ctrlTypeBuffer){}
void operator() (Conduit& c) {
// Free buffer on re-connection
// Check Byte size first!!!
bool allocateMemory=false ;
if(c.ctrlBuffer==NULL) {
allocateMemory=true;
}
else if ( dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) > c.channelRequestMetaCtrl.getByteSize() ) {
cout << "ctrlBuffer already exists= " << c.ctrlBuffer << " for channel " << c.pv
<< " with handle " << c.handle << endl;
cout << "Freeing and reallocating ctrlBuffer" << endl;
free(c.ctrlBuffer);
allocateMemory=true;
}
if (allocateMemory) {
//cout << "sizeof c.ctrlBuffer " << dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) << endl;
c.ctrlBuffer = (db_access_val *) malloc ( dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem()) );
c.channelRequestMetaCtrl.byteSize=dbr_size_n(new_ctrlTypeBuffer,c.channelRequestMetaCtrl.getNelem());
}
if (c.ctrlBuffer==0){
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
printf ("Exiting CAFE");
}
}
private:
chtype new_ctrlTypeBuffer;
#undef __METHOD__
};
/**
* Friend to CAFEConduit/CAFEGroup permitting fast modification to the dataBuffer of type DBR (putBuffer)
* This is used in ca_put methods when input data that is not already in native data type is thus converted
*/
struct change_dataBufferSize_PRIMITIVE
{
#define __METHOD__ "change_dataBufferSize_PRIMITIVE"
change_dataBufferSize_PRIMITIVE (const chtype & new_dataTypeBufferNative): new_dataTypeBufferNative(new_dataTypeBufferNative){}
void operator() (Conduit& c) {
bool allocateMemory=false ;
if(c.putBuffer==NULL) {
allocateMemory=true;
}
else if ( dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
c.channelRequestMetaPrimitive.getNelem())
> c.channelRequestMetaPrimitive.getByteSize() ) {
cout << "putBuffer already exists= " << c.putBuffer << " for channel " << c.pv
<< " with handle " << c.handle << endl;
cout << "Freeing and reallocating putBuffer" << endl;
free(c.putBuffer);
allocateMemory=true;
}
if (allocateMemory) {
//cout << "sizeof c.putBuffer " << dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
// c.channelRequestMetaPrimitive.getNelem()) << endl;
c.putBuffer = (db_access_val *) malloc (dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
c.channelRequestMetaPrimitive.getNelem()));
c.channelRequestMetaPrimitive.byteSize
=dbr_size_n(c.channelRequestMetaPrimitive.getDbrDataType(),
c.channelRequestMetaPrimitive.getNelem());
}
if (c.putBuffer==0){
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
printf ("Exiting CAFE");
exit(0);
}
}
private:
chtype new_dataTypeBufferNative;
#undef __METHOD__
};
/**
* Friend to CAFEConduit/CAFEGroup permitting fast modification to the ctrlBuffer
* This is the ctrlBuffer for _CTRL data requested through ca_get
*/
struct change_dataBufferSize_STSACK
{
#define __METHOD__ "change_dataBufferSize_STSACK"
change_dataBufferSize_STSACK (){}
void operator() (Conduit& c) {
bool allocateMemory=false ;
if(c.stsackBuffer==NULL) {
allocateMemory=true;
}
else if ( dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
c.channelRequestMetaSTSACK.getNelem())
> c.channelRequestMetaSTSACK.getByteSize() ) {
cout << "stsackBuffer already exists= " << c.stsackBuffer << " for channel " << c.pv
<< " with handle " << c.handle << endl;
cout << "Freeing and reallocating putBuffer" << endl;
free(c.stsackBuffer);
allocateMemory=true;
}
if (allocateMemory) {
//cout << "sizeof c.stsackBuffer " << dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
// c.channelRequestMetaSTSACK.getNelem()) << endl;
c.stsackBuffer = (db_access_val *) malloc (dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
c.channelRequestMetaSTSACK.getNelem()));
c.channelRequestMetaSTSACK.byteSize
=dbr_size_n(c.channelRequestMetaSTSACK.getDbrDataType(),
c.channelRequestMetaSTSACK.getNelem());
}
}
#undef __METHOD__
};
/**
* Friend to CAFEConduit/CAFEGroup permitting fast modification to the dataBuffer of type DBR_TIME (dataBuffer)
* This is the main dataBuffer for data requested through ca_get
*/
struct change_dataBufferSize_TIME
{
#define __METHOD__ "change_dataBufferSize_PRIMITIVE"
change_dataBufferSize_TIME (const chtype & new_dataTypeBuffer): new_dataTypeBuffer(new_dataTypeBuffer){}
void operator() (Conduit& c) {
// Free buffer on re-connection
// Check Byte size first!!!
bool allocateMemory=false ;
if(c.dataBuffer==NULL) {
allocateMemory=true;
}
else if ( dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) > c.channelRequestMetaData.getByteSize() ) {
cout << "dataBuffer already exists= " << c.dataBuffer << " for channel " << c.pv
<< " with handle " << c.handle << endl;
cout << "Freeing and reallocating dataBuffer" << endl;
cout << dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) << " VERSUS "
<< c.channelRequestMetaData.getByteSize() << endl;
free(c.dataBuffer);
allocateMemory=true;
}
if (allocateMemory) {
//cout << "sizeof c.dataBuffer " << dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) << endl;
c.dataBuffer = (db_access_val *) malloc ( dbr_size_n(new_dataTypeBuffer,c.channelRegalia.getNelem()) );
c.channelRequestMetaData.byteSize=dbr_size_n(new_dataTypeBuffer,c.channelRequestMetaData.getNelem());
}
if (c.dataBuffer==NULL){
cout << __FILE__ << "/" << __LINE__ << "/" << __METHOD__ << endl;
printf ("Virtual memory exhausted for channel %s ", ca_name(c.channelID));
printf ("Exiting CAFE");
exit(0);
}
}
private:
chtype new_dataTypeBuffer;
#undef __METHOD__
};
/**
* Friend to CAFEConduit/CAFEGroup - releases resources
*/
struct free_dataBuffers
{
free_dataBuffers (){}
void operator() (Conduit& c) {
//cout << "c.handle=" << c.handle << " " << c.pv << endl;
if(c.dataBuffer) {
free(c.dataBuffer); // _TIME data buffer for ca_get
}
if(c.ctrlBuffer) {
free(c.ctrlBuffer); // _CTRL data buffer for ca_get
}
if(c.stsackBuffer) {
free(c.stsackBuffer); // _STSACK_STRING data buffer for ca_get
}
if(c.putBuffer) {
free(c.putBuffer); // data buffer for ca_put
}
}
};
#endif // CONDUITCONNECTIONHANDLERARGS_H

File diff suppressed because it is too large Load Diff

794
include/conduitFriends.h Normal file
View File

@@ -0,0 +1,794 @@
///
/// \file conduitFriends.h
/// \author Jan Chrin, PSI
/// \date November 2014
/// \version CAFE 1.0.0
///
#ifndef CONDUITFRIENDS_H
#define CONDUITFRIENDS_H
#include <cstdio>
#include <conduit.h>
#include <statusCodes.h>
using namespace std;
/**
* Friend to Conduit/CAFEGroup permitting fast modification to STS recorded in hash table
*/
struct change_alarmStatus
{
change_alarmStatus (const dbr_short_t & new_alarmStatus): new_alarmStatus(new_alarmStatus){}
void operator() (Conduit& c) {
///////////////////////////////////////////////////////////////////////////
c.alarmStatus = new_alarmStatus;
///////////////////////////////////////////////////////////////////////////
}
private:
dbr_short_t new_alarmStatus;
};
struct change_alarmSeverity
{
change_alarmSeverity (const dbr_short_t & new_alarmSeverity): new_alarmSeverity(new_alarmSeverity){}
void operator() (Conduit& c) {
///////////////////////////////////////////////////////////////////////////
c.alarmSeverity = new_alarmSeverity;
///////////////////////////////////////////////////////////////////////////
}
private:
dbr_short_t new_alarmSeverity;
};
struct change_epicsTimeStamp
{
change_epicsTimeStamp (const epicsTimeStamp & new_epicsTimeStamp): new_epicsTimeStamp(new_epicsTimeStamp){}
void operator() (Conduit& c) {
///////////////////////////////////////////////////////////////////////////
c.ts = new_epicsTimeStamp;
//Do this to prevent overflow error in epicsTime time(ts) routines!
//This bad number can occur in timeouts
if(c.ts.nsec>1000000000) {c.ts.nsec=0;}
///////////////////////////////////////////////////////////////////////////
}
private:
epicsTimeStamp new_epicsTimeStamp;
};
/**
* Friend to Conduit/CAFEGroup permitting fast modification to access rights state recorded in hash table
*/
struct change_accessRead
{
change_accessRead (const unsigned int & new_accessRead): new_accessRead(new_accessRead){}
void operator() (Conduit& c) {
///////////////////////////////////////////////////////////////////////////
c.channelRegalia.accessRead = new_accessRead;
///////////////////////////////////////////////////////////////////////////
}
private:
unsigned int new_accessRead;
};
/**
* Friend to Conduit/CAFEGroup permitting fast modification to access rights state recorded in hash table
*/
struct change_accessWrite
{
change_accessWrite (const unsigned int & new_accessWrite): new_accessWrite(new_accessWrite){}
void operator() (Conduit& c) {
///////////////////////////////////////////////////////////////////////////
c.channelRegalia.accessWrite = new_accessWrite;
///////////////////////////////////////////////////////////////////////////
}
private:
unsigned int new_accessWrite;
};
/**
* Friend toConduit/CAFEGroup permitting the access_rights_handler_args struct from callback fns
* to be recorded in hash table
*/
struct change_accessRightsHandlerArgs
{
change_accessRightsHandlerArgs (const struct access_rights_handler_args & new_accessRightsHandlerArgs):
new_accessRightsHandlerArgs(new_accessRightsHandlerArgs){}
void operator() (Conduit& c) {
///////////////////////////////////////////////////////////////////////////
c.channelRegalia.accessRead = new_accessRightsHandlerArgs.ar.read_access;
c.channelRegalia.accessWrite= new_accessRightsHandlerArgs.ar.write_access;
///////////////////////////////////////////////////////////////////////////
}
private:
access_rights_handler_args new_accessRightsHandlerArgs;
};
/**
* Friend to Conduit/CAFEGroup records the channelRegalia class members in hash table
*/
struct change_channelDeviceAttribute
{
change_channelDeviceAttribute (const ChannelDeviceAttribute & new_channelDeviceAttribute):
new_channelDeviceAttribute(new_channelDeviceAttribute){}
void operator() (Conduit& c) {c.channelDeviceAttribute = new_channelDeviceAttribute;}
private:
ChannelDeviceAttribute new_channelDeviceAttribute;
};
/**
* Friend to Conduit/CAFEGroup records the channelID in hash table
*/
struct change_channelID
{
change_channelID (const chid & new_channelID): new_channelID(new_channelID){}
void operator() (Conduit& c) {
c.channelRegalia.channelID=new_channelID;
c.channelID=new_channelID;
}
private:
chid new_channelID;
};
/**
* Friend to Conduit records the channelGetActionWhenMonitorPolicy in hash table
*/
struct change_channelGetActionWhenMonitorPolicy
{
change_channelGetActionWhenMonitorPolicy (
const ChannelGetActionWhenMonitorPolicy & new_channelGetActionWhenMonitorPolicy):
new_channelGetActionWhenMonitorPolicy(new_channelGetActionWhenMonitorPolicy){}
void operator() (Conduit& c) {
//
c.channelGetActionWhenMonitorPolicy = new_channelGetActionWhenMonitorPolicy;
}
private:
ChannelGetActionWhenMonitorPolicy new_channelGetActionWhenMonitorPolicy;
};
/**
* Friend to Conduit records the channelGetCacheWaitPolicy in hash table
*/
struct change_channelGetCacheWaitPolicy
{
change_channelGetCacheWaitPolicy (
const ChannelGetCacheWaitPolicy & new_channelGetCacheWaitPolicy):
new_channelGetCacheWaitPolicy(new_channelGetCacheWaitPolicy){}
void operator() (Conduit& c) {
//
c.channelGetCacheWaitPolicy = new_channelGetCacheWaitPolicy;
}
private:
ChannelGetCacheWaitPolicy new_channelGetCacheWaitPolicy;
};
/**
* Friend to Conduit permitting hasNewData flag to be set in hash table
*/
struct change_hasNewData
{
change_hasNewData (const bool & new_hasNewData): new_hasNewData(new_hasNewData){}
void operator() (Conduit& c) {c.hasNewData = new_hasNewData;}
private:
bool new_hasNewData;
};
/**
* Friend to Conduit/CAFEGroup records the channelRegalia class members in hash table
*/
struct change_channelRegalia
{
change_channelRegalia (const ChannelRegalia & new_channelRegalia): new_channelRegalia(new_channelRegalia){}
void operator() (Conduit& c) {c.channelRegalia = new_channelRegalia;}
private:
ChannelRegalia new_channelRegalia;
};
/**
* Friend to Conduit records the channelRequestDataTypePolicy in hash table
*/
struct change_channelRequestDataTypePolicy
{
change_channelRequestDataTypePolicy (
const ChannelRequestDataTypePolicy & new_channelRequestDataTypePolicy):
new_channelRequestDataTypePolicy(new_channelRequestDataTypePolicy){}
void operator() (Conduit& c) {
//
c.channelRequestDataTypePolicy = new_channelRequestDataTypePolicy;
}
private:
ChannelRequestDataTypePolicy new_channelRequestDataTypePolicy;
};
/**
* Friend to Conduit records the channelRequestMetaCtrl in hash table
*/
struct change_channelRequestMetaCtrl
{
change_channelRequestMetaCtrl (const ChannelRequestMetaData & new_channelData):
new_channelData(new_channelData){}
void operator() (Conduit& c) {
//
c.channelRequestMetaCtrl = new_channelData;
}
private:
ChannelRequestMetaData new_channelData;
};
/**
* Friend to Conduit records the channelRequestMetaCtrlClient in hash table
*/
struct change_channelRequestMetaCtrlClient
{
change_channelRequestMetaCtrlClient (const ChannelRequestMetaDataClient & new_channelData):
new_channelData(new_channelData){}
void operator() (Conduit& c) {
//
c.channelRequestMetaCtrlClient = new_channelData;
}
private:
ChannelRequestMetaDataClient new_channelData;
};
/**
* Friend to Conduit records the channelRequestMetaData in hash table
*/
struct change_channelRequestMetaData
{
change_channelRequestMetaData (const ChannelRequestMetaData & new_channelData):
new_channelData(new_channelData){}
void operator() (Conduit& c) {
//
c.channelRequestMetaData = new_channelData;
}
private:
ChannelRequestMetaData new_channelData;
};
/**
* Friend to Conduit records the channelRequestMetaDataClient in hash table
*/
struct change_channelRequestMetaDataClient
{
change_channelRequestMetaDataClient (const ChannelRequestMetaDataClient & new_channelData):
new_channelData(new_channelData){}
void operator() (Conduit& c) {
//
c.channelRequestMetaDataClient = new_channelData;
}
private:
ChannelRequestMetaDataClient new_channelData;
};
/**
* Friend to Conduit records the channelRequestMetaPrimitive in hash table
*/
struct change_channelRequestMetaPrimitive
{
change_channelRequestMetaPrimitive (const ChannelRequestMetaData & new_channelData):
new_channelData(new_channelData){}
void operator() (Conduit& c) {
//
c.channelRequestMetaPrimitive = new_channelData;
}
private:
ChannelRequestMetaData new_channelData;
};
/**
* Friend to Conduit records the channelRequestPolicyGet in hash table
*/
struct change_channelRequestPolicyGet
{
change_channelRequestPolicyGet (const ChannelRequestPolicy & new_ChannelRequestPolicy):
new_ChannelRequestPolicy(new_ChannelRequestPolicy){}
void operator() (Conduit& c) {
//This does a deep copy!
c.channelRequestPolicyGet = new_ChannelRequestPolicy;
}
private:
ChannelRequestPolicy new_ChannelRequestPolicy;
};
/**
* Friend to Conduit records the channelRequestPolicyGetCtrl in hash table
*/
struct change_channelRequestPolicyGetCtrl
{
change_channelRequestPolicyGetCtrl (const ChannelRequestPolicy & new_ChannelRequestPolicy):
new_ChannelRequestPolicy(new_ChannelRequestPolicy){}
void operator() (Conduit& c) {
//This does a deep copy!
c.channelRequestPolicyGetCtrl = new_ChannelRequestPolicy;
}
private:
ChannelRequestPolicy new_ChannelRequestPolicy;
};
/**
* Friend to Conduit records the channelRequestPolicyPut in hash table
*/
struct change_channelRequestPolicyPut
{
change_channelRequestPolicyPut (const ChannelRequestPolicy & new_ChannelRequestPolicy):
new_ChannelRequestPolicy(new_ChannelRequestPolicy){}
void operator() (Conduit& c) {
//This does a deep copy!
c.channelRequestPolicyPut = new_ChannelRequestPolicy;
}
private:
ChannelRequestPolicy new_ChannelRequestPolicy;
};
/**
* Friend to Conduit records the channelRequestStatusGet in hash table
*/
struct change_channelRequestStatusGet
{
change_channelRequestStatusGet (const ChannelRequestStatus & new_ChannelRequestStatus):
new_ChannelRequestStatus(new_ChannelRequestStatus){}
void operator() (Conduit& c) {
//This does a deep copy!
c.channelRequestStatusGet = new_ChannelRequestStatus;
}
private:
ChannelRequestStatus new_ChannelRequestStatus;
};
/**
* Friend to Conduit records the channelRequestStatusGetCtrl in hash table
*/
struct change_channelRequestStatusGetCtrl
{
change_channelRequestStatusGetCtrl (const ChannelRequestStatus & new_ChannelRequestStatus):
new_ChannelRequestStatus(new_ChannelRequestStatus){}
void operator() (Conduit& c) {
//This does a deep copy!
c.channelRequestStatusGetCtrl = new_ChannelRequestStatus;
}
private:
ChannelRequestStatus new_ChannelRequestStatus;
};
/**
* Friend to Conduit records the channelRequestStatusGetSTSACK in hash table
*/
struct change_channelRequestStatusGetSTSACK
{
change_channelRequestStatusGetSTSACK (const ChannelRequestStatus & new_ChannelRequestStatus):
new_ChannelRequestStatus(new_ChannelRequestStatus){}
void operator() (Conduit& c) {
//This does a deep copy!
c.channelRequestStatusGetSTSACK = new_ChannelRequestStatus;
}
private:
ChannelRequestStatus new_ChannelRequestStatus;
};
/**
* Friend to Conduit records the channelRequestStatusGetClassName in hash table
*/
struct change_channelRequestStatusGetClassName
{
change_channelRequestStatusGetClassName (const ChannelRequestStatus & new_ChannelRequestStatus):
new_ChannelRequestStatus(new_ChannelRequestStatus){}
void operator() (Conduit& c) {
//This does a deep copy!
c.channelRequestStatusGetClassName = new_ChannelRequestStatus;
}
private:
ChannelRequestStatus new_ChannelRequestStatus;
};
/**
* Friend to Conduit records the channelRequestStatusPut in hash table
*/
struct change_channelRequestStatusPut
{
change_channelRequestStatusPut (const ChannelRequestStatus & new_ChannelRequestStatus):
new_ChannelRequestStatus(new_ChannelRequestStatus){}
void operator() (Conduit& c) {
//This does a deep copy!
c.channelRequestStatusPut = new_ChannelRequestStatus;
}
private:
ChannelRequestStatus new_ChannelRequestStatus;
};
/**
* Friend to Conduit records the channelTimeoutPolicyGet in hash table
*/
struct change_channelTimeoutPolicyGet
{
change_channelTimeoutPolicyGet (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
new_channelTimeoutPolicy(new_channelTimeoutPolicy){}
void operator() (Conduit& c) {
//This does a deep copy!
c.channelTimeoutPolicyGet = new_channelTimeoutPolicy;
}
private:
ChannelTimeoutPolicy new_channelTimeoutPolicy;
};
/**
* Friend to Conduit records the channelTimeoutPolicyPut in hash table
*/
struct change_channelTimeoutPolicyPut
{
change_channelTimeoutPolicyPut (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
new_channelTimeoutPolicy(new_channelTimeoutPolicy){}
void operator() (Conduit& c) {
//This does a deep copy!
c.channelTimeoutPolicyPut = new_channelTimeoutPolicy;
}
private:
ChannelTimeoutPolicy new_channelTimeoutPolicy;
};
/**
* Friend to Conduit permitting fast modification to vector<string> monitorAction
* (for CAFE Extensions)
*/
struct change_monitorAction
{
change_monitorAction (string &new_monitorAction): new_monitorAction(new_monitorAction){}
void operator() (Conduit& c) {
c.monitorAction.push_back(new_monitorAction);
}
private:
string new_monitorAction;
};
/**
* Friend to Conduit permitting fast removal of all elements in vector<string> monitorAction
* (for CAFE Extensions)
*/
struct change_monitorActionClear
{
change_monitorActionClear (){}
void operator() (Conduit& c) {
c.monitorAction.clear();
}
};
/**
* Friend to Conduit permitting fast removal of an entry in vector<string> monitorAction
* (for CAFE Extensions)
*/
struct change_monitorActionErase
{
change_monitorActionErase (string &new_monitorAction): new_monitorAction(new_monitorAction){}
void operator() (Conduit& c) {
bool maFound=false;
vector<string>::iterator it;
for (it = c.monitorAction.begin(); it != c.monitorAction.end(); ) {
if( (*it)==new_monitorAction) {
it = c.monitorAction.erase(it);
maFound=true;
}
else {
++it;
}
}
if (!maFound) {
cout << "monitorAction " << new_monitorAction << " NOT FOUND! " << endl;
cout << "Could not delete entry!" << endl;
}
}
private:
string new_monitorAction;
};
/**
* Friend to Conduit permitting fast removal of an entry in the monitorPolicy vector
*
*/
struct change_monitorPolicyErase
{
change_monitorPolicyErase (unsigned int & new_evid): new_evid(new_evid){}
void operator() (Conduit& c) {
bool evidFound=false;
vector<MonitorPolicy>::iterator it;
//Iterate
for (it = c.mpV.begin(); it != c.mpV.end();) {
//cout << "ID " << (*it).getID() << " " << endl;
if ( (*it).getID()==new_evid) {
evidFound=true;
it=(c.mpV).erase(it);
break;
}
else {
++it;
}
}
if (!evidFound) {
cout << "evid " << new_evid << " NOT FOUND! " << endl;
cout << "Could not delete entry!" << endl;
}
}
private:
unsigned int new_evid;
};
/**
* Friend to Conduit permitting fast insertion into the monitorPolicy vector
*
*/
struct change_monitorPolicyInsert
{
change_monitorPolicyInsert (class MonitorPolicy & new_monitorPolicy): new_monitorPolicy(new_monitorPolicy){}
void operator() (Conduit& c) {
//insert into mpV
(c.mpV).push_back(new_monitorPolicy);
if (c.mpV.size()>(MAX_NO_MONITORS_PER_CHANNEL/2)) {
cout << "HEY DUDE - YOU NOW HAVE " << c.mpV.size() << " MONITORS " << endl;
cout << "for channel " << c.pv << " with handle " << c.handle << endl;
}
}
private:
class MonitorPolicy new_monitorPolicy;
};
/**
* Friend to Conduit permitting fast removal of an entry in the monitorPolicyInWaiting vector
*
*/
struct change_monitorPolicyInWaitingErase
{
change_monitorPolicyInWaitingErase (unsigned int & new_evid): new_evid(new_evid){}
void operator() (Conduit& c) {
bool evidFound=false;
vector<MonitorPolicy>::iterator it;
//Iterate
for (it = c.mpInWaitingV.begin(); it != c.mpInWaitingV.end(); ++it) {
if ( (*it).getID()==new_evid) {
evidFound=true;
(c.mpInWaitingV).erase(it);
break;
}
}
if (!evidFound) {
cout << "evid " << new_evid << " NOT FOUND! " << endl;
cout << "Could not delete entry!" << endl;
}
}
private:
unsigned int new_evid;
};
/**
* Friend to Conduit permitting fast insertion into the monitorPolicyInWaiting vector
*
*/
struct change_monitorPolicyInWaitingInsert
{
change_monitorPolicyInWaitingInsert (class MonitorPolicy & new_monitorPolicy): new_monitorPolicy(new_monitorPolicy){}
void operator() (Conduit& c) {
//insert into mpnWaitingV
(c.mpInWaitingV).push_back(new_monitorPolicy);
if (c.mpInWaitingV.size()>6) {
cout << "HEY DUDE - YOU NOW HAVE " << c.mpInWaitingV.size()
<< " MONITORS IN WAITING" << endl;
cout << "for channel " << c.pv << " with handle " << c.handle << endl;
}
}
private:
class MonitorPolicy new_monitorPolicy;
};
/**
* Friend to Conduit/CAFEGroup permitting fast modification to pvAlias in hash table
*/
struct change_pvAlias
{
change_pvAlias (const char * & new_pvAlias): new_pvAlias(new_pvAlias){}
void operator() (Conduit& c) {
c.pvAlias = new_pvAlias;
//No longer supporting c,pvd
///strcpy(c.pvd.pvAlias, new_pvAlias);
//strcpy(c.pvc.pvAlias, new_pvAlias);
}
private:
const char * new_pvAlias;
};
/**
* Friend to Conduit permitting pyCafeFlag flag to be set in hash table
*
struct change_pyCafeFlag
{
change_pyCafeFlag (const bool & new_pyCafeFlag): new_pyCafeFlag(new_pyCafeFlag){}
void operator() (Conduit& c) {c.pyCafeFlag = new_pyCafeFlag;}
private:
bool new_pyCafeFlag;
};
*/
/**
* Friend to Conduit/CAFEGroup permitting fast modification to the status as given by the last method invocation
*/
struct change_status
{
change_status (const int & new_status): new_status(new_status){}
void operator() (Conduit& c) {c.status = new_status;}
private:
int new_status;
};
/**
* Friend to Conduit/CAFEGroup permitting fast modification to the usrArgs as given by the last method invocation
*/
struct change_usrArgs
{
change_usrArgs (const unsigned int & new_usrArgs): new_usrArgs(new_usrArgs){}
void operator() (Conduit& c) {c.usrArgs = (void *) new_usrArgs;}
private:
unsigned int new_usrArgs;
};
/**
* friend to Conduit/CAFEGroup permitting the groupHandle to which the channel belongs to be recorded in hash table
*/
struct change_groupHandle
{
change_groupHandle (const unsigned int & new_groupHandle): new_groupHandle(new_groupHandle){}
void operator() (Conduit& c) {c.groupHandle = new_groupHandle;}
private:
unsigned int new_groupHandle;
};
#endif // CONDUITFRIENDS_H

171
include/conduitGroup.h Normal file
View File

@@ -0,0 +1,171 @@
///
/// \file conduitGroup.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef CONDUITGROUP_H
#define CONDUITGROUP_H
#include <iostream>
#include <cadef.h>
#include <hashConduit.h>
#include <statusCodes.h>
/**
* Principal constructor has:\n
* \param _groupName assigned group name
* \param _ccc ca_client_context
* \param _groupID unique group identifier (CA_SYNC_GID)
* \param _nMember number of members in group
* \param _memberCC CAFEConduit object representing each group member
* \param _groupStatus groupStatus: error indicates >0 members have an error
*/
class ConduitGroup
{
friend struct change_channelTimeoutPolicySGPut;
friend struct change_channelTimeoutPolicySGGet;
friend struct change_timeout_sg_pend_io;
friend struct change_sg_rule;
friend class Connect;
private:
static unsigned int groupHandleNext;
unsigned int nMember;
ca_client_context * ccc;
double timeout_sg_pend_io;
ChannelTimeoutPolicy channelTimeoutPolicySGGet;
ChannelTimeoutPolicy channelTimeoutPolicySGPut;
union db_access_val ** dataBuffer;
friend std::ostream& operator<<(std::ostream& os, const ConduitGroup& e)
{
os<< "handle=" << e.groupHandle<<" name=" << e.groupName<< " nMember=" << e.nMember << std::endl;
return os;
};
public:
std::string groupName;
unsigned int groupHandle;
CA_SYNC_GID groupID;
int * mStatus;
bool * mRule;
unsigned int * mHandle;
virtual ~ConduitGroup();
ConduitGroup();
ConduitGroup(const char * _groupName, ca_client_context * _ccc, CA_SYNC_GID _groupID,
unsigned int _nMember, unsigned int * _handle);
int get(void) const;
int put(void) const;
ca_client_context * getClientContext(void) const {return ccc;};
const char * getGroupName(void) const {return groupName.c_str();};
string getGroupNameAsString(void) const {return groupName;};
CA_SYNC_GID getGroupID(void) const {return groupID;};
unsigned int getNMember(void) const {return nMember;};
int * getStatus(void) const {return mStatus;};
bool * getRule(void) const {return mRule;};
bool getRule(unsigned int i) const {return mRule[i];};
unsigned int getGroupHandle(void) const {return groupHandle;};
ChannelTimeoutPolicy getChannelTimeoutPolicySGPut(void) const {return channelTimeoutPolicySGPut;};
ChannelTimeoutPolicy getChannelTimeoutPolicySGGet(void) const {return channelTimeoutPolicySGGet;};
};
/**
* Friend to ConduitGroup permitting fast modification of the rule in group hash table;
* the rule flag only functions within a PVGroup
*/
struct change_sg_rule
{
change_sg_rule (const bool & new_rule, const unsigned int & iMember):
new_rule(new_rule),iMember(iMember){}
void operator() (ConduitGroup& g) {g.mRule[iMember] = new_rule;}
private:
bool new_rule;
unsigned int iMember;
};
/**
* Friend to ConduitGroup permitting fast modification of status in group hash table;
*/
struct change_sg_status
{
change_sg_status (const int & new_status, const unsigned int & iMember):
new_status(new_status),iMember(iMember){}
void operator() (ConduitGroup& g) {
g.mStatus[iMember] = new_status;
}
private:
int new_status;
unsigned int iMember;
};
/**
* friend to ConduitGroup permitting fast modification to \n
* the timeout_sg_pend_event period recorded in ConduitGroup hash table
*/
struct change_timeout_sg_pend_io
{
change_timeout_sg_pend_io (const double & new_timeout_sg_pend_io):
new_timeout_sg_pend_io(new_timeout_sg_pend_io){}
void operator() (ConduitGroup& g) {g.timeout_sg_pend_io = new_timeout_sg_pend_io;}
private:
double new_timeout_sg_pend_io;
};
/**
* Friend to ConduitGroup records the channelTimeoutPolicySGGet in hash table
*/
struct change_channelTimeoutPolicySGGet
{
change_channelTimeoutPolicySGGet (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
new_channelTimeoutPolicy(new_channelTimeoutPolicy){}
void operator() (ConduitGroup & g) {
//This does a deep copy!
g.channelTimeoutPolicySGGet = new_channelTimeoutPolicy;
}
private:
ChannelTimeoutPolicy new_channelTimeoutPolicy;
};
/**
* Friend to ConduitGroup records the channelTimeoutPolicySGPut in hash table
*/
struct change_channelTimeoutPolicySGPut
{
change_channelTimeoutPolicySGPut (const ChannelTimeoutPolicy & new_channelTimeoutPolicy):
new_channelTimeoutPolicy(new_channelTimeoutPolicy){}
void operator() (ConduitGroup & g) {
//This does a deep copy!
g.channelTimeoutPolicySGPut = new_channelTimeoutPolicy;
}
private:
ChannelTimeoutPolicy new_channelTimeoutPolicy;
};
#endif

594
include/connect.h Normal file
View File

@@ -0,0 +1,594 @@
///
/// \file connect.h
/// \author Jan Chrin, PSI
/// \date Release February: 2015
/// \version CAFE 1.0.0
///
#ifndef CONNECT_H
#define CONNECT_H
// generated by autotools
#include <config.h>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <climits>
#include <global.h>
#include <exceptionsHelper.h>
#include <handleHelper.h>
#include <policyHelper.h>
#include <hashConduitGroup.h>
#if HAVE_BOOST_THREAD
#include <boost/thread/thread_only.hpp>
#include <boost/chrono.hpp>
#endif
class Connect
{
protected:
int status;
CAFEStatus cafeStatus;
CAFEStatusSeverity cafeStatusSeverity;
cafeConduit_set::iterator itcs;
cafeGroup_set::iterator itgs;
CAFEDataTypeCode cafeDataTypeCode;
ExceptionsHelper exceptionsHelper;
ChannelCreatePolicy channelCreatePolicy;
PolicyHelper policyHelper;
HandleHelper handleHelper;
Helper helper;
std::string deviceAttributeDeliminator;
bool pyCafeFlag;
//connectCallbacks.cc
static void callbackHandlerAccessRights(struct access_rights_handler_args args);
static void callbackHandlerException (struct exception_handler_args args);
//connect.cpp
int createChannel(unsigned int handle, const char * pv, chid &pCh);
int createHandle(const char * pv, ca_client_context * ccc, unsigned int &handle)
//int createHandle(const char * pv, ca_client_context * ccc, ChannelRequestPolicy channelRequestPolicyPut, unsigned int &handle)
throw (CAFEException_pv);
int contextDestroy();
int contextDestroy(ca_client_context * cctLocal);
unsigned short epicsVersion(unsigned short & major, unsigned short & minor, unsigned short & patch);
//group functions
int createChannelWithinGroup(unsigned int handle, const char * pv, chid &pCh);
int createHandleWithinGroup(const char * pv, ca_client_context * ccc, unsigned int & _handle)
throw (CAFEException_pv);
public:
Connect(){
channelMonitorPolicy.setPolicy(
(ChannelWhenToFlushSendBufferPolicyKind) CAFENUM::FLUSH_AFTER_EACH_CHANNEL_SUBSCRIPTION,
CAFENUM::WITH_FLUSH_IO, DEFAULT_TIMEOUT_PEND_IO);
channelOpenGroupPolicy.setPolicy(
CAFENUM::FLUSH_AFTER_EACH_GROUP_CREATION,
CAFENUM::WITH_PEND_EVENT, DEFAULT_TIMEOUT_SG_PEND_EVENT);
channelOpenPolicy.setPolicy(
CAFENUM::FLUSH_AFTER_EACH_CHANNEL_CREATION,
CAFENUM::WITH_PEND_EVENT, DEFAULT_TIMEOUT_PEND_EVENT);
deviceAttributeDeliminator=DEFAULT_DEVICE_ATTRIBUTE_DELIMINATOR;
#if HAVE_PYTHON_H
pyCafeFlag=true;
#else
pyCafeFlag=false;
#endif
};
//these need to be public
PrintErrorPolicy printErrorPolicy;
ChannelOpenPolicy channelOpenPolicy;
ChannelOpenPolicy channelClosePolicy; //can also use for close
ChannelOpenPolicy channelMonitorPolicy;
ChannelOpenPolicy channelOpenGroupPolicy;
//28 May 2017
ChannelRequestPolicy channelRequestPolicyMasterPut;
ChannelRequestPolicy channelRequestPolicyMasterGet;
ChannelRequestPolicy channelRequestPolicyMasterGetCtrl;
ChannelGetActionWhenMonitorPolicy channelGetActionWhenMonitorPolicyMaster;
//ChannelOpenPolicy getChannelOpenPolicy(){return channelOpenPolicy;}
//ChannelOpenPolicy getChannelClosePolicy(){return channelClosePolicy;}
//ChannelOpenPolicy getChannelMonitorPolicy(){return channelMonitorPolicy;}
//ChannelOpenPolicy getChannelOpenGroupPolicy(){return channelOpenGroupPolicy;}
HandleHelper getHandleHelper() {return handleHelper;}
HandleHelper getInfo() {return handleHelper;}
PolicyHelper getPolicyHelper() {return policyHelper;}
PolicyHelper getPolicy() {return policyHelper;}
unsigned int getNelemClient(unsigned int h){ return handleHelper.getNelemClient(h);}
unsigned int getNelemNative(unsigned int h){ return handleHelper.getNelemNative(h);}
unsigned int getNelemRequest(unsigned int h){ return handleHelper.getNelemRequest(h);}
int getStatus() {return status;}
CAFEStatus getCafeStatus() {return cafeStatus;}
CAFEStatusSeverity getCafeStatusSeverity() {return cafeStatusSeverity;}
int flushNow() {return ca_flush_io();}
int _ca_flush_io(){return ca_flush_io();}
int _ca_poll(){return ca_poll();}
int _ca_pend_io(double t){return ca_pend_io(t);}
int _ca_pend_event(double t){return ca_pend_event(t);}
//connect.cc
bool setPyCafe(bool b){return pyCafeFlag=b;};
bool getPyCafe(){return pyCafeFlag;} ;
int init() throw (CAFEException_init);
int init(ca_preemptive_callback_select select) throw (CAFEException_init);
//std::string
int open(const string pvS, unsigned int &handle) throw (CAFEException_open){
try { open (pvS.c_str(), handle);} catch(CAFEException_open &e) {throw e;};
}
int open(const string pvS, const std::string pvAliasS, unsigned int &handle)
throw (CAFEException_open){
try { open (pvS.c_str(), pvAliasS.c_str(), handle);} catch(CAFEException_open &e) {throw e;};
}
int open(const string *pvArrayS, unsigned int *handleArray, const unsigned int nHandles)
throw (CAFEException_open);
//const char *pv
int open(const char *pv, unsigned int &handle) throw (CAFEException_open);
int open(const char *pv, const char *pvAlias, unsigned int &handle)
throw (CAFEException_open);
int open(const char **pvArray, unsigned int *handleArray, const unsigned int nHandles)
throw (CAFEException_open);
int open(vector<const char *>, vector<unsigned int> &) throw (CAFEException_open);
int open(vector<string>, vector<unsigned int> &) throw (CAFEException_open);
int openV(vector<string> s, vector<unsigned int> &i) throw (CAFEException_open)
{return open(s,i); };
//################################################################################
void openGroupPrepare(){
channelOpenGroupPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
channelOpenGroupPolicy.setWhenToFlushSendBuffer(FLUSH_DESIGNATED_TO_CLIENT);
return;
}
void openMonitorPrepare(){
channelMonitorPolicy.setFlushSendBufferKind(WITH_FLUSH_IO);
channelMonitorPolicy.setWhenToFlushSendBuffer(FLUSH_DESIGNATED_TO_CLIENT);
return;
}
double setOpenDefaultPendTime(double _timeout){
return channelOpenPolicy.setDefaultTimeout(_timeout);
}
double getOpenDefaultPendTime(){
return channelOpenPolicy.getDefaultTimeout();
}
void openGroupNowAndWait(double _timeout){
double dto = channelOpenGroupPolicy.getTimeout();
channelOpenGroupPolicy.setTimeout(_timeout);
channelOpenGroupPolicy.flushSendBufferNow();
//
//reset
channelOpenGroupPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
channelOpenGroupPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
//channelOpenGroupPolicy.setTimeoutToDefault();
channelOpenGroupPolicy.setTimeout(dto);
return;
}
void openMonitorNow(){
channelMonitorPolicy.flushSendBufferNow();
//reset
channelMonitorPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
channelMonitorPolicy.setFlushSendBufferKind(WITH_FLUSH_IO);
return;
}
void openMonitorNowAndWait(double _timeout){
channelMonitorPolicy.setTimeout(_timeout);
channelMonitorPolicy.flushSendBufferNow();
//reset
channelMonitorPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
channelMonitorPolicy.setFlushSendBufferKind(WITH_FLUSH_IO);
return;
}
void openPrepare() {
channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_DESIGNATED_TO_CLIENT);
return;
}
void openNowAndWait(double _timeout) {
double dto = channelOpenPolicy.getTimeout();
channelOpenPolicy.setTimeout(_timeout);
channelOpenPolicy.flushSendBufferNow();
//reset
channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
//channelOpenPolicy.setTimeoutToDefault();
channelOpenPolicy.setTimeout(dto);
return;
}
void openNow() {
channelOpenPolicy.flushSendBufferNow();
channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_NOW);
channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
return;
}
void openNoWait(){
channelOpenPolicy.setFlushSendBufferKind(WITH_PEND_EVENT);
channelOpenPolicy.setWhenToFlushSendBuffer(FLUSH_DESIGNATED_TO_CLIENT);
return;
}
bool initCallbackComplete(vector<unsigned int> hV) {
return initCallbackComplete(&hV[0], hV.size());
}
bool initCallbackComplete(unsigned int * hArray, unsigned int nelem);
//#################################################################################
unsigned int printHandle(unsigned int h){return handleHelper.printHandle(h);};
unsigned int printHandles(void){return handleHelper.printHandles();};
unsigned int printDisconnectedHandles(void){return handleHelper.printDisconnectedHandles();};
unsigned int getDisconnectedHandles(vector<unsigned int> &dhV, vector<string> &pvV)
{return handleHelper.getDisconnectedHandles(dhV, pvV);};
void printCAFEException_pv(CAFEException_pv & e){exceptionsHelper.printCAFEException_pv(e);};
//closeChannel(s) only close within a context
int closeChannels(unsigned int * handleArray, unsigned int nHandles);
int closeChannels(vector<unsigned int> v){
//unsigned int * handleArray = new unsigned int[v.size()];
//int status= closeChannels(handleArray, v.size());
//delete [] handleArray;
//return status;
return closeChannels(&v[0], v.size());
};
int closeChannelsV(vector<unsigned int> v){
//unsigned int * handleArray = new unsigned int[v.size()];
//int status= closeChannels(handleArray, v.size());
//delete [] handleArray;
//return status;
return closeChannels(&v[0], v.size());
};
int close(unsigned int handle);
int closeChannel(unsigned int handle){return close(handle);};
int closeChannels();
int closeChannels(ca_client_context * cctLocal);
int close(){return closeChannels();};
//closeHandle(s) close regardless of context
int closeHandlesV(vector<unsigned int> v){ return closeHandles(&v[0], v.size());}
int closeHandles (vector<unsigned int> v){ return closeHandles(&v[0], v.size());}
int closeHandles(unsigned int * handleArray, unsigned int nHandles);
int closeHandle(unsigned int handle);
int closeHandles();
// Monitors
int monitorStart(unsigned int handle, MonitorPolicy &mp);
int monitorStart(unsigned int handle, unsigned int & monitorID);
int monitorStart(unsigned int handle) {
unsigned int monitorID; return monitorStart(handle, monitorID);
}
int monitorStop (unsigned int handle, MonitorPolicy mp);
int monitorStop (unsigned int handle, unsigned int monitorID);
int monitorStopWithID (unsigned int handle, unsigned int monitorID){
return monitorStop(handle, monitorID);}
int monitorStop (unsigned int handle); //stop all monitors for this handle
int monitorStop ();
int monitorStopAll (){return monitorStop();};
int monitorStop (ca_client_context * ccc);
// Monitors for arrays and vectors
int monitorStart(unsigned int * handleArray, unsigned int nelem) {
int * statusArray = new int[nelem];
MonitorPolicy * mpV = new MonitorPolicy[nelem];
status = monitorStart (handleArray, nelem, statusArray, mpV);
delete [] statusArray; delete [] mpV;
return status;
}
int monitorStart(unsigned int * handleArray, unsigned int nelem, int *statusArray,
MonitorPolicy * mpV);
int monitorStart(unsigned int * handleArray, unsigned int nelem, int *statusArray,
unsigned int * monitorIDArray);
int monitorStart(vector<unsigned int> handleV, vector<int> &statusV,
vector<MonitorPolicy> &mpV);
int monitorStart(vector<unsigned int> handleV, vector<int> &statusV,
vector<unsigned int> &monitorIDV);
int monitorStop (unsigned int * handleArray, unsigned int nelem, int *statusArray);
int monitorStop (vector<unsigned int> handleV, vector<int> &statusV);
int monitorStop(unsigned int * handleArray, unsigned int nelem) {
int * statusArray = new int[nelem];
status = monitorStop (handleArray, nelem, statusArray);
delete [] statusArray;
return status;
}
MonitorPolicy * createMonitorPolicyArray(const unsigned int nmp) {
MonitorPolicy * mpArray = new MonitorPolicy[nmp];
return mpArray;
}
int terminate();
int terminate(ca_client_context * cctLocal);
unsigned int getHandleFromPV(const char * pv) {return handleHelper.getHandleFromPV(pv); }
const char * getPVFromHandle(unsigned int handle){
return handleHelper.getPVFromHandle(handle);
}
unsigned int getHandleFromPVWithinGroup(const char * pv, unsigned int grh) {
return handleHelper.getHandleFromPVWithinGroup(pv, grh); }
bool isEnum(unsigned int handle) {return handleHelper.isEnum(handle);}
bool isValid(unsigned int handle) { for (itcs = cs.begin(); itcs != cs.end(); ++itcs)
{if ((*itcs).getHandle()==handle) {return true;}} return false;}
bool allChannelsConnected() { for (itcs = cs.begin(); itcs != cs.end(); ++itcs)
{if (!(*itcs).isConnected()) {return false;}} return true;}
bool isConnected(unsigned int handle) {
return isChannelConnected(handle);
}
bool isChannelConnected(unsigned int handle){cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {return (*it_handle).isConnected();}
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl; return false;}}
int getChannelInfo(unsigned int handle, ChannelRegalia & channelInfo){
cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {channelInfo=(*it_handle).getChannelRegalia(); return ICAFE_NORMAL;}
else {return ECAFE_INVALID_HANDLE;}
};
chid getChannelID(unsigned int handle){cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {return (*it_handle).getChannelID();}
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl; return NULL;}}
ca_client_context * getClientContext(const char * pvname){
return handleHelper.getContextFromPV(pvname);
}
ca_client_context * getClientContext(unsigned int handle){
return handleHelper.getContextFromHandle(handle);
}
int attachContext(ca_client_context *ccc){
if (ccc != NULL) {
return ca_attach_context(ccc);
} else { return ECAFE_NULLCONTEXT;}
}
int attachContextByPVName(const char * pvname){
ca_client_context * ccc=getClientContext(pvname);
if (ccc != NULL) {
return ca_attach_context(ccc);
} else { return ECAFE_NULLCONTEXT;}
}
int attachContextByHandle(unsigned int handle){
ca_client_context * ccc=getClientContext(handle);
if (ccc != NULL) {
return ca_attach_context(ccc);
} else { return ECAFE_NULLCONTEXT;}
}
//Add these methods for QCafe
int updateAccessRead(unsigned int handle, int ar) {cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {
if ( (*it_handle).getAccessRead() != ar ) {
if(MUTEX){cafeMutex.lock();}
handle_index.modify(it_handle, change_accessRead(ar));
if(MUTEX){cafeMutex.unlock();}
}
return ICAFE_NORMAL;}
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
return ECAFE_INVALID_HANDLE;}
}
int updateAccessWrite(unsigned int handle, int aw) {cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {
if ( (*it_handle).getAccessWrite() != aw ) {
if(MUTEX){cafeMutex.lock();}
handle_index.modify(it_handle, change_accessWrite(aw));
if(MUTEX){cafeMutex.unlock();}
}
return ICAFE_NORMAL;}
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl;
return ECAFE_INVALID_HANDLE;}
}
bool getReadAccess(unsigned int handle){cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {return (bool) (*it_handle).getAccessRead();}
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl; return false;}}
bool getWriteAccess(unsigned int handle){cafeConduit_set_by_handle & handle_index=cs.get<by_handle>();
cafeConduit_set_by_handle::iterator it_handle; it_handle = handle_index.find(handle);
if (it_handle != handle_index.end()) {return (bool) (*it_handle).getAccessWrite();}
else {std::cout<< "Input handle " << handle << " does not exists! " << std::endl; return false;}}
void printStatusMessage(int status) {
string s = getCafeStatus().csi.message(status);
string c = getCafeStatus().csc.message(status);
printf("%s\n",c.c_str());
printf("%s\n",s.c_str());
}
int printStatus(unsigned int handle, int status);
int printStatusIfError(unsigned int handle, int status);
int printStatus(unsigned int * handleArray, unsigned int nelem, int * statusArray);
int printStatusIfError(unsigned int * handleArray, unsigned int nelem, int * statusArray);
int printStatus(vector<unsigned int> handleV, vector<int> statusV);
int printStatusIfError(vector<unsigned int> handleV, vector<int> statusV);
int setPVAlias(unsigned int handle, const char * pv) throw (CAFEException_open);
// GROUP FUNCTIONS
PVDataHolder * getPVData(vector <unsigned int> handleArray);
int collectionDefine(const char * collectionName, vector<string> deviceV);
int collectionDefine(const char * collectionName, vector<const char *> deviceV);
int collectionDefine(const char * collectionName, pv_string_t * deviceArray, unsigned int deviceLength);
int collectionFetch(const char * collectionName, vector<string> &deviceListV);
int collectionFetch(const char * collectionName, vector<const char *> &deviceListV);
int collectionFetch(const char * collectionName,deviceCollection &dC);
vector<deviceCollection> getCollections() const {return deviceCollectionV;};
//To do: Add shared_ptr for this method to ensure memory release
int collectionMemberList(const char * collectionName, boost::shared_ptr<pv_string_t []> &list, unsigned int &listLength);
//int collectionMemberList(const char * collectionName, dbr_string_t * &list, unsigned int &listLength);
//To do: Add shared_ptr for this method to ensure memory release
int collectionList (boost::shared_ptr<pv_string_t []> &clist, unsigned int &listLength);
//int collectionList (dbr_string_t * &clist, unsigned int &listLength);
int collectionMemberList(const char * collectionName, vector<string> &list);
int collectionList (vector<string> &clist);
int devicePositionOrderedMultiMap(const char * collectionName, std::multimap<float, string> &posDev);
int devicePositionMap(const char * collectionName, std::map<float, string> &posDev);
int devicePositionV(const char * collectionName, std::vector<string> &dev, std::vector<float> &pos);
int fetchIndexOfCollectionMember(const char *collectionName, const char * deviceName);
bool isGroup(const char *);
bool isCollection(const char *);
int groupOpen(const char *pv, unsigned int &groupHandle) throw (CAFEException_groupOpen);
int groupOpen(PVGroup &pvgroup, unsigned int &groupHandle) throw (CAFEException_groupOpen);
int groupClose(unsigned int groupHandle);
int groupClose();
int groupCloseAll(){return groupClose(); };
int groupHandleErase();
int groupHandleErase(ca_client_context *ccc);
int groupCombine(const char * newGroupName, const char * groupName1,
const char * groupName2); // PVGroup &pvGroup);
int groupCombine(const char * newGroupName, vector<char *> groupName);// PVGroup &pvGroup);
vector<string> generateChannelList(vector<string> inputStringV) {
return getFromGlobalChannelList(inputStringV);
}
vector<string> getFromGlobalChannelList(vector<string>);
int groupDefine (const char * groupName, const char * collectionName, vector<string> attributeV);
int groupDefine (const char * groupName, const char * collectionName, vector<const char*> attributeV);
int groupDefine (const char * groupName, const char * collectionName,
pv_string_t * attributeArray, unsigned short attributeLength);
int groupDefine (const char * groupName, const char * collectionName, pv_string_t attribute){
pv_string_t aA[1]; strcpy(aA[0], attribute);
return groupDefine(groupName, collectionName, aA, 1);
}
int groupDefine (const char * groupName, vector<string> deviceV, vector<string> attributeV);// PVGroup &pvGroup);
int groupDefine (const char * groupName, vector<const char *> deviceV, vector<const char*> attributeV);
//PVGroup &pvGroup);
int groupDefine (const char * groupName, pv_string_t * deviceArray, unsigned int deviceLength,
pv_string_t * attributeArray, unsigned short attributeLength); //
int groupDefine (const char * groupName, vector<string> pvArrayV); // PVGroup &pvGroup);
int groupDefine (const char * groupName, vector<const char *> pvArrayV); // PVGroup &pvGroup);
int groupDefine (const char * groupName, pv_string_t * pvArray, unsigned int pvArrayLength);
//PVGroup &pvGroup);
//To do: Add shared_ptr for this method to ensure memory release
int groupMemberList(const char * groupName, boost::shared_ptr<pv_string_t []> &list, unsigned int &listLength);
//int groupMemberList(const char * groupName, dbr_string_t * &list, unsigned int &listLength);
int groupList (boost::shared_ptr<pv_string_t []> &glist, unsigned int &listLength);
//int groupList (dbr_string_t * &glist, unsigned int &listLength);
int groupMemberList(const char * groupName, vector<string> &list);
int groupList (vector<string> &glist);
int fetchIndexOfGroupMember(const char *groupName, const char * pv);
void setDeviceAttributeDeliminator(std::string d) {deviceAttributeDeliminator=d;};
std::string getDeviceAttributeDeliminator() const {return deviceAttributeDeliminator;};
};
#endif // CONNECT_H

80
include/defines.h Normal file
View File

@@ -0,0 +1,80 @@
///
/// \file defines.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
#ifndef DEFINES_H
#define DEFINES_H
#include <cadef.h>
#include <iostream>
#define EV EPICSVERSION(HAVE_EPICS)
#if (EPICS_VERSION==3) && (EPICS_MAJOR==14) && (EPICS_MINOR>=11)
#define MASK_CTRL DBE_VALUE | DBE_LOG | DBE_ALARM | DBE_PROPERTY
#elif (EPICS_VERSION==3) && (EPICS_MAJOR>14)
#define MASK_CTRL DBE_VALUE | DBE_LOG | DBE_ALARM | DBE_PROPERTY
#else
#define MASK_CTRL DBE_VALUE | DBE_LOG | DBE_ALARM
#endif
//To match alarmString.h in EPICS
const unsigned short ALARM_SEVERITY_STRING_LENGTH = 4; // "NO_ALARM","MINOR","MAJOR", "INVALID"
const unsigned short ALARM_STATUS_STRING_LENGTH = 22; // "NO_ALARM","READ","WRITE",
//"HIHI","HIGH","LOLO","LOW","STATE","COS","COMM","TIMEOUT","HWLIMIT","CALC","SCAN","LINK",
//"SOFT","BAD_SUB","UDF","DISABLE","SIMM","READ_ACCESS","WRITE_ACCESS"
/**
* Define pCallback \n
*/
typedef void (*pCallback) (struct event_handler_args ARGS);
typedef void (*pCallbackConnection) (struct connection_handler_args ARGS);
const bool ADD_EXCEPTION_EVENT=false; //set to false for use with MATLAB
// Standard exception event is good enough
/**
* Size of char * array to hold pv and pvAlias names \n
*/
const short PVNAME_SIZE=MAX_STRING_SIZE +20; //from epicsTypes.h 40;
const short PVGROUP_PSEUDO_SIZE=1024; //determines max size of groupNameEntry for Pseudo groups
//List all possible deliminators; code will separate dev/attriby when first of this list is found;
const std::string DEFAULT_DEVICE_ATTRIBUTE_DELIMINATOR=":"; //Only one deliminator
typedef char pv_string_t[PVNAME_SIZE];
/**
* Default configuration parameters. Recall that if pend_event is too short \n
* then create callback function will still be called after the specified period
*/
const bool DEFAULT_SELF_GOVERNING_TIMEOUT = true;
const double DEFAULT_TIMEOUT_PEND_IO_WF = 5.0;
const double TIMEOUT_PEND_IO_MIN = 0.00001;
const double TIMEOUT_PEND_IO_MAX = 20.0; // max timeout for first attempt (ntries=1)
const unsigned short DEFAULT_PEND_IO_NO_TRIES = 2;
const unsigned short PEND_IO_MAX_TRIES = 10; // safety net
const double DEFAULT_PEND_IO_INCREMENT_TIME = 2.0;
const double PEND_IO_INCREMENT_TIME_MIN= 0.05;
const double PEND_IO_INCREMENT_TIME_MAX= 10.0;
const double DEFAULT_TIMEOUT_PEND_EVENT = 0.4;
const double DEFAULT_TIMEOUT_PEND_IO = 3.0;
const double DEFAULT_TIMEOUT_SG_PEND_EVENT = 0.5; // plus nMember/NMEMBER_PER_SEC_SG_PEND_EVENT
const double NMEMBER_PER_SEC_SG_PEND_EVENT = 400; //
const double DEFAULT_TIMEOUT_SG_PEND_IO = 5.0;
// Otherwise too many large databuffers are created
const unsigned int MAX_NELEM_FOR_CTRL_BUFFER = 8192;
// Keep at 1, else becomes problematic when wf is made a syn. group member (ch disconnect occurs for STSACK cb)
const unsigned int MAX_NELEM_FOR_STSACK_BUFFER = 1;
const unsigned int DEFAULT_NELEM_FOR_CTRL_BUFFER = 256; // if nelem exceeds above
const unsigned int DEFAULT_NELEM_FOR_STSACK_BUFFER = 1; // if nelem exceeds above
const unsigned short MAX_NO_MONITORS_PER_CHANNEL = 4; // Can't start more than 4; 1 is more usual.
#endif // DEFINES_H

115
include/deviceCollection.h Normal file
View File

@@ -0,0 +1,115 @@
///
/// \file deviceCollection.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef DEVICECOLLECTION_H
#define DEVICECOLLECTION_H
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <helper.h>
class collectionMember {
public:
collectionMember():deviceName(""),devicePosition(0){};
virtual ~collectionMember(){};
std::string deviceName;
float devicePosition;
};
class deviceCollection {
friend class Connect;
friend class CAFE;
//if HAVE_LIBQTXML
friend class loadCollectionXMLParser;
//endif
private:
std::string name;
std::string description;
std::vector<collectionMember> cMembers;
std::vector<std::string> attributes;
Helper helper;
public:
deviceCollection():description("collection of devices"){};
virtual ~deviceCollection(){};
std::string getName() const {return name;};
std::string getDescription() const {return description;};
std::vector<collectionMember> getCMembers() const {return cMembers;};
std::vector<std::string> getAttributes() const {return attributes;};
std::vector<float> getPositions() {
std::vector<float> posV; posV.clear(); posV.reserve(cMembers.size());
for (size_t i=0; i<cMembers.size(); ++i) {
posV.push_back(cMembers[i].devicePosition);
};
return posV;
};
float getPosition(const char * c) {
char _c[PVNAME_SIZE];
helper.removeLeadingAndTrailingSpaces(c, _c);
for (size_t i=0; i<cMembers.size(); ++i) {
if(strcmp(cMembers[i].deviceName.c_str(),_c)==0) {
return cMembers[i].devicePosition;
}
}
std::cout << "INPUT: " << _c << " NOT FOUND IN COLLECTION: " << name << std::endl;
std::cout << "HENCE RETURNING -1 FOR POSITION " << std::endl;
return -1;
}
std::vector<std::string> getMembers() {
std::vector<std::string> memberV; memberV.clear(); memberV.reserve(cMembers.size());
for (size_t i=0; i<cMembers.size(); ++i) {
memberV.push_back(cMembers[i].deviceName);
};
return memberV;
};
unsigned int getNCollectionMembers() const {return cMembers.size();};
unsigned int getNAttribuites() const {return attributes.size();};
};
class collectionInGroup {
//friend class loadGroupXMLParser;
public:
collectionInGroup(){};
virtual ~collectionInGroup(){};
std::string id;
std::string attrib;
};
class deviceGroup {
//if HAVE_LIBQTXML
friend class loadGroupXMLParser;
//endif
private:
std::string id;
std::string description;
std::vector<collectionMember> members;
std::vector<std::string> xmlMembers;
std::vector<collectionInGroup> collections;
public:
deviceGroup(){};
virtual ~deviceGroup(){};
std::string getName() const {return id;};
std::string getID() const {return id;};
std::string getDescription() const {return description;};
std::vector<collectionMember> getCMembers() const {return members;};
std::vector<collectionInGroup> getCollections() const {return collections;};
std::vector<std::string>getXMLMembers() const {return xmlMembers;};
};
#endif // DEVICECOLLECTION_H

98
include/enumStrings.h Normal file
View File

@@ -0,0 +1,98 @@
///
/// \file enumStrings.h
/// \author Jan Chrin, PSi
/// \brief Modified from Astari's C++11 version.
/// Use boost::begin() boost::end() for C++
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef ENUMSTRINGS_H
#define ENUMSTRINGS_H
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <iterator>
#include <boost/range.hpp>
template<typename T>
struct enumStrings
{
static char const* data[];
};
template<typename T>
struct enumRefHolder
{
T& enumVal;
enumRefHolder(T& enumVal): enumVal(enumVal) {}
};
template<typename T>
struct enumConstRefHolder
{
T const& enumVal;
enumConstRefHolder(T const& enumVal): enumVal(enumVal) {}
};
template<typename T>
inline std::ostream& operator<<(std::ostream& str, enumConstRefHolder<T> const& data)
{
//Add check on enumStrings<T>::data size to ensure correspondence with entries in cafeEnumEpics.h
if ( boost::size( enumStrings<T>::data) > (unsigned int) data.enumVal) {
return str << enumStrings<T>::data[data.enumVal];
}
else {
return str << "ERROR: enumStrings.h reports data.enumVal= " << data.enumVal
<< " DOES NOT HAVE A STRING EQUIVALENT!";
}
}
template<typename T>
inline std::istream& operator>>(std::istream& str, enumRefHolder<T> const& data)
{
std::string value;
str >> value;
// These two can be made easier to read in C++11
// using std::begin() and std::end()
//static auto begin = std::begin(enumStrings<T>::data);
//static auto end = std::end(enumStrings<T>::data);
//auto find = std::find(begin, end, value);
//if (find != end)
if ( std::find( boost::begin(enumStrings<T>::data), boost::end( enumStrings<T>::data), value) !=
boost::end( enumStrings<T>::data))
{
//data.enumVal = static_cast<T>(std::distance(begin, find));
data.enumVal = static_cast<T>(std::distance(boost::begin(enumStrings<T>::data),
std::find (boost::begin(enumStrings<T>::data), boost::end(enumStrings<T>::data), value ) ));
}
if (data.enumVal > boost::size( enumStrings<T>::data) ) {
std::cout << "ERROR: enumStrings.h reports data.enumVal = " << data.enumVal
<< " is out of enum range = " << boost::size( enumStrings<T>::data) << std::endl;
}
return str;
}
template<typename T>
enumConstRefHolder<T> enumToString(T const& e) {return enumConstRefHolder<T>(e);}
template<typename T>
enumRefHolder<T> enumFromString(T& e) {return enumRefHolder<T>(e);}
#endif // ENUMSTRINGS_H

106
include/exceptions.h Normal file
View File

@@ -0,0 +1,106 @@
///
/// \file exceptions.h
/// \author Jan Chrin, PSI
/// \date November 2014
/// \version CAFE 1.0.0
///
#ifndef EXCEPTIONS_H
#define EXCEPTIONS_H
#include <exception>
#include <cstring>
#include <defines.h>
#include <cafeDataType.h>
using namespace std;
/**
* The CAFEException_pv struct for pv error reporting
*/
struct CAFEException_pv
{
char pv [PVNAME_SIZE];
char pvAlias[PVNAME_SIZE];
unsigned int handle;
CAFE_DATATYPE dataTypeNative;
const char * dataTypeNativeText;
int statusCode;
const char * statusCodeText;
const char * statusMessage;
const char * source;
unsigned int ln;
};
/**
* The CAFEException_group struct for group error reporting
*/
struct CAFEException_group
{
char groupName [PVNAME_SIZE];
unsigned int groupHandle;
int statusCode;
const char * statusCodeText;
const char * statusMessage;
const char * source;
unsigned int ln;
};
/**
* The CAFEException_open class for ca open error reporting
*/
class CAFEException_open : public exception
{
public:
virtual const char* what() const throw()
{
return "CAFEException_open exception: Could not establish link to pv";
};
CAFEException_pv pvEx;
};
/**
* The CAFEException_groupOpen class for ca group open error reporting
*/
class CAFEException_groupOpen : public exception
{
public:
virtual const char* what() const throw()
{
return "CAFEException_groupOpen exception: Could not establish link to group";
};
CAFEException_group groupEx;
};
/**
* The CAFEException_init
*/
class CAFEException_init: public exception
{
public:
virtual const char* what() const throw()
{
return "CAFEException_init exception: \nChannel Access Error: ECA_ALLOCMEM when calling ca_context_create";
};
};
/**
* The CAFEException_allocBufferMem
*/
class CAFEException_allocBufferMem: public exception
{
public:
virtual const char* what() const throw()
{
return "CAFEException_allocBufferMem exception: \nCAFE ERROR: Cannot create space for pv data/ctrl buffer";
};
};
#endif // EXCEPTION_H

View File

@@ -0,0 +1,38 @@
///
/// \file exceptionsHelper.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef EXCEPTIONSHELPER_H
#define EXCEPTIONSHELPER_H
#include "exceptions.h"
#include "statusCodes.h"
#include "defines.h"
class ExceptionsHelper
{
private:
CAFEDataTypeCode cafeDataTypeCode;
CAFEStatus cafeStatus;
public:
CAFEException_pv prepareCAFEException_pv(const char *pv, const char *pvAlias,
unsigned int handle, chid pCh, int status,
const char * source, unsigned int ln);
CAFEException_group prepareCAFEException_group(
char groupName [PVNAME_SIZE],
unsigned int groupHandle,
int statusCode,
const char * source,
unsigned int ln);
ExceptionsHelper(void){};
~ExceptionsHelper(void){};
void printCAFEException_pv(CAFEException_pv & e);
};
#endif // EXCEPTIONSHELPER_H

36
include/global.h Normal file
View File

@@ -0,0 +1,36 @@
///
/// \file global.h
/// \brief For access to containers for callbacks
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef GLOBAL_H
#define GLOBAL_H
#include <cadef.h>
#include <hashConduit.h>
#include <hashConduitGroup.h>
#include <PVGroup.h>
#include <deviceCollection.h>
#include <enumStrings.h>
extern bool CHECK_CONSISTENCY_CA_STATE;
extern bool MUTEX;
extern epicsMutex cafeMutex;
extern cafeConduit_set cs;
extern cafeGroup_set gs;
extern vector<PVGroup> PVGroupV;
extern vector<PVGroup> PVGroupPseudo;
extern vector<deviceCollection> deviceCollectionV;
extern map<vector<unsigned int>, string> groupPseudoMap;
extern vector<string> globalChannelList;
extern string globalZmqStream;
extern string contentsS;
extern unsigned long nCBs;
#endif // GLOBAL_H

98
include/granules.h Normal file
View File

@@ -0,0 +1,98 @@
///
/// \file granules.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
/**
* Contains methods that are used by Instant template
* Among these are the Verify, Prepare, Execute
*/
#ifndef GRANULES_H
#define GRANULES_H
#include <boost/date_time/posix_time/posix_time.hpp>
#include <config.h>
#if HAVE_BOOST_THREAD
#include <boost/thread/thread_only.hpp>
#include <boost/chrono.hpp>
#endif
#include <global.h>
#include <conduitFriends.h>
#include <handleHelper.h>
class Granules {
public:
template <class CTYPE> friend class Instant;
friend class CAFE;
Granules(){};
private:
HandleHelper helper;
CAFEStatus cafeStatus;
ChannelRequestDataTypePolicy channelRequestDataTypePolicy;
ChannelRequestPolicyKind methodKind; //for channelExecutePut
ChannelRequestPolicy channelRequestPolicyPut;
ChannelRequestStatus channelRequestStatusPut;
ChannelRequestPolicy channelRequestPolicyGet;
ChannelRequestStatus channelRequestStatusGet;
ChannelRequestMetaDataClient channelRequestMetaDataClient;
ChannelRequestMetaData channelRequestMetaData;
ChannelRequestMetaData channelRequestMetaPrimitive;
ChannelRequestPolicy channelRequestPolicyGetCtrl;
ChannelRequestStatus channelRequestStatusGetCtrl;
ChannelRequestMetaDataClient channelRequestMetaCtrlClient;
ChannelRequestMetaData channelRequestMetaCtrl;
ChannelTimeoutPolicy channelTimeoutPolicyGet;
ChannelTimeoutPolicy channelTimeoutPolicyPut;
int channelVerifyPut (const unsigned int, chtype); //isChannelConnected //writeAccess
int channelPreparePut (const unsigned int); //nelem offset requestType
int channelExecutePut (const unsigned int);
int waitForPutEvent (const unsigned int, double);
bool isPutCallbackDone (const unsigned int _handle);
int channelVerifyGet (const unsigned int, chtype); //isChannelConnected //readAccess
int channelPrepareGet (const unsigned int); //nelem offset requestType
int channelExecuteGet (const unsigned int); //report status
int channelExecuteGetNoWait(const unsigned int); //report status
int waitForManyGetEvents(const unsigned int * handleArray, unsigned int arrayLength, map<unsigned int, int> & bundleResponse);
int waitForGetEvent (const unsigned int, double);
bool isGetCallbackDone (const unsigned int _handle);
int channelVerifyGetCtrl (const unsigned int, chtype); //isChannelConnected //readAccess
int channelPrepareGetCtrl (const unsigned int); //nelem offset requestType
int channelExecuteGetCtrl (const unsigned int); //report status
int channelExecuteGetCtrlNoWait(const unsigned int _handle);
int waitForGetCtrlEvent(const unsigned int, double);
bool isGetCtrlCallbackDone(const unsigned int _handle);
int status;
chtype convertMatrix(const chtype nativeType, const chtype clientT);
};
#endif // GRANULES_H

276
include/handleHelper.h Normal file
View File

@@ -0,0 +1,276 @@
///
/// \file handleHelper.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef HANDLEHELPER_H
#define HANDLEHELPER_H
#include <cadef.h>
#include <helper.h>
#include <defines.h>
#include <hashConduit.h>
#include <conduitFriends.h>
#include <hashConduitGroup.h>
#include <cafeDataType.h>
class HandleHelper : public Helper {
private:
CAFEStatus cafeStatus;
cafeConduit_set::iterator itcs;
cafeGroup_set::iterator itgs;
ChannelRequestMetaDataClient channelRequestMetaDataClient;
ChannelRequestMetaData channelRequestMetaData;
ChannelRequestMetaDataClient channelRequestMetaCtrlClient;
ChannelRequestMetaData channelRequestMetaCtrl;
ChannelDeviceAttribute channelDeviceAttribute;
CAFEDataTypeCode cafeDataTypeCode;
PrintErrorPolicy printErrorPolicy;
struct etsNorm{ unsigned int secPastEpoch; unsigned int nsec;};
struct etsDate{ int year; int mon; int day;
int hour; int min; int sec; unsigned long nsec;};
public:
HandleHelper(){};
~HandleHelper(){};
//Move to private if possible
int setSTS(unsigned int _handle, dbr_short_t a, dbr_short_t s, epicsTimeStamp ets);
etsNorm _etsNorm;
etsDate _etsDate;
int checkConsistency();
int checkConsistency(unsigned int _handle);
int setChannelDeviceAttribute(std::string deliminator);
int setChannelDeviceAttribute(unsigned int _handle, std::string deliminator);
int getChannelDevice(unsigned int _handle, std::string & device);
int getChannelAttribute(unsigned int _handle, std::string & attribute);
int getChannelRegalia(unsigned int _handle, ChannelRegalia & channelInfo);
int getChannelRequestStatusGetClassName(unsigned int _handle, ChannelRequestStatus &crsClassName);
int getChannelRequestStatusGetSTSACK (unsigned int _handle, ChannelRequestStatus &crsSTSACK);
int getChannelRequestStatusGetCtrl (unsigned int _handle, ChannelRequestStatus &crsCtrl);
int getChannelRequestStatusGet (unsigned int _handle, ChannelRequestStatus &crs);
//Add getPVFromHandle
ca_client_context * getContextFromPV (const char * _pv);
ca_client_context * getContextFromHandle (unsigned int _handle);
const char * getPVFromHandle (unsigned int _handle);
const char * getPVFromHandle (unsigned int _handle, ca_client_context * ccc);
unsigned int getHandleFromPV (const char * _pv);
unsigned int getHandleFromPV (const char * _pv, ca_client_context * ccc);
unsigned int getHandleFromPVAlias(const char * _pv);
unsigned int getHandleFromPVAlias(const char * _pv, ca_client_context * ccc);
vector<unsigned int> getHandlesFromWithinGroupV(unsigned int gh);
unsigned int * getHandlesFromWithinGroup(unsigned int gh);
unsigned int getHandleFromPVWithinGroup(const char * _pv, unsigned int gh);
unsigned int getHandleFromPVWithinGroup(const char * _pv,
ca_client_context * ccc, unsigned int gh);
int getStatus (unsigned int h);
int getTimeStamp(unsigned int h, epicsTimeStamp &ts);
etsNorm getEpicsTimeStampAsUInt32(unsigned int h) {
epicsTimeStamp ts;
getTimeStamp(h, ts);
_etsNorm.secPastEpoch=ts.secPastEpoch; _etsNorm.nsec=ts.nsec;
return _etsNorm;};
etsDate getEpicsTimeStampAsDate(unsigned int h) {
epicsTimeStamp ts;
getTimeStamp(h, ts);
epicsTime time(ts);
local_tm_nano_sec local = (local_tm_nano_sec) time;
_etsDate.year = local.ansi_tm.tm_year + 1900;
_etsDate.mon = local.ansi_tm.tm_mon + 1;
_etsDate.day = local.ansi_tm.tm_mday;
_etsDate.hour = local.ansi_tm.tm_hour;
_etsDate.min = local.ansi_tm.tm_min;
_etsDate.sec = local.ansi_tm.tm_sec;
_etsDate.nsec = (unsigned long) ts.nsec;
return _etsDate;
}
etsDate epicsTimeStampToDate(epicsTimeStamp ts) {
epicsTime time(ts);
local_tm_nano_sec local = (local_tm_nano_sec) time;
_etsDate.year = local.ansi_tm.tm_year + 1900;
_etsDate.mon = local.ansi_tm.tm_mon + 1;
_etsDate.day = local.ansi_tm.tm_mday;
_etsDate.hour = local.ansi_tm.tm_hour;
_etsDate.min = local.ansi_tm.tm_min;
_etsDate.sec = local.ansi_tm.tm_sec;
_etsDate.nsec = (unsigned long) ts.nsec;
return _etsDate;
}
int getPulseID(unsigned int h, unsigned int &pulseID) {
epicsTimeStamp ts;
int status=getTimeStamp(h, ts);
if (status==ICAFE_NORMAL){
std::string nsS = static_cast<ostringstream*>( &(ostringstream() << ts.nsec) )->str();
int l=nsS.length();
int startPos=max(l-6,0);
std::string pidS = nsS.substr(startPos,min(6,l));
if ( ! (istringstream(pidS) >> pulseID) ) pulseID = 0;
}
return status;
}
unsigned int getPulseIDFromTS(epicsTimeStamp ts) {
unsigned int pulseID;
std::string nsS = static_cast<ostringstream*>( &(ostringstream() << ts.nsec) )->str();
int l=nsS.length();
int startPos=max(l-6,0);
std::string pidS = nsS.substr(startPos,min(6,l));
if ( ! (istringstream(pidS) >> pulseID) ) pulseID = 0;
return pulseID;
}
int getAlarmStatusSeverity(unsigned int h, dbr_short_t as[2]);
int getAlarmStatusSeverityAsString(unsigned int h, string asas[2]);
unsigned int getNoHandles();
unsigned int getNextFreeHandle();
bool isChannelConnected(unsigned int handle);
int printHandle (unsigned int h);
int printHandlesV(vector<unsigned int> handleV);
int printHandles(unsigned int * handleArray, unsigned int nHandles);
unsigned int printHandles();
unsigned int printChannels(){return printHandles();};
unsigned int printDisconnectedHandles();
unsigned int printDisconnectedChannels(){return printDisconnectedChannels();};
unsigned int getDisconnectedHandles(vector<unsigned int> &, vector<string> &);
unsigned int getConnectedHandles(vector<unsigned int> &, vector<string> &);
unsigned int getHandles(vector<unsigned int> &, vector<string> &);
unsigned int getHandleStates(vector<unsigned int> &, vector<string> &, vector<unsigned short> &);
unsigned int printMonitors();
vector<unsigned int> getHandlesWithMonitors();
int getMonitorHandlesAndActions(vector<unsigned int> & handleV, vector<string> & actionV);
int setCafeDbrTypeV(vector<unsigned int> _handleV, CAFENUM::DBR_TYPE cdt);
int setCafeDbrType(unsigned int _handle, CAFENUM::DBR_TYPE cdt);
int getCafeDbrType(unsigned int _handle, CAFENUM::DBR_TYPE &cdt);
bool isEnum(unsigned int _handle);
short getEnumFromString(unsigned int _handle, string enumStringValue);
string getStringFromEnum(unsigned int _handle, unsigned short enumValue);
int getDataTypeNative (unsigned int _handle, chtype &ndt);
int getDataTypeRequest(unsigned int _handle, chtype &rdt);
int eraseMonitorAction(unsigned int _handle);
int clearMonitorAction(unsigned int _handle);
int clearMonitorAction();
int addMonitorAction(unsigned int _handle, string mAction);
int getMonitorAction(unsigned int _handle, vector<string> &msV);
vector<string> getMonitorAction(bool onlyIfNewData); //all handles; false gives all
int getMonitorPolicyVector(unsigned int _handle, vector<MonitorPolicy> &mpV);
int getMonitorPolicyInWaitingVector(unsigned int _handle, vector<MonitorPolicy> &mpV);
int getNmonitor(unsigned int _handle);
int getNmonitorData(unsigned int _handle);
int getNmonitorCtrl(unsigned int _handle);
vector<unsigned int> getMonitorIDs(unsigned int _handle);
vector<unsigned int> getMonitorIDsInWaiting(unsigned int _handle);
unsigned int getUsrArgsAsUInt(unsigned int _handle); //From c.channelRequestMetaData.usrArg
chtype getDataTypeCB(unsigned int _handle);
chtype getDbrDataTypeCB(unsigned int _handle);
CAFENUM::DBR_TYPE getCafeDbrTypeCB(unsigned int _handle);
//setNoElements
int setNelem (); //All handles to native
unsigned int setNelem (unsigned int _handle); //To Native
unsigned int setNelemToNative (unsigned int _handle){return setNelem(_handle);}; //To Native
unsigned int setNelem (unsigned int _handle, unsigned int _nelem);
//For Arrays:
unsigned int setNelemToRetrieveFromCache (unsigned int _handle);
unsigned int setNelemToRetrieveFromCache (unsigned int _handle, unsigned int _nelem);
unsigned int setNelemToRetrieveFromCtrlCache (unsigned int _handle);
unsigned int setNelemToRetrieveFromCtrlCache (unsigned int _handle, unsigned int _nelem);
unsigned int getNelemToRetrieveFromCache (unsigned int _handle);
unsigned int getNelemToRetrieveFromCtrlCache (unsigned int _handle);
char * getPV (unsigned int _handle);
char * getPVAlias (unsigned int _handle);
unsigned int getNelemClient (unsigned int _handle);
unsigned int getNelemNative (unsigned int _handle);
unsigned int getNelemRequest (unsigned int _handle);
int getNelem(unsigned int _handle, unsigned int &c, unsigned int &n, unsigned int &r);
//Ctrl
unsigned int setNelemCtrl (unsigned int _handle, unsigned int _nelem);
unsigned int getNelemRequestCtrl (unsigned int _handle);
unsigned int getNelemClientCtrl (unsigned int _handle);
//setOffSet
unsigned int setOffset(unsigned int _handle, unsigned int _offset);
unsigned int getOffset(unsigned int _handle);
unsigned int getOffsetLast(unsigned int _handle);
void setFirstAndLastArrayElements(unsigned int _handle,
unsigned int _start, unsigned int _last){
if (_last > _start ) { setOffset(_handle, _start); setNelem(_handle, _last);}
else {std::cout << " offset must be less than the nelements" <<std::endl; };
};
//long setOffsetCtrl(unsigned int _handle, unsigned int _offset);
//Groups
unsigned int getGroupHandleFromGroupName(const char * _groupName){
ca_client_context * ccc= ca_current_context();
return getGroupHandleFromGroupName(_groupName, ccc);
}
unsigned int getGroupHandleFromGroupName(const char * _groupName, ca_client_context * ccc);
string getGroupNameFromGroupHandle(unsigned int groupHandle);
unsigned int getGroupNPV(unsigned int gHandle);
unsigned int getGroupNPV(const char * _groupName, ca_client_context * ccc);
unsigned int getGroupNPV(const char * _groupName){
ca_client_context * ccc= ca_current_context();
return getGroupNPV(_groupName, ccc);
}
};
#endif

53
include/hashConduit.h Normal file
View File

@@ -0,0 +1,53 @@
///
/// \file hashConduit.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
#ifndef HASHCONDUIT_H
#define HASHCONDUIT_H
#include <conduit.h>
#include <map>
// boost include
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/tokenizer.hpp>
using boost::multi_index_container;
using namespace boost::multi_index;
struct by_handle{};
struct by_channelID{};
struct by_pv{};
struct by_pvAlias{};
typedef multi_index_container<
Conduit,
indexed_by<
ordered_unique<
tag<by_handle>, BOOST_MULTI_INDEX_MEMBER(Conduit, unsigned int, handle)>,
ordered_non_unique<
tag<by_channelID>, BOOST_MULTI_INDEX_MEMBER(Conduit, chid, channelID)>,
ordered_non_unique<
tag<by_pv>, BOOST_MULTI_INDEX_MEMBER(Conduit, std::string, pv)>,
ordered_non_unique<
tag<by_pvAlias>, BOOST_MULTI_INDEX_MEMBER(Conduit, std::string, pvAlias)>,
//ordered_non_unique<
//tag<by_uniqueID>, BOOST_MULTI_INDEX_MEMBER(Conduit, unsigned int, uniqueID)>,
hashed_unique<member<Conduit, unsigned int, &Conduit::handle> >
>
> cafeConduit_set;
typedef cafeConduit_set::index<by_channelID>::type cafeConduit_set_by_channelID;
typedef cafeConduit_set::index<by_handle>::type cafeConduit_set_by_handle;
typedef cafeConduit_set::index<by_pv>::type cafeConduit_set_by_pv;
typedef cafeConduit_set::index<by_pvAlias>::type cafeConduit_set_by_pvAlias;
#endif // HASHCONDUIT_H

View File

@@ -0,0 +1,45 @@
///
/// \file hashConduitGroup.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef HASHCONDUIT_GROUP_H
#define HASHCONDUIT_GROUP_H
#include "conduitGroup.h"
// boost include
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/tokenizer.hpp>
using boost::multi_index_container;
// namespace multi-indexing of reference handles to CAFEConduit objects
using namespace boost::multi_index;
struct by_groupHandle{};
struct by_groupID{};
struct by_groupName{};
typedef multi_index_container<
ConduitGroup,
indexed_by<
ordered_unique<
tag<by_groupHandle>, BOOST_MULTI_INDEX_MEMBER(ConduitGroup, unsigned int, groupHandle)>,
ordered_non_unique<
tag<by_groupID>, BOOST_MULTI_INDEX_MEMBER(ConduitGroup, CA_SYNC_GID, groupID)>,
ordered_non_unique<
tag<by_groupName>, BOOST_MULTI_INDEX_MEMBER(ConduitGroup, std::string, groupName)>,
hashed_unique<member<ConduitGroup, unsigned int, &ConduitGroup::groupHandle> >
>
> cafeGroup_set;
typedef cafeGroup_set::index<by_groupID>::type cafeGroup_set_by_groupID;
typedef cafeGroup_set::index<by_groupHandle>::type cafeGroup_set_by_groupHandle;
typedef cafeGroup_set::index<by_groupName>::type cafeGroup_set_by_groupName;
#endif

37
include/helper.h Normal file
View File

@@ -0,0 +1,37 @@
///
/// \file helper.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef HELPER_H
#define HELPER_H
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <cadef.h>
#include <cafeEnum.h>
#include <defines.h>
class Helper
{
public:
Helper(){};
void removeLeadingAndTrailingSpacesDbrString(const char * _pv, char pvStripped[MAX_STRING_SIZE]);
void removeLeadingAndTrailingSpacesPseudo(const char * _pv, char pvStripped[PVGROUP_PSEUDO_SIZE]);
void removeLeadingAndTrailingSpaces(const char * _pv, char pvStripped[PVNAME_SIZE]);
unsigned int convertToUniqueNumber(const char * pv, ca_client_context * ccc, unsigned int ghs);
unsigned int convertToUniqueNumber(const char * pv, ca_client_context * ccc);
CAFENUM::DBR_TYPE convertToCAFEDbrTypeClass(const chtype _chtype) const;
std::string concatToString(dbr_char_t * inChar, unsigned int nChar);
};
#endif // HELPER_H

2145
include/instant.cpp Normal file

File diff suppressed because it is too large Load Diff

272
include/instant.h Normal file
View File

@@ -0,0 +1,272 @@
///
/// \file instant.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef INSTANT_H
#define INSTANT_H
#include <transpose.h>
#include <granules.h>
#include <cafeEnum.h>
template <class CTYPE> class Instant {
private:
Transpose<dbr_string_t> renderString; // 0
Transpose<dbr_short_t> renderShort; // 1
Transpose<dbr_float_t> renderFloat; // 2
Transpose<dbr_enum_t> renderEnum; // 3
Transpose<dbr_char_t> renderChar; // 4
Transpose<dbr_long_t> renderLong; // 5
Transpose<dbr_double_t> renderDouble; // 6
CAFEStatus cafeStatus;
Granules cafeGranules;
PolicyHelper policyHelper;
HandleHelper helper;
Conduit cc;
ChannelTimeoutPolicy channelTimeoutPolicyGet;
ChannelRequestPolicy channelRequestPolicyGet;
ChannelRequestStatus channelRequestStatusGet;
ChannelRequestDataTypePolicy channelRequestDataTypePolicy;
ChannelRequestMetaDataClient channelRequestMetaDataClient; //-1
int status;
int clientRequests(const unsigned int _handle, const chtype dbrType, const CTYPE * _val);
int clientRequests(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts,
bool isCacheRequest);
public:
Instant (){};
~Instant (){};
int set(const unsigned int *handleArray, const unsigned int nelem,
const chtype _dbrType, const CTYPE * val, int *statusArray);
int set(const unsigned int _handle, const chtype dbrType, const CTYPE * _val);
int get(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
int get(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){
epicsTimeStamp ts;
return get(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
};
int get(const unsigned int _handle, const chtype dbrType, CTYPE * _val){
dbr_short_t alarmStatus; dbr_short_t alarmSeverity; epicsTimeStamp ts;
return get(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity, epicsTimeStamp &ts);
int getCache(const unsigned int _handle, const chtype dbrType, CTYPE * _val,
dbr_short_t &alarmStatus, dbr_short_t &alarmSeverity){
epicsTimeStamp ts;
return getCache(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int _handle, const chtype dbrType, CTYPE * _val){
dbr_short_t alarmStatus; dbr_short_t alarmSeverity; epicsTimeStamp ts;
return getCache(_handle, dbrType, _val, alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, const unsigned int nelem,
const chtype _dbrType, CTYPE * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity, epicsTimeStamp *ts);
int getCache(const unsigned int *handleArray, const unsigned int nelem,
const chtype _dbrType, CTYPE * val, int *statusArray,
dbr_short_t *alarmStatus, dbr_short_t *alarmSeverity ) {
epicsTimeStamp * ts;
return getCache(handleArray, nelem, _dbrType, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int getCache(const unsigned int *handleArray, const unsigned int nelem,
const chtype _dbrType, CTYPE * val, int *statusArray) {
dbr_short_t * alarmStatus; dbr_short_t * alarmSeverity; epicsTimeStamp * ts;
return getCache(handleArray, nelem, _dbrType, val, statusArray,
alarmStatus, alarmSeverity, ts);
};
int setAndGet(const unsigned int handleSet, const chtype dbrType, CTYPE valSet, CTYPE &valGet);
int setAndMatch(const unsigned int handleSet, const chtype dbrType, CTYPE valSet, const unsigned int handleMatch,
CTYPE tolerance, double timeout, bool printFlag);
int setAndMatchMany(vector<unsigned int> handleSetV, const chtype dbrType, vector<CTYPE> valSet, vector<unsigned int> handleMatch,
CTYPE tolerance, double timeout, bool printFlag);
int matchMany( const chtype dbrType, vector<CTYPE> valSet, vector<unsigned int> handleMatch,
CTYPE tolerance, double timeout, bool printFlag);
int match( const chtype dbrType, CTYPE valSet, unsigned int handleMatch,
CTYPE tolerance, double timeout, bool printFlag);
/**
* \brief Set followed by an immediate get
* \param handleSet input: handle
* \param valSet input: string value to set
* \param valGet output: string value to get
* \return ECA_NORMAL if all OK else first ECAFE error encountered, else ICAFE_SET_AND_GET_MISMATCH;
*/
int setAndGetString(const unsigned int handleSet, string valSet, string &valGet) {
#define __METHOD__ "Instant<CTYPE>::setAndGetString(const unsigned int handleSet, string valSet, string &valGet"
//CheckPolicy
dbr_string_t valGetA[1]; dbr_string_t valSetA[1];
strcpy(valGetA[0],"0");
valGet="0";
helper.removeLeadingAndTrailingSpaces(valSet.c_str(), valSetA[0]);
status=Instant::set(handleSet, DBR_STRING, valSetA);
if (status==ICAFE_NORMAL) {
status=Instant::get(handleSet, DBR_STRING, valGetA);
valGet=valGetA[0];
}
else {
return status;
}
if (strcmp(valSetA[0],valGetA[0])==0) {
return ICAFE_NORMAL;
}
//Check if number
istringstream ins, ous;
double oud=0;
ous.clear();
ous.str(valGetA[0]);
ous>>oud;
double ind=0;
ins.clear();
ins.str(valSetA[0]);
ins>>ind;
if ( !ous.fail() && !ins.fail()) {
if (ind==oud) {return ICAFE_NORMAL;}
}
//Cater for enums that are refered to by their integer values in string format
else if (!ins.fail()) {
short enumval=-1;
enumval=helper.getEnumFromString(handleSet, valGet);
//Convert integer to string
stringstream ss;
ss << enumval;
valGet= ss.str();
if ((short)ind==enumval) {
return ICAFE_NORMAL;
}
}
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
cout << "Process Variable = " << helper.getPVFromHandle(handleSet) << endl;
cout << "Set Value: " << valSetA[0] << " Get Value: " << valGet.c_str() << endl;
return ICAFE_SET_AND_GET_MISMATCH;
#undef __METHOD__
};
/**
* \brief Set followed by an immediate get
* \param handleSet input: handle
* \param valSet input: dbr_string_t value to set
* \param valGet output: dbr_string_t value to get
* \return ECA_NORMAL if all OK else first ECAFE error encountered, else ICAFE_SET_AND_GET_MISMATCH;
*/
int setAndGetDbrString(const unsigned int handleSet, dbr_string_t valSet, dbr_string_t &valGet) {
#define __METHOD__ "Instant<CTYPE>::setAndGetDbrString(const unsigned int handleSet, dbr_string_tvalSet, dbr_string_t &valGet"
//CheckPolicy
dbr_string_t valGetA[1]; dbr_string_t valSetA[1];
strcpy(valGetA[0],"0");
strcpy(valGet,"0");
helper.removeLeadingAndTrailingSpaces(valSet, valSetA[0]);
status=Instant::set(handleSet, DBR_STRING, valSetA);
if (status==ICAFE_NORMAL) {
status=Instant::get(handleSet, DBR_STRING, valGetA);
strcpy(valGet,valGetA[0]);
}
else {
return status;
}
if (strcmp(valSetA[0],valGetA[0])==0) {
return ICAFE_NORMAL;
}
//Check if number
//Check if number
istringstream ins, ous;
double oud=0;
ous.clear();
ous.str(valGetA[0]);
ous>>oud;
double ind=0;
ins.clear();
ins.str(valSetA[0]);
ins>>ind;
if ( !ous.fail() && !ins.fail()) {
if (ind==oud) {return ICAFE_NORMAL;}
}
//Cater for enums that are refered to by their integer values in string format
else if (!ins.fail()) {
short enumval=-1;
enumval=helper.getEnumFromString(handleSet, valGet);
//Convert integer to string
stringstream ss;
ss << enumval;
strcpy(valGet, ss.str().c_str());
if ((short) ind==enumval) {
return ICAFE_NORMAL;
}
}
cout << __FILE__ << "//" << __LINE__ << "//" << __METHOD__ << endl;
cout << "Process Variable = " << helper.getPVFromHandle(handleSet) << endl;
cout << "Set Value: " << valSetA[0] << " Get Value: " << valGet << endl;
return ICAFE_SET_AND_GET_MISMATCH;
#undef __METHOD__
};
};
#include "instant.cpp"
#endif // INSTANT_H

View File

@@ -0,0 +1,62 @@
///
/// \file loadCollectionXMLParser.h
/// \author Jan Chrin, George Prekas, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#include <config.h>
#if HAVE_LIBQTXML
#ifndef LOADCOLLECTIONXMLPARSER_H
#define LOADCOLLECTIONXMLPARSER_H
#include "deviceCollection.h"
#include <QtXml/QXmlDefaultHandler>
class loadCollectionXMLParser : public QXmlDefaultHandler {
public:
loadCollectionXMLParser();
virtual ~loadCollectionXMLParser();
bool startElement(const QString& namespaceURI,
const QString& localName,
const QString& qName,
const QXmlAttributes& atts);
bool endElement (const QString& namespaceURI,
const QString& localName,
const QString& qName);
bool characters (const QString& ch);
std::vector<deviceCollection> deviceCollectionV;
private:
enum
{
NotWaiting,
WaitingForDescription,
WaitingForDevice,
WaitingForAttribute
} state;
deviceCollection devCollection;
collectionMember cMember;
std::string attributeName;
static const QString& tagConfig;
static const QString& tagGroup;
static const QString& tagDescription;
static const QString& tagAttributes;
static const QString& tagAttribute;
static const QString& tagMember;
static const QString& tagDevice;
};
#endif
#endif // LOADCOLLECTIONXMLPARSER_H

View File

@@ -0,0 +1,67 @@
///
/// \file loadGroupXMLParser.h
/// \author Jan Chrin, G. Prekas, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#include <config.h>
#if HAVE_LIBQTXML
#ifndef LOADGROUPXMLPARSER_H
#define LOADGROUPXMLPARSER_H
#include "deviceCollection.h"
#include <QtXml/QXmlDefaultHandler>
class loadGroupXMLParser : public QXmlDefaultHandler {
public:
loadGroupXMLParser();
virtual ~loadGroupXMLParser();
bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts);
bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName);
bool characters(const QString& ch);
std::vector<deviceGroup> groups;
private:
enum
{
NotWaiting,
WaitingForDescription,
WaitingForStatusGroup,
WaitingForMember,
WaitingForName,
WaitingForNelem,
WaitingForStatus,
WaitingForRule,
WaitingForDataType,
WaitingForId,
WaitingForAttrib,
WaitingForCollectiveType
} state;
deviceGroup group;
//collectionMember member;
collectionInGroup collection;
std::string xmlMem;
const static QString& tagCollection_list;
const static QString& tagGroup;
const static QString& tagDescription;
const static QString& tagStatusGroup;
const static QString& tagMember;
const static QString& tagName;
const static QString& tagNelem;
const static QString& tagStatus;
const static QString& tagRule;
const static QString& tagDataType;
const static QString& tagCollection;
const static QString& tagId;
const static QString& tagAttrib;
const static QString& tagCollectiveType;
};
#endif /* LOADGROUPXMLPARSER_H */
#endif

483
include/makefile Normal file
View File

@@ -0,0 +1,483 @@
# makefile.in generated by automake 1.11.1 from makefile.am.
# include/makefile. Generated from makefile.in by configure.
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
pkgdatadir = $(datadir)/cafe
pkgincludedir = $(includedir)/cafe
pkglibdir = $(libdir)/cafe
pkglibexecdir = $(libexecdir)/cafe
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-unknown-linux-gnu
host_triplet = x86_64-unknown-linux-gnu
#am__append_1 = PyCafe_api.h
#am__append_2 = PyCafe.h
subdir = include
DIST_COMMON = $(am__include_HEADERS_DIST) $(srcdir)/makefile.am \
$(srcdir)/makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/./include/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__include_HEADERS_DIST = cafe.h cafeCache.h cafeConvert.h \
cafeDataType.h cafeDataTypeHelper.h cafeEnum.h \
cafeEnumStrings.h cafeRoast.h cafeVectors.h cafeXML.h \
caopCodes.h channelRegalia.h conduit.h \
conduitConnectionHandlerArgs.h conduitEventHandlerArgs.h \
conduitFriends.h connect.h defines.h deviceCollection.h \
exceptions.h exceptionsHelper.h global.h enumStrings.h \
granules.h handleHelper.h hashConduit.h helper.h instant.h \
instant.cpp loadCollectionXMLParser.h loadGroupXMLParser.h \
methodCallbacks.h policies.h policyHelper.h PVCtrlHolder.h \
PVDataHolder.h PVGroup.h PVHolder.h statusCodes.h transpose.h \
conduitGroup.h hashConduitGroup.h restorePVGroupXMLParser.h \
PyCafe_api.h PyCafe.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(includedir)"
HEADERS = $(include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run aclocal-1.11
AMTAR = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run tar
AM_CPPFLAGS = -fexceptions -fPIC -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml
AM_LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64
AR = ar
AUTOCONF = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run autoconf
AUTOHEADER = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run autoheader
AUTOMAKE = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run automake-1.11
AWK = gawk
CAFE_CPPFLAGS = -I$(top_srcdir)/include
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = gcc -E
CPPFLAGS = -fexceptions -fPIC -I/usr/local/epics/base/include/ -I/usr/local/epics/base/include/os/Linux -I/opt/gfa/cafe/boost/boost_1_61_0/include/boost -I/opt/gfa/cafe/boost/boost_1_61_0/include -I/usr/include/QtCore -I/usr/include/QtXml
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DSYMUTIL =
DUMPBIN =
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
EXEEXT =
FGREP = /bin/grep -F
GREP = /bin/grep
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS = -L/usr/local/epics/base/lib/SL6-x86_64 -Wl,-rpath,/usr/local/epics/base/lib/SL6-x86_64 -L/usr/lib64 -Wl,-rpath,/usr/lib64
LIBOBJS =
LIBS = -lQtXml -lQtCore
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
LTLIBOBJS =
MAKEINFO = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/missing --run makeinfo
MKDIR_P = /bin/mkdir -p
NM = /usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
OBJEXT = o
OTOOL =
OTOOL64 =
PACKAGE = cafe
PACKAGE_BUGREPORT = Bug reports to: jan.chrin@psi.ch
PACKAGE_NAME = CAFE
PACKAGE_STRING = CAFE 1.0.0
PACKAGE_TARNAME = cafe
PACKAGE_VERSION = 1.0.0
PATH_SEPARATOR = :
RANLIB = ranlib
SED = /bin/sed
SET_MAKE =
SHELL = /bin/sh
STRIP = strip
VERSION = 1.0.0
abs_builddir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/include
abs_srcdir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/include
abs_top_builddir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
abs_top_srcdir = /afs/psi.ch/project/cafe/gitlab/CAFE/cpp
ac_ct_CC = gcc
ac_ct_CXX = g++
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__tar = ${AMTAR} chof - "$$tardir"
am__untar = ${AMTAR} xf -
bindir = ${exec_prefix}/bin
build = x86_64-unknown-linux-gnu
build_alias =
build_cpu = x86_64
build_os = linux-gnu
build_vendor = unknown
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = x86_64-unknown-linux-gnu
host_alias =
host_cpu = x86_64
host_os = linux-gnu
host_vendor = unknown
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /afs/psi.ch/project/cafe/gitlab/CAFE/cpp/install-sh
libdir = /opt/gfa/cafe/cpp/cafe-1.3.0-final-1/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
lt_ECHO = echo
mandir = ${datarootdir}/man
mkdir_p = /bin/mkdir -p
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /opt/gfa/cafe/cpp/cafe-1.3.0-final-1
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target_alias =
top_build_prefix = ../
top_builddir = ..
top_srcdir = ..
include_HEADERS = cafe.h cafeCache.h cafeConvert.h cafeDataType.h \
cafeDataTypeHelper.h cafeEnum.h cafeEnumStrings.h cafeRoast.h \
cafeVectors.h cafeXML.h caopCodes.h channelRegalia.h conduit.h \
conduitConnectionHandlerArgs.h conduitEventHandlerArgs.h \
conduitFriends.h connect.h defines.h deviceCollection.h \
exceptions.h exceptionsHelper.h global.h enumStrings.h \
granules.h handleHelper.h hashConduit.h helper.h instant.h \
instant.cpp loadCollectionXMLParser.h loadGroupXMLParser.h \
methodCallbacks.h policies.h policyHelper.h PVCtrlHolder.h \
PVDataHolder.h PVGroup.h PVHolder.h statusCodes.h transpose.h \
conduitGroup.h hashConduitGroup.h restorePVGroupXMLParser.h \
$(am__append_1) $(am__append_2)
all: all-am
.SUFFIXES:
$(srcdir)/makefile.in: $(srcdir)/makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu include/makefile
.PRECIOUS: makefile
makefile: $(srcdir)/makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(includedir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: makefile $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-includeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-includeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am \
install-includeHEADERS install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags uninstall uninstall-am uninstall-includeHEADERS
#if HAVE_ZEROMQ
#include_HEADERS += cafeService.h zhelpers.h
#endif
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

27
include/makefile.am Normal file
View File

@@ -0,0 +1,27 @@
## Makefile.am - used by automake to produce makefile.in
##
## input file for production of cafe library
##
include_HEADERS = cafe.h cafeCache.h cafeConvert.h cafeDataType.h cafeDataTypeHelper.h cafeEnum.h \
cafeEnumStrings.h cafeRoast.h cafeVectors.h cafeXML.h caopCodes.h channelRegalia.h \
conduit.h conduitConnectionHandlerArgs.h conduitEventHandlerArgs.h conduitFriends.h \
connect.h defines.h deviceCollection.h exceptions.h exceptionsHelper.h global.h \
enumStrings.h granules.h handleHelper.h hashConduit.h helper.h instant.h instant.cpp \
loadCollectionXMLParser.h loadGroupXMLParser.h methodCallbacks.h policies.h policyHelper.h \
PVCtrlHolder.h PVDataHolder.h PVGroup.h PVHolder.h statusCodes.h transpose.h \
conduitGroup.h hashConduitGroup.h restorePVGroupXMLParser.h
if HAVE_PYTHON_
include_HEADERS += PyCafe_api.h
endif
if HAVE_PYCAFE_EXT
include_HEADERS += PyCafe.h
endif
#if HAVE_ZEROMQ
#include_HEADERS += cafeService.h zhelpers.h
#endif

25
include/methodCallbacks.h Normal file
View File

@@ -0,0 +1,25 @@
///
/// \file methodCallbacks.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef METHODCALLBACKS_H
#define METHODCALLBACKS_H
#include <config.h>
namespace CALLBACK_CAFE {
#if HAVE_PYTHON_H
void PyHandlerPut( struct event_handler_args args);
void PyHandlerGet( struct event_handler_args args);
#endif
void handlerPut( struct event_handler_args args) ;
void handlerGet( struct event_handler_args args) ;
void handlerGetCtrl( struct event_handler_args args) ;
void handlerGetSTSACK( struct event_handler_args args) ;
void handlerGetClassName( struct event_handler_args args) ;
};
#endif // METHODCALLBACKS_H

536
include/policies.h Normal file
View File

@@ -0,0 +1,536 @@
///
/// \file policies.h
///
/// Policies are:
/// ChannelCreatePolicy
/// ChannelOpenPolicy
/// ChannelRequestDataTypePolicy
/// ChannelGetCacheWaitPolicy
/// ChannelGetActionWhenMonitorPolicy
/// ChannelTimeoutPolicy
/// ChannelRequestPolicy
/// ChannelMonitorPolicy
///
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef POLICIES_H
#define POLICIES_H
#include <cafeEnum.h>
#include <defines.h>
#include <statusCodes.h>
#include <algorithm>
#include <cstring>
#include <iostream>
//include <config.h> //In the below!
#include <methodCallbacks.h>
//include <enumStrings.h>
using namespace CAFENUM;
using namespace std;
/**
* Define Policy for printing messages
*/
class PrintErrorPolicy{
protected:
bool invalidHandle;
bool info;
bool warn;
bool error;
public:
bool setInvalidHandle(bool inv) {return invalidHandle=inv;}
bool setInfo(bool i) {return info=i;}
bool setWarn(bool w) {return warn=w;}
bool setError(bool e) {return error=e;}
bool setAll(bool a) {invalidHandle=a; info=a; warn=a; error=a; return a;}
bool getInvalidHandle() {return invalidHandle;}
bool getInfo() {return info;}
bool getWarn() {return warn;}
bool getError() {return error;}
PrintErrorPolicy():invalidHandle(false),info(true),warn(true),error(true){};
};
/**
* Define Policy for creating channel; this just sets the priority level
* for dispatch within the server or network
*/
class ChannelCreatePolicy{
private:
unsigned short priority;
static void callbackHandlerCreate(struct connection_handler_args args);
//special method to find handle thru conduit_set iterator
pCallbackConnection handler;
public:
pCallbackConnection getHandler(){return handler;};
void setHandler(pCallbackConnection h){handler=h;};
unsigned short getPriority() const {return priority;}
unsigned short setPriority(unsigned short p){
priority=std::min(p,(unsigned short) CA_SERVER_DISPATCH_PRIORITY_MAX);
return priority;
}
ChannelCreatePolicy():priority(CA_SERVER_DISPATCH_PRIORITY_DEFAULT),handler(callbackHandlerCreate){};
};
/**
* Define Policy to open/close/monitor channels one-by-one
* or to accumulate messages for later dispatch
*/
class ChannelOpenPolicy{
public:
//Constructors
ChannelOpenPolicy():whenKind(FLUSH_AFTER_EACH_CHANNEL_CREATION), flushKind(WITH_PEND_EVENT),
timeout(DEFAULT_TIMEOUT_PEND_EVENT),defaultTimeout(DEFAULT_TIMEOUT_PEND_EVENT){};
ChannelOpenPolicy(ChannelFlushSendBufferPolicyKind f,
ChannelWhenToFlushSendBufferPolicyKind w, double t){
if (f>=WITH_PEND_EVENT && f<=WITH_POLL)
{setFlushSendBufferKind(f);} else {std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << endl;}
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
{setWhenToFlushSendBuffer(w);} else {std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << endl;}
setTimeout(t), setDefaultTimeout(DEFAULT_TIMEOUT_PEND_EVENT);
};
~ChannelOpenPolicy(){};
private:
ChannelWhenToFlushSendBufferPolicyKind whenKind;
ChannelFlushSendBufferPolicyKind flushKind;
double timeout;
double defaultTimeout;
public:
void flushSendBufferNow() {
switch(flushKind){
case WITH_PEND_EVENT:
ca_pend_event(timeout);
break;
case WITH_PEND_IO:
ca_pend_io(timeout);
break;
case WITH_FLUSH_IO:
ca_flush_io();
break;
case WITH_POLL:
ca_poll();
break;
default:
ca_pend_event(timeout);
break;
}
//Reset to default
setWhenToFlushSendBuffer(FLUSH_AFTER_EACH_CHANNEL_CREATION);
};
ChannelFlushSendBufferPolicyKind getFlushSendBufferKind() const {return flushKind;}
ChannelWhenToFlushSendBufferPolicyKind getWhenToFlushSendBuffer() const {return whenKind;}
double getTimeout() const {
//std::cout << "CHANNELOPENPOLICY " << " *GET* timeout " << timeout << endl;
return timeout;
}
double getDefaultTimeout() const {return defaultTimeout;}
void setFlushSendBufferKind(ChannelFlushSendBufferPolicyKind f){if (f>=WITH_FLUSH_IO && f<=WITH_POLL)
{flushKind=f;} else {std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << endl;}};
void setWhenToFlushSendBuffer(ChannelWhenToFlushSendBufferPolicyKind w) {
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
{whenKind=w;} else {std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << endl;}};
double setTimeout(double t) {
if (t<0){
std::cout << "CHANNELOPENPOLICY:setTimeout " << t << " seconds is an illegal value!" << endl;
return timeout;
}
else if (t==0) {
timeout=0.001;
std::cout << "CHANNELOPENPOLICY:setTimeout " << " A value of zero would block the ioc for ever! "<< endl;
std::cout << "CHANNELOPENPOLICY:setTimeout " << " Setting timeout to " << timeout << endl;
return timeout=0.001;
}
return timeout=t;}
double setDefaultTimeout(double t) {
if (t<0){
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << t << " seconds is an illegal value!" << endl;
return defaultTimeout;
}
else if (t==0) {
defaultTimeout=0.001;
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << " A value of zero would block the ioc for ever! "<< endl;
std::cout << "CHANNELOPENPOLICY:setDefaultTimeout " << " Setting timeout to " << defaultTimeout << endl;
return defaultTimeout;
}
return defaultTimeout=t;}
double setTimeoutToDefault() {return timeout=defaultTimeout;}
void setPolicy(ChannelWhenToFlushSendBufferPolicyKind w, ChannelFlushSendBufferPolicyKind f, double t){
if (f>=WITH_FLUSH_IO && f<=WITH_POLL){flushKind=f;}
else {std::cout << f << " is an INVALID ChannelFlushSendBufferPolicyKind" << endl;}
if (w>=FLUSH_AFTER_EACH_CHANNEL_CREATION && w<=FLUSH_DESIGNATED_TO_CLIENT)
{whenKind=w;}
else {std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << endl;}
timeout = t;
defaultTimeout = t;
//std::cout << "CHANNELOPENPOLICY " << " timeout " << timeout << endl;
};
};
/**
* Define Policy to control datatype conversion for data transfer
*/
class ChannelRequestDataTypePolicy{
private:
CAFENUM::ChannelRequestDataTypePolicyKind requestKind;
public:
void setRequestKind(CAFENUM::ChannelRequestDataTypePolicyKind rk) {
if (rk>=CAFENUM::NATIVE_DATATYPE && rk<=CAFENUM::LOWEST_DATATYPE)
{requestKind=rk;}
else {std::cout << rk << " is an INVALID ChannelDataTypePolicyKind" << endl;}
};
CAFENUM::ChannelRequestDataTypePolicyKind getRequestKind() const {return requestKind;}
//Constructors
ChannelRequestDataTypePolicy():requestKind(CAFENUM::NATIVE_DATATYPE){};
ChannelRequestDataTypePolicy(CAFENUM::ChannelRequestDataTypePolicyKind rk){requestKind=rk;};
};
/**
* Define Policy to control wait/nowait strategy in getCache operations
*/
class ChannelGetCacheWaitPolicy{
private:
CAFENUM::ChannelGetCacheWaitPolicyKind getCacheWaitKind;
public:
void setWaitKind(CAFENUM::ChannelGetCacheWaitPolicyKind wk) {
if (wk>=CAFENUM::GET_CACHE_NO_WAIT && wk<=CAFENUM::GET_CACHE_WAIT)
{getCacheWaitKind=wk;}
else {std::cout << wk << " is an INVALID ChannelGetCacheWaitKind" << endl;}
};
CAFENUM::ChannelGetCacheWaitPolicyKind getWaitKind() const {return getCacheWaitKind;}
//Constructors
ChannelGetCacheWaitPolicy():getCacheWaitKind(CAFENUM::GET_CACHE_WAIT){};
ChannelGetCacheWaitPolicy(CAFENUM::ChannelGetCacheWaitPolicyKind wk){getCacheWaitKind=wk;};
};
/**
* Define Policy to control whether the get operations targets the ioc or not when there is a monitor
*/
class ChannelGetActionWhenMonitorPolicy{
private:
CAFENUM::ChannelGetActionWhenMonitorPolicyKind getActionWhenMonitorKind;
public:
void setActionKind(CAFENUM::ChannelGetActionWhenMonitorPolicyKind ak) {
if (ak>=CAFENUM::GET_FROM_CACHE && ak<=CAFENUM::GET_FROM_IOC)
{getActionWhenMonitorKind=ak;}
else {std::cout << ak << " is an INVALID ChannelGetActionWhenMonitorKind" << endl;}
};
CAFENUM::ChannelGetActionWhenMonitorPolicyKind getActionKind() const {return getActionWhenMonitorKind;}
//Constructors
ChannelGetActionWhenMonitorPolicy():getActionWhenMonitorKind(CAFENUM::GET_FROM_IOC){};
ChannelGetActionWhenMonitorPolicy(CAFENUM::ChannelGetActionWhenMonitorPolicyKind ak){getActionWhenMonitorKind=ak;};
};
/**
* Defines Timeout policy for channel access transactions
* and configures the number of transaction attempts in the
* event of an ECA_TIMEOUT error; deltaTimeout gives the
* increment in timeout for each additional attempt.
*/
class ChannelTimeoutPolicy{
private:
bool selfGoverningTimeout;
double timeout;
double deltaTimeout;
unsigned short ntries;
double defaultTimeout;
public:
bool getSelfGoverningTimeout() const {return selfGoverningTimeout;};
void setSelfGoverningTimeout(bool sgt){selfGoverningTimeout=sgt;};
double getTimeout() const {return timeout;};
double getDefaultTimeout() const {return defaultTimeout;}
double getDeltaTimeout() const {return deltaTimeout;};
unsigned short getNtries() const {return ntries;};
double setTimeout(double t) {timeout=max(t,TIMEOUT_PEND_IO_MIN);
return timeout=min(timeout,TIMEOUT_PEND_IO_MAX);};
double setDeltaTimeout(double dt) { deltaTimeout=max(dt,PEND_IO_INCREMENT_TIME_MIN);
return deltaTimeout=min(deltaTimeout,PEND_IO_INCREMENT_TIME_MAX);};
unsigned short setNtries(unsigned short nt) {return ntries=min(nt, PEND_IO_MAX_TRIES);};
double setDefaultTimeout(double t) {return defaultTimeout=t;}
double setTimeoutToDefault() {return timeout=defaultTimeout;}
ChannelTimeoutPolicy():selfGoverningTimeout(DEFAULT_SELF_GOVERNING_TIMEOUT),
timeout(DEFAULT_TIMEOUT_PEND_IO),deltaTimeout(DEFAULT_PEND_IO_INCREMENT_TIME),
ntries(DEFAULT_PEND_IO_NO_TRIES),defaultTimeout(DEFAULT_TIMEOUT_PEND_IO){};
};
/**
* Define Policy to get/set channels whether in blocking/non-blocking mode:
* Blocking can be achieved with or without callback
*/
class ChannelRequestPolicy{
private:
ChannelWhenToFlushSendBufferPolicyKind whenKind; // used for set
ChannelWaitForResponsePolicyKind waitKind; //only for WITH_CALLBACK WAIT or NO_WAIT
ChannelRequestPolicyKind methodKind;
pCallback handler; // for blockingKind=WITH_CALLBACK_DEFAULT or WITH_CALLBACK_USER_SUPPLIED
int callbackStatus; // used by CAFE::waitForGetEvent() to record status of callback
public:
ChannelWhenToFlushSendBufferPolicyKind getWhenToFlushSendBuffer() const {return whenKind;}
ChannelWaitForResponsePolicyKind getWaitKind() const {return waitKind;};
ChannelRequestPolicyKind getMethodKind() const {return methodKind;};
pCallback getHandler() const {return handler;};
int getCallbackStatus() const {return callbackStatus;};
void setHandler(pCallback h){if (h!=NULL) {handler=h; methodKind=WITH_CALLBACK_USER_SUPPLIED;}};
#if HAVE_PYTHON_H
void setPyHandlerGet(){handler= CALLBACK_CAFE::PyHandlerGet; methodKind=WITH_CALLBACK_USER_SUPPLIED;}; //CAFE_CALLBACK::PyHandlerGet
void setPyHandlerPut(){handler= CALLBACK_CAFE::PyHandlerPut; methodKind=WITH_CALLBACK_USER_SUPPLIED;}; //CAFE_CALLBACK::PyHandlerPut
#endif
void setMethodKind(ChannelRequestPolicyKind m) { if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED)
{methodKind=m;} else {std::cout << m << " is an INVALID ChannelRequestPolicyKind" << std::endl;} };
void setWhenToFlushSendBuffer(ChannelWhenToFlushSendBufferPolicyKind w) {
if (w>=FLUSH_AFTER_EACH_MESSAGE && w<=FLUSH_DESIGNATED_TO_CLIENT)
{whenKind=w;} else {std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << std::endl;}};
void setWaitKind(ChannelWaitForResponsePolicyKind r) { if (r>=WAIT && r<=NO_WAIT)
{waitKind=r;} else {std::cout << r << " is an INVALID ChannelWaitForResponsePolicyKind" << std::endl;}};
void setCallbackStatus (int cstatus) {callbackStatus =cstatus;};
void setPolicy(
ChannelWhenToFlushSendBufferPolicyKind w, ChannelWaitForResponsePolicyKind r,
ChannelRequestPolicyKind m)
{
if (w>=FLUSH_AFTER_EACH_MESSAGE && w<=FLUSH_DESIGNATED_TO_CLIENT)
{whenKind=w;} else {std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
std::cout << w << " is an INVALID ChannelWhenToFlushSendBufferPolicyKind" << endl;
std::cout << "Sticking to default value ChannelWhenToFlushSendBufferPolicyKind=" << whenKind << std::endl;
}
if (r>=WAIT && r<=NO_WAIT)
{waitKind=r;} else {std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
std::cout << r<< " is an INVALID ChannelWaitForResponsePolicyKind" << endl;
std::cout << "Sticking to default value ChannelWaitForRespomsePolicyKind=" << waitKind << std::endl;
}
if (m>=WITHOUT_CALLBACK && m<=WITH_CALLBACK_USER_SUPPLIED)
{methodKind=m;} else {std::cout << "ERROR in setting ChannelRequestPolicy " << std::endl;
std::cout << r<< " is an INVALID ChannelRequestPolicyKind" << endl;
std::cout << "Sticking to default value ChannelRequestPolicyKind=" << methodKind << std::endl;
}
if (methodKind==WITHOUT_CALLBACK && waitKind==NO_WAIT) {
std::cout << "WARNING when setting ChannelRequestPolicy " << std::endl;
std::cout << "waitKind=NO_WAIT does not apply when methodKind=WITHOUT_CALLBACK " << std::endl;
}
};
//Constructors
ChannelRequestPolicy():
whenKind(FLUSH_AFTER_EACH_MESSAGE),waitKind(WAIT),methodKind(WITH_CALLBACK_DEFAULT), //WITHOUT_CALLBACK),
callbackStatus(ICAFE_NORMAL){
handler=NULL;
};
ChannelRequestPolicy(ChannelRequestPolicyKind b){
if (b>=WITHOUT_CALLBACK && b<=WITH_CALLBACK_USER_SUPPLIED)
{methodKind=b;} else {cout << b << " is anINVALID ChannelRequestPolicyKind" << endl;}
handler=NULL;
callbackStatus=ICAFE_NORMAL;
whenKind=FLUSH_AFTER_EACH_MESSAGE;
waitKind=WAIT;
};
ChannelRequestPolicy(pCallback h){
handler=h;
methodKind=WITH_CALLBACK_DEFAULT;
whenKind=FLUSH_AFTER_EACH_MESSAGE;
waitKind=WAIT;
callbackStatus =ICAFE_NORMAL;
}
~ChannelRequestPolicy(){};
};
/**
* Defines policy to start a monitor on a channel
* upon first connection. Note that CAFE will not
* start a monitor on a channel if it is not connected
* as the datatype in such cases is unknown. \n
* The monitor is rather placed in a monitor_in_waiting
* pseudo-queue and only started upon connection
*/
class MonitorPolicy
{
friend class Conduit;
friend class Connect;
private:
static unsigned int idNext;
chtype dataType; //specify primitive datatype for monitoring
chtype dbrDataType; //1
CAFENUM::DBR_TYPE cafeDbrType;
unsigned int nelem; //2
//chid channelID; //3
unsigned int mask; //4
pCallback handler;//5
void * userArgs; //6
evid eventID; //output
int status; //output
unsigned int id;
static void callbackHandlerMonitor(struct event_handler_args args);
static void PyCallbackHandlerMonitorData(struct event_handler_args args); //pushes pvd,handle,pvname
static void PyCallbackHandlerMonitor(struct event_handler_args args); //pushes handle
void setEventID(evid e){eventID=e;};
public:
MonitorPolicy():dataType((CAFE_DATATYPE) CAFE_NOT_REQUESTED),
dbrDataType((CAFE_DATATYPE) CAFE_NOT_REQUESTED),
cafeDbrType((CAFENUM::DBR_TYPE) CAFENUM::DBR_TIME),
nelem(0), mask(DBE_VALUE | DBE_LOG | DBE_ALARM),
handler(callbackHandlerMonitor), userArgs(NULL), eventID(NULL),
status(ICAFE_NORMAL){
++idNext;
id = idNext;
};
chtype getDataType() const {return dataType;};
chtype getDbrDataType() const {return dbrDataType;};
CAFENUM::DBR_TYPE getCafeDbrType() const {return cafeDbrType;};
unsigned int getNelem() const {return nelem;};
//chid getChannelID() const {return channelID;};
unsigned int getMask() const {return mask;};
bool maskHasDBE_PROPERTY() const {bool has=false;
# if (EPICS_MAJOR==3 && EPICS_MINOR>=14 && EPICS_PATCH >=11)
mask & DBE_PROPERTY ? has=true : has=false;
# endif
return has;
}; //8
bool maskHasDBE_VALUE() const {bool has=false; mask & DBE_VALUE ? has=true : has=false; return has;}; //4
bool maskHasDBE_LOG() const {bool has=false; mask & DBE_LOG ? has=true : has=false; return has;}; //2
bool maskHasDBE_ALARM() const {bool has=false; mask & DBE_ALARM ? has=true : has=false; return has;}; //1
pCallback getHandler() const {return handler;};
void * getUserArgs() const {return userArgs;};
//On most platforms pointers and longs are the same size, but ints and pointers often are not the same size
//on 64bit platforms. If you convert (void*) to (long) no precision is lost, then by assigning the (long) to
//an (int), it properly truncates the number to fit.
unsigned int getUserArgsAsInt() const {return (unsigned int) ((long long) (void *)userArgs);};
evid getEventID() const {return eventID;};
unsigned int getMonitorID() const {return id;};
int getStatus() const {return status;};
unsigned int getID() const {return id;};
void setMask(unsigned int m) {mask=m;};
void setPyHandler(){handler= PyCallbackHandlerMonitor;};
void setPyHandlerData(){handler= PyCallbackHandlerMonitorData;};
void setDefaultHandler(){handler= callbackHandlerMonitor;};
void setHandler(pCallback h){handler=h;};
void setNelem(unsigned int n){nelem=n;};
void setDataType(chtype dt){ if (dt < DBR_PUT_ACKT) {
dataType=dt%(LAST_TYPE+1);} else {
cout << "monitorPolicy FUNNY! " << dt << " is an INVALID DATATYPE! " << endl;
return;}
switch(cafeDbrType) {
case CAFENUM::DBR_TIME:
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
break;
case CAFENUM::DBR_STS:
dbrDataType=(dbf_type_to_DBR_STS (dataType));
break;
case CAFENUM::DBR_PRIMITIVE:
dbrDataType=(dbf_type_to_DBR (dataType));
break;
case CAFENUM::DBR_CTRL:
dbrDataType=(dbf_type_to_DBR_CTRL(dataType));
break;
case CAFENUM::DBR_GR:
dbrDataType=(dbf_type_to_DBR_GR (dataType));
break;
default:
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
}
};
void setCafeDbrType( CAFENUM::DBR_TYPE cdt) {if (cdt > DBR_PUT) {
cout << "monitorPolicy FUNNY! " << cdt << " is an INVALID CAFENUM::DBR_TYPE! " << endl;
return;} else { cafeDbrType=cdt;}
//cout << "monitorPolicy Class: " << " cafeDbrType = " << cafeDbrType << endl;
//cout << "setDataType: " << dataType << endl;
switch(cafeDbrType) {
case CAFENUM::DBR_TIME:
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
break;
case CAFENUM::DBR_STS:
dbrDataType=(dbf_type_to_DBR_STS (dataType));
break;
case CAFENUM::DBR_PRIMITIVE:
dbrDataType=(dbf_type_to_DBR (dataType));
break;
case CAFENUM::DBR_CTRL:
dbrDataType=(dbf_type_to_DBR_CTRL(dataType));
break;
case CAFENUM::DBR_GR:
dbrDataType=(dbf_type_to_DBR_GR (dataType));
break;
default:
dbrDataType=(dbf_type_to_DBR_TIME(dataType));
}
//cout << "monitorPolicy Class: " << " dbrDataType = " << dbrDataType << endl;
}
void setUserArgs(void * u){userArgs=u;};
void setStatus(int s){status=s;};
void print() {
cout << "-------------------------------" << endl;
cout << "Monitor Policy " << endl;
cout << "-------------------------------" << endl;
cout << "dbrDataType = " << dbr_type_to_text(dbrDataType) << endl;
cout << "nelem = " << nelem << endl;
cout << "eventID = " << eventID << endl;
cout << "monitorID = " << id << endl;
cout << "-------------------------------" << endl;
}
};
#endif // POLICIES_H

144
include/policyHelper.h Normal file
View File

@@ -0,0 +1,144 @@
///
/// \file policyHelper.h
/// \author Jan Chrin, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#ifndef POLICYHELPER_H
#define POLICYHELPER_H
#include <cadef.h>
#include "helper.h"
#include "defines.h"
#include "hashConduit.h"
#include "hashConduitGroup.h"
#include "conduitFriends.h"
class PolicyHelper : Helper
{
private:
CAFEStatus cafeStatus;
cafeConduit_set::iterator itcs;
cafeGroup_set::iterator itgs;
public:
PolicyHelper(){};
~PolicyHelper(){};
int getChannelGetActionWhenMonitorPolicy(unsigned int _handle, ChannelGetActionWhenMonitorPolicy & awmp);
int setChannelGetActionWhenMonitorPolicy(unsigned int _handle, ChannelGetActionWhenMonitorPolicy awmp);
int setChannelGetActionWhenMonitorPolicy(ChannelGetActionWhenMonitorPolicy awmp);
int setChannelGetActionWhenMonitorPolicyAllHandles(ChannelGetActionWhenMonitorPolicy awmp){
return setChannelGetActionWhenMonitorPolicy(awmp);}
int getChannelGetCacheWaitPolicy(unsigned int _handle, ChannelGetCacheWaitPolicy & cwp);
int setChannelGetCacheWaitPolicy(unsigned int _handle, ChannelGetCacheWaitPolicy cwp);
int setChannelGetCacheWaitPolicy(ChannelGetCacheWaitPolicy cwp);
int setChannelGetCacheWaitPolicyAllHandles(ChannelGetCacheWaitPolicy cwp){
return setChannelGetCacheWaitPolicy(cwp);}
int getChannelRequestDataTypePolicy(unsigned int _handle, ChannelRequestDataTypePolicy &crdtp);
int setChannelRequestDataTypePolicy(unsigned int _handle, ChannelRequestDataTypePolicy crdtp);
int setChannelRequestDataTypePolicy(ChannelRequestDataTypePolicy crdtp);
int setChannelRequestDataTypePolicyAllHandles(ChannelRequestDataTypePolicy crdtp){
return setChannelRequestDataTypePolicy(crdtp);}
int getChannelRequestPolicyGet (unsigned int _handle, ChannelRequestPolicy & crpg);
int setChannelRequestPolicyGet (unsigned int _handle, ChannelRequestPolicy crpg);
int setChannelRequestPolicyGet (ChannelRequestPolicy crpg);
int setChannelRequestPolicyGetAllHandles (ChannelRequestPolicy crpg) {return setChannelRequestPolicyGet (crpg);}
int getChannelRequestPolicyPut (unsigned int _handle, ChannelRequestPolicy & crpp);
int setChannelRequestPolicyPut (unsigned int _handle, ChannelRequestPolicy crpp);
int setChannelRequestPolicyPut (ChannelRequestPolicy crpp);
int setChannelRequestPolicyPutAllHandles (ChannelRequestPolicy crpp) {return setChannelRequestPolicyPut (crpp);}
int getChannelTimeoutPolicyGet (unsigned int _handle, ChannelTimeoutPolicy & ctpg);
int setChannelTimeoutPolicyGet (unsigned int _handle, ChannelTimeoutPolicy ctpg);
int getChannelTimeoutPolicyPut (unsigned int _handle, ChannelTimeoutPolicy & ctpp);
int setChannelTimeoutPolicyPut (unsigned int _handle, ChannelTimeoutPolicy ctpp);
int setSelfGoverningTimeout(bool b);
int setSelfGoverningTimeout(unsigned int _handle, bool b);
int setSelfGoverningTimeoutPut(unsigned int _handle, bool p);
int setSelfGoverningTimeoutGet(unsigned int _handle, bool g);
int getSelfGoverningTimeout(unsigned int _handle, bool &p, bool &g);
int setSGSelfGoverningTimeout(bool b);
int setSGSelfGoverningTimeout(unsigned int _handle, bool b);
int setSGSelfGoverningTimeoutPut(unsigned int _handle, bool p);
int setSGSelfGoverningTimeoutGet(unsigned int _handle, bool g);
int getSGSelfGoverningTimeout(unsigned int _handle, bool &p, bool &g);
//Short cuts
//put, get, put, get
int getTimeoutRange (double &p, double &p2, double &g, double &g2) { int stp; int stg;
stp=getTimeoutMin(p,g); stg=getTimeoutMax(p2, g2);
if (stp!=ICAFE_NORMAL){return stp;} else if(stg!=ICAFE_NORMAL){return stg;}
else {return ICAFE_NORMAL;}
};
int getTimeoutMin (double &p, double &g);
int getTimeoutMax (double &p, double &g);
int getTimeout (unsigned int _handle, double &p, double &g);
//returns lesser of the two
int getTimeout (unsigned int _handle, double &pg) {double p; double g; int st;
st=getTimeout(_handle, p, g); pg=std::min(p,g); return st;}
int getTimeoutPut(unsigned int _handle, double &p) {double g; return getTimeout(_handle, p, g);}
int getTimeoutGet(unsigned int _handle, double &g) {double p; return getTimeout(_handle, p, g);}
int printTimeout ();
int printTimeout (unsigned int _handle);
int setTimeout (double p, double g); // for all handles put and get separately
int setTimeout (double pg){return setTimeout(pg, pg);};
int setTimeoutPut(double p) {return setTimeout(p, (double) NULL);};
int setTimeoutGet(double g) {return setTimeout((double) NULL, g);};
int setTimeout (unsigned int _handle, double p, double g);
int setTimeout (unsigned int _handle, double pg){return setTimeout(_handle, pg, pg); };
int setTimeoutPut(unsigned int _handle, double p) {return setTimeout(_handle, p, (double) NULL);};
int setTimeoutGet(unsigned int _handle, double g) {return setTimeout(_handle, (double) NULL, g);};
int setTimeoutToDefault(unsigned int _handle);
int setTimeoutToDefault();
//get SGTimeout
int getSGTimeoutRange (double &p, double &p2, double &g, double &g2) { int stp; int stg;
stp=getSGTimeoutMin(p,g); stg=getSGTimeoutMax(p2, g2);
if (stp!=ICAFE_NORMAL){return stp;} else if(stg!=ICAFE_NORMAL){return stg;}
else {return ICAFE_NORMAL;}
};
int getSGTimeoutMin (double &p, double &g);
int getSGTimeoutMax (double &p, double &g);
int printSGTimeout ();
int printSGTimeout (unsigned int _handle);
int getSGTimeout (unsigned int _handle, double &p, double &g);
//returns lesser of the two
int getSGTimeout (unsigned int _handle, double &pg) {double p; double g; int st;
st=getSGTimeout(_handle, p, g); pg=std::min(p,g); return st;}
int getSGTimeoutPut(unsigned int _handle, double &p) {double g; return getSGTimeout(_handle, p, g);}
int getSGTimeoutGet(unsigned int _handle, double &g) {double p; return getSGTimeout(_handle, p, g);}
//set SGTimeout
int setSGTimeout (double p, double g); // for all group handles put and get separately
int setSGTimeout (double pg){return setSGTimeout(pg, pg);};
int setSGTimeoutPut(double p) {return setSGTimeout(p, (double) NULL);};
int setSGTimeoutGet(double g) {return setSGTimeout((double) NULL, g);};
int setSGTimeout (unsigned int _gHandle, double p, double g);
int setSGTimeout (unsigned int _gHandle, double pg){return setSGTimeout(_gHandle, pg, pg); };
int setSGTimeoutPut(unsigned int _gHandle, double p) {return setSGTimeout(_gHandle, p, (double) NULL);};
int setSGTimeoutGet(unsigned int _gHandle, double g) {return setSGTimeout(_gHandle, (double) NULL, g);};
int setSGTimeoutToDefault(unsigned int _handle);
int setSGTimeoutToDefault();
};
#endif

View File

@@ -0,0 +1,74 @@
///
/// \file restorePVGroupXMLParser.h
/// \author Jan Chrin, G. Prekas, PSI
/// \date Release: February 2015
/// \version CAFE 1.0.0
///
#include <config.h>
#if HAVE_LIBQTXML
#ifndef RESTOREPVGROUPXMLPARSER_H
#define RESTOREPVGROUPXMLPARSER_H
#include "PVGroup.h"
#include <QtXml/QXmlDefaultHandler>
class restorePVGroupXMLParser : public QXmlDefaultHandler {
public:
restorePVGroupXMLParser();
virtual ~restorePVGroupXMLParser();
bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts);
bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName);
bool characters(const QString& ch);
PVGroup group;
private:
enum
{
NotWaiting,
WaitingForConfig,
WaitingForNPV,
WaitingForGroup,
WaitingForDescription,
WaitingForStatusGroup,
WaitingForMember,
WaitingForName,
WaitingForNelem,
WaitingForStatus,
WaitingForRule,
WaitingForVal,
WaitingForSettable
} state;
PVDataHolder * pvd;
bool settable;
unsigned int icount;
const static QString& tagConfig;
const static QString& tagGroup;
const static QString& tagNPV;
const static QString& tagDescription;
const static QString& tagStatusGroup;
const static QString& tagMember;
const static QString& tagName;
const static QString& tagNelem;
const static QString& tagStatus;
const static QString& tagRule;
const static QString& tagVal;
const static QString& tagSettable;
};
#endif /* RESTOREPVGROUPXMLPARSER_H */
#endif

1
include/stamp-h1 Normal file
View File

@@ -0,0 +1 @@
timestamp for ./include/config.h

974
include/statusCodes.h Normal file
View File

@@ -0,0 +1,974 @@
///
/// \file StatusCodes.h
///
/// class StatusInfo - contains user defined messages (>ICAFE_STATUS_BASE)
/// and ca_message() output string
///
/// class StatusMap - contains ECA and ECAFE error strings plus ICAFE info strings
///
/// class Status - contains both above classes by composition
///
/// \author Jan Chrin, PSI
/// \date Release: Feb. 2015
/// Revised: May 2017
/// Added CAFEGlobalAlarmStatus and CAFEGlobalAlarmSeverity
/// \version CAFE 1.1.0
///
/// JC, Dec. 2015, additional methods to CAFEStatus
///
#ifndef STATUSCODES_H
#define STATUSCODES_H
#include <cadef.h>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cafeDataType.h>
const unsigned short ICAFE_STATUS_BASE = 600;
const unsigned short ICAFE_STATUS_CS = ICAFE_STATUS_BASE;
const unsigned short ICAFE_STATUS_CFT = 700; // ca_field_type
const unsigned short ICAFE_STATUS_CA_OP = 800;
const unsigned short ICAFE_STATUS_ERROR = 1000;
const unsigned short ICAFE_FILE_ERROR = 1100;
const unsigned short ICAFE_SERVICE_ERROR =1200;
const unsigned short ICAFE_LINUX_ERROR = 5000;
const unsigned short ICAFE_SUCCESS = ECA_NORMAL;
const unsigned short ICAFE_NORMAL = ECA_NORMAL;
enum CAFE_CS_STATE { ICAFE_CS_NEVER_CONN=ICAFE_STATUS_CS,
ICAFE_CS_PREV_CONN,
ICAFE_CS_CONN,
ICAFE_CS_CLOSED,
ICAFE_CS_DISCONN,
ICAFE_CS_UNKNOWN
};
enum CAFE_CFT_STATE{ ICAFE_TYPENOTCONN=ICAFE_STATUS_CFT,
ICAFE_RULE_FALSE,
ICAFE_BADCOUNT,
ICAFE_CALLBACK_NOT_YET_INVOKED,
ICAFE_WAITING_FOR_PREV_CALLBACK,
ICAFE_CACHE_EMPTY,
ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT,
ICAFE_MONITOR_DELAYED_AS_CONN_DOWN,
ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE,
ICAFE_SET_AND_GET_MISMATCH
};
enum CAFE_CC_STATE { ICAFE_CA_OP_GET=ICAFE_STATUS_CA_OP,
ICAFE_CA_OP_PUT,
ICAFE_CA_OP_CREATE_CHANNEL,
ICAFE_CA_OP_ADD_EVENT,
ICAFE_CA_OP_CLEAR_EVENT,
ICAFE_CA_OP_OTHER,
ICAFE_CA_OP_CONN_UP,
ICAFE_CA_OP_CONN_DOWN
};
enum CAFE_ERROR_STATE { ECAFE_NODATA=ICAFE_STATUS_ERROR,
ECAFE_INVALID_TYPE,
ECAFE_BADCOUNT,
ECAFE_BADSTR,
ECAFE_BADTYPE,
ECAFE_NO_CONVERT,
ECAFE_NULLCONTEXT,
ECAFE_NULLCHID,
ECAFE_NULLEVID,
ECAFE_UNKNOWN_COLLECTION,
ECAFE_EMPTY_COLLECTION,
ECAFE_COLLECTION_PREV_DEF,
ECAFE_COLLECTION_INVALID_MEMBER,
ECAFE_RULE_FALSE,
ECAFE_UNKNOWN_GROUP,
ECAFE_EMPTY_GROUP,
ECAFE_GROUP_PREV_DEF,
ECAFE_INVALID_HANDLE,
ECAFE_INVALID_GROUP_HANDLE,
ECAFE_NORDACCESS,
ECAFE_NOWTACCESS,
ECAFE_TIMEOUT,
ECAFE_CANNOT_OPEN_FILE,
ECAFE_INVALID_SWITCH_CASE,
ECAFE_PVALIAS_PREV_DEF,
ECAFE_PVALIAS_INVALID,
ECAFE_PVNAME_PREV_DEF_AS_PVALIAS,
ECAFE_DEVICE_ATTRIB_NOT_FOUND,
ECAFE_HASH_UNIQUEID_EXISTS,
ECAFE_WRONG_CA_CONTEXT,
ECAFE_INVALID_CAFENUM_POLICY_TYPE,
ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED,
ECAFE_INVALID_ENUM_INDEX,
ECAFE_PVGROUP_GROUPHANDLE_MISMATCH,
ECAFE_TIMEOUT_SET_AND_MATCH,
ECAFE_HANDLE_MISMATCH_SET_AND_MATCH
};
enum CAFE_FILE_ERROR { ECAFE_LOAD_COLLECTION=ICAFE_FILE_ERROR,
ECAFE_LOAD_GROUP
};
enum CAFE_SERVICE_ERROR { ECAFE_BPM_DATA_IS_INVALID=ICAFE_SERVICE_ERROR
};
//Used by zeromq
enum CAFE_LINUX_ERROR { LINUX_EINTR =ICAFE_LINUX_ERROR+4,
LINUX_EAGAIN=ICAFE_LINUX_ERROR+11,
LINUX_EFAULT=ICAFE_LINUX_ERROR+14,
LINUX_ENOTSOCK=ICAFE_LINUX_ERROR+88,
LINUX_EPROTONOSUPPORT=ICAFE_LINUX_ERROR+93
};
//epicsAlarmConditionStrings = {"NO_ALARM","READ","WRITE","HIHI","HIGH",
//"LOLO","LOW","STATE","COS", "COMM","TIMEOUT","HWLIMIT","CALC","SCAN","LINK",
//"SOFT","BAD_SUB","UDF","DISABLE","SIMM","READ_ACCESS", "WRITE_ACCESS"};
enum EPICS_GLOBAL_ALARM_CONDITION {STAT_NO_ALARM=0, STAT_READ, STAT_WRITE, STAT_HIHI, STAT_HIGH,
STAT_LOLO, STAT_LOW, STAT_STATE, STAT_COS, STAT_COMM, STAT_TIMEOUT, STAT_HWLIMIT,
STAT_CALC, STAT_SCAN, STAT_LINK,
STAT_SOFT, STAT_BAD_SUB, STAT_UDF, STAT_DISABLE, STAT_SIMM, STAT_READ_ACCESS, STAT_WRITE_ACCESS
};
enum EPICS_GLOBAL_ALARM_SEVERITY {SEV_NO_ALARM=0, SEV_MINOR, SEV_MAJOR, SEV_INVALID};
class CAFEGlobalAlarmCondition {
typedef std::map<int, std::string> mapIntString;
private:
mapIntString mapAlarmCondition;
mapIntString::iterator pos;
public:
CAFEGlobalAlarmCondition() {
mapAlarmCondition.insert(std::make_pair((int) STAT_NO_ALARM, "NO_ALARM"));
mapAlarmCondition.insert(std::make_pair((int) STAT_READ, "READ"));
mapAlarmCondition.insert(std::make_pair((int) STAT_WRITE, "WRITE"));
mapAlarmCondition.insert(std::make_pair((int) STAT_HIHI, "HIHI"));
mapAlarmCondition.insert(std::make_pair((int) STAT_HIGH, "HIGH"));
mapAlarmCondition.insert(std::make_pair((int) STAT_LOLO, "LOLO"));
mapAlarmCondition.insert(std::make_pair((int) STAT_LOW, "LOW"));
mapAlarmCondition.insert(std::make_pair((int) STAT_STATE, "STATE"));
mapAlarmCondition.insert(std::make_pair((int) STAT_COS, "COS"));
mapAlarmCondition.insert(std::make_pair((int) STAT_COMM, "COMM"));
mapAlarmCondition.insert(std::make_pair((int) STAT_TIMEOUT, "TIMEOUT"));
mapAlarmCondition.insert(std::make_pair((int) STAT_HWLIMIT, "HWLIMIT"));
mapAlarmCondition.insert(std::make_pair((int) STAT_CALC, "CALC"));
mapAlarmCondition.insert(std::make_pair((int) STAT_SCAN, "SCAN"));
mapAlarmCondition.insert(std::make_pair((int) STAT_LINK, "LINK"));
mapAlarmCondition.insert(std::make_pair((int) STAT_SOFT, "SOFT"));
mapAlarmCondition.insert(std::make_pair((int) STAT_BAD_SUB, "BAD_SUB"));
mapAlarmCondition.insert(std::make_pair((int) STAT_UDF, "UDF"));
mapAlarmCondition.insert(std::make_pair((int) STAT_DISABLE, "DISABLE"));
mapAlarmCondition.insert(std::make_pair((int) STAT_SIMM, "SIMM"));
mapAlarmCondition.insert(std::make_pair((int) STAT_READ_ACCESS, "READ_ACCESS"));
mapAlarmCondition.insert(std::make_pair((int) STAT_WRITE_ACCESS, "WRITE_ACCESS"));
};
~CAFEGlobalAlarmCondition() {};
std::string asString (int i) {
pos = mapAlarmCondition.find(i);
if (pos != mapAlarmCondition.end()) {
return pos->second;
}
std::ostringstream oss;
if (i == -1) {
oss << "NO DATA" ;
return oss.str();
}
std::cout << "------------------------------------" << std::endl;
oss << "INVALID ENUM VALUE: " << i ; //<< --std::endl;
std::cout << oss.str();
std::cout << " VALID VALUES ARE: " << std::endl;
printAll();
std::cout << "--------------------------------------" << std::endl;
return oss.str();
};
int asInt (std::string message) {
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos) {
if (pos->second==message) return pos->first;
// String searches such as s.find(s1) return string::npos on failure
else if ( (pos->second).find(message) != std::string::npos) return pos->first;
}
std::cout << "------------------------------------" << std::endl;
std::cout << "INVALID INPUT: " << message << " VALID VALUES ARE: " << std::endl;
printAll();
std::cout << "------------------------------------" << std::endl;
return -1;
};
void getStates(std::vector<int> &vecI, std::vector<std::string> &vecS ) {
vecS.clear(); vecS.reserve(mapAlarmCondition.size());
vecI.clear(); vecI.reserve(mapAlarmCondition.size());
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos) {
vecI.push_back(pos->first);
vecS.push_back(pos->second);
}
return;
}
void printAll() {
std::cout << "-------------------" << std::endl;
std::cout << "EPICS GLOBAL ALARM CONDITION LIST" << std::endl;
std::cout << "-------------------" << std::endl;
for (pos=mapAlarmCondition.begin(); pos != mapAlarmCondition.end(); ++pos) {
if (pos->first < 10) {
std::cout << " " << pos->first << " " << pos->second << std::endl;
}
else {
std::cout << pos->first << " " << pos->second << std::endl;
}
}
std::cout << "------------------" << std::endl;
};
};
class CAFEGlobalAlarmSeverity {
typedef std::map<int, std::string> mapIntString;
private:
mapIntString mapAlarmSeverity;
mapIntString::iterator pos;
public:
CAFEGlobalAlarmSeverity() {
mapAlarmSeverity.insert(std::make_pair((int) SEV_NO_ALARM, "NO_ALARM"));
mapAlarmSeverity.insert(std::make_pair((int) SEV_MINOR, "MINOR"));
mapAlarmSeverity.insert(std::make_pair((int) SEV_MAJOR, "MAJOR"));
mapAlarmSeverity.insert(std::make_pair((int) SEV_INVALID, "INVALID"));
};
~CAFEGlobalAlarmSeverity() {};
std::string asString (int i) {
pos = mapAlarmSeverity.find(i);
if (pos != mapAlarmSeverity.end()) {
return pos->second;
}
std::ostringstream oss;
if (i == -1) {
oss << "NO DATA" ;
return oss.str();
}
std::cout << "--------------------------------------" << std::endl;
oss << "INVALID ENUM VALUE: " << i ; //<< std::endl;
std::cout << oss.str();
std::cout << " VALID VALUES ARE: " << std::endl;
printAll();
std::cout << "--------------------------------------" << std::endl;
return oss.str();
};
int asInt (std::string message) {
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos) {
if (pos->second==message) return pos->first;
// String searches such as s.find(s1) return string::npos on failure
else if ( (pos->second).find(message) != std::string::npos) return pos->first;
}
std::cout << "--------------------------------------" << std::endl;
std::cout << "INVALID INPUT: " << message << " VALID VALUES ARE: " << std::endl;
printAll();
std::cout << "--------------------------------------" << std::endl;
return -1;
};
void getStates(std::vector<int> &vecI, std::vector<std::string> &vecS ) {
vecS.clear(); vecS.reserve(mapAlarmSeverity.size());
vecI.clear(); vecI.reserve(mapAlarmSeverity.size());
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos) {
vecI.push_back(pos->first);
vecS.push_back(pos->second);
}
return;
}
void printAll() {
std::cout << "-------------------" << std::endl;
std::cout << "EPICS GLOBAL ALARM SEVERITY LIST" << std::endl;
std::cout << "-------------------" << std::endl;
for (pos=mapAlarmSeverity.begin(); pos != mapAlarmSeverity.end(); ++pos) {
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "------------------" << std::endl;
};
};
/* class StatusInfo provides information for user defined error/status codes
* and ca defined error/status codes \n
* 1 ECA_NORMAL \n
* 48 ECA_ALLOCMEM \n
* 72 ECA_TOLARGE \n
* 80 ECA_TIMEOUT \n
* 114 ECA_BADTYPE \n
* 142 ECA_INTERNAL \n
* 152 ECA_GETFAIL \n
* 160 ECA_PUTFAIL \n
* 176 ECA_BADCOUNT \n
* 186 ECA_BADSTR \n
* 192 ECA_DISCONN \n
* 200 ECA_DBLCHNL \n
* 210 ECA_EVDISALLOW \n
* 242 ECA_BADMONID \n
* 330 ECA_BADMASK \n
* 339 ECA_IODONE \n
* 347 ECA_IOINPROGRESS \n
* 354 ECA_BADSYNCGRP \n
* 362 ECA_PUTCBINPROG \n
* 368 ECA_NORDACCESS \n
* 376 ECA_NOWTACCESS \n
* 386 ECA_ANACHRONISM \n
* 392 ECA_NOSEARCHADDR \n
* 400 ECA_NOCONVERT \n
* 410 ECA_BADCHID \n
* 418 ECA_BADFUNCPTR \n
* 424 ECA_ISATTACHED \n
* 432 ECA_UNAVAILINSERV \n
* 440 ECA_CHANDESTROY \n
* 450 ECA_BADPRIORITY \n
* 458 ECA_NOTTHREADED \n
* 464 ECA_16KARRAYCLIENT \n
* 472 ECA_CONNSEQTMO \n
* 480 ECA_UNRESPTMO \n
* 600 ICAFE_CS_NEVER_CONN \n
* 601 ICAFE_CS_PREV_CONN \n
* 602 ICAFE_CS_CONN \n
* 603 ICAFE_CS_CLOSED \n
* 604 ICAFE_CS_DISCONN, \n
* 605 ICAFE_CS_UNKNOWN \n
* 700 ICAFE_TYPENOTCONN \n
* 701 ICAFE_RULE_FALSE \n
* 702 ICAFE_BADCOUNT \n
* 703 ICAFE_CALLBACK_NOT_YET_INVOKED \n
* 704 ICAFE_WAITING_FOR_PREV_CALLBACK \n
* 705 ICAFE_CACHE_EMPTY \n
* 706 ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT \n
* 707 ICAFE_MONITOR_DELAYED_AS_CONN_DOWN \n
* 708 ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE \n
* 709 ICAFE_SET_AND_GET_MISMATCH \n
* 806 ICAFE_CA_OP_CONN_UP \n
* 807 ICAFE_CA_OP_CONN_DOWN \n
* 1000 ECAFE_NODATA \n
* 1001 ECAFE_INVALID_TYPE \n
* 1002 ECAFE_BADCOUNT \n
* 1003 ECAFE_BADSTR \n
* 1004 ECAFE_BADTYPE \n
* 1005 ECAFE_NO_CONVERT \n
* 1006 ECAFE_NULLCONTEXT \n
* 1007 ECAFE_NULLCHID \n
* 1008 ECAFE_NULLEVID \n
* 1009 ECAFE_UNKNOWN_COLLECTION \n
* 1010 ECAFE_EMPTY_COLLECTION \n
* 1011 ECAFE_COLLECTION_PREV_DEF \n
* 1012 ECAFE_COLLECTION_INVALID_MEMBER \n
* 1013 ECAFE_RULE_FALSE \n
* 1014 ECAFE_UNKNOWN_GROUP \n
* 1015 ECAFE_EMPTY_GROUP \n
* 1016 ECAFE_GROUP_PREV_DEF \n
* 1017 ECAFE_INVALID_HANDLE \n
* 1018 ECAFE_INVALID_GROUP_HANDLE \n
* 1019 ECAFE_NORDACCESS \n
* 1020 ECAFE_NOWTACCESS \n
* 1021 ECAFE_TIMEOUT \n
* 1022 ECAFE_CANNOT_OPEN_FILE \n
* 1023 ECAFE_INVALID_SWITCH_CASE \n
* 1024 ECAFE_PVALIAS_INVALID \n
* 1025 ECAFE_PVALIAS_PREV_DEF \n
* 1026 ECAFE_PVNAME_PREV_DEF_AS_PVALIAS \n
* 1027 ECAFE_DEVICE_ATTRIB_NOT_FOUND \n
* 1028 ECAFE_HASH_UNIQUEID_EXISTS \n
* 1029 ECAFE_WRONG_CA_CONTEXT \n
* 1030 ECAFE_INVALID_CAFENUM_POLICY_TYPE \n
* 1031 ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED \n
* 1032 ECAFE_INVALID_ENUM_INDEX \n
* 1033 ECAFE_PVGROUP_GROUPHANDLE_MISMATCH \n
* 1034 ECAFE_TIMEOUT_SET_AND_MATCH \n
* 1035 ECAFE_HANDLE_MISMATCH_SET_AND_MATCH \n
* 1100 ECAFE_LOAD_COLLECTION \n
* 1101 ECAFE_LOAD_GROUP \n
* 1200 ECAFE_BPM_DATA_IS_INVALID \n
* 5004 LINUX_EINTR \n
* 5011 LINUX_EGAIN \n
* 5014 LINUX_EFAULT \n
* 5088 LINUX_ENOTSOCK \n
* 5093 LINUX_EPROTONOSUPPORT \n
*/
class CAFEStatusInfo {
typedef std::map<int, std::string> mapLongString;
private:
mapLongString mapStatusInfo;
mapLongString::iterator posStatusInfo;
public:
CAFEStatusInfo() {
//maximum message length is 80 characters
mapStatusInfo.insert(std::make_pair((int) ICAFE_CA_OP_CONN_UP, "Status of channel connection: channel UP " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_CA_OP_CONN_DOWN, "Status of channel connection: channel DOWN! " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_NEVER_CONN, "Valid chid; server not found or unavailable " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_PREV_CONN, "Valid chid; previously connected to server " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_CONN, "Valid chid; connected to server " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_CLOSED, "Channel deleted by user " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_DISCONN, "Channel disconnected " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_CS_UNKNOWN, "Unknown state!!! " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_TYPENOTCONN, "ca_field_type() channel is disconnected " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_RULE_FALSE, "CAFE collection rule for channel set to false by user " ));
mapStatusInfo.insert(std::make_pair((int) ICAFE_BADCOUNT, "nelemClient exceeds nelemNative (max. allowed)! Set nelemClient/nelemRequest to nelemNative "));
mapStatusInfo.insert(std::make_pair((int) ICAFE_CALLBACK_NOT_YET_INVOKED, "Callback for get/set operation has not yet been invoked "));
mapStatusInfo.insert(std::make_pair((int) ICAFE_WAITING_FOR_PREV_CALLBACK, "Callback for previous get/set operation not yet invoked "));
mapStatusInfo.insert(std::make_pair((int) ICAFE_CACHE_EMPTY, "Data buffer is empty; get message to IOC not yet invoked"));
mapStatusInfo.insert(std::make_pair((int) ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT, "User supplied callback function not provided when expected "));
mapStatusInfo.insert(std::make_pair((int) ICAFE_MONITOR_DELAYED_AS_CONN_DOWN, "Channel disconnected. Monitor will be started on connection "));
mapStatusInfo.insert(std::make_pair((int) ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE, "Handle has monitor, hence data retrieved from cache "));
mapStatusInfo.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "Set and Get values from SetAndGetMethod do not match"));
mapStatusInfo.insert(std::make_pair((int) ECAFE_NODATA, "Requested data transfer is of zero length! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_TYPE, "Invalid data type! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_BADCOUNT, "nelemClient exceeds nelemNative (max. allowed)! Set nelemClient/nelemRequest to nelemNative "));
mapStatusInfo.insert(std::make_pair((int) ECAFE_BADSTR, "Empty string for process variable name! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_BADTYPE, "Invalid datatype! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_NO_CONVERT, "set()/get() cannot convert to/from native datatype! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_NULLCONTEXT, "Error: current context is null; CA not initialized. " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_NULLCHID, "Error: chid is null!! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_NULLEVID, "Monitor() evid is null! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_UNKNOWN_COLLECTION, "CAFE collection is unknown/unregistered or invalid! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_EMPTY_COLLECTION, "CAFE collection is empty; has no members! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_COLLECTION_PREV_DEF, "CAFE collection with this name already exists! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_COLLECTION_INVALID_MEMBER,"Device is not a member of the CAFE collection! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_RULE_FALSE, "CAFE rule for channel set to false by user " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_UNKNOWN_GROUP, "CAFE group is unknown/unregistered or invalid! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_EMPTY_GROUP, "CAFE group is empty; has no members! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_GROUP_PREV_DEF, "CAFE group with this name already exists! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_HANDLE, "Handle does not exist! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_GROUP_HANDLE, "Group handle does not exist! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_NORDACCESS, "Channel does not have READ access! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_NOWTACCESS, "Channel does not have WRITE access! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_TIMEOUT, "Callback function not activated within specified timeout period " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_CANNOT_OPEN_FILE, "Cannot open file! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_SWITCH_CASE, "Internal CAFE Error: Invalid option for switch case " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_PVALIAS_INVALID, "Requested PVAlias is another handle's PV name. Bizarre! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_PVALIAS_PREV_DEF, "Requested PVAlias already exists! " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_PVNAME_PREV_DEF_AS_PVALIAS, "PVName clashes with previously defined PVAlias!" ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_DEVICE_ATTRIB_NOT_FOUND, "Deliminator - hence dev/attrib - not found in PV name" ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_HASH_UNIQUEID_EXISTS,"cafeConduit object already inserted (handle exists) "));
mapStatusInfo.insert(std::make_pair((int) ECAFE_WRONG_CA_CONTEXT,"Operation cannot be carried out for this ca_client_context "));
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_CAFENUM_POLICY_TYPE, "Not a valid CAFENUM type for this policy. See policies.h "));
mapStatusInfo.insert(std::make_pair((int) ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED, "See define.sh to change the allowed maximum "));
mapStatusInfo.insert(std::make_pair((int) ECAFE_INVALID_ENUM_INDEX, "DBR_ENUM value exceeds the number of enum string options " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_PVGROUP_GROUPHANDLE_MISMATCH, "PVGroup previously assigned to another group handle " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_TIMEOUT_SET_AND_MATCH, "Readback channel did not reach set value within specified timeout period "));
mapStatusInfo.insert(std::make_pair((int) ECAFE_HANDLE_MISMATCH_SET_AND_MATCH, "Number of set/readback handles do not match"));
mapStatusInfo.insert(std::make_pair((int) ECAFE_LOAD_COLLECTION, "CAFE collection could not be loaded from xml configuration file " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_LOAD_GROUP, "CAFE group could not be loaded from group xml configuration file " ));
mapStatusInfo.insert(std::make_pair((int) ECAFE_BPM_DATA_IS_INVALID, "CAFE BPM Service: Data Validity channel reports BPM data is INVALID " ));
mapStatusInfo.insert(std::make_pair((int) LINUX_EINTR, "C ERROR CODE IN LINUX: Interrupted system call" ));
mapStatusInfo.insert(std::make_pair((int) LINUX_EAGAIN, "C ERROR CODE IN LINUX: Try again" ));
mapStatusInfo.insert(std::make_pair((int) LINUX_EFAULT, "C ERROR CODE IN LINUX: Bad address" ));
mapStatusInfo.insert(std::make_pair((int) LINUX_ENOTSOCK, "C ERROR CODE IN LINUX: Socket operation on non-socket" ));
mapStatusInfo.insert(std::make_pair((int) LINUX_EPROTONOSUPPORT, "C ERROR CODE IN LINUX: Protocol not supported" ));
}
~CAFEStatusInfo() {};
std::string message (int i) {
if (i<ICAFE_STATUS_BASE) {
std::string c= ca_message(i);
return c;
}
else {
posStatusInfo = mapStatusInfo.find(i);
if (posStatusInfo != mapStatusInfo.end()) {
return posStatusInfo->second;
}
std::ostringstream oss;
oss << "INVALID ERROR CODE: " << i ; //<< std::endl;
//std::cout << oss.str();
return oss.str();
}
};
void printAll() {
std::cout << "-----------------------" << std::endl;
std::cout << "CAFE ERROR MESSAGE LIST" << std::endl;
std::cout << "-----------------------" << std::endl;
for (posStatusInfo=mapStatusInfo.begin(); posStatusInfo != mapStatusInfo.end(); ++posStatusInfo) {
std::cout << posStatusInfo->first << " " << posStatusInfo->second << std::endl;
}
std::cout << "------------------" << std::endl;
};
};
class CAFEStatusCode {
typedef std::map<int, std::string> mapLongString;
private:
mapLongString mapStatusCode;
mapLongString::iterator pos;
public:
CAFEStatusCode() {
mapStatusCode.insert(std::make_pair(ECA_NORMAL, "SUCCESS: ECA_NORMAL"));
mapStatusCode.insert(std::make_pair(ECA_ALLOCMEM, "WARNING: ECA_ALLOCMEM"));
mapStatusCode.insert(std::make_pair(ECA_TOLARGE, "WARNING: ECA_TOLARGE"));
mapStatusCode.insert(std::make_pair(ECA_TIMEOUT, "WARNING: ECA_TIMEOUT"));
mapStatusCode.insert(std::make_pair(ECA_BADTYPE, "ERROR: ECA_BADTYPE"));
mapStatusCode.insert(std::make_pair(ECA_INTERNAL, "FATAL: ECA_INTERNAL"));
mapStatusCode.insert(std::make_pair(ECA_GETFAIL, "WARNING: ECA_GETFAIL"));
mapStatusCode.insert(std::make_pair(ECA_PUTFAIL, "WARNING: ECA_PUTFAIL"));
mapStatusCode.insert(std::make_pair(ECA_BADCOUNT, "WARNING: ECA_BADCOUNT"));
mapStatusCode.insert(std::make_pair(ECA_BADSTR, "ERROR: ECA_BADSTR"));
mapStatusCode.insert(std::make_pair(ECA_DISCONN, "WARNING: ECA_DISCONN"));
mapStatusCode.insert(std::make_pair(ECA_DBLCHNL, "WARNING: ECA_DBLCHNL"));
mapStatusCode.insert(std::make_pair(ECA_EVDISALLOW, "ERROR: ECA_EVDISALLOW"));
mapStatusCode.insert(std::make_pair(ECA_BADMONID, "ERROR: ECA_BADMONID"));
mapStatusCode.insert(std::make_pair(ECA_BADMASK, "ERROR: ECA_BADMASK"));
mapStatusCode.insert(std::make_pair(ECA_IODONE , "INFO: ECA_IODONE "));
mapStatusCode.insert(std::make_pair(ECA_IOINPROGRESS, "INFO: ECA_IOINPROGRESS"));
mapStatusCode.insert(std::make_pair(ECA_BADSYNCGRP, "ERROR: ECA_BADSYNCGRP"));
mapStatusCode.insert(std::make_pair(ECA_PUTCBINPROG, "ERROR: ECA_PUTCBINPROG"));
mapStatusCode.insert(std::make_pair(ECA_NORDACCESS, "WARNING: ECA_NORDACCESS"));
mapStatusCode.insert(std::make_pair(ECA_NOWTACCESS, "WARNING: ECA_NOWTACCESS"));
mapStatusCode.insert(std::make_pair(ECA_ANACHRONISM, "ERROR: ECA_ANACHRONISM"));
mapStatusCode.insert(std::make_pair(ECA_NOSEARCHADDR, "WARNING: ECA_NOSEARCHADDR"));
mapStatusCode.insert(std::make_pair(ECA_NOCONVERT, "WARNING: ECA_NOCONVERT"));
mapStatusCode.insert(std::make_pair(ECA_BADCHID, "ERROR: ECA_BADCHID"));
mapStatusCode.insert(std::make_pair(ECA_BADFUNCPTR, "ERROR: ECA_BADFUNCPTR"));
mapStatusCode.insert(std::make_pair(ECA_ISATTACHED, "WARNING: ECA_ISATTACHED"));
mapStatusCode.insert(std::make_pair(ECA_UNAVAILINSERV, "WARNING: ECA_UNAVAILINSERV"));
mapStatusCode.insert(std::make_pair(ECA_CHANDESTROY, "WARNING: ECA_CHANDESTROY"));
mapStatusCode.insert(std::make_pair(ECA_BADPRIORITY, "ERROR: ECA_BADPRIORITY"));
mapStatusCode.insert(std::make_pair(ECA_NOTTHREADED, "ERROR: ECA_NOTTHREADED"));
mapStatusCode.insert(std::make_pair(ECA_16KARRAYCLIENT,"WARNING: ECA_16KARRAYCLIENT"));
mapStatusCode.insert(std::make_pair(ECA_CONNSEQTMO, "WARNING: ECA_CONNSEQTMO"));
mapStatusCode.insert(std::make_pair(ECA_UNRESPTMO , "WARNING: ECA_UNRESPTMO"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_NEVER_CONN, "CHANNEL STATE: ICAFE_CS_NEVER_CONN" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_PREV_CONN, "CHANNEL STATE: ICAFE_CS_PREV_CONN " ));
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_CONN, "CHANNEL STATE: ICAFE_CS_CONN" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_CLOSED, "CHANNEL STATE: ICAFE_CS_CLOSED" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_DISCONN, "CHANNEL STATE: ICAFE_CS_DISCONN" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_CS_UNKNOWN, "CHANNEL STATE: ICAFE_CS_UNKNOWN" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_TYPENOTCONN, "CHANNEL FIELD TYPE: ICAFE_CFT_TYPENOTCONN"));
mapStatusCode.insert(std::make_pair((int) ICAFE_RULE_FALSE, "CAFE INFO: ICAFE_RULE_FALSE"));
mapStatusCode.insert(std::make_pair((int) ICAFE_BADCOUNT, "CAFE INFO: ICAFE_BADCOUNT"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CALLBACK_NOT_YET_INVOKED, "CAFE_INFO: ICAFE_CALLBACK_NOT_YET_INVOKED"));
mapStatusCode.insert(std::make_pair((int) ICAFE_WAITING_FOR_PREV_CALLBACK, "CAFE_INFO: ICAFE_WAITING_FOR_PREV_CALLBACK"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CACHE_EMPTY, "CAFE_INFO:ICAFE_CACHE_EMPTY"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT, "CAFE_INFO: ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT"));
mapStatusCode.insert(std::make_pair((int) ICAFE_CA_OP_CONN_UP, "CHANNEL CONNECTION: ICAFE_CC_OP_CONN_UP" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_CA_OP_CONN_DOWN, "CHANNEL CONNECTION: ICAFE_CC_OP_CONN_DOWN" ));
mapStatusCode.insert(std::make_pair((int) ICAFE_MONITOR_DELAYED_AS_CONN_DOWN, "CHANNEL CONNECTION: ICAFE_MONITOR_DELAYED_AS_CONN_DOWN"));
mapStatusCode.insert(std::make_pair((int) ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE, "CAFE_INFO: ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE"));
mapStatusCode.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "CAFE_INFO: ICAFE_SET_AND_GET_MISMATCH"));
mapStatusCode.insert(std::make_pair((int) ECAFE_NODATA, "CAFE ERROR: ECAFE_NODATA"));
mapStatusCode.insert(std::make_pair((int) ECAFE_BADCOUNT, "CAFE ERROR: ECAFE_BADCOUNT"));
mapStatusCode.insert(std::make_pair((int) ECAFE_BADSTR, "CAFE ERROR: ECAFE_BADSTR"));
mapStatusCode.insert(std::make_pair((int) ECAFE_BADTYPE, "CAFE ERROR: ECAFE_BADTYPE"));
mapStatusCode.insert(std::make_pair((int) ECAFE_NO_CONVERT, "CAFE ERROR: ECAFE_NO_CONVERT"));
mapStatusCode.insert(std::make_pair((int) ECAFE_NULLCONTEXT, "CAFE ERROR: ECAFE_NULLCONTEXT"));
mapStatusCode.insert(std::make_pair((int) ECAFE_NULLCHID, "CAFE ERROR: ECAFE_NULLCHID"));
mapStatusCode.insert(std::make_pair((int) ECAFE_NULLEVID, "CAFE ERROR: ECAFE_NULLEVID"));
mapStatusCode.insert(std::make_pair((int) ECAFE_UNKNOWN_COLLECTION, "CAFE ERROR: ECAFE_UNKNOWN_COLLECTION"));
mapStatusCode.insert(std::make_pair((int) ECAFE_EMPTY_COLLECTION, "CAFE ERROR: ECAFE_EMPTY_COLLECTION"));
mapStatusCode.insert(std::make_pair((int) ECAFE_COLLECTION_PREV_DEF, "CAFE ERROR: ECAFE_COLLECTION_PREV_DEF"));
mapStatusCode.insert(std::make_pair((int) ECAFE_COLLECTION_INVALID_MEMBER, "CAFE ERROR: ECAFE_COLLECTION_INVALID_MEMBER"));
mapStatusCode.insert(std::make_pair((int) ECAFE_RULE_FALSE, "CAFE ERROR/INFO: ECAFE_RULE_FALSE"));
mapStatusCode.insert(std::make_pair((int) ECAFE_UNKNOWN_GROUP, "CAFE ERROR: ECAFE_UNKNOWN_GROUP"));
mapStatusCode.insert(std::make_pair((int) ECAFE_EMPTY_GROUP, "CAFE ERROR: ECAFE_EMPTY_GROUP"));
mapStatusCode.insert(std::make_pair((int) ECAFE_GROUP_PREV_DEF, "CAFE ERROR: ECAFE_GROUP_PREV_DEF"));
mapStatusCode.insert(std::make_pair((int) ECAFE_INVALID_HANDLE, "CAFE ERROR: ECAFE_INVALID_HANDLE"));
mapStatusCode.insert(std::make_pair((int) ECAFE_INVALID_GROUP_HANDLE, "CAFE ERROR: ECAFE_INVALID_GROUP_HANDLE"));
mapStatusCode.insert(std::make_pair((int) ECAFE_NORDACCESS, "CAFE ERROR: ECAFE_NORDACCESS"));
mapStatusCode.insert(std::make_pair((int) ECAFE_NOWTACCESS, "CAFE ERROR: ECAFE_NOWTACCESS"));
mapStatusCode.insert(std::make_pair((int) ECAFE_TIMEOUT, "CAFE ERROR: ECAFE_TIMEOUT"));
mapStatusCode.insert(std::make_pair((int) ECAFE_CANNOT_OPEN_FILE, "CAFE ERROR: ECAFE_CANNOT_OPEN_FILE"));
mapStatusCode.insert(std::make_pair((int) ECAFE_INVALID_SWITCH_CASE, "CAFE ERROR: ECAFE_INVALID_SWITCH_CASE"));
mapStatusCode.insert(std::make_pair((int) ECAFE_PVALIAS_INVALID, "CAFE ERROR: ECAFE_PVALIAS_INVALID"));
mapStatusCode.insert(std::make_pair((int) ECAFE_PVALIAS_PREV_DEF, "CAFE ERROR: ECAFE_PVALIAS_PREV_DEF"));
mapStatusCode.insert(std::make_pair((int) ECAFE_PVNAME_PREV_DEF_AS_PVALIAS,"CAFE ERROR: ECAFE_PVNAME_PREV_DEF_AS_PVALIAS"));
mapStatusCode.insert(std::make_pair((int) ECAFE_DEVICE_ATTRIB_NOT_FOUND,"CAFE ERROR: ECAFE_DEVICE_ATTRIB_NOT_FOUND"));
mapStatusCode.insert(std::make_pair((int) ECAFE_HASH_UNIQUEID_EXISTS, "CAFE ERROR: ECAFE_HASH_UNIQUEID_EXISTS"));
mapStatusCode.insert(std::make_pair((int) ECAFE_WRONG_CA_CONTEXT, "CAFE ERROR: ECAFE_WRONG_CA_CONTEXT"));
mapStatusCode.insert(std::make_pair((int) ECAFE_INVALID_CAFENUM_POLICY_TYPE, "CAFE ERROR: ECAFE_INVALID_CAFENUM_POLICY_TYPE"));
mapStatusCode.insert(std::make_pair((int) ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED, "CAFE_ERROR: ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED"));
mapStatusCode.insert(std::make_pair((int) ECAFE_INVALID_ENUM_INDEX, "CAFE_ERROR: ECAFE_INVALID_ENUM_INDEX"));
mapStatusCode.insert(std::make_pair((int) ECAFE_PVGROUP_GROUPHANDLE_MISMATCH, "CAFE ERROR:ECAFE_PVGROUP_GROUPHANDLE_MISMATCH"));
mapStatusCode.insert(std::make_pair((int) ECAFE_TIMEOUT_SET_AND_MATCH, "CAFE ERROR: CAFE_TIMEOUT_SET_AND_MATCH"));
mapStatusCode.insert(std::make_pair((int) ECAFE_HANDLE_MISMATCH_SET_AND_MATCH, "CAFE ERROR: CAFE_HANDLE_MISMATCH_SET_AND_MATCH"));
mapStatusCode.insert(std::make_pair((int) ECAFE_LOAD_COLLECTION, "CAFE ERROR: ECAFE_LOAD_COLLECTION"));
mapStatusCode.insert(std::make_pair((int) ECAFE_LOAD_GROUP, "CAFE ERROR: ECAFE_LOAD_GROUP"));
mapStatusCode.insert(std::make_pair((int) ECAFE_BPM_DATA_IS_INVALID, "CAFE_ERROR: ECAFE_BPM_DATA_IS_INVALID" ));
mapStatusCode.insert(std::make_pair((int) LINUX_EINTR, "CAFE_ERROR: LINUX_EINTR" ));
mapStatusCode.insert(std::make_pair((int) LINUX_EAGAIN, "CAFE_ERROR: LINUX_EAGAIN " ));
mapStatusCode.insert(std::make_pair((int) LINUX_EFAULT, "CAFE_ERROR: LINUX_EFAULT" ));
mapStatusCode.insert(std::make_pair((int) LINUX_ENOTSOCK, "CAFE_ERROR: LINUX_ENOTSOCK" ));
mapStatusCode.insert(std::make_pair((int) LINUX_EPROTONOSUPPORT, "CAFE_ERROR: LINUX_EPROTONOSUPPORT" ));
};
~CAFEStatusCode() {};
std::string message (int i) {
pos = mapStatusCode.find(i);
if (pos != mapStatusCode.end()) {
return pos->second;
}
std::ostringstream oss;
oss << "INVALID ERROR CODE: " << i ; //<< std::endl;
//std::cout << oss.str();
return oss.str();
};
void getStates(std::vector<int> &vecI, std::vector<std::string> &vecS ) {
vecS.clear(); vecS.reserve(mapStatusCode.size());
vecI.clear(); vecI.reserve(mapStatusCode.size());
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
std::size_t found = (pos->second).find(": ");
if (found!=std::string::npos) {
vecS.push_back((pos->second).substr(found+2,(pos->second).length()));
}
else {
vecS.push_back(pos->second);
}
vecI.push_back(pos->first);
}
return;
};
std::string msgIDAsString (int i) {
pos = mapStatusCode.find(i);
if (pos != mapStatusCode.end()) {
std::size_t found = (pos->second).find(": ");
if (found!=std::string::npos) {
return (pos->second).substr(found+2,(pos->second).length());
}
else {
return pos->second;
}
}
std::ostringstream oss;
oss << "INVALID ERROR CODE: " << i ; //<< std::endl;
//std::cout << oss.str();
return oss.str();
};
int enumIs (std::string message) {
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
if (pos->second==message) return pos->first;
// String searches such as s.find(s1) return string::npos on failure
else if ( (pos->second).find(message) != std::string::npos) return pos->first;
}
return -1;
};
bool isTimeout(int statusCodeToCheck) {
if (statusCodeToCheck==ECA_TIMEOUT || statusCodeToCheck==ECAFE_TIMEOUT) {
return true;
}
else {return false;}
}
void printAll() {
std::cout << "-------------------" << std::endl;
std::cout << "CAFE ERROR CODE LIST" << std::endl;
std::cout << "-------------------" << std::endl;
for (pos=mapStatusCode.begin(); pos != mapStatusCode.end(); ++pos) {
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "------------------" << std::endl;
};
};
class CAFEStatusSeverity {
typedef std::map<int, std::string> mapLongString;
private:
mapLongString mapStatusSeverity;
mapLongString::iterator pos;
public:
CAFEStatusSeverity() {
mapStatusSeverity.insert(std::make_pair(ECA_NORMAL, "INFO"));
mapStatusSeverity.insert(std::make_pair(ECA_ALLOCMEM, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_TOLARGE, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_TIMEOUT, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_BADTYPE, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_INTERNAL, "FATAL"));
mapStatusSeverity.insert(std::make_pair(ECA_GETFAIL, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_PUTFAIL, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_BADCOUNT, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_BADSTR, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_DISCONN, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_DBLCHNL, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_EVDISALLOW, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_BADMONID, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_BADMASK, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_IODONE , "INFO"));
mapStatusSeverity.insert(std::make_pair(ECA_IOINPROGRESS, "INFO"));
mapStatusSeverity.insert(std::make_pair(ECA_BADSYNCGRP, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_PUTCBINPROG, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_NORDACCESS, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_NOWTACCESS, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_ANACHRONISM, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_NOSEARCHADDR, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_NOCONVERT, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_BADCHID, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_BADFUNCPTR, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_ISATTACHED, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_UNAVAILINSERV, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_CHANDESTROY, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_BADPRIORITY, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_NOTTHREADED, "ERROR"));
mapStatusSeverity.insert(std::make_pair(ECA_16KARRAYCLIENT, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_CONNSEQTMO, "WARN"));
mapStatusSeverity.insert(std::make_pair(ECA_UNRESPTMO , "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_NEVER_CONN, "WARN" ));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_PREV_CONN, "INFO" ));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_CONN, "INFO" ));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_CLOSED, "INFO" ));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_DISCONN, "WARN" ));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CS_UNKNOWN, "ERROR" ));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_TYPENOTCONN, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_RULE_FALSE, "INFO"));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_BADCOUNT, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CALLBACK_NOT_YET_INVOKED, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_WAITING_FOR_PREV_CALLBACK, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CACHE_EMPTY, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CHANNEL_BLOCKING_POLICY_CONFLICT, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CA_OP_CONN_UP, "INFO" ));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_CA_OP_CONN_DOWN, "WARN" ));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_MONITOR_DELAYED_AS_CONN_DOWN, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_HAS_MONITOR_GET_DONE_FROM_CACHE, "INFO"));
mapStatusSeverity.insert(std::make_pair((int) ICAFE_SET_AND_GET_MISMATCH, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NODATA, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_BADCOUNT, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_BADSTR, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_BADTYPE, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NO_CONVERT, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NULLCONTEXT, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NULLCHID, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NULLEVID, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_UNKNOWN_COLLECTION, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_EMPTY_COLLECTION, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_COLLECTION_PREV_DEF, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_COLLECTION_INVALID_MEMBER, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_RULE_FALSE, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_UNKNOWN_GROUP, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_EMPTY_GROUP, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_GROUP_PREV_DEF, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_INVALID_HANDLE, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_INVALID_GROUP_HANDLE, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NORDACCESS, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_NOWTACCESS, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_TIMEOUT, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_CANNOT_OPEN_FILE, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_INVALID_SWITCH_CASE, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_PVALIAS_INVALID, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_PVALIAS_PREV_DEF, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_PVNAME_PREV_DEF_AS_PVALIAS,"ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_DEVICE_ATTRIB_NOT_FOUND,"ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_HASH_UNIQUEID_EXISTS, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_WRONG_CA_CONTEXT, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_INVALID_CAFENUM_POLICY_TYPE, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_MAX_MONITORS_PER_CHAN_EXCEEDED, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_INVALID_ENUM_INDEX, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_PVGROUP_GROUPHANDLE_MISMATCH, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_TIMEOUT_SET_AND_MATCH, "WARN"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_HANDLE_MISMATCH_SET_AND_MATCH, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_LOAD_COLLECTION, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_LOAD_GROUP, "ERROR"));
mapStatusSeverity.insert(std::make_pair((int) ECAFE_BPM_DATA_IS_INVALID, "WARN" ));
};
~CAFEStatusSeverity() {};
std::string message (int i) {
pos = mapStatusSeverity.find(i);
if (pos != mapStatusSeverity.end()) {
return pos->second;
}
std::ostringstream oss;
oss << "INVALID ERROR CODE: " << i ; //<< std::endl;
//std::cout << oss.str();
return oss.str();
};
int enumIs (std::string message) {
for (pos=mapStatusSeverity.begin(); pos != mapStatusSeverity.end(); ++pos) {
if (pos->second==message) return pos->first;
// String searches such as s.find(s1) return string::npos on failure
else if ( (pos->second).find(message) != std::string::npos) return pos->first;
}
return -1;
};
void printAll() {
std::cout << "-------------------" << std::endl;
std::cout << "CAFE STATUS SEVERITY LIST" << std::endl;
std::cout << "-------------------" << std::endl;
for (pos=mapStatusSeverity.begin(); pos != mapStatusSeverity.end(); ++pos) {
std::cout << pos->first << " " << pos->second << std::endl;
}
std::cout << "------------------" << std::endl;
};
};
//Example
//For statusCode=0, we have
//severity: INFO
//asString: ECA_NORMAL
//msgID: ECA_NORMAL
//code: SUCCESS: ECA_NORMAL
//info: Normal successful completion
//message: SUCCESS: ECA_NORMAL Normal successful completion
class CAFEStatus {
public:
CAFEStatusSeverity css;
CAFEStatusInfo csi;
CAFEStatusCode csc;
CAFEStatus() {};
std::string severity(int i) {
return (std::string) css.message(i);
}
std::string asString(int i) {
return (std::string) csc.msgIDAsString(i);
}
std::string msgID(int i) {
return (std::string) csc.msgIDAsString(i);
}
std::string code(int i) {
return (std::string) csc.message(i);
}
std::string info(int i) {
return (std::string) csi.message(i);
}
std::string message(int i) {
std::string strRet="";
strRet.append(csc.message(i));
strRet.append(" ");
strRet.append(csi.message(i));
return (std::string) strRet;
}
void report (int i) {
std::cout << "------------------" << std::endl;
std::cout << "CAFE STATUS REPORT" << std::endl;
std::cout << "------------------" << std::endl;
std::cout << csc.message(i) << std::endl;
std::cout << csi.message(i) << std::endl;
std::cout << "------------------" << std::endl;
};
};
#endif // STATUSCODES_H

2159
include/transpose.h Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More