work in progress; simple easyGet worked!!!

This commit is contained in:
Marty Kraimer
2015-02-27 15:04:56 -05:00
commit f677e1a091
34 changed files with 5540 additions and 0 deletions

13
example/Makefile Normal file
View File

@@ -0,0 +1,13 @@
# Makefile at top of application tree
TOP = .
include $(TOP)/configure/CONFIG
DIRS += configure
DIRS += src
src_DEPEND_DIRS = configure
include $(TOP)/configure/RULES_TOP

29
example/configure/CONFIG Normal file
View File

@@ -0,0 +1,29 @@
# CONFIG - Load build configuration data
#
# Do not make changes to this file!
# Allow user to override where the build rules come from
RULES = $(EPICS_BASE)
# RELEASE files point to other application tops
include $(TOP)/configure/RELEASE
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).Common
ifdef T_A
-include $(TOP)/configure/RELEASE.Common.$(T_A)
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).$(T_A)
endif
CONFIG = $(RULES)/configure
include $(CONFIG)/CONFIG
# Override the Base definition:
INSTALL_LOCATION = $(TOP)
# CONFIG_SITE files contain other build configuration settings
include $(TOP)/configure/CONFIG_SITE
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).Common
ifdef T_A
-include $(TOP)/configure/CONFIG_SITE.Common.$(T_A)
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)
endif

View File

@@ -0,0 +1,27 @@
# CONFIG_SITE
# Make any application-specific changes to the EPICS build
# configuration variables in this file.
#
# Host/target specific settings can be specified in files named
# CONFIG_SITE.$(EPICS_HOST_ARCH).Common
# CONFIG_SITE.Common.$(T_A)
# CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A)
# CHECK_RELEASE controls the consistency checking of the support
# applications pointed to by the RELEASE* files.
# Normally CHECK_RELEASE should be set to YES.
# Set CHECK_RELEASE to NO to disable checking completely.
# Set CHECK_RELEASE to WARN to perform consistency checking but
# continue building anyway if conflicts are found.
CHECK_RELEASE = WARN
# To install files into a location other than $(TOP) define
# INSTALL_LOCATION here.
#INSTALL_LOCATION=</path/name/to/install/top>
INSTALL_INCLUDE = $(INSTALL_LOCATION)/include/pv
USR_INCLUDES += -I $(INSTALL_LOCATION)/include
-include $(TOP)/../../CONFIG_SITE.local
-include $(TOP)/../configure/CONFIG_SITE.local

View File

@@ -0,0 +1,7 @@
EPICS_BASE=/home/install/epics/base
TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
EPICSV4HOME=/home/hg
PVCOMMON=${EPICSV4HOME}/pvCommonCPP
PVDATA=${EPICSV4HOME}/pvDataCPP
PVACCESS=${EPICSV4HOME}/pvAccessCPP
EASYPVA==${EPICSV4HOME}/easyPVACPP

View File

@@ -0,0 +1,8 @@
TOP=..
include $(TOP)/configure/CONFIG
TARGETS = $(CONFIG_TARGETS)
CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS)))
include $(TOP)/configure/RULES

41
example/configure/RELEASE Normal file
View File

@@ -0,0 +1,41 @@
# pvDatabaseCPP/example RELEASE - Location of external support modules
#
# IF YOU CHANGE this file or any file it includes you must
# subsequently do a "gnumake rebuild" in the application's
# top level directory.
#
# The build process does not check dependencies against files
# that are outside this application, thus you should also do a
# "gnumake rebuild" in the top level directory after EPICS_BASE
# or any other external module pointed to below is rebuilt.
#
# Host- or target-specific settings can be given in files named
# RELEASE.$(EPICS_HOST_ARCH).Common
# RELEASE.Common.$(T_A)
# RELEASE.$(EPICS_HOST_ARCH).$(T_A)
# EPICS V4 Developers: Do not edit the locations in this file!
#
# Create a file RELEASE.local pointing to your PVASRV, PVACCESS,
# PVDATA, PVCOMMON and EPICS_BASE build directories, e.g.
# PVASRV = /path/to/epics/pvaSrvCPP
# PVACCESS = /path/to/epics/pvAccessCPP
# PVDATA = /path/to/epics/pvDataCPP
# PVCOMMON = /path/to/epics/pvCommonCPP
# EPICS_BASE = /path/to/epics/base
# If this example is built in a directory under pvDatabaseCPP,
# use the following definitions:
EASYPVA = $(TOP)/..
-include $(TOP)/../configure/RELEASE.local
-include $(TOP)/../../RELEASE.local
# If you copied this example from pvDatabaseCPP to be built as a
# standalone TOP, adjust and use the following definitions:
#EASYPVA = /path/to/epics/easyPVACPP
#-include $(TOP)/../RELEASE.local
#-include $(TOP)/configure/RELEASE.local

6
example/configure/RULES Normal file
View File

@@ -0,0 +1,6 @@
# RULES
include $(CONFIG)/RULES
# Library should be rebuilt because LIBOBJS may have changed.
$(LIBNAME): ../Makefile

View File

@@ -0,0 +1,2 @@
#RULES.ioc
include $(CONFIG)/RULES.ioc

View File

@@ -0,0 +1,2 @@
#RULES_DIRS
include $(CONFIG)/RULES_DIRS

View File

@@ -0,0 +1,3 @@
#RULES_TOP
include $(CONFIG)/RULES_TOP

27
example/src/Makefile Normal file
View File

@@ -0,0 +1,27 @@
TOP=..
include $(TOP)/configure/CONFIG
#----------------------------------------
# ADD MACRO DEFINITIONS AFTER THIS LINE
PROD_HOST += exampleEasyPVStructure
exampleEasyPVStructure_SRCS += exampleEasyPVStructure.cpp
exampleEasyPVStructure_LIBS += easyPVA
exampleEasyPVStructure_LIBS += pvAccess
exampleEasyPVStructure_LIBS += pvData
exampleEasyPVStructure_LIBS += Com
PROD_HOST += exampleEasyGet
exampleEasyGet_SRCS += exampleEasyGet.cpp
exampleEasyGet_LIBS += easyPVA
exampleEasyGet_LIBS += pvAccess
exampleEasyGet_LIBS += pvData
exampleEasyGet_LIBS += Com
#===========================
include $(TOP)/configure/RULES
#----------------------------------------
# ADD RULES AFTER THIS LINE

View File

@@ -0,0 +1,49 @@
/*exampleEasyGet.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
*/
/* Author: Marty Kraimer */
#include <iostream>
#include <pv/easyPVA.h>
#include <pv/clientFactory.h>
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::easyPVA;
int main(int argc,char *argv[])
{
ClientFactory::start();
EasyPVAPtr easyPVA = EasyPVA::create();
double value;
try {
cout << "short way\n";
value = easyPVA->createChannel("exampleDouble")->createGet()->getDouble();
cout << "as double " << value << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
try {
cout << "long way\n";
EasyChannelPtr easyChannel = easyPVA->createChannel("exampleDouble");
easyChannel->connect(2.0);
EasyGetPtr easyGet = easyChannel->createGet();
value = easyGet->getDouble();
cout << "as double " << value << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
cout << "done\n";
ClientFactory::stop();
return 0;
}

View File

@@ -0,0 +1,69 @@
/*exampleEasyPVStructure.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
*/
/* Author: Marty Kraimer */
#include <iostream>
#include <pv/easyPVA.h>
using namespace std;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::easyPVA;
int main(int argc,char *argv[])
{
EasyPVAPtr easyPVA = EasyPVA::create();
StandardPVFieldPtr standardPVField = getStandardPVField();
EasyPVStructurePtr easyStruct = easyPVA->createEasyPVStructure();
PVStructurePtr pvStructure = standardPVField->scalar(pvDouble,"alarm,timeStamp");
easyStruct->setPVStructure(pvStructure);
cout << easyStruct->getPVStructure() << endl;
cout << "as double " << easyStruct->getDouble() << endl;
cout << "as float " << easyStruct->getFloat() << endl;
try {
cout << "as ubyte " << easyStruct->getUByte() << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
pvStructure = standardPVField->scalar(pvInt,"alarm,timeStamp");
easyStruct->setPVStructure(pvStructure);
cout << easyStruct->getPVStructure() << endl;
cout << "as double " << easyStruct->getDouble() << endl;
cout << "as float " << easyStruct->getFloat() << endl;
cout << "as int " << easyStruct->getInt() << endl;
cout << "as uint " << easyStruct->getUInt() << endl;
cout << "as long " << easyStruct->getLong() << endl;
cout << "as ulong " << easyStruct->getULong() << endl;
try {
cout << "as byte " << easyStruct->getByte() << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
try {
cout << "as ubyte " << easyStruct->getUByte() << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
try {
cout << "as short " << easyStruct->getShort() << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
try {
cout << "as ushort " << easyStruct->getUShort() << endl;
} catch (std::runtime_error e) {
cout << "exception " << e.what() << endl;
}
return 0;
}